text:
package android.support.v4.app;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.widget.RemoteViews;
import java.util.ArrayList;

/**
 * Helper for accessing features in {@link android.app.Notification}
 * introduced after API level 4 in a backwards compatible fashion.
 */
public class NotificationCompat {
    /**
     * Obsolete flag indicating high-priority notifications; use the priority field instead.
     *
     * @deprecated Use {@link NotificationCompat.Builder#setPriority(int)} with a positive value.
     */
    public static final int FLAG_HIGH_PRIORITY = 0x00000080;

    /**
     * Default notification priority for {@link NotificationCompat.Builder#setPriority(int)}.
     * If your application does not prioritize its own notifications,
     * use this value for all notifications.
     */
    public static final int PRIORITY_DEFAULT = 0;

    /**
     * Lower notification priority for {@link NotificationCompat.Builder#setPriority(int)},
     * for items that are less important. The UI may choose to show
     * these items smaller, or at a different position in the list,
     * compared with your app's {@link #PRIORITY_DEFAULT} items.
     */
    public static final int PRIORITY_LOW = -1;

    /**
     * Lowest notification priority for {@link NotificationCompat.Builder#setPriority(int)};
     * these items might not be shown to the user except under
     * special circumstances, such as detailed notification logs.
     */
    public static final int PRIORITY_MIN = -2;

    /**
     * Higher notification priority for {@link NotificationCompat.Builder#setPriority(int)},
     * for more important notifications or alerts. The UI may choose
     * to show these items larger, or at a different position in
     * notification lists, compared with your app's {@link #PRIORITY_DEFAULT} items.
     */
    public static final int PRIORITY_HIGH = 1;

    /**
     * Highest notification priority for {@link NotificationCompat.Builder#setPriority(int)},
     * for your application's most important items that require the user's
     * prompt attention or input.
     */
    public static final int PRIORITY_MAX = 2;

    private static final NotificationCompatImpl IMPL;

    interface NotificationCompatImpl {
        public Notification build(Builder b);
    }

    static class NotificationCompatImplBase implements NotificationCompatImpl {
        public Notification build(Builder b) {
            Notification result = (Notification) b.mNotification;
            result.setLatestEventInfo(b.mContext, b.mContentTitle,
                    b.mContentText, b.mContentIntent);
            // translate high priority requests into legacy flag
            if (b.mPriority > PRIORITY_DEFAULT) {
                result.flags |= FLAG_HIGH_PRIORITY;
            }
            return result;
        }
    }

    static class NotificationCompatImplHoneycomb implements NotificationCompatImpl {
        public Notification build(Builder b) {
            return NotificationCompatHoneycomb.add(b.mContext, b.mNotification,
                    b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView,
                    b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon);
        }
    }

    static class NotificationCompatImplIceCreamSandwich implements NotificationCompatImpl {
        public Notification build(Builder b) {
            return NotificationCompatIceCreamSandwich.add(b.mContext, b.mNotification,
                    b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView,
                    b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
                    b.mProgressMax, b.mProgress, b.mProgressIndeterminate);
        }
    }

    static class NotificationCompatImplJellybean implements NotificationCompatImpl {
        public Notification build(Builder b) {
            NotificationCompatJellybean jbBuilder = new NotificationCompatJellybean(
                    b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo,
                    b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
                    b.mProgressMax, b.mProgress, b.mProgressIndeterminate,
                    b.mUseChronometer, b.mPriority, b.mSubText);
            for (Action action: b.mActions) {
                jbBuilder.addAction(action.icon, action.title, action.actionIntent);
            }
            if (b.mStyle != null) {
                if (b.mStyle instanceof BigTextStyle) {
                    BigTextStyle style = (BigTextStyle) b.mStyle;
                    jbBuilder.addBigTextStyle(style.mBigContentTitle,
                            style.mSummaryTextSet,
                            style.mSummaryText,
                            style.mBigText);
                } else if (b.mStyle instanceof InboxStyle) {
                    InboxStyle style = (InboxStyle) b.mStyle;
                    jbBuilder.addInboxStyle(style.mBigContentTitle,
                            style.mSummaryTextSet,
                            style.mSummaryText,
                            style.mTexts);
                } else if (b.mStyle instanceof BigPictureStyle) {
                    BigPictureStyle style = (BigPictureStyle) b.mStyle;
                    jbBuilder.addBigPictureStyle(style.mBigContentTitle,
                            style.mSummaryTextSet,
                            style.mSummaryText,
                            style.mPicture,
                            style.mBigLargeIcon,
                            style.mBigLargeIconSet);
                }
            }
            return(jbBuilder.build());
        }
    }

    static {
        if (Build.VERSION.SDK_INT >= 16) {
            IMPL = new NotificationCompatImplJellybean();
        } else if (Build.VERSION.SDK_INT >= 14) {
            IMPL = new NotificationCompatImplIceCreamSandwich();
        } else if (Build.VERSION.SDK_INT >= 11) {
            IMPL = new NotificationCompatImplHoneycomb();
        } else {
            IMPL = new NotificationCompatImplBase();
        }
    }

    /**
     * Builder class for {@link NotificationCompat} objects.  Allows easier control over
     * all the flags, as well as help constructing the typical notification layouts.
     *

     * On platform versions that don't offer expanded notifications, methods that depend on
     * expanded notifications have no effect.
     *

     *

     * For example, action buttons won't appear on platforms prior to Android 4.1. Action
     * buttons depend on expanded notifications, which are only available in Android 4.1
     * and later.
     *

     * For this reason, you should always ensure that UI controls in a notification are also
     * available in an {@link android.app.Activity} in your app, and you should always start that
     * {@link android.app.Activity} when users click the notification. To do this, use the
     * {@link NotificationCompat.Builder#setContentIntent setContentIntent()}
     * method.
     *

     *
     */
    public static class Builder {
        Context mContext;

        CharSequence mContentTitle;
        CharSequence mContentText;
        PendingIntent mContentIntent;
        PendingIntent mFullScreenIntent;
        RemoteViews mTickerView;
        Bitmap mLargeIcon;
        CharSequence mContentInfo;
        int mNumber;
        int mPriority;
        boolean mUseChronometer;
        Style mStyle;
        CharSequence mSubText;
        int mProgressMax;
        int mProgress;
        boolean mProgressIndeterminate;
        ArrayList<Action> mActions = new ArrayList<Action>();

        Notification mNotification = new Notification();

        /**
         * Constructor.
         *
         * Automatically sets the when field to {@link System#currentTimeMillis()
         * System.currentTimeMillis()} and the audio stream to the
         * {@link Notification#STREAM_DEFAULT}.
         *
         * @param context A {@link Context} that will be used to construct the
         *      RemoteViews. The Context will not be held past the lifetime of this
         *      Builder object.
         */
        public Builder(Context context) {
            mContext = context;

            // Set defaults to match the defaults of a Notification
            mNotification.when = System.currentTimeMillis();
            mNotification.audioStreamType = Notification.STREAM_DEFAULT;
            mPriority = PRIORITY_DEFAULT;
        }

        /**
         * Set the time that the event occurred.  Notifications in the panel are
         * sorted by this time.
         */
        public Builder setWhen(long when) {
            mNotification.when = when;
            return this;
        }

        /**
         * Show the {@link Notification#when} field as a stopwatch.
         *
         * Instead of presenting when as a timestamp, the notification will show an
         * automatically updating display of the minutes and seconds since when.
         *
         * Useful when showing an elapsed time (like an ongoing phone call).
         *
         * @see android.widget.Chronometer
         * @see Notification#when
         */
        public Builder setUsesChronometer(boolean b) {
            mUseChronometer = b;
            return this;
        }

