text:
package gwt.material.design.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsDate;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import gwt.material.design.client.base.*;
import gwt.material.design.client.base.mixin.ErrorMixin;
import gwt.material.design.client.base.mixin.ReadOnlyMixin;
import gwt.material.design.client.constants.*;
import gwt.material.design.client.js.JsDatePickerOptions;
import gwt.material.design.client.js.JsMaterialElement;
import gwt.material.design.client.js.Window;
import gwt.material.design.client.ui.html.DateInput;
import gwt.material.design.client.ui.html.Label;

import java.util.Date;

import static gwt.material.design.client.js.JsMaterialElement.$;

//@formatter:off

/**
 * Material Date Picker will provide a visual calendar to your apps.
 *

 *
UiBinder Usage:

 * {@code
 * <m:MaterialDatePicker ui:field="datePicker">
 * }
 *
Java Usage:

 * {@code
 * datePicker.setDate(new Date());
 * }
 *
 * @author kevzlou7979
 * @author Ben Dol
 * @see Material Date Picker
 * @see Material Design Specification
 */
//@formatter:on
public class MaterialDatePicker extends AbstractValueWidget<Date> implements HasOrientation, HasPlaceholder,
        HasOpenHandlers<MaterialDatePicker>, HasCloseHandlers<MaterialDatePicker>, HasIcon, HasReadOnly {

    /**
     * Enum for identifying various selection types for the picker.
     */
    public enum MaterialDatePickerType {
        DAY,
        MONTH_DAY,
        YEAR_MONTH_DAY,
        YEAR
    }

    private String placeholder;
    private Date date;
    private Date dateMin;
    private Date dateMax;
    private Date dateTemp;
    private String format = "dd mmmm yyyy";
    private DateInput dateInput;
    private Label label = new Label();
    private MaterialLabel placeholderLabel = new MaterialLabel();
    protected Element pickatizedDateInput;
    private MaterialLabel errorLabel = new MaterialLabel();
    private DatePickerLanguage language;
    private JsDatePickerOptions options;
    private Orientation orientation;

    private MaterialDatePickerType selectionType = MaterialDatePickerType.DAY;

    private boolean detectOrientation;
    private boolean suppressChangeEvent;

    protected HandlerRegistration autoCloseHandler;
    protected HandlerRegistration orientationHandler;
    private MaterialIcon icon = new MaterialIcon();

    private ErrorMixin<AbstractValueWidget, MaterialLabel> errorMixin = new ErrorMixin<>(this, errorLabel, dateInput, placeholderLabel);
    private ReadOnlyMixin<MaterialDatePicker, DateInput> readOnlyMixin;

    private int yearsToDisplay = 10;
    private DatePickerContainer container = DatePickerContainer.SELF;
    private String tabIndex = "0";

    public MaterialDatePicker() {
        super(Document.get().createDivElement(), CssName.INPUT_FIELD);

        build();
    }

    public MaterialDatePicker(String placeholder) {
        this();
        setPlaceholder(placeholder);
    }

    public MaterialDatePicker(String placeholder, Date value) {
        this(placeholder);
        setDate(value);
    }

    public MaterialDatePicker(String placeholder, Date value, MaterialDatePickerType selectionType) {
        this(placeholder, value);
        setSelectionType(selectionType);
    }

    @Override
    protected void build() {
        dateInput = new DateInput();
        add(dateInput);

        label.add(placeholderLabel);
        add(label);
        add(errorLabel);
    }

    @Override
    public void onUnload() {
        super.onUnload();

        dateTemp = getValue();
    }

    @Override
    protected void initialize() {
        if (options == null) {
            options = new JsDatePickerOptions();
        }

        options.format = getFormat();
        switch (getSelectionType()) {
            case MONTH_DAY:
                options.selectMonths = true;
                break;
            case YEAR_MONTH_DAY:
                options.selectYears = yearsToDisplay;
                options.selectMonths = true;
                break;
            case YEAR:
                options.selectYears = yearsToDisplay;
                break;
        }

        if (container == DatePickerContainer.BODY) {
            options.container = "body";
        }

        pickatizedDateInput = $(dateInput.getElement()).pickadate(options).asElement();
        label.getElement().setAttribute("for", getPickerId());

        if (options.set == null) {
            options.set = thing -> {
                if (thing.hasOwnProperty("clear")) {
                    clear();
                } else if (thing.hasOwnProperty("select")) {
                    select();
                }
            };
        }

        getPicker()
                .off("open").off("close").off(options)
                .on(options).on("open", (e, param1) -> {
            onOpen();
            return true;
        }).on("close", (e, param1) -> {
            onClose();
            $(pickatizedDateInput).blur();
            return true;
        });

        setPopupEnabled(isEnabled());

        setInitialize(true);

        // Set up date specific settings.
        // These values require initialization.
        setDate(date);
        setDateMin(dateMin);
        setDateMax(dateMax);
        setOrientation(orientation);
    }

    private void setPopupEnabled(boolean enabled) {
        if (getPicker() != null) {
            if (!enabled) {
                $(getPickerRootElement()).attr("tabindex", "-1");
            } else {
                $(getPickerRootElement()).attr("tabindex", tabIndex);
            }
        }
    }

    /**
     * Reinitialize the datepicker.
     */
    @Override
    public void reinitialize() {
        Scheduler.get().scheduleDeferred(() -> {
            initialize();
            if (pickatizedDateInput != null && dateTemp != null) {
                getPicker().set("select", dateTemp, () -> {
                    DOM.createFieldSet().setPropertyObject("muted", true);
                });
            }
        });
    }

    @Override
    public void clear() {
        clearErrorOrSuccess();
        label.removeStyleName(CssName.ACTIVE);
        dateInput.removeStyleName(CssName.VALID);
        dateInput.clear();
    }

    /**
     * Sets the type of selection options (date, month, year,...).
     *
     * @param type if null, {@link MaterialDatePickerType#DAY} will be used as fallback.
     */
    public void setDateSelectionType(MaterialDatePickerType type) {
        if (type != null) {
            this.selectionType = type;
        }
    }

    protected void onClose() {
        CloseEvent.fire(this, this);
        fireEvent(new BlurEvent() {
        });
    }

    protected void onOpen() {
        label.addStyleName(CssName.ACTIVE);
        dateInput.setFocus(true);
        OpenEvent.fire(this, this);
        fireEvent(new FocusEvent() {
        });
    }

    /**
     * Programmatically close the date picker component
     */
    public void close() {
        Scheduler.get().scheduleDeferred(() -> {
            getPicker().close();
        });
    }

    /**
     * Programmatically open the date picker component
     */
    public void open() {
        Scheduler.get().scheduleDeferred(() -> {
            getPicker().open();
        });
    }

    public boolean isOpen() {
        return Boolean.parseBoolean(getPicker().get("open").toString());
    }

    protected void select() {
        label.addStyleName(CssName.ACTIVE);
        dateInput.addStyleName(CssName.VALID);

        // Ensure the value change event is
        // triggered on selecting a date if the picker is open
        // to avoid conflicts on setValue(value, fireEvents).
        if (isOpen() && !suppressChangeEvent) {
            ValueChangeEvent.fire(this, getValue());
        }
    }

    public String getPickerId() {
        return getPicker().get("id").toString();
    }

    public Element getPickerRootElement() {
        return $("#" + getPickerId() + "_root").asElement();
    }

    /**
     * Sets the current date of the picker.
     *
     * @param date - must not be null
     */
    public void setDate(Date date) {
        setValue(date);
    }

    /**
     * Get the minimum date limit.
     */
    public Date getDateMin() {
        return dateMin;
    }

    /**
     * Set the minimum date limit.
     */
    public void setDateMin(Date dateMin) {
        this.dateMin = dateMin;

        if (isInitialize() && dateMin != null) {
            getPicker().set("min", JsDate.create((double) dateMin.getTime()));
        }
    }

    /**
     * Get the maximum date limit.
     */
    public Date getDateMax() {
        return dateMax;
    }

    /**
     * Set the maximum date limit.
     */
    public void setDateMax(Date dateMax) {
        this.dateMax = dateMax;

        if (isInitialize() && dateMax != null) {
            getPicker().set("max", JsDate.create((double) dateMax.getTime()));
        }
    }

    /**
     * Set the pickers date.
     */
    public void setPickerDate(JsDate date, Element picker) {
        try {
            $(picker).pickadate("picker").set("select", date, () -> {
                DOM.createFieldSet().setPropertyObject("muted", true);
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Get the pickers date.
     */
    protected Date getPickerDate() {
        try {
            JsDate pickerDate = getPicker().get("select").obj;
            return new Date((long) pickerDate.getTime());
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    protected JsMaterialElement getPicker() {
        return $(pickatizedDateInput).pickadate("picker");
    }

    public Date getDate() {
        return getPickerDate();
    }

    /**
     * Clears the values of the picker field.
     */
    public void clearValues() {
        if (pickatizedDateInput != null) {
            clearValues(pickatizedDateInput);
        }
    }

    public void clearValues(Element picker) {
        $(picker).pickadate("picker").clear();
    }

    @Override
    public String getPlaceholder() {
        return placeholder;
    }

    @Override
    public void setPlaceholder(String placeholder) {
        this.placeholder = placeholder;

        if (placeholder != null) {
            placeholderLabel.setText(placeholder);
        }
    }

    /**
     * Get the pickers selection type.
     */
    public MaterialDatePickerType getSelectionType() {
        return selectionType;
    }

    /**
     * Set the pickers selection type.
     */
    public void setSelectionType(MaterialDatePickerType selectionType) {
        this.selectionType = selectionType;
    }

    /**
     * Set the pickers selection type with the ability to set the number of years to display
     * in the dropdown list.
     */
    public void setSelectionType(MaterialDatePickerType selectionType, int yearsToDisplay) {
        this.selectionType = selectionType;
        this.yearsToDisplay = yearsToDisplay;
    }

    /**
     * @return the orientation
     */
    @Override
    public Orientation getOrientation() {
        return orientation;
    }

    /**
     * @param orientation the orientation to set : can be Vertical or Horizontal
     */
    @Override
    public void setOrientation(Orientation orientation) {
        JsMaterialElement element = getPicker();
        if (isInitialize() && this.orientation != null) {
            element.root.removeClass(this.orientation.getCssName());
        }
        this.orientation = orientation;
        if (isInitialize() && orientation != null) {
            element.root.addClass(orientation.getCssName());
        }
    }

    public void setDetectOrientation(boolean detectOrientation) {
        this.detectOrientation = detectOrientation;

        if (orientationHandler != null) {
            orientationHandler.removeHandler();
            orientationHandler = null;
        }

        if (detectOrientation) {
            orientationHandler = com.google.gwt.user.client.Window.addResizeHandler(resizeEvent -> {
                detectAndApplyOrientation();
            });
            detectAndApplyOrientation();
        }
    }

    public boolean isDetectOrientation() {
        return detectOrientation;
    }

    protected void detectAndApplyOrientation() {
        if (Window.matchMedia("(orientation: portrait)")) {
            setOrientation(Orientation.PORTRAIT);
        } else {
            setOrientation(Orientation.LANDSCAPE);
        }
    }

    @Override
    public void setError(String error) {
        super.setError(error);
        dateInput.addStyleName(CssName.INVALID);
        dateInput.removeStyleName(CssName.VALID);
    }

    @Override
    public void setSuccess(String success) {
        super.setSuccess(success);
        dateInput.addStyleName(CssName.VALID);
        dateInput.removeStyleName(CssName.INVALID);
    }

    @Override
    public void clearErrorOrSuccess() {
        super.clearErrorOrSuccess();
        dateInput.removeStyleName(CssName.VALID);
        dateInput.removeStyleName(CssName.INVALID);
    }

    public String getFormat() {
        return format;
    }

    /**
     * To call before initialization.
     */
    public void setFormat(String format) {
        this.format = format;
    }

    @Override
    public Date getValue() {
        return getPickerDate();
    }

    @Override
    public void setValue(Date value, boolean fireEvents) {
        if (value == null) {
            clearValues();
            return;
        }
        this.date = value;
        if (isInitialize()) {
            suppressChangeEvent = !fireEvents;
            setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput);
            suppressChangeEvent = false;
            label.addStyleName(CssName.ACTIVE);
        }
        super.setValue(value, fireEvents);
    }

    @Override
    public void setValue(Date value) {
        setValue(value, false);
    }

    @Override
    public HandlerRegistration addCloseHandler(final CloseHandler<MaterialDatePicker> handler) {
        return addHandler(handler, CloseEvent.getType());
    }

    @Override
    public HandlerRegistration addOpenHandler(final OpenHandler<MaterialDatePicker> handler) {
        return addHandler(handler, OpenEvent.getType());
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        dateInput.setEnabled(enabled);
        if (isInitialize()) {
            setPopupEnabled(enabled);
        }
    }

    @Override
    public boolean isEnabled() {
        return dateInput.isEnabled();
    }

    @Override
    public void setTabIndex(int index) {
        tabIndex = String.valueOf(index);
        dateInput.setTabIndex(index);
    }

    @Override
    public int getTabIndex() {
        return dateInput.getTabIndex();
    }

    public DatePickerLanguage getLanguage() {
        return language;
    }

    public void setLanguage(DatePickerLanguage language) {
        this.language = language;

        if (language.getJs() != null) {
            ScriptInjector.fromString(language.getJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
        }
        stop();
        reinitialize();
    }

    /**
     * Stop the datepicker instance.
     */
    public void stop() {
        if (pickatizedDateInput != null) {
            getPicker().stop();
        }
    }

    protected void start() {
        getPicker().start();
    }

    @Override
    public MaterialIcon getIcon() {
        return icon;
    }

    @Override
    public void setIconType(IconType iconType) {
        icon.setIconType(iconType);
        icon.setIconPrefix(true);
        errorLabel.setPaddingLeft(44);
        insert(icon, 0);
    }

    @Override
    public void setIconPosition(IconPosition position) {
        icon.setIconPosition(position);
    }

    @Override
    public void setIconSize(IconSize size) {
        icon.setIconSize(size);
    }

    @Override
    public void setIconFontSize(double size, Style.Unit unit) {
        icon.setIconFontSize(size, unit);
    }

    @Override
    public void setIconColor(Color iconColor) {
        icon.setIconColor(iconColor);
    }

    @Override
    public void setIconPrefix(boolean prefix) {
        icon.setIconPrefix(prefix);
    }

    @Override
    public boolean isIconPrefix() {
        return icon.isIconPrefix();
    }

    @Override
    protected ErrorMixin<AbstractValueWidget, MaterialLabel> getErrorMixin() {
        return errorMixin;
    }

    public ReadOnlyMixin<MaterialDatePicker, DateInput> getReadOnlyMixin() {
        if (readOnlyMixin == null) {
            readOnlyMixin = new ReadOnlyMixin<>(this, dateInput);
        }
        return readOnlyMixin;
    }

    @Override
    public void setReadOnly(boolean value) {
        getReadOnlyMixin().setReadOnly(value);
    }

    @Override
    public boolean isReadOnly() {
        return getReadOnlyMixin().isReadOnly();
    }

    @Override
    public void setToggleReadOnly(boolean toggle) {
        getReadOnlyMixin().setToggleReadOnly(toggle);
    }

    @Override
    public boolean isToggleReadOnly() {
        return getReadOnlyMixin().isToggleReadOnly();
    }

    public DateInput getDateInput() {
        return dateInput;
    }

    public boolean isAutoClose() {
        return autoCloseHandler != null;
    }

    /**
     * Enables or disables auto closing when selecting a date.
     */
    public void setAutoClose(boolean autoClose) {
        if (autoCloseHandler != null) {
            autoCloseHandler.removeHandler();
            autoCloseHandler = null;
        }

        if (autoClose) {
            autoCloseHandler = addValueChangeHandler(event -> close());
        }
    }

    public int getYearsToDisplay() {
        return yearsToDisplay;
    }

    /**
     * Ability to set the number of years to display
     * in the dropdown list.
     */
    public void setYearsToDisplay(int yearsToDisplay) {
        this.yearsToDisplay = yearsToDisplay;
    }

    public DatePickerContainer getContainer() {
        return container;
    }

    /**
     * Set the Root Picker Container (Default : SELF)
     */
    public void setContainer(DatePickerContainer container) {
        this.container = container;
    }

    public Label getLabel() {
        return label;
    }

    public MaterialLabel getPlaceholderLabel() {
        return placeholderLabel;
    }

    public MaterialLabel getErrorLabel() {
        return errorLabel;
    }
}


text:
package counts

import (
	"net/http"
	"strconv"
	"sync"

	"github.com/rancher/apiserver/pkg/store/empty"
	"github.com/rancher/apiserver/pkg/types"
	"github.com/rancher/steve/pkg/accesscontrol"
	"github.com/rancher/steve/pkg/attributes"
	"github.com/rancher/steve/pkg/clustercache"
	"github.com/rancher/wrangler/pkg/summary"
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/runtime"
	schema2 "k8s.io/apimachinery/pkg/runtime/schema"
)

var (
	ignore = map[string]bool{
		"count":   true,
		"schema":  true,
		"apiRoot": true,
	}
)

func Register(schemas *types.APISchemas, ccache clustercache.ClusterCache) {
	schemas.MustImportAndCustomize(Count{}, func(schema *types.APISchema) {
		schema.CollectionMethods = []string{http.MethodGet}
		schema.ResourceMethods = []string{http.MethodGet}
		schema.Attributes["access"] = accesscontrol.AccessListByVerb{
			"watch": accesscontrol.AccessList{
				{
					Namespace:    "*",
					ResourceName: "*",
				},
			},
		}
		schema.Store = &Store{
			ccache: ccache,
		}
	})
}

type Count struct {
	ID     string               `json:"id,omitempty"`
	Counts map[string]ItemCount `json:"counts"`
}

type Summary struct {
	Count         int            `json:"count,omitempty"`
	States        map[string]int `json:"states,omitempty"`
	Error         int            `json:"errors,omitempty"`
	Transitioning int            `json:"transitioning,omitempty"`
}

func (s *Summary) DeepCopy() *Summary {
	r := *s
	if r.States != nil {
		r.States = map[string]int{}
		for k := range s.States {
			r.States[k] = s.States[k]
		}
	}
	return &r
}

type ItemCount struct {
	Summary    Summary            `json:"summary,omitempty"`
	Namespaces map[string]Summary `json:"namespaces,omitempty"`
	Revision   int                `json:"revision,omitempty"`
}

func (i *ItemCount) DeepCopy() *ItemCount {
	r := *i
	r.Summary = *r.Summary.DeepCopy()
	if r.Namespaces != nil {
		r.Namespaces = map[string]Summary{}
		for k, v := range i.Namespaces {
			r.Namespaces[k] = *v.DeepCopy()
		}
	}
	return &r
}

type Store struct {
	empty.Store
	ccache clustercache.ClusterCache
}

func toAPIObject(c Count) types.APIObject {
	return types.APIObject{
		Type:   "count",
		ID:     c.ID,
		Object: c,
	}
}

func (s *Store) ByID(apiOp *types.APIRequest, schema *types.APISchema, id string) (types.APIObject, error) {
	c := s.getCount(apiOp)
	return toAPIObject(c), nil
}

func (s *Store) List(apiOp *types.APIRequest, schema *types.APISchema) (types.APIObjectList, error) {
	c := s.getCount(apiOp)
	return types.APIObjectList{
		Objects: []types.APIObject{
			toAPIObject(c),
		},
	}, nil
}

func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, w types.WatchRequest) (chan types.APIEvent, error) {
	var (
		result      = make(chan types.APIEvent, 100)
		counts      map[string]ItemCount
		gvrToSchema = map[schema2.GroupVersionResource]*types.APISchema{}
		countLock   sync.Mutex
	)

	counts = s.getCount(apiOp).Counts
	for id := range counts {
		schema := apiOp.Schemas.LookupSchema(id)
		if schema == nil {
			continue
		}

		gvrToSchema[attributes.GVR(schema)] = schema
	}

	go func() {
		<-apiOp.Context().Done()
		countLock.Lock()
		close(result)
		result = nil
		countLock.Unlock()
	}()

	onChange := func(add bool, gvr schema2.GroupVersionResource, _ string, obj, oldObj runtime.Object) error {
		countLock.Lock()
		defer countLock.Unlock()

		if result == nil {
			return nil
		}

		schema := gvrToSchema[gvr]
		if schema == nil {
			return nil
		}

		_, namespace, revision, summary, ok := getInfo(obj)
		if !ok {
			return nil
		}

		itemCount := counts[schema.ID]
		if revision <= itemCount.Revision {
			return nil
		}

		if oldObj != nil {
			if _, _, _, oldSummary, ok := getInfo(oldObj); ok {
				if oldSummary.Transitioning == summary.Transitioning &&
					oldSummary.Error == summary.Error &&
					oldSummary.State == summary.State {
					return nil
				}
				itemCount = removeCounts(itemCount, namespace, oldSummary)
				itemCount = addCounts(itemCount, namespace, summary)
			} else {
				return nil
			}
		} else if add {
			itemCount = addCounts(itemCount, namespace, summary)
		} else {
			itemCount = removeCounts(itemCount, namespace, summary)
		}

		counts[schema.ID] = itemCount
		countsCopy := map[string]ItemCount{}
		for k, v := range counts {
			countsCopy[k] = *v.DeepCopy()
		}

		result <- types.APIEvent{
			Name:         "resource.change",
			ResourceType: "counts",
			Object: toAPIObject(Count{
				ID:     "count",
				Counts: countsCopy,
			}),
		}

		return nil
	}

	s.ccache.OnAdd(apiOp.Context(), func(gvr schema2.GroupVersionResource, key string, obj runtime.Object) error {
		return onChange(true, gvr, key, obj, nil)
	})
	s.ccache.OnChange(apiOp.Context(), func(gvr schema2.GroupVersionResource, key string, obj, oldObj runtime.Object) error {
		return onChange(true, gvr, key, obj, oldObj)
	})
	s.ccache.OnRemove(apiOp.Context(), func(gvr schema2.GroupVersionResource, key string, obj runtime.Object) error {
		return onChange(false, gvr, key, obj, nil)
	})

	return result, nil
}

func (s *Store) schemasToWatch(apiOp *types.APIRequest) (result []*types.APISchema) {
	for _, schema := range apiOp.Schemas.Schemas {
		if ignore[schema.ID] {
			continue
		}

		if schema.Store == nil {
			continue
		}

		if apiOp.AccessControl.CanList(apiOp, schema) != nil {
			continue
		}

		if apiOp.AccessControl.CanWatch(apiOp, schema) != nil {
			continue
		}

		result = append(result, schema)
	}

	return
}

func getInfo(obj interface{}) (name string, namespace string, revision int, summaryResult summary.Summary, ok bool) {
	r, ok := obj.(runtime.Object)
	if !ok {
		return "", "", 0, summaryResult, false
	}

	meta, err := meta.Accessor(r)
	if err != nil {
		return "", "", 0, summaryResult, false
	}

	revision, err = strconv.Atoi(meta.GetResourceVersion())
	if err != nil {
		return "", "", 0, summaryResult, false
	}

	summaryResult = summary.Summarize(r)
	return meta.GetName(), meta.GetNamespace(), revision, summaryResult, true
}

func removeCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
	itemCount.Summary = removeSummary(itemCount.Summary, summary)
	if ns != "" {
		itemCount.Namespaces[ns] = removeSummary(itemCount.Namespaces[ns], summary)
	}
	return itemCount
}

func addCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
	itemCount.Summary = addSummary(itemCount.Summary, summary)
	if ns != "" {
		itemCount.Namespaces[ns] = addSummary(itemCount.Namespaces[ns], summary)
	}
	return itemCount
}

func removeSummary(counts Summary, summary summary.Summary) Summary {
	counts.Count--
	if summary.Transitioning {
		counts.Transitioning--
	}
	if summary.Error {
		counts.Error--
	}
	if summary.State != "" {
		if counts.States == nil {
			counts.States = map[string]int{}
		}
		counts.States[summary.State] -= 1
	}
	return counts
}

func addSummary(counts Summary, summary summary.Summary) Summary {
	counts.Count++
	if summary.Transitioning {
		counts.Transitioning++
	}
	if summary.Error {
		counts.Error++
	}
	if summary.State != "" {
		if counts.States == nil {
			counts.States = map[string]int{}
		}
		counts.States[summary.State] += 1
	}
	return counts
}

func (s *Store) getCount(apiOp *types.APIRequest) Count {
	counts := map[string]ItemCount{}

	for _, schema := range s.schemasToWatch(apiOp) {
		gvr := attributes.GVR(schema)
		access, _ := attributes.Access(schema).(accesscontrol.AccessListByVerb)

		rev := 0
		itemCount := ItemCount{
			Namespaces: map[string]Summary{},
		}

		all := access.Grants("list", "*", "*")

		for _, obj := range s.ccache.List(gvr) {
			name, ns, revision, summary, ok := getInfo(obj)
			if !ok {
				continue
			}

			if !all && !access.Grants("list", ns, name) && !access.Grants("get", ns, name) {
				continue
			}

			if revision > rev {
				rev = revision
			}

			itemCount = addCounts(itemCount, ns, summary)
		}

		itemCount.Revision = rev
		counts[schema.ID] = itemCount
	}

	return Count{
		ID:     "count",
		Counts: counts,
	}
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Windows.Input;
using MvvmHelpers;
using Newtonsoft.Json;
using NotHotdog.Model;
using Plugin.Media;
using Xamarin.Forms;
using System.Linq;
using Plugin.Share;
using Plugin.Share.Abstractions;
using Microsoft.Azure.Mobile.Analytics;
using System.Collections.Generic;
using Plugin.Media.Abstractions;
using NotHotdog.Services;

namespace NotHotdog.ViewModels
{
    public class InfoViewModel : BaseViewModel
    {
        IHotDogRecognitionService _hotdogRecognitionService;
        INavigation _navigation;

        public InfoViewModel(IHotDogRecognitionService hotdogRecognitionService, INavigation navigation)
        {
            _hotdogRecognitionService = hotdogRecognitionService;
            _navigation = navigation;
        }

        #region commands

		ICommand githubCommand;
		public ICommand GithubCommand =>
			githubCommand ?? (githubCommand = new Command(async () => await ExecuteGithubAsync()));

		async Task ExecuteGithubAsync()
		{
			if (!CrossShare.IsSupported)
				return;

            Analytics.TrackEvent("open github event");
			await CrossShare.Current.OpenBrowser("https://github.com/Geertvdc/Xamarin-NotHotdog");
		}

        #endregion
    }
}


text:
layout: page
title: Price Dragon Motors Conference
date: 2016-05-24
author: Nicholas Dickson
tags: weekly links, java
status: published
summary: Morbi in arcu magna. Fusce justo felis, euismod quis commodo.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 05/12/2019
  endDate: 05/17/2019
  ctyhocn: SRQELHX
  groupCode: PDMC
published: true
---
Maecenas sagittis risus urna. Phasellus at risus justo. Praesent feugiat urna nulla, ut elementum lorem fermentum id. Phasellus blandit hendrerit condimentum. Proin aliquet ex vitae augue accumsan semper. Cras tincidunt dolor ut augue mollis, eget porttitor urna iaculis. Pellentesque lacus elit, accumsan vitae imperdiet id, sagittis eu nisl. Donec at massa ex. Cras ac mattis odio, vitae feugiat dolor.

1 Nullam eget leo non turpis feugiat consectetur
1 Donec interdum sapien nec pretium rutrum
1 Aenean tincidunt eros non ante mattis egestas
1 Sed posuere odio vitae posuere ultricies
1 Nullam ut orci interdum sapien sodales congue.

Nunc at libero magna. Proin non lectus auctor, fermentum nibh volutpat, dictum mi. Proin turpis elit, accumsan at elementum in, luctus at lacus. Morbi tristique nunc eget velit fermentum, vitae consectetur orci sodales. Donec lobortis convallis viverra. In et pulvinar lectus. Nulla facilisi. Ut venenatis mi non ante mollis blandit. Etiam id diam in diam tristique lacinia vitae quis metus. Suspendisse vitae tincidunt ipsum. Phasellus consequat at libero sed lobortis. In hac habitasse platea dictumst. Nam vitae sodales elit, sit amet aliquam tortor. Pellentesque vel neque nisl. Phasellus facilisis congue dignissim. Aliquam pharetra non nisl ac mollis.
Nulla libero ligula, sodales at nunc hendrerit, tempor egestas lectus. Donec orci magna, porta eget neque vel, facilisis tincidunt lorem. Vivamus fringilla dapibus mi id ultrices. In hac habitasse platea dictumst. Sed vitae bibendum lacus, a dignissim nulla. Donec hendrerit aliquam ipsum et tincidunt. Sed condimentum vel ante nec pharetra. Ut in eros vitae libero varius accumsan. Duis fringilla iaculis massa vitae vestibulum. Morbi vulputate enim sapien, sit amet interdum sem venenatis laoreet. Sed nec mollis enim. Pellentesque tempus orci leo, quis vulputate risus blandit sed. Nam sed urna at lectus condimentum vulputate eget at est.


text:
layout: default
sectionid: support
---

Support

Stack Overflow

  Stackoverflow is a great way to ask a question. We follow the martyjs tag so be sure to add it to your question.

Want to chat?

  We have a Gitter chatroom where you can chat about Marty. We also have a slack channel on reactiflux.slack.com.

Mailing list

  We have a new mailing list for any questions you have.

Github issues

  If you've got found a bug in Marty, then please create an issue on Github.

Twitter

  You can keep up to date on marty.js using the #martyjs hash tag on Twitter.

      #martyjs Tweets


text:
releases for this module are handled by https://github.com/johnmuhl/electron-prebuilt-updater

versions published to npm should match the versions published to [github releases for electron](https://github.com/electron/electron/releases)

coding style should be `standard`:

[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.crowleysimon.cookbook.ResultsFragment">

   <GridView
       android:id="@+id/gridview_results"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:numColumns="auto_fit"
       android:verticalSpacing="@dimen/keyline_12"
       android:horizontalSpacing="@dimen/keyline_12"
       android:stretchMode="spacingWidth"
       android:columnWidth="@dimen/column_width"/>

    <com.melnykov.fab.FloatingActionButton
        android:id="@+id/button_add_recipe"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_margin="16dp"
        android:src="@drawable/plus"
        fab:fab_colorNormal="@color/alt_colour_highlight"
        fab:fab_colorPressed="@color/alt_colour"/>

</RelativeLayout>


text:
package net.mostlyoriginal.game.component.buildings;

/**
 * @author Daan van Yperen
 */
public class Techpoint extends ResourceNode {
}


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#include "EnginePrivate.h"
#include "Kismet/KismetTextLibrary.h"

#define LOCTEXT_NAMESPACE "Kismet"

/* UKismetTextLibrary structors
 *****************************************************************************/

UKismetTextLibrary::UKismetTextLibrary(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{ }

/* UKismetTextLibrary static functions
 *****************************************************************************/

FString UKismetTextLibrary::Conv_TextToString(const FText& InText)
{
	return InText.ToString();
}

FText UKismetTextLibrary::Conv_StringToText(const FString& InString)
{
	return FText::FromString(InString);
}

FText UKismetTextLibrary::Conv_NameToText(FName InName)
{
	return FText::FromName(InName);
}

bool UKismetTextLibrary::TextIsEmpty(const FText& InText)
{
	return InText.IsEmpty();
}

bool UKismetTextLibrary::TextIsTransient(const FText& InText)
{
	return InText.IsTransient();
}

bool UKismetTextLibrary::TextIsCultureInvariant(const FText& InText)
{
	return InText.IsCultureInvariant();
}

FText UKismetTextLibrary::TextTrimPreceding(const FText& InText)
{
	return FText::TrimPreceding(InText);
}

FText UKismetTextLibrary::TextTrimTrailing(const FText& InText)
{
	return FText::TrimTrailing(InText);
}

FText UKismetTextLibrary::TextTrimPrecedingAndTrailing(const FText& InText)
{
	return FText::TrimPrecedingAndTrailing(InText);
}

FText UKismetTextLibrary::GetEmptyText()
{
	return FText::GetEmpty();
}

bool UKismetTextLibrary::FindTextInLocalizationTable(const FString& Namespace, const FString& Key, FText& OutText)
{
	return FText::FindText(Namespace, Key, OutText);
}

bool UKismetTextLibrary::EqualEqual_IgnoreCase_TextText(const FText& A, const FText& B)
{
	return A.EqualToCaseIgnored( B );
}

bool UKismetTextLibrary::EqualEqual_TextText(const FText& A, const FText& B)
{
	return A.EqualTo( B );
}

bool UKismetTextLibrary::NotEqual_IgnoreCase_TextText(const FText& A, const FText& B)
{
	return !A.EqualToCaseIgnored( B );
}

bool UKismetTextLibrary::NotEqual_TextText(const FText& A, const FText& B)
{
	return !A.EqualTo( B );
}

FText UKismetTextLibrary::Conv_BoolToText(bool InBool)
{
	return InBool ? LOCTEXT("True", "true") : LOCTEXT("False", "false");
}

FText UKismetTextLibrary::Conv_ByteToText(uint8 Value)
{
	return FText::AsNumber(Value, &FNumberFormattingOptions::DefaultNoGrouping());
}

FText UKismetTextLibrary::Conv_IntToText(int32 Value, bool bUseGrouping/* = true*/, int32 MinimumIntegralDigits/* = 1*/, int32 MaximumIntegralDigits/* = 324*/)
{
	// Only update the values that need to be changed from the default FNumberFormattingOptions,
	// as this lets us use the default formatter if possible (which is a performance win!)
	FNumberFormattingOptions NumberFormatOptions;
	NumberFormatOptions.UseGrouping = bUseGrouping;
	NumberFormatOptions.MinimumIntegralDigits = MinimumIntegralDigits;
	NumberFormatOptions.MaximumIntegralDigits = MaximumIntegralDigits;

	return FText::AsNumber(Value, &NumberFormatOptions);
}

FText UKismetTextLibrary::Conv_FloatToText(float Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bUseGrouping/* = true*/, int32 MinimumIntegralDigits/* = 1*/, int32 MaximumIntegralDigits/* = 324*/, int32 MinimumFractionalDigits/* = 0*/, int32 MaximumFractionalDigits/* = 3*/)
{
	FNumberFormattingOptions NumberFormatOptions;
	NumberFormatOptions.UseGrouping = bUseGrouping;
	NumberFormatOptions.RoundingMode = RoundingMode;
	NumberFormatOptions.MinimumIntegralDigits = MinimumIntegralDigits;
	NumberFormatOptions.MaximumIntegralDigits = MaximumIntegralDigits;
	NumberFormatOptions.MinimumFractionalDigits = MinimumFractionalDigits;
	NumberFormatOptions.MaximumFractionalDigits = MaximumFractionalDigits;

	return FText::AsNumber(Value, &NumberFormatOptions);
}

FText UKismetTextLibrary::AsCurrency_Integer(int32 Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bUseGrouping/* = true*/, int32 MinimumIntegralDigits/* = 1*/, int32 MaximumIntegralDigits/* = 324*/, int32 MinimumFractionalDigits/* = 0*/, int32 MaximumFractionalDigits/* = 3*/, const FString& CurrencyCode)
{
	FNumberFormattingOptions NumberFormatOptions;
	NumberFormatOptions.UseGrouping = bUseGrouping;
	NumberFormatOptions.RoundingMode = RoundingMode;
	NumberFormatOptions.MinimumIntegralDigits = MinimumIntegralDigits;
	NumberFormatOptions.MaximumIntegralDigits = MaximumIntegralDigits;
	NumberFormatOptions.MinimumFractionalDigits = MinimumFractionalDigits;
	NumberFormatOptions.MaximumFractionalDigits = MaximumFractionalDigits;

	return FText::AsCurrency(Value, CurrencyCode, &NumberFormatOptions);
}

FText UKismetTextLibrary::AsCurrency_Float(float Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bUseGrouping/* = true*/, int32 MinimumIntegralDigits/* = 1*/, int32 MaximumIntegralDigits/* = 324*/, int32 MinimumFractionalDigits/* = 0*/, int32 MaximumFractionalDigits/* = 3*/, const FString& CurrencyCode)
{
	FNumberFormattingOptions NumberFormatOptions;
	NumberFormatOptions.UseGrouping = bUseGrouping;
	NumberFormatOptions.RoundingMode = RoundingMode;
	NumberFormatOptions.MinimumIntegralDigits = MinimumIntegralDigits;
	NumberFormatOptions.MaximumIntegralDigits = MaximumIntegralDigits;
	NumberFormatOptions.MinimumFractionalDigits = MinimumFractionalDigits;
	NumberFormatOptions.MaximumFractionalDigits = MaximumFractionalDigits;

	return FText::AsCurrency(Value, CurrencyCode, &NumberFormatOptions);
}

FText UKismetTextLibrary::AsPercent_Float(float Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bUseGrouping/* = true*/, int32 MinimumIntegralDigits/* = 1*/, int32 MaximumIntegralDigits/* = 324*/, int32 MinimumFractionalDigits/* = 0*/, int32 MaximumFractionalDigits/* = 3*/)
{
	FNumberFormattingOptions NumberFormatOptions;
	NumberFormatOptions.UseGrouping = bUseGrouping;
	NumberFormatOptions.RoundingMode = RoundingMode;
	NumberFormatOptions.MinimumIntegralDigits = MinimumIntegralDigits;
	NumberFormatOptions.MaximumIntegralDigits = MaximumIntegralDigits;
	NumberFormatOptions.MinimumFractionalDigits = MinimumFractionalDigits;
	NumberFormatOptions.MaximumFractionalDigits = MaximumFractionalDigits;

	return FText::AsPercent(Value, &NumberFormatOptions);
}

FText UKismetTextLibrary::AsDate_DateTime(const FDateTime& InDateTime)
{
	return FText::AsDate(InDateTime, EDateTimeStyle::Default, FText::GetInvariantTimeZone());
}

FText UKismetTextLibrary::AsDateTime_DateTime(const FDateTime& InDateTime)
{
	return FText::AsDateTime(InDateTime, EDateTimeStyle::Default, EDateTimeStyle::Default, FText::GetInvariantTimeZone());
}

FText UKismetTextLibrary::AsTime_DateTime(const FDateTime& InDateTime)
{
	return FText::AsTime(InDateTime, EDateTimeStyle::Default, FText::GetInvariantTimeZone());
}

FText UKismetTextLibrary::AsTimespan_Timespan(const FTimespan& InTimespan)
{
	return FText::AsTimespan(InTimespan);
}

FText UKismetTextLibrary::Format(FText InPattern, TArray<FFormatTextArgument> InArgs)
{
	TArray< FFormatArgumentData > Arguments;
	for(auto It = InArgs.CreateConstIterator(); It; ++It)
	{
		FFormatArgumentData argument;
		argument.ArgumentName = It->ArgumentName;
		argument.ArgumentValue = It->TextValue;

		Arguments.Add(argument);
	}

	return FText::Format(InPattern, Arguments);
}

#undef LOCTEXT_NAMESPACE


text:
var MovieListItem = React.createClass({

    handleClick: function(event) {
        console.log('an item is clicked', this.props.movie)
        this.props.onListItemClicked(this.props.movie.name)
    },

    render: function() {

        var movie = this.props.movie

        return (

                     {movie.name}

                    {movie.rlsdate}

        )
  }
})


text:
from six.moves import input
import sys

from model import Polycule
import polycules

db = polycules.connect_db()

id = input('Enter the ID of the polycule to delete > ')
polycule = Polycule.get(db, int(id), None, force=True)
if polycule is None:
    print('\nNo polycule with that ID found.')
    db.close()
    sys.exit(1)

if polycule.delete_pass is not None:
    confirm = input(
        '\nPolycule has a delete password, are you sure? [y/n] > ')
    if confirm[0].lower() != 'y':
        print('\nOkay, exiting without deleting.')
        db.close()
        sys.exit(1)

confirm = input(
    '\nAre you sure you want to delete {}? [y/n] > '.format(id))
if confirm[0].lower() == 'y':
    print('\nDeleting {}...'.format(id))
    polycule.delete(None, force=True)
    print('Polycule deleted.')
db.close()


text:
"""
@file
@brief First approach for a edit distance between two graphs.

See :ref:`l-graph_distance`.
"""
import copy
import re

class _Vertex:

    __slots__ = ('nb', 'label', 'weight')

    def __init__(self, nb, label, weight):
        self.nb = nb         # kind of id
        self.label = label      # label
        self.weight = weight

class Vertex(_Vertex):
    """
    Defines a vertex of a graph.
    """

    def __init__(self, nb, label, weight):
        """
        constructor
        @param      nb      (int) index of the vertex
        @param      label   (str) label
        @para       weight  (float)
        """
        _Vertex.__init__(self, nb, label, weight)
        self.pair = (None, None)
        self.edges = {}
        self.predE = {}
        self.succE = {}

    def __str__(self):
        """
        usual
        """
        return f'{self.Label}'

    def __repr__(self):
        """
        usual
        """
        return f"Vertex({repr(self.nb)}, {repr(self.Label)}, {self.weight})"

    def is_vertex(self):
        """
        returns True
        """
        return True

    def is_edge(self):
        """
        returns False
        """
        return False

    @property
    def Label(self):
        """
        returns the label
        """
        return self.label

class _Edge:

    __slots__ = ('from_', 'to', 'label', 'weight', 'nb')

    def __init__(self, from_, to, label, weight):
        self.from_, self.to = from_, to
        self.nb = from_, to  # pylint: disable=E1101
        self.label = label

class Edge(_Edge):
    """
    Defines an edge of a graph.
    """

    def __init__(self, from_, to, label, weight):
        """
        @param  from_       (int)
        @param  to          (int)
        @param  label       (str)
        @param  weight      (float)

        ``'00'`` means the beginning of a graph, ``'11'`` the end.
        """
        _Edge.__init__(self, from_, to, label, weight)
        self.pair = (None, None)
        self.weight = weight
        if self.from_ == "00" and self.to == "00":
            raise AssertionError("should not happen")  # pragma: no cover
        if self.from_ == "11" and self.to == "11":
            raise AssertionError("should not happen")  # pragma: no cover

    def __str__(self):
        """
        usual
        """
        return f"{self.nb[0]} -> {self.nb[1]} [{self.Label}]"  # pylint: disable=E1101

    def __repr__(self):
        """
        usual
        """
        return "Edge({}, {}, {}, {})".format(
            repr(self.nb[0]), repr(self.nb[1]),  # pylint: disable=E1101
            repr(self.Label), self.weight)  # pylint: disable=E1101

    def is_vertex(self):
        """
        returns False
        """
        return False

    def is_edge(self):
        """
        returns True
        """
        return True

    @property
    def Label(self):
        """
        returns the label
        """
        return self.label

class GraphDistance:
    """
    Defines a graph to compute a distance between two graphs.

    .. exref::
        :title: Compute a distance between two graphs.

        See :ref:`l-graph_distance`.

        .. runpython::
            :showcode:

            import copy
            from mlstatpy.graph import GraphDistance

            # We define two graphs as list of edges.
            graph1 = [("a", "b"), ("b", "c"), ("b", "X"), ("X", "c"),
                      ("c", "d"), ("d", "e"), ("0", "b")]
            graph2 = [("a", "b"), ("b", "c"), ("b", "X"), ("X", "c"),
                      ("c", "t"), ("t", "d"), ("d", "e"), ("d", "g")]

            # We convert them into objects GraphDistance.
            graph1 = GraphDistance(graph1)
            graph2 = GraphDistance(graph2)

            distance, graph = graph1.distance_matching_graphs_paths(graph2, use_min=False)

            print("distance", distance)
            print("common paths:", graph)
    """

    # graph is a dictionary
    @staticmethod
    def get_list_of_vertices(graph):
        edges = [edge[:2] for edge in graph]
        unique = {}
        for i, j in edges:
            unique[i] = unique[j] = 1
        vertices = list(unique.keys())
        vertices.sort()
        return vertices

    def __init__(self, edge_list, vertex_label=None, add_loop=False,
                 weight_vertex=1., weight_edge=1.):
        """
        constructor

        @param      edge_list        list of edges
        @param      add_loop         automatically add a loop on each vertex (an edge from a vertex to itself)
        @param      weight_vertex    weight for every vertex
        @param      weight_edge      weight for every edge
        """
        if vertex_label is None:
            vertex_label = {}
        if isinstance(edge_list, str):
            self.load_from_file(edge_list, add_loop)
        else:
            self.vertices = {}
            self.edges = {}
            self.labelBegin = "00"
            self.labelEnd = "11"
            vid = GraphDistance.get_list_of_vertices(edge_list)
            for u in vid:
                self.vertices[u] = Vertex(
                    u, vertex_label.get(u, str(u)), weight_vertex)
            for e in edge_list:
                i, j = e[:2]
                ls = "" if len(e) < 3 else e[2]
                self.edges[i, j] = Edge(i, j, str(ls), weight_edge)
            self._private__init__(add_loop, weight_vertex, weight_edge)

    def __getitem__(self, index):
        """
        returns a vertex or an edge if no vertex with the given index was found
        @param      index   id (index) to look for
        @return             Vertex or Edge
        """
        if isinstance(index, str):
            return self.vertices[index]
        if isinstance(index, tuple):
            return self.edges[index]
        raise KeyError(  # pragma: no cover
            "unable to get element " + str(index))

    @staticmethod
    def load_from_file(filename, add_loop):
        """
        loads a graph from a file
        @param      filename        file name
        @param      add_loop         @see me __init__
        """
        lines = open(filename, "r").readlines()  # pylint: disable=R1732,W1514
        regV = re.compile("\\\"?([a-z0-9_]+)\\\"? *[[]label=\\\"(.*)\\\"[]]")
        regE = re.compile("\\\"?([a-z0-9_]+)\\\"? *-> *\\\"?" +
                          "([a-z0-9_]+)\\\"? *[[]label=\\\"(.*)\\\"[]]")
        edge_list = []
        vertex_label = {}
        for line in lines:
            line = line.strip("\r\n ;")
            ed = regE.search(line)
            ve = regV.search(line)
            if ed:
                g = ed.groups()
                edge_list.append((g[0], g[1], g[2]))
            elif ve:
                g = ve.groups()
                vertex_label[g[0]] = g[1]
        if len(vertex_label) == 0 or len(edge_list) == 0:
            raise OSError(  # pragma: no cover
                f"Unable to parse file {filename!r}.")
        return GraphDistance(edge_list, vertex_label, add_loop)

    def _private__init__(self, add_loop, weight_vertex, weight_edge):
        if add_loop:
            for k in self.vertices:
                if k not in (self.labelBegin, self.labelEnd):
                    self.edges[k, k] = Edge(k, k, "", weight_edge)
        self.connect_root_and_leave(weight_vertex, weight_edge)
        self.compute_predecessor()
        self.compute_successor()

    def connect_root_and_leave(self, weight_vertex, weight_edge):
        order = self.get_order_vertices()
        roots = [v for v, k in order.items() if k == 0]
        vert = {}
        for o in order:
            vert[o] = 0
        for k in self.edges:
            if k[0] != k[1]:
                vert[k[0]] += 1
        for r in roots:
            if self.labelBegin not in self.vertices:
                self.vertices[self.labelBegin] = Vertex(
                    self.labelBegin, self.labelBegin, weight_vertex)
            if r != self.labelBegin:
                self.edges[self.labelBegin, r] = Edge(
                    self.labelBegin, r, "", weight_edge)

        leaves = [k for k, v in vert.items() if v == 0]
        for r in leaves:
            if self.labelEnd not in self.vertices:
                self.vertices[self.labelEnd] = Vertex(
                    self.labelEnd, self.labelEnd, weight_vertex)
            if r != self.labelEnd:
                self.edges[r, self.labelEnd] = Edge(
                    r, self.labelEnd, "", weight_edge)

    def get_order_vertices(self):
        edges = self.edges
        order = {}
        for k in edges:
            order[k[0]] = 0
            order[k[1]] = 0

        modif = 1
        while modif > 0:
            modif = 0
            for k in edges:
                i, j = k
                if i != j and order[j] <= order[i]:
                    order[j] = order[i] + 1
                    modif += 1

        return order

    def __str__(self):
        """
        usual
        """
        li = []
        for v in self.vertices.values():
            li.append(str(v))
        for k, e in self.edges.items():
            li.append(str(e))
        return "\n".join(li)

    def __repr__(self):
        """
        usual
        """
        edges = ", ".join(repr(v) for _, v in sorted(self.edges.items()))
        vertices = ", ".join(f"'{k}': {repr(v)}"
                             for k, v in sorted(self.vertices.items()))
        return f"GraphDistance(\n    [{edges}],\n    {{{vertices}}})"

    def compute_predecessor(self):
        """
        usual
        """
        pred = {}
        for i, j in self.edges:
            if j not in pred:
                pred[j] = {}
            pred[j][i, j] = 0
        for k, v in pred.items():
            for n in v:
                self.vertices[k].predE[n] = self.edges[n]

    def compute_successor(self):
        succ = {}
        for i, j in self.edges:
            if i not in succ:
                succ[i] = {}
            succ[i][i, j] = i, j
        for k, v in succ.items():
            for n in v:
                self.vertices[k].succE[n] = self.edges[n]

    def get_matching_functions(self, function_mach_vertices, function_match_edges,
                               cost=False):
        """
        returns default matching functions between two vertices and two edges
        @param      function_mach_vertices   if not None, this function is returned, othewise, it returns a new fonction.
                                             See below.
        @param      function_match_edges     if not None, this function is returned, othewise, it returns a new fonction.
                                             See below.
        @param      cost                     if True, the returned function should return a float, otherwise a boolean
        @return                              a pair of functions

        Example for * if cost is False:

        ::

            lambda v1,v2,g1,g2,w1,w2 : v1.label == v2.label

        Example for *function_mach_vertices* if cost is True:

        ::

            def tempF1 (v1,v2,g1,g2,w1,w2) :
                if v1 is not None and not v1.is_vertex() : raise TypeError("should be a vertex")
                if v2 is not None and not v2.is_vertex() : raise TypeError("should be a vertex")
                if v1 is None and v2 is None : return 0
                elif v1 is None or v2 is None :
                    return v2.weight*w2 if v1 is None else v1.weight*w1
                else :
                    return 0 if v1.label == v2.label else 0.5*(v1.weight*w1 + v2.weight*w2)

        Example for *function_match_edges* if cost is False:

        ::

            lambda e1,e2,g1,g2,w1,w2 : e1.label == e2.label and
                        (e1.from_ != e1.to or e2.from_ != e2.to) and
                        (e1.from_ != self.labelBegin or e1.to != self.labelBegin) and
                        (e1.from_ != self.labelEnd or e1.to != self.labelEnd)

        Example if cost is True:

        ::

            def tempF2 (e1,e2,g1,g2,w1,w2) :
                if e1 is not None and not e1.is_edge() : raise TypeError("should be an edge")
                if e2 is not None and not e2.is_edge() : raise TypeError("should be an edge")
                if e1 is None and e2 is None : return 0
                elif e1 is None or e2 is None :
                    return e2.weight*w2 if e1 is None else e1.weight*w1
                elif e1.label != e2.label : return 0.5*(e1.weight*w1 + e2.weight*w2)
                else :
                    lab1 = g1.vertices [e1.from_].label == g2.vertices [e2.from_].label
                    lab2 = g1.vertices [e1.to].label == g2.vertices [e2.to].label
                    if lab1 and lab2 : return 0
                    else :  return e1.weight*w1 + e2.weight*w2

        """
        if cost:

            if function_mach_vertices is None:
                def tempF1_vertex(v1, v2, g1, g2, w1, w2):
                    if v1 is None:
                        if v2 is None:
                            return 0.
                        if not v2.is_vertex():
                            raise TypeError(  # pragma: no cover
                                "v2 should be a vertex")
                        return v2.weight * w2
                    elif v2 is None:
                        if not v1.is_vertex():
                            raise TypeError(  # pragma: no cover
                                "v1 should be a vertex")
                        if not v1.is_vertex():
                            raise TypeError(  # pragma: no cover
                                "v1 should be a vertex")
                        return v1.weight * w1
                    else:
                        if not v1.is_vertex():
                            raise TypeError(  # pragma: no cover
                                "v1 should be a vertex")
                        if not v2.is_vertex():
                            raise TypeError(  # pragma: no cover
                                "v2 should be a vertex")
                        return (
                            0 if v1.label == v2.label
                            else 0.5 * (v1.weight * w1 + v2.weight * w2))

                function_mach_vertices = tempF1_vertex

            if function_match_edges is None:
                def tempF2_edge(e1, e2, g1, g2, w1, w2):
                    if e1 is not None and not e1.is_edge():
                        raise TypeError("should be an edge")
                    if e2 is not None and not e2.is_edge():
                        raise TypeError("should be an edge")
                    if e1 is None and e2 is None:
                        return 0
                    elif e1 is None or e2 is None:
                        return e2.weight * w2 if e1 is None else e1.weight * w1
                    elif e1.label != e2.label:
                        return 0.5 * (e1.weight * w1 + e2.weight * w2)
                    else:
                        lab1 = g1.vertices[e1.from_].label == g2.vertices[e2.from_].label
                        lab2 = g1.vertices[e1.to].label == g2.vertices[e2.to].label
                        if lab1 and lab2:
                            return 0
                        else:
                            return e1.weight * w1 + e2.weight * w2

                function_match_edges = tempF2_edge
        else:
            if function_mach_vertices is None:
                function_mach_vertices = \
                    lambda v1, v2, g1, g2, w1, w2: \
                    v1.label == v2.label
            if function_match_edges is None:
                function_match_edges = \
                    lambda e1, e2, g1, g2, w1, w2: \
                    e1.label == e2.label and \
                    (e1.from_ != e1.to or e2.from_ != e2.to) and \
                    (e1.from_ != self.labelBegin or e1.to != self.labelBegin) and \
                    (e1.from_ != self.labelEnd or e1.to != self.labelEnd)
        return function_mach_vertices, function_match_edges

    def common_paths(self, graph2,
                     function_mach_vertices=None,
                     function_match_edges=None,
                     noClean=False):
        function_mach_vertices, function_match_edges = \
            self.get_matching_functions(
                function_mach_vertices, function_match_edges)
        g = GraphDistance([])
        vfirst = Vertex(self.labelBegin, f"{self.labelBegin}-{self.labelBegin}",
                        (self.vertices[self.labelBegin].weight +
                         graph2.vertices[self.labelBegin].weight) / 2)
        g.vertices[self.labelBegin] = vfirst
        vfirst.pair = self.vertices[
            self.labelBegin], graph2.vertices[self.labelBegin]

        modif = 1
        while modif > 0:
            modif = 0
            add = {}
            for k, v in g.vertices.items():

                v1, v2 = v.pair
                if len(v.succE) == 0:
                    for e1 in v1.succE:
                        for e2 in v2.succE:
                            oe1 = self.edges[e1]
                            oe2 = graph2.edges[e2]
                            if function_match_edges(oe1, oe2, self, graph2, 1., 1.):
                                tv1 = self.vertices[oe1.to]
                                tv2 = graph2.vertices[oe2.to]
                                if function_mach_vertices(tv1, tv2, self, graph2, 1., 1.):
                                    # we have a match
                                    ii = f"{tv1.nb}-{tv2.nb}"
                                    if tv1.nb == self.labelEnd and tv2.nb == self.labelEnd:
                                        ii = self.labelEnd
                                    lab = f"{tv1.label}-{tv2.label}" \
                                        if tv1.label != tv2.label else tv1.label
                                    tv = Vertex(
                                        ii, lab, (tv1.weight + tv2.weight) / 2)
                                    lab = f"{oe1.label}-{oe2.label}" \
                                        if oe1.label != oe2.label else oe1.label
                                    ne = Edge(v.nb, tv.nb, lab,
                                              (oe1.weight + oe2.weight) / 2)
                                    add[tv.nb] = tv
                                    g.edges[ne.from_, ne.to] = ne
                                    ne.pair = oe1, oe2
                                    tv.pair = tv1, tv2
                                    v.succE[ne.from_, ne.to] = ne
                                    modif += 1
            for k, v in add.items():
                g.vertices[k] = v

        if not noClean:
            # g.connect_root_and_leave()
            g.compute_predecessor()
            g.clean_dead_ends()
        return g

    def clean_dead_ends(self):
        edgesToKeep = {}
        verticesToKeep = {}
        if self.labelEnd in self.vertices:
            v = self.vertices[self.labelEnd]
            verticesToKeep[v.nb] = False

            modif = 1
            while modif > 0:
                modif = 0
                add = {}
                for k, v in verticesToKeep.items():
                    if v:
                        continue
                    modif += 1
                    verticesToKeep[k] = True
                    for pred, vv in self.vertices[k].predE.items():
                        edgesToKeep[pred] = True
                        add[vv.from_] = verticesToKeep.get(vv.from_, False)
                for k, v in add.items():
                    verticesToKeep[k] = v

            remove = {}
            for k in self.vertices:
                if k not in verticesToKeep:
                    remove[k] = True
            for k in remove:
                del self.vertices[k]

            remove = {}
            for k in self.edges:
                if k not in edgesToKeep:
                    remove[k] = True
            for k in remove:
                del self.edges[k]
        else:
            self.vertices = {}
            self.edges = {}

    def enumerate_all_paths(self, edges_and_vertices, begin=None):
        if begin is None:
            begin = []
        if len(self.vertices) > 0 and len(self.edges) > 0:
            if edges_and_vertices:
                last = begin[-1] if len(begin) > 0 \
                    else self.vertices[self.labelBegin]
            else:
                last = self.vertices[begin[-1].to] if len(begin) > 0 \
                    else self.vertices[self.labelBegin]

            if edges_and_vertices and len(begin) == 0:
                begin = [last]

            for ef in last.succE:
                e = self.edges[ef]
                path = copy.copy(begin)
                v = self.vertices[e.to]
                if e.to == e.from_:
                    # cycle
                    continue
                path.append(e)
                if edges_and_vertices:
                    path.append(v)
                if v.label == self.labelEnd:
                    yield path
                else:
                    for p in self.enumerate_all_paths(edges_and_vertices, path):
                        yield p

    def edit_distance_path(self, p1, p2, g1, g2,
                           function_mach_vertices=None,
                           function_match_edges=None,
                           use_min=False,
                           debug=False,
                           cache=None):
        """
        Tries to align two paths from two graphs.

        @param      p1                      path 1 (from g1)
        @param      p2                      path 2 (from g2)
        @param      g1                      graph 1
        @param      g2                      graph 2
        @param      function_mach_vertices  function which gives a distance bewteen two vertices,
                                            if None, it take the output of @see me get_matching_functions
        @param      function_match_edges    function which gives a distance bewteen two edges,
                                            if None, it take the output of @see me get_matching_functions
        @param      use_min                 the returned is based on a edit distance, if this parameter is True, the returned value will be:

                                            ::

                                                if use_min :
                                                    n = min (len(p1), len(p2))
                                                    d = d*1.0 / n if n > 0 else 0

        @param      debug                   unused
        @param      cache                   to cache the costs
        @return                             2-uple: distance, aligned path
        """
        def edge_vertex_match(x, y, g1, g2, w1, w2):
            if x is None:
                if y is None:
                    raise RuntimeError(
                        "Both x and y are None.")
                return y.weight * w2
            elif y is None:
                return x.weight * w1
            return (x.weight * w1 + y.weight * w2) / 2

        def cache_cost(func, a, b, g1, g2, w1, w2):
            if cache is None:
                return func(a, b, g1, g2, w1, w2)
            key = (id(a), id(b), w1, w2)
            if key in cache:
                return cache[key]
            cost = func(a, b, g1, g2, w1, w2)
            cache[key] = cost
            return cost

        function_mach_vertices, function_match_edges = (
            self.get_matching_functions(
                function_mach_vertices, function_match_edges, True))
        dist = {(-1, -1): (0, None, None)}

        if use_min:
            w1 = 1.0 / len(p1)
            w2 = 1.0 / len(p2)
        else:
            w1 = 1.
            w2 = 1.

        p2l = list(enumerate(p2))
        for i1, eorv1 in enumerate(p1):
            ed1 = eorv1.is_edge()
            ve1 = eorv1.is_vertex()
            for i2, eorv2 in p2l:
                np = i1, i2
                posit = [((i1 - 1, i2 - 1), (eorv1, eorv2)),
                         ((i1 - 1, i2), (eorv1, None)),
                         ((i1, i2 - 1), (None, eorv2))]

                if ed1 and eorv2.is_edge():
                    func = function_match_edges
                elif ve1 and eorv2.is_vertex():
                    func = function_mach_vertices
                else:
                    func = edge_vertex_match

                for p, co in posit:
                    if p in dist:
                        c0 = dist[p][0]
                        c1 = cache_cost(func, co[0], co[1], g1, g2, w1, w2)
                        c = c0 + c1
                        if np not in dist or c < dist[np][0]:
                            dist[np] = (c, p, co, (c0, c1))

        last = dist[len(p1) - 1, len(p2) - 1]
        path = []
        while last[1] is not None:
            path.append(last)
            last = dist[last[1]]

        path.reverse()

        d = dist[len(p1) - 1, len(p2) - 1][0]
        if use_min:
            n = min(len(p1), len(p2))
            d = d * 1.0 / n if n > 0 else 0
        return d, path

    def private_count_left_right(self, valuesInList):
        countLeft = {}
        countRight = {}
        for k, v in valuesInList:
            i, j = v
            if i not in countRight:
                countRight[i] = {}
            countRight[i][j] = countRight[i].get(j, 0) + 1
            if j not in countLeft:
                countLeft[j] = {}
            countLeft[j][i] = countLeft[j].get(i, 0) + 1
        return countLeft, countRight

    def private_kruskal_matrix(self, matrix, reverse):
        countLeft, countRight = self.private_count_left_right(matrix)
        cleft, cright = len(countLeft), len(countRight)
        matrix.sort(reverse=reverse)
        count = max(max(sum(_.values()) for _ in countRight.values()),
                    max(sum(_.values()) for _ in countLeft.values()))
        while count > 1:
            k, v = matrix.pop()
            i, j = v
            countRight[i][j] -= 1
            countLeft[j][i] -= 1
            count = max(max(max(_.values()) for _ in countRight.values()),
                        max(max(_.values()) for _ in countLeft.values()))

        mini = min(cleft, cright)
        if len(matrix) < mini:
            raise Exception("impossible: the smallest set should get all" +
                            "its element associated to at least one coming from the other set")

    def _private_string_path_matching(self, path, skipEdge=False):
        temp = []
        for p in path:
            u, v = p[2]
            if skipEdge and ((u is not None and u.is_edge()) or
                             (v is not None and v.is_edge())):
                continue
            su = "-" if u is None else str(u.nb)
            sv = "-" if v is None else str(v.nb)
            s = f"({su},{sv})"
            temp.append(s)
        return " ".join(temp)

    def distance_matching_graphs_paths(self, graph2,
                                       function_mach_vertices=None,
                                       function_match_edges=None,
                                       noClean=False,
                                       store=None,
                                       use_min=True,
                                       weight_vertex=1.,
                                       weight_edge=1.,
                                       verbose=0, fLOG=print):
        """
        Computes an alignment between two graphs.

        @param      graph2                  the other graph
        @param      function_mach_vertices  function which gives a distance bewteen two vertices,
                                            if None, it take the output of @see me get_matching_functions
        @param      function_match_edges    function which gives a distance bewteen two edges,
                                            if None, it take the output of @see me get_matching_functions
        @param      noClean                 if True, clean unmatched vertices and edges
        @param      store                   if None, does nothing, if it is a dictionary, the function will store here various
                                            information about how th matching was operated
        @param      use_min                 @see me edit_distance_path
        @param      weight_vertex           a weight for every vertex
        @param      weight_edge             a weight for every edge
        @param      verbose                 display some progress with :epkg:`tqdm`
        @param      fLOG                    logging functino
        @return                             2 tuple (a distance, a graph containing the aligned paths between the two graphs)

        See :ref:`l-graph_distance`.
        """

        function_mach_vertices, function_match_edges = (
            self.get_matching_functions(
                function_mach_vertices, function_match_edges, True))

        paths1 = list(self.enumerate_all_paths(True))
        paths2 = list(graph2.enumerate_all_paths(True))

        if store is not None:
            store["nbpath1"] = len(paths1)
            store["nbpath2"] = len(paths2)

        matrix_distance = {}
        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] builds matrix_distance")
            from tqdm import tqdm
            loop1 = tqdm(list(enumerate(paths1)))
        else:
            loop1 = enumerate(paths1)
        loop2 = list(enumerate(paths2))
        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] len(loop1)=%d" % len(
                list(enumerate(paths1))))
            fLOG(f"[distance_matching_graphs_paths] len(loop2)={len(loop2)}")
        cache = {}
        for i1, p1 in loop1:
            for i2, p2 in loop2:
                matrix_distance[i1, i2] = self.edit_distance_path(
                    p1, p2, self, graph2, function_mach_vertices,
                    function_match_edges, use_min=use_min,
                    cache=cache)
        if verbose > 0 and fLOG is not None:
            fLOG(f"[distance_matching_graphs_paths] len(cache)={len(cache)}")

        if store is not None:
            store["matrix_distance"] = matrix_distance
        reduction = [(v[0], k) for k, v in matrix_distance.items()]
        if store is not None:
            store["path_mat1"] = copy.deepcopy(reduction)
        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] private_kruskal_matrix")
        self.private_kruskal_matrix(reduction, False)
        if store is not None:
            store["path_mat2"] = copy.deepcopy(reduction)

        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] pair_count_vertex")
        pair_count_edge = {}
        pair_count_vertex = {}
        for k, v in reduction:
            path = matrix_distance[v][1]
            for el in path:
                n1, n2 = el[2]
                if n1 is not None and n2 is not None:
                    if n1.is_edge() and n2.is_edge():
                        add = n1.nb, n2.nb
                        pair_count_edge[add] = pair_count_edge.get(add, 0) + 1
                    elif n1.is_vertex() and n2.is_vertex():
                        add = n1.nb, n2.nb
                        pair_count_vertex[
                            add] = pair_count_vertex.get(add, 0) + 1

        if store is not None:
            store["pair_count_vertex"] = pair_count_vertex
            store["pair_count_edge"] = pair_count_edge

        reduction_edge = [(v, k) for k, v in pair_count_edge.items()]
        if store is not None:
            store["edge_mat1"] = copy.copy(reduction_edge)
        self.private_kruskal_matrix(reduction_edge, True)
        if store is not None:
            store["edge_mat2"] = copy.copy(reduction_edge)

        reduction_vertex = [(v, k) for k, v in pair_count_vertex.items()]
        if store is not None:
            store["vertex_mat1"] = copy.copy(reduction_vertex)
        self.private_kruskal_matrix(reduction_vertex, True)
        if store is not None:
            store["vertex_mat2"] = copy.copy(reduction_vertex)

        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] private_count_left_right")
        count_edge_left, count_edge_right = self.private_count_left_right(
            reduction_edge)
        count_vertex_left, count_vertex_right = self.private_count_left_right(
            reduction_vertex)

        res_graph = GraphDistance([])
        doneVertex = {}
        done_edge = {}

        if verbose > 0 and fLOG is not None:
            fLOG("[distance_matching_graphs_paths] builds merged graph")
        for k, v in self.vertices.items():
            newv = Vertex(v.nb, v.label, weight_vertex)
            res_graph.vertices[k] = newv
            if v.nb in count_vertex_right:
                ind = list(count_vertex_right[v.nb].keys())[0]
                newv.pair = (v, graph2.vertices[ind])
                doneVertex[ind] = newv
                if newv.pair[0].label != newv.pair[1].label:
                    newv.label = f"{newv.pair[0].label}|{newv.pair[1].label}"
            else:
                newv.pair = (v, None)

        for k, v in graph2.vertices.items():
            if k in doneVertex:
                continue
            newv = Vertex(f"2a.{v.nb}", v.label, weight_vertex)
            res_graph.vertices[newv.nb] = newv
            newv.pair = (None, v)

        for k, e in self.edges.items():
            newe = Edge(e.from_, e.to, e.label, weight_edge)
            res_graph.edges[k] = newe
            if e.nb in count_edge_right:
                ind = list(count_edge_right[e.nb].keys())[0]
                newe.pair = (e, graph2.edges[ind])
                done_edge[ind] = newe
            else:
                newe.pair = (e, None)

        for k, e in graph2.edges.items():
            if k in done_edge:
                continue
            from_ = list(count_vertex_left[e.from_].keys())[0] if e.from_ in count_vertex_left \
                else f"2a.{e.from_}"
            to = list(count_vertex_left[e.to].keys())[0] if e.to in count_vertex_left \
                else f"2a.{e.to}"
            if from_ not in res_graph.vertices:
                raise RuntimeError("should not happen " +
                                   from_)  # pragma: no cover
            if to not in res_graph.vertices:
                raise RuntimeError("should not happen " +
                                   to)  # pragma: no cover
            newe = Edge(from_, to, e.label, weight_edge)
            res_graph.edges[newe.nb] = newe  # pylint: disable=E1101
            newe.pair = (None, e)

        if verbose > 0 and fLOG is not None:
            fLOG(
                "[distance_matching_graphs_paths] compute_predecessor, compute_successor")
        res_graph.compute_predecessor()
        res_graph.compute_successor()

        allPaths = list(res_graph.enumerate_all_paths(True))

        temp = [sum(0 if None in _.pair else 1 for _ in p) * 1.0 / len(p)
                for p in allPaths]
        distance = 1.0 - 1.0 * sum(temp) / len(allPaths)

        return distance, res_graph

    def draw_vertices_edges(self):
        vertices = []
        edges = []
        for k, v in self.vertices.items():
            if v.pair == (None, None) or (v.pair[0] is not None and v.pair[1] is not None):
                vertices.append((k, v.label))
            elif v.pair[1] is None:
                vertices.append((k, "-" + v.label, "red"))
            elif v.pair[0] is None:
                vertices.append((k, "+" + v.label, "green"))
            else:
                raise RuntimeError("?")  # pragma: no cover

        for k, v in self.edges.items():
            if v.pair == (None, None) or (v.pair[0] is not None and v.pair[1] is not None):
                edges.append((v.from_, v.to, v.label))
            elif v.pair[1] is None:
                edges.append((v.from_, v.to, "-" + v.label, "red"))
            elif v.pair[0] is None:
                edges.append((v.from_, v.to, "+" + v.label, "green"))
            else:
                raise RuntimeError("?")  # pragma: no cover

        return vertices, edges


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/action_bar_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:fitsSystemWindows="true">

    <FrameLayout
        android:id="@id/action_bar_activity_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:foreground="?android:attr/windowContentOverlay"/>

</LinearLayout>
<!-- From: file:/F:/Nitesh/Android/Libraries%20and%20Views/Gradle/PhotosSearch/Application/build/intermediates/exploded-aar/com.android.support/appcompat-v7/20.0.0/res/layout/abc_simple_decor.xml -->


text:
System.register([], function (_export) {
  "use strict";

  var Foo;
  _export("default", foo);

  function foo() {}
  return {
    setters: [],
    execute: function () {
      _export("default", 42);

      _export("default", {});

      _export("default", []);

      _export("default", foo);

      _export("default", function () {});

      _export("default", function () {});

      Foo = function Foo() {};

      _export("default", Foo);
    }
  };
});