        /**
         * Set the small icon to use in the notification layouts.  Different classes of devices
         * may return different sizes.  See the UX guidelines for more information on how to
         * design these icons.
         *
         * @param icon A resource ID in the application's package of the drawble to use.
         */
        public Builder setSmallIcon(int icon) {
            mNotification.icon = icon;
            return this;
        }

        /**
         * A variant of {@link #setSmallIcon(int) setSmallIcon(int)} that takes an additional
         * level parameter for when the icon is a {@link android.graphics.drawable.LevelListDrawable
         * LevelListDrawable}.
         *
         * @param icon A resource ID in the application's package of the drawble to use.
         * @param level The level to use for the icon.
         *
         * @see android.graphics.drawable.LevelListDrawable
         */
        public Builder setSmallIcon(int icon, int level) {
            mNotification.icon = icon;
            mNotification.iconLevel = level;
            return this;
        }

        /**
         * Set the title (first row) of the notification, in a standard notification.
         */
        public Builder setContentTitle(CharSequence title) {
            mContentTitle = title;
            return this;
        }

        /**
         * Set the text (second row) of the notification, in a standard notification.
         */
        public Builder setContentText(CharSequence text) {
            mContentText = text;
            return this;
        }

        /**
         * Set the third line of text in the platform notification template.
         * Don't use if you're also using {@link #setProgress(int, int, boolean)};
         * they occupy the same location in the standard template.
         *

         * If the platform does not provide large-format notifications, this method has no effect.
         * The third line of text only appears in expanded view.
         *

         */
        public Builder setSubText(CharSequence text) {
            mSubText = text;
            return this;
        }

        /**
         * Set the large number at the right-hand side of the notification.  This is
         * equivalent to setContentInfo, although it might show the number in a different
         * font size for readability.
         */
        public Builder setNumber(int number) {
            mNumber = number;
            return this;
        }

        /**
         * Set the large text at the right-hand side of the notification.
         */
        public Builder setContentInfo(CharSequence info) {
            mContentInfo = info;
            return this;
        }

        /**
         * Set the progress this notification represents, which may be
         * represented as a {@link android.widget.ProgressBar}.
         */
        public Builder setProgress(int max, int progress, boolean indeterminate) {
            mProgressMax = max;
            mProgress = progress;
            mProgressIndeterminate = indeterminate;
            return this;
        }

        /**
         * Supply a custom RemoteViews to use instead of the standard one.
         */
        public Builder setContent(RemoteViews views) {
            mNotification.contentView = views;
            return this;
        }

        /**
         * Supply a {@link PendingIntent} to send when the notification is clicked.
         * If you do not supply an intent, you can now add PendingIntents to individual
         * views to be launched when clicked by calling {@link RemoteViews#setOnClickPendingIntent
         * RemoteViews.setOnClickPendingIntent(int,PendingIntent)}.  Be sure to
         * read {@link Notification#contentIntent Notification.contentIntent} for
         * how to correctly use this.
         */
        public Builder setContentIntent(PendingIntent intent) {
            mContentIntent = intent;
            return this;
        }

        /**
         * Supply a {@link PendingIntent} to send when the notification is cleared by the user
         * directly from the notification panel.  For example, this intent is sent when the user
         * clicks the "Clear all" button, or the individual "X" buttons on notifications.  This
         * intent is not sent when the application calls {@link NotificationManager#cancel
         * NotificationManager.cancel(int)}.
         */
        public Builder setDeleteIntent(PendingIntent intent) {
            mNotification.deleteIntent = intent;
            return this;
        }

        /**
         * An intent to launch instead of posting the notification to the status bar.
         * Only for use with extremely high-priority notifications demanding the user's
         * immediate attention, such as an incoming phone call or
         * alarm clock that the user has explicitly set to a particular time.
         * If this facility is used for something else, please give the user an option
         * to turn it off and use a normal notification, as this can be extremely
         * disruptive.
         *
         * @param intent The pending intent to launch.
         * @param highPriority Passing true will cause this notification to be sent
         *          even if other notifications are suppressed.
         */
        public Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {
            mFullScreenIntent = intent;
            setFlag(FLAG_HIGH_PRIORITY, highPriority);
            return this;
        }

        /**
         * Set the text that is displayed in the status bar when the notification first
         * arrives.
         */
        public Builder setTicker(CharSequence tickerText) {
            mNotification.tickerText = tickerText;
            return this;
        }

        /**
         * Set the text that is displayed in the status bar when the notification first
         * arrives, and also a RemoteViews object that may be displayed instead on some
         * devices.
         */
        public Builder setTicker(CharSequence tickerText, RemoteViews views) {
            mNotification.tickerText = tickerText;
            mTickerView = views;
            return this;
        }

        /**
         * Set the large icon that is shown in the ticker and notification.
         */
        public Builder setLargeIcon(Bitmap icon) {
            mLargeIcon = icon;
            return this;
        }

        /**
         * Set the sound to play.  It will play on the default stream.
         */
        public Builder setSound(Uri sound) {
            mNotification.sound = sound;
            mNotification.audioStreamType = Notification.STREAM_DEFAULT;
            return this;
        }

        /**
         * Set the sound to play.  It will play on the stream you supply.
         *
         * @see #STREAM_DEFAULT
         * @see AudioManager for the STREAM_ constants.
         */
        public Builder setSound(Uri sound, int streamType) {
            mNotification.sound = sound;
            mNotification.audioStreamType = streamType;
            return this;
        }

        /**
         * Set the vibration pattern to use.
         *
         * @see android.os.Vibrator for a discussion of the pattern
         * parameter.
         */
        public Builder setVibrate(long[] pattern) {
            mNotification.vibrate = pattern;
            return this;
        }

        /**
         * Set the argb value that you would like the LED on the device to blnk, as well as the
         * rate.  The rate is specified in terms of the number of milliseconds to be on
         * and then the number of milliseconds to be off.
         */
        public Builder setLights(int argb, int onMs, int offMs) {
            mNotification.ledARGB = argb;
            mNotification.ledOnMS = onMs;
            mNotification.ledOffMS = offMs;
            boolean showLights = mNotification.ledOnMS != 0 && mNotification.ledOffMS != 0;
            mNotification.flags = (mNotification.flags & ~Notification.FLAG_SHOW_LIGHTS) |
                    (showLights ? Notification.FLAG_SHOW_LIGHTS : 0);
            return this;
        }

        /**
         * Set whether this is an ongoing notification.
         *
         *
Ongoing notifications differ from regular notifications in the following ways:
         *

         *
Ongoing notifications are sorted above the regular notifications in the
         *   notification panel.

         *
Ongoing notifications do not have an 'X' close button, and are not affected
         *   by the "Clear all" button.
         *

         */
        public Builder setOngoing(boolean ongoing) {
            setFlag(Notification.FLAG_ONGOING_EVENT, ongoing);
            return this;
        }

        /**
         * Set this flag if you would only like the sound, vibrate
         * and ticker to be played if the notification is not already showing.
         */
        public Builder setOnlyAlertOnce(boolean onlyAlertOnce) {
            setFlag(Notification.FLAG_ONLY_ALERT_ONCE, onlyAlertOnce);
            return this;
        }

        /**
         * Setting this flag will make it so the notification is automatically
         * canceled when the user clicks it in the panel.  The PendingIntent
         * set with {@link #setDeleteIntent} will be broadcast when the notification
         * is canceled.
         */
        public Builder setAutoCancel(boolean autoCancel) {
            setFlag(Notification.FLAG_AUTO_CANCEL, autoCancel);
            return this;
        }

        /**
         * Set the default notification options that will be used.
         *

         * The value should be one or more of the following fields combined with
         * bitwise-or:
         * {@link Notification#DEFAULT_SOUND}, {@link Notification#DEFAULT_VIBRATE},
         * {@link Notification#DEFAULT_LIGHTS}.
         *

         * For all default values, use {@link Notification#DEFAULT_ALL}.
         */
        public Builder setDefaults(int defaults) {
            mNotification.defaults = defaults;
            if ((defaults & Notification.DEFAULT_LIGHTS) != 0) {
                mNotification.flags |= Notification.FLAG_SHOW_LIGHTS;
            }
            return this;
        }

        private void setFlag(int mask, boolean value) {
            if (value) {
                mNotification.flags |= mask;
            } else {
                mNotification.flags &= ~mask;
            }
        }

        /**
         * Set the relative priority for this notification.
         *
         * Priority is an indication of how much of the user's
         * valuable attention should be consumed by this
         * notification. Low-priority notifications may be hidden from
         * the user in certain situations, while the user might be
         * interrupted for a higher-priority notification.
         * The system sets a notification's priority based on various factors including the
         * setPriority value. The effect may differ slightly on different platforms.
         */
        public Builder setPriority(int pri) {
            mPriority = pri;
            return this;
        }

        /**
         * Add an action to this notification. Actions are typically displayed by
         * the system as a button adjacent to the notification content.
         *

         * Action buttons won't appear on platforms prior to Android 4.1. Action
         * buttons depend on expanded notifications, which are only available in Android 4.1
         * and later. To ensure that an action button's functionality is always available, first
         * implement the functionality in the {@link android.app.Activity} that starts when a user
         * clicks the  notification (see {@link #setContentIntent setContentIntent()}), and then
         * enhance the notification by implementing the same functionality with
         * {@link #addAction addAction()}.
         *
         * @param icon Resource ID of a drawable that represents the action.
         * @param title Text describing the action.
         * @param intent {@link android.app.PendingIntent} to be fired when the action is invoked.
         */
        public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
            mActions.add(new Action(icon, title, intent));
            return this;
        }

        /**
         * Add a rich notification style to be applied at build time.
         *

         * If the platform does not provide rich notification styles, this method has no effect. The
         * user will always see the normal notification style.
         *
         * @param style Object responsible for modifying the notification style.
         */
        public Builder setStyle(Style style) {
            if (mStyle != style) {
                mStyle = style;
                if (mStyle != null) {
                    mStyle.setBuilder(this);
                }
            }
            return this;
        }

        /**
         * @deprecated Use {@link #build()} instead.
         */
        @Deprecated
        public Notification getNotification() {
            return (Notification) IMPL.build(this);
        }

        /**
         * Combine all of the options that have been set and return a new {@link Notification}
         * object.
         */
        public Notification build() {
            return (Notification) IMPL.build(this);
        }
    }

    /**
     * An object that can apply a rich notification style to a {@link Notification.Builder}
     * object.
     *

     * If the platform does not provide rich notification styles, methods in this class have no
     * effect.
     */
    public static abstract class Style
    {
        Builder mBuilder;
        CharSequence mBigContentTitle;
        CharSequence mSummaryText;
        boolean mSummaryTextSet = false;

        public void setBuilder(Builder builder) {
            if (mBuilder != builder) {
                mBuilder = builder;
                if (mBuilder != null) {
                    mBuilder.setStyle(this);
                }
            }
        }

        public Notification build() {
            Notification notification = null;
            if (mBuilder != null) {
                notification = mBuilder.build();
            }
            return notification;
        }
    }

    /**
     * Helper class for generating large-format notifications that include a large image attachment.
     *

     * If the platform does not provide large-format notifications, this method has no effect. The
     * user will always see the normal notification view.
     *

     * This class is a "rebuilder": It attaches to a Builder object and modifies its behavior, like so:
     *

     * Notification noti = new Notification.Builder()
     *     .setContentTitle("New photo from " + sender.toString())
     *     .setContentText(subject)
     *     .setSmallIcon(R.drawable.new_post)
     *     .setLargeIcon(aBitmap)
     *     .setStyle(new Notification.BigPictureStyle()
     *         .bigPicture(aBigBitmap))
     *     .build();
     *

     *
     * @see Notification#bigContentView
     */
    public static class BigPictureStyle extends Style {
        Bitmap mPicture;
        Bitmap mBigLargeIcon;
        boolean mBigLargeIconSet;

        public BigPictureStyle() {
        }

        public BigPictureStyle(Builder builder) {
            setBuilder(builder);
        }

        /**
         * Overrides ContentTitle in the big form of the template.
         * This defaults to the value passed to setContentTitle().
         */
        public BigPictureStyle setBigContentTitle(CharSequence title) {
            mBigContentTitle = title;
            return this;
        }

        /**
         * Set the first line of text after the detail section in the big form of the template.
         */
        public BigPictureStyle setSummaryText(CharSequence cs) {
            mSummaryText = cs;
            mSummaryTextSet = true;
            return this;
        }

        /**
         * Provide the bitmap to be used as the payload for the BigPicture notification.
         */
        public BigPictureStyle bigPicture(Bitmap b) {
            mPicture = b;
            return this;
        }

        /**
         * Override the large icon when the big notification is shown.
         */
        public BigPictureStyle bigLargeIcon(Bitmap b) {
            mBigLargeIcon = b;
            mBigLargeIconSet = true;
            return this;
        }
    }

    /**
     * Helper class for generating large-format notifications that include a lot of text.
     *
     *

     * If the platform does not provide large-format notifications, this method has no effect. The
     * user will always see the normal notification view.
     *

     * This class is a "rebuilder": It attaches to a Builder object and modifies its behavior, like so:
     *

     * Notification noti = new Notification.Builder()
     *     .setContentTitle("New mail from " + sender.toString())
     *     .setContentText(subject)
     *     .setSmallIcon(R.drawable.new_mail)
     *     .setLargeIcon(aBitmap)
     *     .setStyle(new Notification.BigTextStyle()
     *         .bigText(aVeryLongString))
     *     .build();
     *

     *
     * @see Notification#bigContentView
     */
    public static class BigTextStyle extends Style {
        CharSequence mBigText;

        public BigTextStyle() {
        }

        public BigTextStyle(Builder builder) {
            setBuilder(builder);
        }

        /**
         * Overrides ContentTitle in the big form of the template.
         * This defaults to the value passed to setContentTitle().
         */
        public BigTextStyle setBigContentTitle(CharSequence title) {
            mBigContentTitle = title;
            return this;
        }

        /**
         * Set the first line of text after the detail section in the big form of the template.
         */
        public BigTextStyle setSummaryText(CharSequence cs) {
            mSummaryText = cs;
            mSummaryTextSet = true;
            return this;
        }

        /**
         * Provide the longer text to be displayed in the big form of the
         * template in place of the content text.
         */
        public BigTextStyle bigText(CharSequence cs) {
            mBigText = cs;
            return this;
        }
    }

    /**
     * Helper class for generating large-format notifications that include a list of (up to 5) strings.
     *
     *

     * If the platform does not provide large-format notifications, this method has no effect. The
     * user will always see the normal notification view.
     *

     * This class is a "rebuilder": It attaches to a Builder object and modifies its behavior, like so:
     *

     * Notification noti = new Notification.Builder()
     *     .setContentTitle("5 New mails from " + sender.toString())
     *     .setContentText(subject)
     *     .setSmallIcon(R.drawable.new_mail)
     *     .setLargeIcon(aBitmap)
     *     .setStyle(new Notification.InboxStyle()
     *         .addLine(str1)
     *         .addLine(str2)
     *         .setContentTitle("")
     *         .setSummaryText("+3 more"))
     *     .build();
     *

     *
     * @see Notification#bigContentView
     */
    public static class InboxStyle extends Style {
        ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>();

        public InboxStyle() {
        }

        public InboxStyle(Builder builder) {
            setBuilder(builder);
        }

        /**
         * Overrides ContentTitle in the big form of the template.
         * This defaults to the value passed to setContentTitle().
         */
        public InboxStyle setBigContentTitle(CharSequence title) {
            mBigContentTitle = title;
            return this;
        }

        /**
         * Set the first line of text after the detail section in the big form of the template.
         */
        public InboxStyle setSummaryText(CharSequence cs) {
            mSummaryText = cs;
            mSummaryTextSet = true;
            return this;
        }

        /**
         * Append a line to the digest section of the Inbox notification.
         */
        public InboxStyle addLine(CharSequence cs) {
            mTexts.add(cs);
            return this;
        }
    }

    public static class Action {
        public int icon;
        public CharSequence title;
        public PendingIntent actionIntent;

        public Action(int icon_, CharSequence title_, PendingIntent intent_) {
            this.icon = icon_;
            this.title = title_;
            this.actionIntent = intent_;
        }
    }
}


text:
package org.apache.logging.log4j.layout.template.json.resolver;

import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;

/**
 * {@link EndOfBatchResolver} factory.
 */
@Plugin(name = "EndOfBatchResolverFactory", category = TemplateResolverFactory.CATEGORY)
public final class EndOfBatchResolverFactory implements EventResolverFactory {

    private static final EndOfBatchResolverFactory INSTANCE =
            new EndOfBatchResolverFactory();

    private EndOfBatchResolverFactory() {}

    @PluginFactory
    public static EndOfBatchResolverFactory getInstance() {
        return INSTANCE;
    }

    @Override
    public String getName() {
        return EndOfBatchResolver.getName();
    }

    @Override
    public EndOfBatchResolver create(
            final EventResolverContext context,
            final TemplateResolverConfig config) {
        return EndOfBatchResolver.getInstance();
    }

}

redpajama_set_name: RedPajamaGithub


text:
import { EventEmitter } from "events";
import FChatContext from "./FChatContext";
import * as Rx from "rx";

class ChannelContext extends EventEmitter
{
    private parent: FChatContext;

    messages: Rx.Subject<ChannelMessage>;
    joins: Rx.Subject<string>;
    leaves: Rx.Subject<string>;

    constructor(parent: FChatContext) {
        super();
        this.parent = parent;
    }
}

interface ChannelMessage {
    context: ChannelContext;

}

export default ChannelContext;
export { ChannelContext }


text:
@import XCTest;
@import OCHamcrest;
@import OCMockito;

#import "VMKObservableManager.h"
#import "VMKObservableManager+Private.h"
#import "VMKBindingUpdater.h"
#import "FakeObject.h"

@interface VMKObservableManagerTests : XCTestCase
@property (nonatomic, strong) VMKObservableManager *sut;
@property (nonatomic, strong) FakeObject *fakeObject;
@property (nonatomic, strong) FakeObject *fakeObject2;
@property (nonatomic, strong) FakeObject *fakeObject3;
@property (nonatomic, strong) VMKBindingUpdater *bindingUpdater;
@property (nonatomic, strong) VMKBindingUpdater *bindingUpdater2;
@property (nonatomic, strong) VMKBindingUpdater *bindingUpdater3;
@end

@implementation VMKObservableManagerTests

- (void)setUp {
    [super setUp];
    self.sut = [[VMKObservableManager alloc] init];
    self.fakeObject = [[FakeObject alloc] init];
    self.fakeObject2 = [[FakeObject alloc] init];
    self.fakeObject3 = [[FakeObject alloc] init];
    self.bindingUpdater = [[VMKBindingUpdater alloc] initWithObserver:self.fakeObject updateAction:@selector(someAction)];
    self.bindingUpdater2 = [[VMKBindingUpdater alloc] initWithObserver:self.fakeObject2 updateAction:@selector(someAction)];
    self.bindingUpdater3 = [[VMKBindingUpdater alloc] initWithObserver:self.fakeObject3 updateAction:@selector(someAction)];
}

- (void)tearDown {
    self.fakeObject = nil;
    self.fakeObject2 = nil;
    self.fakeObject3 = nil;
    self.bindingUpdater = nil;
    self.bindingUpdater2 = nil;
    self.bindingUpdater3 = nil;
    self.sut = nil;
    [super tearDown];
}

#pragma mark - helper

- (void)addObjectsToSut {
    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater];
    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty2)) bindingUpdater:self.bindingUpdater];
    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty3)) bindingUpdater:self.bindingUpdater];

    [self.sut addObject:self.fakeObject2 forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater2];
    [self.sut addObject:self.fakeObject2 forKeyPath:NSStringFromSelector(@selector(observableProperty2)) bindingUpdater:self.bindingUpdater2];

    [self.sut addObject:self.fakeObject3 forKeyPath:NSStringFromSelector(@selector(observableProperty3)) bindingUpdater:self.bindingUpdater3];
}

#pragma mark - init

- (void)testSutIsNotNil {
    assertThat(self.sut, notNilValue());
}

- (void)testSutObservablesIsNotNil {
    assertThat(self.sut.observables, notNilValue());
}

- (void)testSutObservablesIsEmpty {
    assertThat(self.sut.observables, hasCountOf(0));
}

#pragma mark - addObject:forKeyPath:bindingUpdater:

- (void)testAddObjectForKeyPathBindingUpdaterAddsAnObservaleWithValidValues {

    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater];

    assertThat(self.sut.observables, hasCountOf(1));
}

- (void)testAddObjectForKeyPathBindingUpdaterAddsTwoObservaleIfCalledTwice {

    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater];
    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty2)) bindingUpdater:self.bindingUpdater];

    assertThat(self.sut.observables, hasCountOf(2));
}

- (void)testAddObjectForKeyPathBindingUpdaterTwiceWillThrow {

    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater];

    XCTAssertThrows([self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater]);
}

- (void)testAddObjectForKeyPathBindingUpdaterAddsSixObservales {

    [self addObjectsToSut];

    assertThat(self.sut.observables, hasCountOf(6));
}

#pragma mark - addObject:withBindings:

- (void)testAddObjectWithEmptyBindingsAddsNothing {

    VMKBindingDictionary *testDic = @{};

    [self.sut addObject:self.fakeObject withBindings:testDic];

    assertThat(self.sut.observables, hasCountOf(0));
}

- (void)testAddObjectWithBindingsAddsTheBindingAsObservable {

    VMKBindingDictionary *testDic = @{ NSStringFromSelector(@selector(observableProperty)): self.bindingUpdater };

    [self.sut addObject:self.fakeObject withBindings:testDic];

    assertThat(self.sut.observables, hasCountOf(1));
}

#pragma mark - removeBindingObserver:ForKeyPath:

- (void)testRemoveBindingObserverForKeyPathRemovesNothingIfObjectIsNotObserved {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self forKeyPath:NSStringFromSelector(@selector(observableProperty2))];

    assertThat(self.sut.observables, hasCountOf(6));
}

- (void)testRemoveBindingObserverForKeyPathRemovesOneObservable {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty2))];

    assertThat(self.sut.observables, hasCountOf(5));
}

- (void)testRemoveBindingObserverForKeyPathRemovesOnlyOneObservableIfCalledTwice {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty2))];
    [self.sut removeBindingObserver:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty2))];

    assertThat(self.sut.observables, hasCountOf(5));
}

- (void)testRemoveBindingObserverForKeyPathRemovesTwoObservableForTwoDifferentObjects {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty))];
    [self.sut removeBindingObserver:self.fakeObject2 forKeyPath:NSStringFromSelector(@selector(observableProperty2))];

    assertThat(self.sut.observables, hasCountOf(4));
}

#pragma mark - removeBindingObserver:

- (void)testRemoveBindingObserverRemovesNothingIfObjectIsNotObserved {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self];

    assertThat(self.sut.observables, hasCountOf(6));
}

- (void)testRemoveBindingObserverRemovesThreeObservables {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject];

    assertThat(self.sut.observables, hasCountOf(3));
}

- (void)testRemoveBindingObserverRemovesTwoObservables {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject2];

    assertThat(self.sut.observables, hasCountOf(4));
}

- (void)testRemoveBindingObserverRemovesOneObservables {
    [self addObjectsToSut];

    [self.sut removeBindingObserver:self.fakeObject3];

    assertThat(self.sut.observables, hasCountOf(5));
}

#pragma mark - removeObserverForObject

- (void)testRemoveObserverForObjectRemovesOnlyOneObject {
    [self addObjectsToSut];

    [self.sut removeObserverForObject:self.fakeObject3];

    assertThat(self.sut.observables, hasCountOf(5));
}

#pragma mark - removeAllBindings

- (void)testRemoveAllBindingsRemovesAll {
    [self addObjectsToSut];

    [self.sut removeAllBindings];

    assertThat(self.sut.observables, hasCountOf(0));
}

#pragma mark - removeAllObserverForKeyPath:

- (void)testRemoveAllObserverForKeyPathRemovesNothingIfKeyPathIsNotObserved {
    [self addObjectsToSut];

    [self.sut removeAllObserverForKeyPath:@"keyPathNotObserved"];

    assertThat(self.sut.observables, hasCountOf(6));
}

- (void)testRemoveAllObserverForKeyPathRemovesKeyPathObservableProperty {
    [self addObjectsToSut];

    [self.sut removeAllObserverForKeyPath:NSStringFromSelector(@selector(observableProperty))];

    assertThat(self.sut.observables, hasCountOf(4));
}

- (void)testRemoveAllObserverForKeyPathRemovesKeyPath {
    [self addObjectsToSut];

    [self.sut removeAllObserverForKeyPath:NSStringFromSelector(@selector(observableProperty2))];

    assertThat(self.sut.observables, hasCountOf(4));
}

#pragma mark - description

- (void)testDescriptionContainsObservableManager {
    assertThat(self.sut.description, containsSubstring(@"VMKObservableManager"));
}

- (void)testDescriptionContainsZeroObservables {
    assertThat(self.sut.description, containsSubstring(@"0 observables"));
}

- (void)testDescriptionContainsOneObservables {
    [self.sut addObject:self.fakeObject forKeyPath:NSStringFromSelector(@selector(observableProperty)) bindingUpdater:self.bindingUpdater];

    assertThat(self.sut.description, containsSubstring(@"1 observables"));
}

@end


text:
/*	$NetBSD: io.c,v 1.2 1999/02/15 04:38:06 sakamoto Exp $	*/

/*-
 * Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
 * All rights reserved.
 *
 * PCI/ISA I/O support
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. 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.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Gary Thomas.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
 */

volatile unsigned char *ISA_io  = (unsigned char *)0x80000000;
volatile unsigned char *ISA_mem = (unsigned char *)0xC0000000;

void
outb(int port, char val)
{
	ISA_io[port] = val;
}

unsigned char
inb(int port)
{
	return (ISA_io[port]);
}

unsigned long
local_to_PCI(unsigned long addr)
{
	return ((addr & 0x7FFFFFFF) | 0x80000000);
}


text:
% Position Jensen Alpha
%
%
% Computes position alpha (excess return) according to the Single Index Model.
%
% Usage
%
% position_jensensAlpha(portfolio,symbol)
%
%
% portfolio
%        Portfolio object created using portfolio_create( ) function
%
% symbol
%        unique identifier of the instrument
%
% Return Value
%
% numeric vector  position alpha values.
%
% Description
% https://www.portfolioeffect.com/docs/glossary/measures/relative-risk-adjusted-measures/jensens-alpha
%
% Note
%
% PortfolioEffect - Matlab Interface to Quant API
%
% Copyright (C) 2010 - 2015 Snowfall Systems, Inc.
%
%
% Examples
%
% data_goog=importdata('data_goog.mat');
% data_aapl=importdata('data_aapl.mat');
% data_spy=importdata('data_spy.mat');
% portfolioExample=portfolio_create('priceDataIx',data_spy);
% portfolio_addPosition(portfolioExample,'GOOG',100,'priceData',data_goog);
% portfolio_addPosition(portfolioExample,'AAPL',300,'priceData',data_aapl);
% portfolio_addPosition(portfolioExample,'SPY',150,'priceData',data_spy);
% portfolio_settings(portfolioExample,'portfolioMetricsMode','price','windowLength','3600s');
% util_plot2d(position_jensensAlpha(portfolioExample,'GOOG'),'Position Jensen Alpha GOOG')
%
% dateStart = '2014-11-17 09:30:00';
% dateEnd = '2014-11-19 16:00:00';
% portfolioExample=portfolio_create('index','SPY','fromTime',dateStart ,'toTime',dateEnd );
% portfolio_addPosition(portfolioExample,'AAPL',100);
% portfolio_addPosition(portfolioExample,'C',300);
% portfolio_addPosition(portfolioExample,'GOOG',150);
% util_plot2d(position_jensensAlpha(portfolioExample,'AAPL'),'Position Jensen Alpha AAPL')
function [position_jensensAlpha] = position_jensensAlpha(portfolio,symbol)
     position_jensensAlpha=position_metric(portfolio,'metric','POSITION_ALPHA_JENSEN','position',symbol);
end


text:
Sanitize [HAST][].

## Installation

[npm][]:

```bash
npm install hast-util-sanitize
```

## Usage

```javascript
var h = require('hastscript');
var u = require('unist-builder');
var sanitize = require('hast-util-sanitize');
var toHTML = require('hast-util-to-html');

var tree = h('div', {
  onmouseover: 'alert("alpha")'
}, [
  h('a', {
    href: 'jAva script:alert("bravo")',
    onclick: 'alert("charlie")'
  }, 'delta'),
  u('text', '\n'),
  h('script', 'alert("charlie")'),
  u('text', '\n'),
  h('img', {src: 'x', onerror: 'alert("delta")'}),
  u('text', '\n'),
  h('iframe', {src: 'javascript:alert("echo")'}),
  u('text', '\n'),
  h('math', h('mi', {
    'xlink:href': 'data:x,<script>alert("foxtrot")</script>'
  }))
]);

var unsanitized = toHTML(tree);
var sanitized = toHTML(sanitize(tree));
```

Unsanitized:

```html
<div onmouseover="alert("alpha")"><a href="jAva script:alert("bravo")" onclick="alert("charlie")">delta</a>
<script>alert("charlie")</script>
<img src="x" onerror="alert("delta")">
<iframe src="javascript:alert("echo")"></iframe>
<math><mi xlink:href="data:x,<script>alert("foxtrot")</script>"></mi></math></div>
```

Sanitized:

```html
<div><a>delta</a>

<img src="x">

</div>
```

## API

### `sanitize(node[, schema])`

Sanitize the given [HAST][] tree.

###### Parameters

*   `node` ([`HASTNode`][hast]).
*   `schema` ([`Schema`][schema], optional).

###### Returns

[`HASTNode`][hast] — A new node.

### `Schema`

Configuration.  If not given, defaults to [GitHub][] style sanitation.
If any top-level key isn't given, it defaults to GH's style too.

For a thorough sample, see the packages [`github.json`][schema-github].

To extend the standard schema with a few changes, clone `github.json`
like so:

```js
var h = require('hastscript');
var merge = require('deepmerge');
var gh = require('hast-util-sanitize/lib/github');

var schema = merge(gh, {attributes: {'*': ['className']}});

var tree = sanitize(h('div', {className: ['foo']}));
// `tree` still has `className`.
```

###### `attributes`

Map of tag-names to allowed attributes (`Object.<Array.<string>>`).

The special `'*'` key sets attributes allowed on all elements.

One special value, namely `'data*'`, can be used to allow all `data`
properties.

```js
"attributes": {
  "a": [
    "href"
  ],
  "img": [
    "src",
    "longDesc"
  ],
  // ...
  "*": [
    "abbr",
    "accept",
    "acceptCharset",
    // ...
    "vspace",
    "width",
    "itemProp"
  ]
}
```

###### `tagNames`

List of allowed tag-names (`Array.<string>`).

```js
"tagNames": [
  "h1",
  "h2",
  "h3",
  // ...
  "strike",
  "summary",
  "details"
]
```

###### `protocols`

Map of protocols to support for attributes (`Object.<Array.<string>>`).

```js
"protocols": {
  "href": [
    "http",
    "https",
    "mailto"
  ],
  // ...
  "longDesc": [
    "http",
    "https"
  ]
}
```

###### `ancestors`

Map of tag-names to their required ancestral elements
(`Object.<Array.<string>>`).

```js
"ancestors": {
  "li": [
    "ol",
    "ul"
  ],
  // ...
  "tr": [
    "table"
  ]
}
```

###### `clobber`

List of allowed attribute-names which can clobber (`Array.<string>`).

```js
"clobber": [
  "name",
  "id"
]
```

###### `clobberPrefix`

Prefix (`string`) to use before potentially clobbering properties.

```js
"clobberPrefix": "user-content"
```

###### `strip`

Tag-names to strip from the tree (`Array.<string>`).

By default, unsafe elements are replaced by their content.  Some elements,
should however be entirely stripped from the tree.

```js
"strip": [
  "script"
]
```

## License

[MIT][license] © [Titus Wormer][author]

<!-- Definitions -->

[travis-badge]: https://img.shields.io/travis/syntax-tree/hast-util-sanitize.svg

[travis]: https://travis-ci.org/syntax-tree/hast-util-sanitize

[codecov-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-sanitize.svg

[codecov]: https://codecov.io/github/syntax-tree/hast-util-sanitize

[npm]: https://docs.npmjs.com/cli/install

[license]: LICENSE

[author]: http://wooorm.com

[hast]: https://github.com/syntax-tree/hast

[schema]: #schema

[github]: https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb

[schema-github]: lib/github.json


text:
@implementation TestView

- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        CGFloat width = [UIScreen mainScreen].bounds.size.width - 100;
        CGFloat height = 100;

//        self.e_RX_ActionSheetViewAnimateDirection = kE_RX_ActionSheetViewAnimateDirection_FromBottomToTop;
//        self.e_RX_ActionSheetViewAnimateDirection = kE_RX_ActionSheetViewAnimateDirection_FromTopToBottom;
//        self.e_RX_ActionSheetViewAnimateDirection = kE_RX_ActionSheetViewAnimateDirection_FromRightToLeft;
        self.e_RX_ActionSheetViewAnimateDirection = kE_RX_ActionSheetViewAnimateDirection_FromLeftToRight;

//        self.frame = CGRectMake(50, ([UIScreen mainScreen].bounds.size.height - height) / 2.0f, width, height);
        self.frame = CGRectMake(0, 0, width, height);
        self.backgroundColor = [UIColor redColor];
    }
    return self;
}

@end


text:
NSString *const cellId = @"cellId";
#define HEADERHEIGHT 250
@interface TwoViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation TwoViewController {
    UIView              *_headView;
    UIImageView         *_headImageView;
    UIStatusBarStyle    _statusBarStyle;
    UIView              *_lineView;
    UIView              *_view;
    CGFloat             _lineHeight;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置新控制器的背景严格,要不然nav会有显示问题
    self.view.backgroundColor = [UIColor whiteColor];
    //TableView
    [self prepareTableView];
    //HeaderView
    [self prepareHeaderView];

    //状态栏的颜色
    _statusBarStyle = UIStatusBarStyleLightContent;

    //添加一个view 代替NAV
    _view = [[UIView alloc]initWithFrame:CGRectMake(0, 20, self.view.hm_width, 44 )];
    _view.alpha = 0;
    [self.view addSubview:_view];

    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(12, 0, 40, 20)];
    btn.hm_y = _view.hm_height * 0.5  - 10 ;
    [btn setTitle:@"返回" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [_view addSubview: btn];
    [btn addTarget:self action:@selector(backViewController) forControlEvents:UIControlEventTouchUpInside];
}
//返回控制器
- (void)backViewController {

    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    //取消自动调整滚动视图的间距  UIViewController + Nav 会自动调整tabview的contentinset
    self.automaticallyAdjustsScrollViewInsets = NO;
    //视图将要显示的时候隐藏nav
    [self.navigationController setNavigationBarHidden:YES animated:NO];
}
//HeaderView
- (void)prepareHeaderView {
    //创建一个视图
    _headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, HEADERHEIGHT)];
    _headView.backgroundColor = [UIColor hm_colorWithHex:0xF8F8F8];
    [self.view addSubview:_headView];

    //创建图片视图
    _headImageView = [[UIImageView alloc]initWithFrame:_headView.bounds];
    _headImageView.backgroundColor = [UIColor hm_colorWithHex:0x000033];

    //设置图片大小样式contentMode UIViewContentModeScaleAspectFill等比例
    _headImageView.contentMode = UIViewContentModeScaleAspectFill;
    //裁减超出部分
    _headImageView.clipsToBounds = YES;
    [_headView addSubview:_headImageView];

    //添加分割线  宽度一个像素的点
    _lineHeight = 1 ;
    //创建分割线
    _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, HEADERHEIGHT - _lineHeight, _headView.hm_width, _lineHeight)];
    _lineView.backgroundColor = [UIColor lightGrayColor];
    [_headView addSubview:_lineView];

    //设置网络图片 用yy_WebImage 因为 AFN大图不缓存, SDWebImage 没有指示器。
    NSURL *url = [[NSURL alloc]initWithString:@"http://c.hiphotos.baidu.com/zhidao/pic/item/3bf33a87e950352afcc234985243fbf2b3118bfa.jpg"];
    [_headImageView yy_setImageWithURL:url options:YYWebImageOptionShowNetworkActivity];
}
//修改状态栏的状态 浅色
- (UIStatusBarStyle)preferredStatusBarStyle {
    return _statusBarStyle;
}
//TableView
- (void)prepareTableView {
    //创建tableview
    UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    //设置数据源和代理
    tableView.delegate = self;
    tableView.dataSource = self;
    //注册tableView
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
    [self.view addSubview:tableView];
    //设置tableView的contentInset
    tableView.contentInset = UIEdgeInsetsMake(HEADERHEIGHT, 0, 0, 0);
    tableView.scrollIndicatorInsets = UIEdgeInsetsMake(HEADERHEIGHT, 0, 0, 0);
}

#pragma mark- TableView的代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1000;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    cell.textLabel.text = @(indexPath.row).stringValue;
    return cell;
}

#pragma mark- scrollView的代理方法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

    //contentoffset.y 是一个负值    contentInset.top 是一个正值。 符号相反
    CGFloat offset = scrollView.contentOffset.y + scrollView.contentInset.top;
    //放大
    if (offset <= 0 ) {

        //OC语法糖
        _headView.hm_height = HEADERHEIGHT - offset;//正减负 等于正加正
        _headImageView.alpha = 1;
    } else {
    //整体移动

        _headView.hm_height = HEADERHEIGHT;
        //Y的最小值,
        CGFloat min = HEADERHEIGHT - 64;
        //移动
        _headView.hm_y = -MIN(min, offset);
        CGFloat progress = 1 - offset / min;
        _headImageView.alpha = progress;
        //判断状态栏颜色
        _statusBarStyle = (progress > 0.5) ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault;
        //状态栏颜色记得跟新状态
        [self.navigationController setNeedsStatusBarAppearanceUpdate];

        //判断自定义代替导航栏的view 是否隐藏
        _view.alpha = (_headView.hm_y == -min) ? 1 :0;
    }
        _headImageView.hm_height = _headView.hm_height;
    //设置分割线跟随图片移动
    _lineView.hm_y = CGRectGetMaxY(_headView.bounds);
}
@end


text:
<?php

declare(strict_types=1);

namespace Phan\LanguageServer\Protocol;

/**
 * A suggestion item for a completion suggested by the language server.
 * @phan-file-suppress PhanWriteOnlyPublicProperty this is sent to the language client
 */
class CompletionItem
{
    /**
     * The label of this completion item. By default
     * also the text that is inserted when selecting
     * this completion.
     *
     * @var string
     */
    public $label;

    /**
     * The kind of this completion item. Based of the kind
     * an icon is chosen by the editor.
     *
     * @var int|null
     */
    public $kind;

    /**
     * A human-readable string with additional information
     * about this item, like type or symbol information.
     *
     * @var string|null
     */
    public $detail;

    /**
     * A human-readable string that represents a doc-comment.
     *
     * @var string|null
     */
    public $documentation;

    /**
     * A string that should be used when comparing this item
     * with other items. When `falsy` the label is used.
     *
     * @var string|null
     */
    public $sortText;

    /**
     * A string that should be used when filtering a set of
     * completion items. When `falsy` the label is used.
     *
     * @var string|null
     */
    public $filterText;

    /**
     * A string that should be inserted in a document when selecting
     * this completion. When `falsy` the label is used.
     *
     * @var string|null
     *
     * TODO: Switch to textEdit once the column is tracked, this is deprecated
     */
    public $insertText;

    /**
     * @param string|null     $label
     * @param int|null        $kind
     * @param string|null     $detail
     * @param string|null     $documentation
     * @param string|null     $sortText
     * @param string|null     $filterText
     * @param string|null     $insertText
     */
    public function __construct(
        string $label = null,
        int $kind = null,
        string $detail = null,
        string $documentation = null,
        string $sortText = null,
        string $filterText = null,
        string $insertText = null
    ) {
        // @phan-suppress-next-line PhanPossiblyNullTypeMismatchProperty the '(at)var string' annotation is used by the RPC library
        $this->label = $label;
        $this->kind = $kind;
        $this->detail = $detail;
        $this->documentation = $documentation;
        $this->sortText = $sortText;
        $this->filterText = $filterText;
        $this->insertText = $insertText;
    }

    /**
     * Create a CompletionItem from a serialized array $data
     * @param array<string,mixed> $data
     */
    public static function fromArray(array $data): CompletionItem
    {
        return new self(
            $data['label'],
            $data['kind'],
            $data['detail'],
            $data['documentation'],
            $data['sortText'],
            $data['filterText'],
            $data['insertText']
        );
    }
}


text:
using System.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MultiSafepay.IntegrationTests.Issuers
{
    [TestClass]
    public class GetIssuers
    {
        [TestMethod]
        public void Issuers_GetIssuers()
        {
            // Arrange
            var url = Settings.MultiSafePayUrl;
            var apiKey = Settings.ApiKey;
            var client = new MultiSafepayClient(apiKey, url);

            // Act
            var gateways = client.GetIssuers("iDEAL");

            // Assert
            Assert.IsNotNull(gateways);
        }
    }
}


text:
<?php
	//a class is an object that can be used whereever it is called
	class Database{
		//the "private" before the variable makes it so that these variables can only be used here
		private $connection;
		//global variables
		private $host;
		private $username;
		private $password;
		private $database;
		//this variable is public so that we can access it in create-db.php
		public $error;

		//allows me to use objects of the Databse class. Defines class. Parameters allow us to use the global variables for this function
		public function __construct($host, $username, $password, $database){
			//accesses the global variable $host
			$this->host = $host;
			//these are local variables
			$this->username = $username;
			//they are deleted when this function is finished.
			$this->password = $password;
			$this->database = $database;

			//helps connect to Database.php variables by putting them in an object.  this opens the connection.
			$this->connection = new mysqli($host, $username, $password);
			//runs if there is no connecton to database.php and hte variables aren't getting read
			if($this->connection->connect_error){
				//eschoes that there is an error
				die("Error: "  . $this->connection->connect_error);
			}

			//try to access a database that exist on the mysql server. selecting database, whether server will say whether database exists
			$exists = $this->connection->select_db($database);
			//checking whether or not I was able to connect to the database.  Only runs when the database doesn't exist
			if(!$exists){
				//php will replace the variable $database with its value "blog_db". creates a query that creates a connection to my server
				$query = $this->connection->query("CREATE DATABASE $database");
				//checks whether $query was true or not
				if($query){
					//echoes that the database was created
					//echo "
successfully created database: " . $database . "
";
				}

			}
			//runs when database has already been created
			else{
				//echoes that the database already exists
			//	echo "
Database already exists
";
			}
		}

		//used to hold repetitive code.  specifically the connection opener
		public function openConnection(){
			//accesses the local variables from the construct function
			$this->connection = new mysqli($this->host, $this->username, $this->password, $this->database);
			//runs if there is no connecton to database.php and hte variables aren't getting read
			if($this->connection->connect_error){
				//eschoes that there is an error
				die("Error: "  . $connection->connect_error);
			}

		}

		//input the code into the function and insert the function name where ever the code should go
		public function closeConnection(){
			if(isset($this->connection)){
				$this->connection->close();
			}
		}
		//the query function takes a string of text and uses it to query the database at $query
		public function query($string){
			//runs the openConnection() function
			$this->openConnection();
			//executes a query on the database
			$query = $this->connection->query($string);
			//checks whether or not the query is false, then echoes out what went wrong
			if(!$query){
				//connects to the publiv variable "error" to find the source of error
				$this->error = $this->connection->error;
			}

			//runs the closeConnection() function
			$this->closeConnection();
			//returns the results of the query
			return $query;
		}

	}

	?>


text:
from humanize import naturaltime

from paasta_tools.cli.cmds.mark_for_deployment import mark_for_deployment
from paasta_tools.cli.utils import extract_tags
from paasta_tools.cli.utils import figure_out_service_name
from paasta_tools.cli.utils import lazy_choices_completer
from paasta_tools.cli.utils import list_services
from paasta_tools.generate_deployments_for_service import get_instance_config_for_service
from paasta_tools.remote_git import list_remote_refs
from paasta_tools.utils import datetime_from_utc_to_local
from paasta_tools.utils import DEFAULT_SOA_DIR
from paasta_tools.utils import format_table
from paasta_tools.utils import get_git_url
from paasta_tools.utils import PaastaColors
from paasta_tools.utils import parse_timestamp

def add_subparser(subparsers):
    list_parser = subparsers.add_parser(
        'rollback',
        help='Rollback a docker image to a previous deploy',
        description=(
            "'paasta rollback' is a human-friendly tool for marking a particular "
            "docker image for deployment, which invokes a bounce. While the command "
            "is called 'rollback', it can be used to roll forward or back, as long "
            "as there is a docker image available for the input git SHA."
        ),
        epilog=(
            "This rollback command uses the Git control plane, which requires network "
            "connectivity as well as authorization to the git repo."
        ),
    )
    list_parser.add_argument(
        '-k', '--commit',
        help="Git SHA to mark for rollback. "
        "A commit to rollback to is required for paasta rollback to run. However if one is not provided, "
        "paasta rollback will instead output a list of valid git shas to rollback to.",
        required=False,
    ).completer = lazy_choices_completer(list_previously_deployed_shas)
    list_parser.add_argument(
        '-d', '--deploy-groups',
        help='Mark one or more deploy groups to roll back (e.g. '
        '"all.main", "all.main,all.canary"). If no deploy groups specified,'
        ' all deploy groups for that service are rolled back',
        default='',
        required=False,
    )
    list_parser.add_argument(
        '-s', '--service',
        help='Name of the service to rollback (e.g. "service1")',
    ).completer = lazy_choices_completer(list_services)
    list_parser.add_argument(
        '-y', '--soa-dir',
        dest="soa_dir",
        metavar="SOA_DIR",
        default=DEFAULT_SOA_DIR,
        help="define a different soa config directory",
    )
    list_parser.set_defaults(command=paasta_rollback)

def list_previously_deployed_shas(parsed_args, **kwargs):
    service = parsed_args.service
    soa_dir = parsed_args.soa_dir
    deploy_groups = {deploy_group for deploy_group in parsed_args.deploy_groups.split(',') if deploy_group}
    return (sha for sha, _ in get_git_shas_for_service(service, deploy_groups, soa_dir))

def get_git_shas_for_service(service, deploy_groups, soa_dir):
    """Returns a list of 2-tuples of the form (sha, timestamp) for each deploy tag in a service's git
    repository"""
    if service is None:
        return []
    git_url = get_git_url(service=service, soa_dir=soa_dir)
    all_deploy_groups = {config.get_deploy_group() for config in get_instance_config_for_service(
        service=service,
        soa_dir=soa_dir,
    )}
    deploy_groups, _ = validate_given_deploy_groups(all_deploy_groups, deploy_groups)
    previously_deployed_shas = {}
    for ref, sha in list_remote_refs(git_url).items():
        regex_match = extract_tags(ref)
        try:
            deploy_group = regex_match['deploy_group']
            tstamp = regex_match['tstamp']
        except KeyError:
            pass
        else:
            # note that all strings are greater than ''
            if deploy_group in deploy_groups and tstamp > previously_deployed_shas.get(sha, ''):
                previously_deployed_shas[sha] = tstamp
    return previously_deployed_shas.items()

def validate_given_deploy_groups(service_deploy_groups, args_deploy_groups):
    """Given two lists of deploy groups, return the intersection and difference between them.

    :param service_deploy_groups: instances actually belonging to a service
    :param args_deploy_groups: the desired instances
    :returns: a tuple with (common, difference) indicating deploy groups common in both
        lists and those only in args_deploy_groups
    """
    if len(args_deploy_groups) is 0:
        valid_deploy_groups = set(service_deploy_groups)
        invalid_deploy_groups = set([])
    else:
        valid_deploy_groups = set(args_deploy_groups).intersection(service_deploy_groups)
        invalid_deploy_groups = set(args_deploy_groups).difference(service_deploy_groups)

    return valid_deploy_groups, invalid_deploy_groups

def list_previous_commits(service, deploy_groups, any_given_deploy_groups, soa_dir):
    def format_timestamp(tstamp):
        return naturaltime(datetime_from_utc_to_local(parse_timestamp(tstamp)))

    print "Please specify a commit to mark for rollback (-k, --commit). Below is a list of recent commits:"
    git_shas = sorted(get_git_shas_for_service(service, deploy_groups, soa_dir), key=lambda x: x[1], reverse=True)[:10]
    rows = [('Timestamp -- UTC', 'Git SHA')]
    rows.extend([('%s (%s)' % (timestamp, format_timestamp(timestamp)), sha) for sha, timestamp in git_shas])
    for line in format_table(rows):
        print line
    if len(git_shas) >= 2:
        sha, tstamp = git_shas[1]
        deploy_groups_arg_line = '-d %s ' % ','.join(deploy_groups) if any_given_deploy_groups else ''
        print "For example, to roll back to the second to last commit from %s, run:" % format_timestamp(tstamp)
        print PaastaColors.bold("    paasta rollback -s %s %s-k %s" % (service, deploy_groups_arg_line, sha))

def paasta_rollback(args):
    """Call mark_for_deployment with rollback parameters
    :param args: contains all the arguments passed onto the script: service,
    deploy groups and sha. These arguments will be verified and passed onto
    mark_for_deployment.
    """
    soa_dir = args.soa_dir
    service = figure_out_service_name(args, soa_dir)

    git_url = get_git_url(service, soa_dir)
    given_deploy_groups = {deploy_group for deploy_group in args.deploy_groups.split(",") if deploy_group}

    service_deploy_groups = {config.get_deploy_group() for config in get_instance_config_for_service(
        service=service,
        soa_dir=soa_dir,
    )}
    deploy_groups, invalid = validate_given_deploy_groups(service_deploy_groups, given_deploy_groups)

    if len(invalid) > 0:
        print PaastaColors.yellow("These deploy groups are not valid and will be skipped: %s.\n" % (",").join(invalid))

    if len(deploy_groups) == 0:
        print PaastaColors.red("ERROR: No valid deploy groups specified for %s.\n" % (service))
        return 1

    commit = args.commit
    if not commit:
        list_previous_commits(service, deploy_groups, bool(given_deploy_groups), soa_dir)
        return 1

    returncode = 0

    for deploy_group in deploy_groups:
        returncode = max(
            mark_for_deployment(
                git_url=git_url,
                service=service,
                deploy_group=deploy_group,
                commit=commit,
            ),
            returncode,
        )

    return returncode


text:
int riscv_main(cosim_cpu_api *sim, int argc, char *argv[]);

#endif


text:
'use strict';

/* globals describe, it */
/* eslint-disable no-unused-expressions */
const chai = require('chai');
const expect = chai.expect;
const mocks = require('../../mocks');
const sinonChai = require('sinon-chai');
const misc = require('../../../src/commands/handlers/misc');
const IrcCommand = require('../../../src/commands/command');

chai.use(sinonChai);

describe('src/commands/handlers/misc.js', function() {
    describe('PING handler', function() {
        const mock = mocks.IrcCommandHandler([misc]);
        const cmd = new IrcCommand('PING', {
            params: ['example.com'],
            tags: {
                time: '2021-06-29T16:42:00Z',
            }
        });
        mock.handlers.PING(cmd, mock.spies);

        it('should respond with the appropriate PONG message', function() {
            expect(mock.spies.connection.write).to.have.been.calledOnce;
            expect(mock.spies.connection.write).to.have.been.calledWith('PONG example.com');
        });

        it('should emit the appropriate PING event', function() {
            expect(mock.spies.emit).to.have.been.calledOnce;
            expect(mock.spies.emit).to.have.been.calledWith('ping', {
                message: undefined,
                time: 1624984920000,
                tags: {
                    time: '2021-06-29T16:42:00Z'
                }
            });
        });
    });

    describe('PONG handler', function() {
        it('should emit the appropriate PONG event', function() {
            const mock = mocks.IrcCommandHandler([misc]);
            const cmd = new IrcCommand('PONG', {
                params: ['one.example.com', 'two.example.com'],
                tags: {
                    time: '2011-10-10T14:48:00Z',
                }
            });
            mock.handlers.PONG(cmd, mock.spies);
            expect(mock.spies.network.addServerTimeOffset).to.have.been.calledOnce;
            expect(mock.spies.emit).to.have.been.calledOnce;
            expect(mock.spies.emit).to.have.been.calledWith('pong', {
                message: 'two.example.com',
                time: 1318258080000,
                tags: {
                    time: '2011-10-10T14:48:00Z'
                }
            });
        });
    });
});