text:
# A0140019W
###### \java\seedu\tasklist\logic\commands\AddCommand.java
``` java
/**
 * Adds a task to the task list.
 */
public class AddCommand extends CommandUndoExtension {

    public static final String COMMAND_WORD = "add";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to the task list. "
            + "Parameters: TITLE [d/DESCRIPTION]  [s/DDMMYYYY [HHMM]] [e/DDMMYYYY [HHMM]] [t/TAG]...\n"
            + "Example: \n"
            + COMMAND_WORD + " CS2103 d/Pre tutorial 1 s/15102016 2100 e/15112016 2300 t/urgent\n"
            + COMMAND_WORD + " CS1020 Tutorial d/many questions e/05102016 t/needhelp\n"
            + COMMAND_WORD + " Meeting";

    public static final String MESSAGE_SUCCESS = "New task added: %1$s";
    public static final String MESSAGE_DUPLICATE_TASK = "This task already exists in the task list";

    private Task toAdd;

    public AddCommand() {};

    /**
     * Convenience constructor using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String title, String startDateTime, String description, String endDateTime, Set<String> tags)
            throws IllegalValueException {
        final Set<Tag> tagSet = new HashSet<>();
        for (String tagName : tags) {
            tagSet.add(new Tag(tagName));
        }
        this.toAdd = new Task(
                new Title(title),
                new DateTime(startDateTime),
                new Description(description),
                new DateTime(endDateTime),
                new UniqueTagList(tagSet)
        );
    }

    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            model.addTask(toAdd);
            CommandHistory.addCommandHistory(this);
            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniqueTaskList.DuplicateTaskException e) {
            return new CommandResult(MESSAGE_DUPLICATE_TASK);
        }

    }

```
###### \java\seedu\tasklist\logic\commands\SelectCommand.java
``` java
    @Override
    public CommandResult execute() {

        UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

        if (lastShownList.size() < targetIndex) {
            indicateAttemptToExecuteIncorrectCommand();
            return new CommandResult(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
        }

        EventsCenter.getInstance().post(new JumpToListRequestEvent(targetIndex - 1));
        return new CommandResult(lastShownList.get(targetIndex - 1).getAllAsText());

    }
```
###### \java\seedu\tasklist\model\task\Date.java
``` java
/**
 * Represents a Task's date in the task list. Guarantees: immutable; is valid as
 * declared in {@link #isValidLocalDate(String)}
 */
public class Date {

    private static final String MESSAGE_DATE_CONSTRAINTS = "Invalid Date format\nDate format: DDMMYYYY";
    private static final String DATE_VALIDATION_REGEX = "^(?:[0-9 ]+|)$";

    private final LocalDate localDate;

    /**
     * Validates given date.
     *
     * @throws IllegalValueException
     *             if given date string is invalid.
     */
    public Date(String localDate) throws IllegalValueException {
        assert localDate != null;
        if (!isValidLocalDate(localDate)) {
            throw new IllegalValueException(MESSAGE_DATE_CONSTRAINTS);
        }

        if (!localDate.isEmpty() && localDate.length() == 8) {
            this.localDate = LocalDate.of(Integer.parseInt(localDate.substring(4, 8)), Integer.parseInt(localDate.substring(2, 4)),
                    Integer.parseInt(localDate.substring(0, 2)));
        } else {
            this.localDate = null;
        }
    }

    /**
     * Returns true if a given string is a valid date.
     */
    public static boolean isValidLocalDate(String test) {
        return test.matches(DATE_VALIDATION_REGEX);
    }

    public LocalDate getLocalDate() {
        return localDate;
    }

    @Override
    public String toString() {
        if (localDate != null) {
            DateTimeFormatter df = DateTimeFormatter.ofPattern("dd-MM-yyyy");
            return df.format(localDate);
        } else {
            return "";
        }
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Date // instanceof handles nulls
                        && this.localDate.equals(((Date) other).localDate)); // state
                                                                   // check
    }

    @Override
    public int hashCode() {
        return localDate.hashCode();
    }

```
###### \java\seedu\tasklist\model\task\DateTime.java
``` java
/**
 * Represents a Task's date and time in the task list.
 * Guarantees: details are present and not null, field values are validated.
 */
public class DateTime implements DateTimeComparator {
    public static final String MESSAGE_DATETIME_CONSTRAINTS = "Invalid Date Time format\nDate format: DDMMYYYY\n24-hour Time format: HHMM";

    private static final int DATE_LENGTH = 8;
    private static final int TIME_LENGTH = 4;
    private static final int VALID_DATE_TIME_LENGTH = 0;    // Valid Date Time length is either 0, 4 or 8

    private Date date;
    private Time time;

    public DateTime() throws IllegalValueException {
        this.date = new Date("");
        this.time = new Time("");
    };

    public DateTime(String arguments) throws IllegalValueException {
        this();
        String[] args = arguments.trim().split(" ");
        for (String datetime : args) {
            if (datetime.length() == TIME_LENGTH) {
                this.time = new Time(datetime);
            } else if (datetime.length() == DATE_LENGTH) {
                this.date = new Date(datetime);
            } else if (datetime.length() != VALID_DATE_TIME_LENGTH) {
                throw new IllegalValueException(MESSAGE_DATETIME_CONSTRAINTS);
            }
        }
    }

    public Date getDate() {
        return date;
    }

    public Time getTime() {
        return time;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public void setTime(Time time) {
        this.time = time;
    }

    @Override
    public String toString() {
        String dateTime = date + " " + time;
        return dateTime.trim();
    }

```
###### \java\seedu\tasklist\model\task\Description.java
``` java
/**
 * Represents a Task's description in the task list.
 * Guarantees: immutable; is valid as declared in {@link #isValidDescription(String)}
 */
public class Description {

    public static final String MESSAGE_DESCRIPTION_CONSTRAINTS =
    		"Description should be spaces or alphanumeric characters";
    public static final String DESCRIPTION_VALIDATION_REGEX = "^[\\p{L}0-9\\s+]*$";

    public final String description;

    /**
     * Validates given description.
     *
     * @throws IllegalValueException if given description string is invalid.
     */
    public Description(String description) throws IllegalValueException {
        assert description != null;
        if (!isValidDescription(description.trim())) {
            throw new IllegalValueException(MESSAGE_DESCRIPTION_CONSTRAINTS);
        }
        this.description = description.trim();
    }

    /**
     * Returns if a given string is a valid description.
     */
    public static boolean isValidDescription(String test) {
        return test.matches(DESCRIPTION_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Description // instanceof handles nulls
                && this.description.equals(((Description) other).description)); // state check
    }

    @Override
    public int hashCode() {
        return description.hashCode();
    }

}
```
###### \java\seedu\tasklist\model\task\ReadOnlyTask.java
``` java
    Title getTitle();
    Description getDescription();
    DateTime getStartDateTime();
    DateTime getEndDateTime();

```
###### \java\seedu\tasklist\model\task\Task.java
``` java
/**
 * Represents a Task in the task list.
 * Guarantees: details are present and not null, field values are validated.
 */
public class Task implements ReadOnlyTask {
    private Title title;
    private Description description;
    private DateTime startDateTime;
    private DateTime endDateTime;

    private UniqueTagList tags;

    private boolean isCompleted;
    private boolean isOverdue;
    private boolean isFloating;

    /**
     * Every field must be present and not null.
     *
     * @throws IllegalValueException
     */
    public Task(Title title, DateTime startDateTime, Description description, DateTime endDateTime, UniqueTagList tags) throws IllegalValueException {
        assert !CollectionUtil.isAnyNull(title, startDateTime, description, endDateTime, tags);

        validateDateTime(startDateTime, endDateTime);

        this.title = title;
        this.startDateTime = startDateTime;
        this.description = description;
        this.endDateTime = endDateTime;
        this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list
        this.isCompleted = false;

        initializeOverdue();
        initializeFloating();
    }

    /**
     * Every field must be present and not null.
     */
    public Task(Title title, DateTime startDateTime, Description description, DateTime endDateTime, UniqueTagList tags, boolean isCompleted, boolean isOverdue, boolean isFloating) {
        assert !CollectionUtil.isAnyNull(title, startDateTime, description, endDateTime, tags, isCompleted, isOverdue, isFloating);

        this.title = title;
        this.startDateTime = startDateTime;
        this.description = description;
        this.endDateTime = endDateTime;
        this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list
        this.isCompleted = isCompleted;
        this.isOverdue = isOverdue;
        this.isFloating = isFloating;

        initializeOverdue();
        initializeFloating();
    }

    /**
     * Copy constructor.
     */
    public Task(ReadOnlyTask source) {
        this(source.getTitle(), source.getStartDateTime(), source.getDescription(), source.getEndDateTime(), source.getTags(), source.isCompleted(), source.isOverdue(), source.isFloating());
    }

```
###### \java\seedu\tasklist\model\task\Task.java
``` java
    @Override
    public Title getTitle() {
        return title;
    }

    @Override
    public Description getDescription() {
        return description;
    }

    @Override
    public DateTime getStartDateTime() {
        return startDateTime;
    }

    @Override
    public DateTime getEndDateTime() {
        return endDateTime;
    }

    @Override
    public UniqueTagList getTags() {
        return new UniqueTagList(tags);
    }

    public boolean isCompleted() {
        return isCompleted;
    }

    public void setCompleted(boolean completed) {
        this.isCompleted = completed;
    }

    public boolean isOverdue() {
        return isOverdue;
    }

    public void setOverdue(boolean isOverdue) {
        this.isOverdue = isOverdue;
    }

    public boolean isFloating() {
        return isFloating;
    }

    /**
     * Replaces this task's tags with the tags in the argument tag list.
     */
    public void setTags(UniqueTagList replacement) {
        tags.setTags(replacement);
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof ReadOnlyTask // instanceof handles nulls
                && this.isSameStateAs((ReadOnlyTask) other));
    }

    @Override
    public int hashCode() {
        // use this method for custom fields hashing instead of implementing your own
        return Objects.hash(title, startDateTime, description, endDateTime, tags);
    }

    @Override
    public String toString() {
        return getAsText();
    }

```
###### \java\seedu\tasklist\model\task\Time.java
``` java
/**
 * Represents a Task's time in the task list. Guarantees: immutable; is valid as
 * declared in {@link #isValidLocalTime(String)}
 */
public class Time {

    private static final String MESSAGE_TIME_CONSTRAINTS = "Invalid Time format\n24-hour Time format: HHMM";
    private static final String TIME_VALIDATION_REGEX = "^(?:[0-9 ]+|)$";

    private final LocalTime localTime;

    /**
     * Validates given time.
     *
     * @throws IllegalValueException
     *             if given time string is invalid.
     */
    public Time(String localTime) throws IllegalValueException {
        assert localTime != null;
        if (!isValidLocalTime(localTime)) {
            throw new IllegalValueException(MESSAGE_TIME_CONSTRAINTS);
        }

        if (!localTime.isEmpty() && localTime.length() == 4) {
            this.localTime = LocalTime.of(Integer.parseInt(localTime.substring(0, 2)), Integer.parseInt(localTime.substring(2, 4)));
        } else {
            this.localTime = null;
        }
    }

    /**
     * Returns true if a given string is a valid time.
     */
    public static boolean isValidLocalTime(String test) {
        return test.matches(TIME_VALIDATION_REGEX);
    }

    public LocalTime getLocalTime() {
        return localTime;
    }

    @Override
    public String toString() {
        if (localTime != null) {
            DateTimeFormatter df = DateTimeFormatter.ofPattern("HH:mm");
            return df.format(localTime);
        } else {
            return "";
        }
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Time // instanceof handles nulls
                        && this.localTime.equals(((Time) other).localTime)); // state
                                                                   // check
    }

    @Override
    public int hashCode() {
        return localTime.hashCode();
    }

```
###### \java\seedu\tasklist\model\task\Title.java
``` java
/**
 * Represents a Task's title in the task list.
 * Guarantees: immutable; is valid as declared in {@link #isValidTitle(String)}
 */
public class Title {

    public static final String MESSAGE_TITLE_CONSTRAINTS = "Task title should be spaces or alphanumeric characters";
    public static final String TITLE_VALIDATION_REGEX = "^[\\p{L}0-9\\s+]*$";

    public final String fullTitle;

    /**
     * Validates given title.
     *
     * @throws IllegalValueException if given title string is invalid.
     */
    public Title(String title) throws IllegalValueException {
        assert title != null;
        if (!isValidTitle(title.trim())) {
            throw new IllegalValueException(MESSAGE_TITLE_CONSTRAINTS);
        }
        this.fullTitle = title.trim();
    }

    /**
     * Returns true if a given string is a valid title.
     */
    public static boolean isValidTitle(String test) {
        return test.matches(TITLE_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        return fullTitle;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Title // instanceof handles nulls
                && this.fullTitle.equals(((Title) other).fullTitle)); // state check
    }

    @Override
    public int hashCode() {
        return fullTitle.hashCode();
    }

}
```
###### \java\seedu\tasklist\ui\StatusBarFooter.java
``` java
    private void addProgressBar(List<ReadOnlyTask> taskList) {
        text = new Text("");
        text.setFont(Font.font("Arial", 12));

        progressbar = new ProgressBar(0.0);
        progressbar.prefWidthProperty().bind(progressBarPane.widthProperty());
        progressbar.getStyleClass().add("bar");
        progressBarPane.getChildren().addAll(progressbar, text);
        progressBarStatus(taskList);
    }
```
###### \java\seedu\tasklist\ui\StatusBarFooter.java
``` java
    private void progressBarStatus(List<ReadOnlyTask> taskList) {
        double count = 0;
        for (ReadOnlyTask readOnlyTask : taskList) {
            if(readOnlyTask.isCompleted()) {
                count++;
            }
        }
        text.setText((int)count + " / " + taskList.size());
        progressbar.setProgress(count/taskList.size());
    }
```
###### \resources\view\Extensions.css
``` css
.bar {
    -fx-background-color:
        -fx-box-border,
        linear-gradient(to bottom, derive(-fx-accent,95%), derive(-fx-accent,10%)),
        #98FB98;
    -fx-background-insets: 0, 1, 2;
}
```
###### \resources\view\StatusBarFooter.fxml
``` fxml
  <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
```
###### \resources\view\StatusBarFooter.fxml
``` fxml
      <StackPane styleClass="anchor-pane" id="progressBarPane" fx:id="progressBarPane" minWidth="0.0" GridPane.columnIndex="1" />
```
###### \resources\view\TaskListCard.fxml
``` fxml
                    <children>
                        <HBox spacing="5" alignment="CENTER_LEFT">
                            <children>
                                <HBox>
                                    <Label fx:id="id" styleClass="cell_big_label"></Label>
                                    <Label fx:id="name" text="\$first" styleClass="cell_big_label"/>
                                </HBox>
                                <Label fx:id="tags" styleClass="cell_small_label" text="\$tags" />
                            </children>
                        </HBox>
                        <Label fx:id="description" styleClass="cell_medium_label" text="\$description" />
                        <Label fx:id="startDateTime" styleClass="cell_small_label" text="\$startDateTime" />
                        <Label fx:id="endDateTime" styleClass="cell_small_label" text="\$endDateTime" />
                    </children>
                </VBox>
            </children>
        </GridPane>
    </children>
</HBox>
```


text:
require "net/https"
require "nokogiri"
require "uri"

module Scrapey
  class LinkCollector

    class TooManyRedirects < StandardError ; end
    class InvalidContentType < StandardError ; end
    class ExternalRedirect < StandardError ; end

    CONTENT_TYPE_HTML = /text\/html/
    REDIRECT_LIMIT = 3

    def collect_links(target)
      link_evaluator = LinkEvaluator.new(target)

      uri = URI.parse(target)

      response = request(target, link_evaluator)
      html = Nokogiri::HTML(response)
      links = html.css("a[href != '#']")
      links = links.map do |link|
        href = link.attributes['href'].value
        link_evaluator.resolve(href)
      end
      links.compact.uniq
    end

    private

    def request(target, link_evaluator, redirectLimit = REDIRECT_LIMIT)
      raise TooManyRedirects if redirectLimit.zero?

      uri = URI.parse(target)
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = uri.scheme.downcase == 'https'

      get = Net::HTTP::Get.new(uri.request_uri)

      response = http.request(get)

      case response
      when Net::HTTPSuccess then response
      when Net::HTTPRedirection
        location = response["Location"]
        if link_evaluator.follow? location
          return request(location, link_evaluator, redirectLimit - 1)
        else
          raise ExternalRedirect, location
        end
      else
        response.error!
      end

      content_type = response["Content-Type"]
      raise InvalidContentType, content_type unless CONTENT_TYPE_HTML =~ content_type

      response.body
    end

  end
end

redpajama_set_name: RedPajamaGithub


text:
package io.reactivex.rxjava3.internal.operators.maybe;

import java.util.concurrent.atomic.*;

import org.reactivestreams.*;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.SequentialDisposable;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;

/**
 * Concatenate values of each MaybeSource provided in an array and delays
 * any errors till the very end.
 *
 * @param <T> the value type
 */
public final class MaybeConcatArrayDelayError<T> extends Flowable<T> {

    final MaybeSource<? extends T>[] sources;

    public MaybeConcatArrayDelayError(MaybeSource<? extends T>[] sources) {
        this.sources = sources;
    }

    @Override
    protected void subscribeActual(Subscriber<? super T> s) {
        ConcatMaybeObserver<T> parent = new ConcatMaybeObserver<>(s, sources);
        s.onSubscribe(parent);
        parent.drain();
    }

    static final class ConcatMaybeObserver<T>
    extends AtomicInteger
    implements MaybeObserver<T>, Subscription {

        private static final long serialVersionUID = 3520831347801429610L;

        final Subscriber<? super T> downstream;

        final AtomicLong requested;

        final AtomicReference<Object> current;

        final SequentialDisposable disposables;

        final MaybeSource<? extends T>[] sources;

        final AtomicThrowable errors;

        int index;

        long produced;

        ConcatMaybeObserver(Subscriber<? super T> actual, MaybeSource<? extends T>[] sources) {
            this.downstream = actual;
            this.sources = sources;
            this.requested = new AtomicLong();
            this.disposables = new SequentialDisposable();
            this.current = new AtomicReference<>(NotificationLite.COMPLETE); // as if a previous completed
            this.errors = new AtomicThrowable();
        }

        @Override
        public void request(long n) {
            if (SubscriptionHelper.validate(n)) {
                BackpressureHelper.add(requested, n);
                drain();
            }
        }

        @Override
        public void cancel() {
            disposables.dispose();
            errors.tryTerminateAndReport();
        }

        @Override
        public void onSubscribe(Disposable d) {
            disposables.replace(d);
        }

        @Override
        public void onSuccess(T value) {
            current.lazySet(value);
            drain();
        }

        @Override
        public void onError(Throwable e) {
            current.lazySet(NotificationLite.COMPLETE);
            if (errors.tryAddThrowableOrReport(e)) {
                drain();
            }
        }

        @Override
        public void onComplete() {
            current.lazySet(NotificationLite.COMPLETE);
            drain();
        }

        @SuppressWarnings("unchecked")
        void drain() {
            if (getAndIncrement() != 0) {
                return;
            }

            AtomicReference<Object> c = current;
            Subscriber<? super T> a = downstream;
            Disposable cancelled = disposables;

            for (;;) {
                if (cancelled.isDisposed()) {
                    c.lazySet(null);
                    return;
                }

                Object o = c.get();

                if (o != null) {
                    boolean goNextSource;
                    if (o != NotificationLite.COMPLETE) {
                        long p = produced;
                        if (p != requested.get()) {
                            produced = p + 1;
                            c.lazySet(null);
                            goNextSource = true;

                            a.onNext((T)o);
                        } else {
                            goNextSource = false;
                        }
                    } else {
                        goNextSource = true;
                        c.lazySet(null);
                    }

                    if (goNextSource && !cancelled.isDisposed()) {
                        int i = index;
                        if (i == sources.length) {
                            errors.tryTerminateConsumer(downstream);
                            return;
                        }
                        index = i + 1;

                        sources[i].subscribe(this);
                    }
                }

                if (decrementAndGet() == 0) {
                    break;
                }
            }
        }
    }
}


text:
package vg.civcraft.mc.namelayer.command.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import vg.civcraft.mc.namelayer.command.PlayerCommandMiddle;
import vg.civcraft.mc.namelayer.group.Group;

import java.util.List;

public class DisciplineGroup extends PlayerCommandMiddle{

	public DisciplineGroup(String name) {
		super(name);
		setIdentifier("nldig");
		setDescription("Disable a group from working.");
		setUsage("/nldig <group>");
		setArguments(1,1);
	}

	@Override
	public boolean execute(CommandSender sender, String[] args) {
		if (!(sender instanceof Player))
			sender.sendMessage(ChatColor.AQUA + "Meh, fine, just this one.");
		// checks and stuff should be in plugin.yml so going to assume that sender has perms
		// naaaaaaa
		Player p = (Player) sender;
		Group g = gm.getGroup(args[0]);
		if (groupIsNull(sender, args[0], g)) {
			return true;
		}
		if (!p.isOp() || !p.hasPermission("namelayer.admin")){
			p.sendMessage(ChatColor.RED + "You do not have permission for this op command.");
			return true;
		}
		if (g.isDisciplined()){
			g.setDisciplined(false);
			sender.sendMessage(ChatColor.GREEN + "Group has been enabled.");
		}
		else{
			g.setDisciplined(true);
		sender.sendMessage(ChatColor.GREEN + "Group has been disabled.");
		}
		return true;
	}

	@Override
	public List<String> tabComplete(CommandSender sender, String[] args) {
		return null;
	}
}


text:
'use strict';

angular.module('oj.RailsAdmin')
  .directive('ojModelList', function () {
    return {
      templateUrl: 'views/oj-model-list.html',
      restrict: 'AE',
      scope: {
      	model: '@ojModelList'
      },
      controller: 'OjmodellistCtrl'
    };
  });


text:
//
//  HGEVersion.h
//  hybridge
//
//  Created by The Narrator on 8/21/12.
//  Copyright (c) 2012 Starduu. All rights reserved.
//

#ifndef __HGEVERSION_H__
#define __HGEVERSION_H__

#define HGE_VERSION_BY_TIMESTAMP		0

#if HGE_VERSION_BY_TIMESTAMP
#include "dev/HGETime.h"
#endif

#include "dev/HGEPlatformMacros.h"

#define HGE_VERSIONED_WILL_INITIALIZE(ver)		\
/**
update the version of the object -- to be called after the object is modified --
works particularly in conjunction with HGERefs, to make references "dirty"
when the referree object has changed in a significant way that must be taken
into account by the referrer
*/												\
public:											\
version_hge revise() {							\
	HGE_VERSION_UP(this->ver);					\
	return this->ver;							\
}												\
/**
 get the version number of the object
 */												\
version_hge vnumber() { return ver; }			\
												\
protected:										\
/**
 get the version number of the object by reference -- only to be used by subclasses
 */												\
version_hge& revision() { return ver; }			\
												\
private:										\
version_hge ver;

NS_HGE_BEGIN

// type for hybrid version uuids
#if HGE_VERSION_BY_TIMESTAMP
typedef timeSD_hge version_hge;
#else
typedef unsigned long long version_hge;
#endif

/**
 returns a new version uuid (using the current version as input)
 can optionally update the input current version as a side-effect
 */
version_hge HGE_VERSION_UP(version_hge& current, bool autoassign = !0);

/**
 returns special version uuid for the zero (initial) version
 */
version_hge const& HGE_VERSION_NONE();

NS_HGE_END

#endif


text:
//===-- primary32.h ---------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef SCUDO_PRIMARY32_H_
#define SCUDO_PRIMARY32_H_

#include "bytemap.h"
#include "common.h"
#include "list.h"
#include "local_cache.h"
#include "release.h"
#include "report.h"
#include "stats.h"
#include "string_utils.h"

namespace scudo {

// SizeClassAllocator32 is an allocator for 32 or 64-bit address space.
//
// It maps Regions of 2^RegionSizeLog bytes aligned on a 2^RegionSizeLog bytes
// boundary, and keeps a bytemap of the mappable address space to track the size
// class they are associated with.
//
// Mapped regions are split into equally sized Blocks according to the size
// class they belong to, and the associated pointers are shuffled to prevent any
// predictable address pattern (the predictability increases with the block
// size).
//
// Regions for size class 0 are special and used to hold TransferBatches, which
// allow to transfer arrays of pointers from the global size class freelist to
// the thread specific freelist for said class, and back.
//
// Memory used by this allocator is never unmapped but can be partially
// reclaimed if the platform allows for it.

template <class SizeClassMapT, uptr RegionSizeLog> class SizeClassAllocator32 {
public:
  typedef SizeClassMapT SizeClassMap;
  // Regions should be large enough to hold the largest Block.
  COMPILER_CHECK((1UL << RegionSizeLog) >= SizeClassMap::MaxSize);
  typedef SizeClassAllocator32<SizeClassMapT, RegionSizeLog> ThisT;
  typedef SizeClassAllocatorLocalCache<ThisT> CacheT;
  typedef typename CacheT::TransferBatch TransferBatch;

  static uptr getSizeByClassId(uptr ClassId) {
    return (ClassId == SizeClassMap::BatchClassId)
               ? sizeof(TransferBatch)
               : SizeClassMap::getSizeByClassId(ClassId);
  }

  static bool canAllocate(uptr Size) { return Size <= SizeClassMap::MaxSize; }

  void initLinkerInitialized(s32 ReleaseToOsInterval) {
    if (SCUDO_FUCHSIA)
      reportError("SizeClassAllocator32 is not supported on Fuchsia");

    PossibleRegions.initLinkerInitialized();
    MinRegionIndex = NumRegions; // MaxRegionIndex is already initialized to 0.

    u32 Seed;
    if (UNLIKELY(!getRandom(reinterpret_cast<void *>(&Seed), sizeof(Seed))))
      Seed =
          static_cast<u32>(getMonotonicTime() ^
                           (reinterpret_cast<uptr>(SizeClassInfoArray) >> 6));
    const uptr PageSize = getPageSizeCached();
    for (uptr I = 0; I < NumClasses; I++) {
      SizeClassInfo *Sci = getSizeClassInfo(I);
      Sci->RandState = getRandomU32(&Seed);
      // See comment in the 64-bit primary about releasing smaller size classes.
      Sci->CanRelease = (ReleaseToOsInterval >= 0) &&
                        (I != SizeClassMap::BatchClassId) &&
                        (getSizeByClassId(I) >= (PageSize / 32));
    }
    ReleaseToOsIntervalMs = ReleaseToOsInterval;
  }
  void init(s32 ReleaseToOsInterval) {
    memset(this, 0, sizeof(*this));
    initLinkerInitialized(ReleaseToOsInterval);
  }

  void unmapTestOnly() {
    while (NumberOfStashedRegions > 0)
      unmap(reinterpret_cast<void *>(RegionsStash[--NumberOfStashedRegions]),
            RegionSize);
    // TODO(kostyak): unmap the TransferBatch regions as well.
    for (uptr I = 0; I < NumRegions; I++)
      if (PossibleRegions[I])
        unmap(reinterpret_cast<void *>(I * RegionSize), RegionSize);
    PossibleRegions.unmapTestOnly();
  }

  TransferBatch *popBatch(CacheT *C, uptr ClassId) {
    DCHECK_LT(ClassId, NumClasses);
    SizeClassInfo *Sci = getSizeClassInfo(ClassId);
    ScopedLock L(Sci->Mutex);
    TransferBatch *B = Sci->FreeList.front();
    if (B) {
      Sci->FreeList.pop_front();
    } else {
      B = populateFreeList(C, ClassId, Sci);
      if (UNLIKELY(!B))
        return nullptr;
    }
    DCHECK_GT(B->getCount(), 0);
    Sci->Stats.PoppedBlocks += B->getCount();
    return B;
  }

  void pushBatch(uptr ClassId, TransferBatch *B) {
    DCHECK_LT(ClassId, NumClasses);
    DCHECK_GT(B->getCount(), 0);
    SizeClassInfo *Sci = getSizeClassInfo(ClassId);
    ScopedLock L(Sci->Mutex);
    Sci->FreeList.push_front(B);
    Sci->Stats.PushedBlocks += B->getCount();
    if (Sci->CanRelease)
      releaseToOSMaybe(Sci, ClassId);
  }

  void disable() {
    for (uptr I = 0; I < NumClasses; I++)
      getSizeClassInfo(I)->Mutex.lock();
  }

  void enable() {
    for (sptr I = static_cast<sptr>(NumClasses) - 1; I >= 0; I--)
      getSizeClassInfo(static_cast<uptr>(I))->Mutex.unlock();
  }

  template <typename F> void iterateOverBlocks(F Callback) {
    for (uptr I = MinRegionIndex; I <= MaxRegionIndex; I++)
      if (PossibleRegions[I]) {
        const uptr BlockSize = getSizeByClassId(PossibleRegions[I]);
        const uptr From = I * RegionSize;
        const uptr To = From + (RegionSize / BlockSize) * BlockSize;
        for (uptr Block = From; Block < To; Block += BlockSize)
          Callback(Block);
      }
  }

  void getStats(ScopedString *Str) {
    // TODO(kostyak): get the RSS per region.
    uptr TotalMapped = 0;
    uptr PoppedBlocks = 0;
    uptr PushedBlocks = 0;
    for (uptr I = 0; I < NumClasses; I++) {
      SizeClassInfo *Sci = getSizeClassInfo(I);
      TotalMapped += Sci->AllocatedUser;
      PoppedBlocks += Sci->Stats.PoppedBlocks;
      PushedBlocks += Sci->Stats.PushedBlocks;
    }
    Str->append("Stats: SizeClassAllocator32: %zuM mapped in %zu allocations; "
                "remains %zu\n",
                TotalMapped >> 20, PoppedBlocks, PoppedBlocks - PushedBlocks);
    for (uptr I = 0; I < NumClasses; I++)
      getStats(Str, I, 0);
  }

  uptr releaseToOS() {
    uptr TotalReleasedBytes = 0;
    for (uptr I = 0; I < NumClasses; I++) {
      if (I == SizeClassMap::BatchClassId)
        continue;
      SizeClassInfo *Sci = getSizeClassInfo(I);
      ScopedLock L(Sci->Mutex);
      TotalReleasedBytes += releaseToOSMaybe(Sci, I, /*Force=*/true);
    }
    return TotalReleasedBytes;
  }

private:
  static const uptr NumClasses = SizeClassMap::NumClasses;
  static const uptr RegionSize = 1UL << RegionSizeLog;
  static const uptr NumRegions = SCUDO_MMAP_RANGE_SIZE >> RegionSizeLog;
#if SCUDO_WORDSIZE == 32U
  typedef FlatByteMap<NumRegions> ByteMap;
#else
  typedef TwoLevelByteMap<(NumRegions >> 12), 1UL << 12> ByteMap;
#endif

  struct SizeClassStats {
    uptr PoppedBlocks;
    uptr PushedBlocks;
  };

  struct ReleaseToOsInfo {
    uptr PushedBlocksAtLastRelease;
    uptr RangesReleased;
    uptr LastReleasedBytes;
    u64 LastReleaseAtNs;
  };

  struct ALIGNED(SCUDO_CACHE_LINE_SIZE) SizeClassInfo {
    HybridMutex Mutex;
    IntrusiveList<TransferBatch> FreeList;
    SizeClassStats Stats;
    bool CanRelease;
    u32 RandState;
    uptr AllocatedUser;
    ReleaseToOsInfo ReleaseInfo;
  };
  COMPILER_CHECK(sizeof(SizeClassInfo) % SCUDO_CACHE_LINE_SIZE == 0);

  uptr computeRegionId(uptr Mem) {
    const uptr Id = Mem >> RegionSizeLog;
    CHECK_LT(Id, NumRegions);
    return Id;
  }

  uptr allocateRegionSlow() {
    uptr MapSize = 2 * RegionSize;
    const uptr MapBase = reinterpret_cast<uptr>(
        map(nullptr, MapSize, "scudo:primary", MAP_ALLOWNOMEM));
    if (UNLIKELY(!MapBase))
      return 0;
    const uptr MapEnd = MapBase + MapSize;
    uptr Region = MapBase;
    if (isAligned(Region, RegionSize)) {
      ScopedLock L(RegionsStashMutex);
      if (NumberOfStashedRegions < MaxStashedRegions)
        RegionsStash[NumberOfStashedRegions++] = MapBase + RegionSize;
      else
        MapSize = RegionSize;
    } else {
      Region = roundUpTo(MapBase, RegionSize);
      unmap(reinterpret_cast<void *>(MapBase), Region - MapBase);
      MapSize = RegionSize;
    }
    const uptr End = Region + MapSize;
    if (End != MapEnd)
      unmap(reinterpret_cast<void *>(End), MapEnd - End);
    return Region;
  }

  uptr allocateRegion(uptr ClassId) {
    DCHECK_LT(ClassId, NumClasses);
    uptr Region = 0;
    {
      ScopedLock L(RegionsStashMutex);
      if (NumberOfStashedRegions > 0)
        Region = RegionsStash[--NumberOfStashedRegions];
    }
    if (!Region)
      Region = allocateRegionSlow();
    if (LIKELY(Region)) {
      if (ClassId) {
        const uptr RegionIndex = computeRegionId(Region);
        if (RegionIndex < MinRegionIndex)
          MinRegionIndex = RegionIndex;
        if (RegionIndex > MaxRegionIndex)
          MaxRegionIndex = RegionIndex;
        PossibleRegions.set(RegionIndex, static_cast<u8>(ClassId));
      }
    }
    return Region;
  }

  SizeClassInfo *getSizeClassInfo(uptr ClassId) {
    DCHECK_LT(ClassId, NumClasses);
    return &SizeClassInfoArray[ClassId];
  }

  bool populateBatches(CacheT *C, SizeClassInfo *Sci, uptr ClassId,
                       TransferBatch **CurrentBatch, u32 MaxCount,
                       void **PointersArray, u32 Count) {
    if (ClassId != SizeClassMap::BatchClassId)
      shuffle(PointersArray, Count, &Sci->RandState);
    TransferBatch *B = *CurrentBatch;
    for (uptr I = 0; I < Count; I++) {
      if (B && B->getCount() == MaxCount) {
        Sci->FreeList.push_back(B);
        B = nullptr;
      }
      if (!B) {
        B = C->createBatch(ClassId, PointersArray[I]);
        if (UNLIKELY(!B))
          return false;
        B->clear();
      }
      B->add(PointersArray[I]);
    }
    *CurrentBatch = B;
    return true;
  }

  NOINLINE TransferBatch *populateFreeList(CacheT *C, uptr ClassId,
                                           SizeClassInfo *Sci) {
    const uptr Region = allocateRegion(ClassId);
    if (UNLIKELY(!Region))
      return nullptr;
    C->getStats().add(StatMapped, RegionSize);
    const uptr Size = getSizeByClassId(ClassId);
    const u32 MaxCount = TransferBatch::getMaxCached(Size);
    DCHECK_GT(MaxCount, 0);
    const uptr NumberOfBlocks = RegionSize / Size;
    DCHECK_GT(NumberOfBlocks, 0);
    TransferBatch *B = nullptr;
    constexpr uptr ShuffleArraySize = 48;
    void *ShuffleArray[ShuffleArraySize];
    u32 Count = 0;
    const uptr AllocatedUser = NumberOfBlocks * Size;
    for (uptr I = Region; I < Region + AllocatedUser; I += Size) {
      ShuffleArray[Count++] = reinterpret_cast<void *>(I);
      if (Count == ShuffleArraySize) {
        if (UNLIKELY(!populateBatches(C, Sci, ClassId, &B, MaxCount,
                                      ShuffleArray, Count)))
          return nullptr;
        Count = 0;
      }
    }
    if (Count) {
      if (UNLIKELY(!populateBatches(C, Sci, ClassId, &B, MaxCount, ShuffleArray,
                                    Count)))
        return nullptr;
    }
    DCHECK(B);
    DCHECK_GT(B->getCount(), 0);

    C->getStats().add(StatFree, AllocatedUser);
    Sci->AllocatedUser += AllocatedUser;
    if (Sci->CanRelease)
      Sci->ReleaseInfo.LastReleaseAtNs = getMonotonicTime();
    return B;
  }

  void getStats(ScopedString *Str, uptr ClassId, uptr Rss) {
    SizeClassInfo *Sci = getSizeClassInfo(ClassId);
    if (Sci->AllocatedUser == 0)
      return;
    const uptr InUse = Sci->Stats.PoppedBlocks - Sci->Stats.PushedBlocks;
    const uptr AvailableChunks = Sci->AllocatedUser / getSizeByClassId(ClassId);
    Str->append("  %02zu (%6zu): mapped: %6zuK popped: %7zu pushed: %7zu "
                "inuse: %6zu avail: %6zu rss: %6zuK\n",
                ClassId, getSizeByClassId(ClassId), Sci->AllocatedUser >> 10,
                Sci->Stats.PoppedBlocks, Sci->Stats.PushedBlocks, InUse,
                AvailableChunks, Rss >> 10);
  }

  NOINLINE uptr releaseToOSMaybe(SizeClassInfo *Sci, uptr ClassId,
                                 bool Force = false) {
    const uptr BlockSize = getSizeByClassId(ClassId);
    const uptr PageSize = getPageSizeCached();

    CHECK_GE(Sci->Stats.PoppedBlocks, Sci->Stats.PushedBlocks);
    const uptr BytesInFreeList =
        Sci->AllocatedUser -
        (Sci->Stats.PoppedBlocks - Sci->Stats.PushedBlocks) * BlockSize;
    if (BytesInFreeList < PageSize)
      return 0; // No chance to release anything.
    if ((Sci->Stats.PushedBlocks - Sci->ReleaseInfo.PushedBlocksAtLastRelease) *
            BlockSize <
        PageSize) {
      return 0; // Nothing new to release.
    }

    if (!Force) {
      const s32 IntervalMs = ReleaseToOsIntervalMs;
      if (IntervalMs < 0)
        return 0;
      if (Sci->ReleaseInfo.LastReleaseAtNs +
              static_cast<uptr>(IntervalMs) * 1000000ULL >
          getMonotonicTime()) {
        return 0; // Memory was returned recently.
      }
    }

    // TODO(kostyak): currently not ideal as we loop over all regions and
    // iterate multiple times over the same freelist if a ClassId spans multiple
    // regions. But it will have to do for now.
    uptr TotalReleasedBytes = 0;
    for (uptr I = MinRegionIndex; I <= MaxRegionIndex; I++) {
      if (PossibleRegions[I] == ClassId) {
        ReleaseRecorder Recorder(I * RegionSize);
        releaseFreeMemoryToOS(&Sci->FreeList, I * RegionSize,
                              RegionSize / PageSize, BlockSize, &Recorder);
        if (Recorder.getReleasedRangesCount() > 0) {
          Sci->ReleaseInfo.PushedBlocksAtLastRelease = Sci->Stats.PushedBlocks;
          Sci->ReleaseInfo.RangesReleased += Recorder.getReleasedRangesCount();
          Sci->ReleaseInfo.LastReleasedBytes = Recorder.getReleasedBytes();
          TotalReleasedBytes += Sci->ReleaseInfo.LastReleasedBytes;
        }
      }
    }
    Sci->ReleaseInfo.LastReleaseAtNs = getMonotonicTime();
    return TotalReleasedBytes;
  }

  SizeClassInfo SizeClassInfoArray[NumClasses];

  ByteMap PossibleRegions;
  // Keep track of the lowest & highest regions allocated to avoid looping
  // through the whole NumRegions.
  uptr MinRegionIndex;
  uptr MaxRegionIndex;
  s32 ReleaseToOsIntervalMs;
  // Unless several threads request regions simultaneously from different size
  // classes, the stash rarely contains more than 1 entry.
  static constexpr uptr MaxStashedRegions = 4;
  HybridMutex RegionsStashMutex;
  uptr NumberOfStashedRegions;
  uptr RegionsStash[MaxStashedRegions];
};

} // namespace scudo

#endif // SCUDO_PRIMARY32_H_


text:
package org.opencv.features2d;

import java.lang.String;

// C++: class GFTTDetector
//javadoc: GFTTDetector

public class GFTTDetector extends Feature2D {

    protected GFTTDetector(long addr) { super(addr); }

    //
    // C++: static Ptr_GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, bool useHarrisDetector = false, double k = 0.04)
    //

    //javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize, useHarrisDetector, k)
    public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, boolean useHarrisDetector, double k)
    {

        GFTTDetector retVal = new GFTTDetector(create_0(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize, useHarrisDetector, k));

        return retVal;
    }

    //javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize)
    public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize)
    {

        GFTTDetector retVal = new GFTTDetector(create_1(maxCorners, qualityLevel, minDistance, blockSize, gradiantSize));

        return retVal;
    }

    //
    // C++: static Ptr_GFTTDetector create(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
    //

    //javadoc: GFTTDetector::create(maxCorners, qualityLevel, minDistance, blockSize, useHarrisDetector, k)
    public static GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, boolean useHarrisDetector, double k)
    {

        GFTTDetector retVal = new GFTTDetector(create_2(maxCorners, qualityLevel, minDistance, blockSize, useHarrisDetector, k));

        return retVal;
    }

    //javadoc: GFTTDetector::create()
    public static GFTTDetector create()
    {

        GFTTDetector retVal = new GFTTDetector(create_3());

        return retVal;
    }

    //
    // C++:  String getDefaultName()
    //

    //javadoc: GFTTDetector::getDefaultName()
    public  String getDefaultName()
    {

        String retVal = getDefaultName_0(nativeObj);

        return retVal;
    }

    //
    // C++:  bool getHarrisDetector()
    //

    //javadoc: GFTTDetector::getHarrisDetector()
    public  boolean getHarrisDetector()
    {

        boolean retVal = getHarrisDetector_0(nativeObj);

        return retVal;
    }

    //
    // C++:  double getK()
    //

    //javadoc: GFTTDetector::getK()
    public  double getK()
    {

        double retVal = getK_0(nativeObj);

        return retVal;
    }

    //
    // C++:  double getMinDistance()
    //

    //javadoc: GFTTDetector::getMinDistance()
    public  double getMinDistance()
    {

        double retVal = getMinDistance_0(nativeObj);

        return retVal;
    }

    //
    // C++:  double getQualityLevel()
    //

    //javadoc: GFTTDetector::getQualityLevel()
    public  double getQualityLevel()
    {

        double retVal = getQualityLevel_0(nativeObj);

        return retVal;
    }

    //
    // C++:  int getBlockSize()
    //

    //javadoc: GFTTDetector::getBlockSize()
    public  int getBlockSize()
    {

        int retVal = getBlockSize_0(nativeObj);

        return retVal;
    }

    //
    // C++:  int getMaxFeatures()
    //

    //javadoc: GFTTDetector::getMaxFeatures()
    public  int getMaxFeatures()
    {

        int retVal = getMaxFeatures_0(nativeObj);

        return retVal;
    }

    //
    // C++:  void setBlockSize(int blockSize)
    //

    //javadoc: GFTTDetector::setBlockSize(blockSize)
    public  void setBlockSize(int blockSize)
    {

        setBlockSize_0(nativeObj, blockSize);

        return;
    }

    //
    // C++:  void setHarrisDetector(bool val)
    //

    //javadoc: GFTTDetector::setHarrisDetector(val)
    public  void setHarrisDetector(boolean val)
    {

        setHarrisDetector_0(nativeObj, val);

        return;
    }

    //
    // C++:  void setK(double k)
    //

    //javadoc: GFTTDetector::setK(k)
    public  void setK(double k)
    {

        setK_0(nativeObj, k);

        return;
    }

    //
    // C++:  void setMaxFeatures(int maxFeatures)
    //

    //javadoc: GFTTDetector::setMaxFeatures(maxFeatures)
    public  void setMaxFeatures(int maxFeatures)
    {

        setMaxFeatures_0(nativeObj, maxFeatures);

        return;
    }

    //
    // C++:  void setMinDistance(double minDistance)
    //

    //javadoc: GFTTDetector::setMinDistance(minDistance)
    public  void setMinDistance(double minDistance)
    {

        setMinDistance_0(nativeObj, minDistance);

        return;
    }

    //
    // C++:  void setQualityLevel(double qlevel)
    //

    //javadoc: GFTTDetector::setQualityLevel(qlevel)
    public  void setQualityLevel(double qlevel)
    {

        setQualityLevel_0(nativeObj, qlevel);

        return;
    }

    @Override
    protected void finalize() throws Throwable {
        delete(nativeObj);
    }

    // C++: static Ptr_GFTTDetector create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, bool useHarrisDetector = false, double k = 0.04)
    private static native long create_0(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, boolean useHarrisDetector, double k);
    private static native long create_1(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize);

    // C++: static Ptr_GFTTDetector create(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
    private static native long create_2(int maxCorners, double qualityLevel, double minDistance, int blockSize, boolean useHarrisDetector, double k);
    private static native long create_3();

    // C++:  String getDefaultName()
    private static native String getDefaultName_0(long nativeObj);

    // C++:  bool getHarrisDetector()
    private static native boolean getHarrisDetector_0(long nativeObj);

    // C++:  double getK()
    private static native double getK_0(long nativeObj);

    // C++:  double getMinDistance()
    private static native double getMinDistance_0(long nativeObj);

    // C++:  double getQualityLevel()
    private static native double getQualityLevel_0(long nativeObj);

    // C++:  int getBlockSize()
    private static native int getBlockSize_0(long nativeObj);

    // C++:  int getMaxFeatures()
    private static native int getMaxFeatures_0(long nativeObj);

    // C++:  void setBlockSize(int blockSize)
    private static native void setBlockSize_0(long nativeObj, int blockSize);

    // C++:  void setHarrisDetector(bool val)
    private static native void setHarrisDetector_0(long nativeObj, boolean val);

    // C++:  void setK(double k)
    private static native void setK_0(long nativeObj, double k);

    // C++:  void setMaxFeatures(int maxFeatures)
    private static native void setMaxFeatures_0(long nativeObj, int maxFeatures);

    // C++:  void setMinDistance(double minDistance)
    private static native void setMinDistance_0(long nativeObj, double minDistance);

    // C++:  void setQualityLevel(double qlevel)
    private static native void setQualityLevel_0(long nativeObj, double qlevel);

    // native support for java finalize()
    private static native void delete(long nativeObj);

}


text: <input type="text" data-ng-model="answer.value" ng-required="block.required">


text:
pong
====

Simple two-player pong made with C++/SFML.


text:
ACCEPTED

#### According to
Integrated Taxonomic Information System

#### Published in
Man. Bot. San Francisco 196. 1894

#### Original name
null

### Remarks
null


text:
extern NSString * const ControlsThemeName;

extern const struct ControlsThemeConstantNames {
    __unsafe_unretained NSString *ButtonCornerRadius;
    __unsafe_unretained NSString *ButtonInsets;
} ControlsThemeConstantNames;

extern const struct ControlsThemeClassNames {
    __unsafe_unretained NSString *Button;
    __unsafe_unretained NSString *SecondaryButton;
    __unsafe_unretained NSString *SegmentedControl;
    __unsafe_unretained NSString *SegmentedControlText;
    __unsafe_unretained NSString *Slider;
    __unsafe_unretained NSString *Switch;
    __unsafe_unretained NSString *WarningButton;
    __unsafe_unretained NSString *WarningSecondaryButton;
} ControlsThemeClassNames;

extern const struct ControlsThemeProperties {
    __unsafe_unretained NSString *backgroundColor;
    __unsafe_unretained NSString *borderColor;
    __unsafe_unretained NSString *borderWidth;
    __unsafe_unretained NSString *color;
    __unsafe_unretained NSString *contentEdgeInsets;
    __unsafe_unretained NSString *cornerRadius;
    __unsafe_unretained NSString *maximumTrackTintColor;
    __unsafe_unretained NSString *minimumTrackTintColor;
    __unsafe_unretained NSString *onTintColor;
    __unsafe_unretained NSString *text;
    __unsafe_unretained NSString *tintColor;
} ControlsThemeProperties;


text:
<?php

namespace Slimore\Log;

/**
 * Class Writer
 *
 * @author Pandao
 * @package Slimore\Log
 */

class Writer
{
    /**
     * @var int
     */
    protected $level;

    /**
     * @var string
     */
    protected $message;

    /**
     * @var string
     */
    protected $filename;

    /**
     * @var resource
     */
    protected $resource;

    /**
     * @var string
     */
    protected $messageOutput;

    /**
     * @var string
     */
    protected $label = 'DEBUG';

    /**
     * @var string
     */
    protected $path = '../app/logs';

    /**
     * @var string
     */

    protected $dateFormat = 'Y-m-d';

    /**
     * @var string
     */
    protected $extension = 'log';

    /**
     * @var string
     */
    protected $messageFormat = '[%label%][#][%date%] %message%';

    /**
     * @var array
     */
    protected $messageFormatSearchs = ['%label%', '[#]', '%date%', '%message%'];

    /**
     * @var array
     */
    protected $messageFormatReplaces;

    /**
     * @var null|callable
     */
    public    $writeBeforeHandle = null;

    public    $customMessageFormatParser = false;

    /**
     * @var array
     */
    protected $levels = [
        1 => 'EMERGENCY',
        2 => 'ALERT',
        3 => 'CRITICAL',
        4 => 'ERROR',
        5 => 'WARNING',
        6 => 'NOTICE',
        7 => 'INFO',
        8 => 'DEBUG'
    ];

    /**
     * Constructor
     */

    public function __construct()
    {
    }

    /**
     * Settings
     *
     * @param string|array $key null
     * @param string $value null
     * @return void
     */

    public function set()
    {
        $args  = func_get_args();
        $count = func_num_args();

        if ( is_array($args[0]) )
        {
            foreach ($args[0] as $key => $value)
            {
                if ($key === 'path')
                {
                    $this->setPath($value);
                    continue;
                }

                if (property_exists($this, $key))
                {
                    $this->$key = $value;
                }
            }
        }
        elseif ($count === 2)
        {
            if ($args[0] === 'path')
            {
                $this->setPath($args[1]);
                return ;
            }

            if (property_exists($this, $args[0]))
            {
                $this[$args[0]] = $args[1];
            }
        }
    }

    /**
     * Setting logs path
     *
     * @param string $path
     *
     * @return void
     */

    public function setPath($path)
    {
        if (!file_exists($path))
        {
            mkdir($path, 0777, true);
        }

        $this->path = $path;
    }

    /**
     * Get log files saved path
     *
     * @return string
     */

    public function getPath()
    {
        return $this->path;
    }

    /**
     * Get log level
     *
     * @return int
     */

    public function getLevel()
    {
        return $this->level;
    }

    /**
     * Get log label
     *
     * @return string
     */

    public function getLabel()
    {
        return $this->label;
    }

    /**
     * Get log message content
     *
     * @return mixed
     */

    public function getMessage()
    {
        return $this->message;
    }

    /**
     * Get log message format
     *
     * @return string
     */

    public function getMessageFormat()
    {
        return $this->messageFormat;
    }

    /**
     * Set log message format
     *
     * @param string $format
     * @return void
     */

    public function setMessageFormat($format)
    {
        $this->messageFormat = (string) $format;
    }

    /**
     * Set log message format searchs
     *
     * @param array $searchs
     * @return void
     */

    public function setMessageFormatSearchs(array $searchs)
    {
        $this->messageFormatSearchs = $searchs;
    }

    /**
     * Get log message format searchs
     *
     * @return array
     * @return void
     */

    public function getMessageFormatSearchs()
    {
        return $this->messageFormatSearchs;
    }

    /**
     * Default log message format replaces
     *
     * @return void
     */

    protected function defaultMessageFormatReplaces()
    {
        $this->messageFormatReplaces = [
            $this->label,
            str_repeat(' ', 9 - strlen($this->label)),
            date('Y-m-d H:i:s e O'),
            $this->message
        ];
    }

    /**
     * Set log message format replaces
     *
     * @param array $replaces
     * @return void
     */

    public function setMessageFormatReplaces(array $replaces)
    {
        $this->messageFormatReplaces = $replaces;
    }

    /**
     * Get log message format repalces
     *
     * @return mixed
     */

    public function getMessageFormatReplaces()
    {
        return $this->messageFormatReplaces;
    }

    /**
     * Log message format parser
     *
     * @return void
     */

    protected function messageFormatParser()
    {
        $this->label = $this->levels[$this->level];

        $this->messageOutput = str_replace(
            $this->getMessageFormatSearchs(),
            $this->getMessageFormatReplaces(),
            $this->getMessageFormat()
        );
    }

    /**
     * Handle for writing log before
     *
     * @param callable $callback
     * @return void
     */

    protected function writeBefore(callable $callback)
    {
        $callback($this);
    }

    /**
     * Write to log file
     *
     * @param   mixed $content
     * @param   int   $level
     * @return  void
     */

    public function write($content, $level)
    {
        $this->message = (string) $content;
        $this->level   = $level;

        if ( is_callable($this->writeBeforeHandle) )
        {
            $this->writeBefore($this->writeBeforeHandle);

            if (!$this->customMessageFormatParser)
            {
                $this->defaultMessageFormatReplaces();
            }
        }
        else
        {
            $this->defaultMessageFormatReplaces();
        }

        $this->messageFormatParser();

        if ( !$this->resource )
        {
            $this->filename = date($this->dateFormat);

            if ( !empty($this->extension) )
            {
                $this->filename .= '.' . $this->extension;
            }

            $this->resource = fopen($this->path . DIRECTORY_SEPARATOR . $this->filename, 'a');
        }

        fwrite($this->resource, $this->messageOutput . PHP_EOL);
    }
}


text:
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from resource_management.core.logger import Logger

def setup_ranger_yarn():
  import params

  if params.enable_ranger_yarn:

    from resource_management.libraries.functions.setup_ranger_plugin_xml import setup_ranger_plugin

    if params.retryAble:
      Logger.info("YARN: Setup ranger: command retry enables thus retrying if ranger admin is down !")
    else:
      Logger.info("YARN: Setup ranger: command retry not enabled thus skipping if ranger admin is down !")

    if params.xml_configurations_supported and params.enable_ranger_yarn and params.xa_audit_hdfs_is_enabled:
      params.HdfsResource("/ranger/audit",
                         type="directory",
                         action="create_on_execute",
                         owner=params.hdfs_user,
                         group=params.hdfs_user,
                         mode=0755,
                         recursive_chmod=True
      )
      params.HdfsResource("/ranger/audit/yarn",
                         type="directory",
                         action="create_on_execute",
                         owner=params.yarn_user,
                         group=params.yarn_user,
                         mode=0700,
                         recursive_chmod=True
      )
      params.HdfsResource(None, action="execute")

    setup_ranger_plugin('hadoop-yarn-resourcemanager', 'yarn', params.previous_jdbc_jar,
                        params.downloaded_custom_connector, params.driver_curl_source,
                        params.driver_curl_target, params.java64_home,
                        params.repo_name, params.yarn_ranger_plugin_repo,
                        params.ranger_env, params.ranger_plugin_properties,
                        params.policy_user, params.policymgr_mgr_url,
                        params.enable_ranger_yarn, conf_dict=params.hadoop_conf_dir,
                        component_user=params.yarn_user, component_group=params.user_group, cache_service_list=['yarn'],
                        plugin_audit_properties=params.config['configurations']['ranger-yarn-audit'], plugin_audit_attributes=params.config['configurationAttributes']['ranger-yarn-audit'],
                        plugin_security_properties=params.config['configurations']['ranger-yarn-security'], plugin_security_attributes=params.config['configurationAttributes']['ranger-yarn-security'],
                        plugin_policymgr_ssl_properties=params.config['configurations']['ranger-yarn-policymgr-ssl'], plugin_policymgr_ssl_attributes=params.config['configurationAttributes']['ranger-yarn-policymgr-ssl'],
                        component_list=['hadoop-yarn-resourcemanager'], audit_db_is_enabled=params.xa_audit_db_is_enabled,
                        credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password,
                        ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password,
                        api_version = 'v2', skip_if_rangeradmin_down= not params.retryAble,
                        is_security_enabled = params.security_enabled,
                        is_stack_supports_ranger_kerberos = params.stack_supports_ranger_kerberos,
                        component_user_principal=params.rm_principal_name if params.security_enabled else None,
                        component_user_keytab=params.rm_keytab if params.security_enabled else None
      )
  else:
    Logger.info('Ranger Yarn plugin is not enabled')


text:
namespace Microsoft.Protocols.TestSuites.Common
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using System.Xml;
    using System.Xml.Schema;
    using Microsoft.Protocols.TestTools;

    /// <summary>
    /// A Class represent the XML schema validation function.
    /// </summary>
    public static class SchemaValidation
    {
        /// <summary>
        /// The result of schema validation.
        /// </summary>
        private static ValidationResult validationResult;

        /// <summary>
        /// A list of schema which is used to construct schema validation reader.
        /// </summary>
        private static List<string> schemaList = new List<string>();

        /// <summary>
        /// The raw XMl response from server.
        /// </summary>
        private static XmlElement rawResponseXml;

        /// <summary>
        /// The raw XMl request to server.
        /// </summary>
        private static XmlElement rawRequestXml;

        /// <summary>
        /// The warning results of XML schema validation.
        /// </summary>
        private static List<ValidationEventArgs> xmlValidationWarnings;

        /// <summary>
        /// The error results of XML schema validation.
        /// </summary>
        private static List<ValidationEventArgs> xmlValidationErrors;

        /// <summary>
        /// Gets the validationResult of schema.
        /// </summary>
        public static ValidationResult ValidationResult
        {
            get
            {
                return validationResult;
            }
        }

        /// <summary>
        /// Gets the error results of XML schema validation.
        /// </summary>
        public static List<ValidationEventArgs> XmlValidationErrors
        {
            get
            {
                return xmlValidationErrors;
            }
        }

        /// <summary>
        /// Gets the warnings results of XML schema validation.
        /// </summary>
        public static List<ValidationEventArgs> XmlValidationWarnings
        {
            get
            {
                return xmlValidationWarnings;
            }
        }

        /// <summary>
        /// Gets or sets the operated raw XMl response from protocol SUT.
        /// </summary>
        public static XmlElement LastRawResponseXml
        {
            get
            {
                return rawResponseXml;
            }

            set
            {
                rawResponseXml = value;
            }
        }

        /// <summary>
        /// Gets or sets the raw Request Xml send to protocol SUT.
        /// </summary>
        public static XmlElement LastRawRequestXml
        {
            get
            {
                return rawRequestXml;
            }

            set
            {
                rawRequestXml = value;
            }
        }

        /// <summary>
        /// Validate a piece of Xml fragment.
        /// </summary>
        /// <param name="xmlValue">Xml fragment string.</param>
        /// <returns>A return represents the validation result of the specified Xml fragment string.</returns>
        public static ValidationResult ValidateXml(string xmlValue)
        {
            InitSchemaList();
            InitValidateRecoder();
            DoValidation(xmlValue);
            return validationResult;
        }

        /// <summary>
        /// This method is used to generate xml validation result information by using
        /// the record errors and warnings.
        /// </summary>
        /// <returns>Return the xml validation result string which contains the errors and warning information.</returns>
        public static string GenerateValidationResult()
        {
            StringBuilder sb = new StringBuilder();

            if (XmlValidationWarnings.Count != 0)
            {
                sb.Append("The xml validation warnings:");
                sb.Append(Environment.NewLine);
                foreach (ValidationEventArgs warning in XmlValidationWarnings)
                {
                    sb.Append(warning.Message);
                    sb.Append(Environment.NewLine);
                }
            }

            if (XmlValidationErrors.Count != 0)
            {
                sb.Append("The xml validation errors:");
                foreach (ValidationEventArgs error in XmlValidationErrors)
                {
                    sb.Append(error.Message);
                    sb.Append(Environment.NewLine);
                }
            }

            return sb.ToString();
        }

        /// <summary>
        /// Initialize the validate recorder.
        /// </summary>
        private static void InitValidateRecoder()
        {
            // Initialize the result as "Success", if there are any validation error, this value will be changed by call back method.
            validationResult = ValidationResult.Success;
            if (null == xmlValidationWarnings)
            {
                xmlValidationWarnings = new List<ValidationEventArgs>();
            }

            xmlValidationWarnings.Clear();

            if (null == xmlValidationErrors)
            {
                xmlValidationErrors = new List<ValidationEventArgs>();
            }

            xmlValidationErrors.Clear();
        }

        /// <summary>
        /// Validate special xml.
        /// </summary>
        /// <param name="xmlString">The xml string.</param>
        private static void DoValidation(string xmlString)
        {
            XmlReaderSettings validationSettings = new XmlReaderSettings();
            foreach (string eachSchema in schemaList)
            {
                StringReader schemaReader = null;
                try
                {
                    schemaReader = new StringReader(eachSchema);
                    using (XmlReader xsdXmlReader = XmlReader.Create(schemaReader))
                    {
                        string targetNameSpace = GetTargetNamespace(eachSchema);
                        if (string.IsNullOrEmpty(targetNameSpace))
                        {
                            validationSettings.Schemas.Add(null, xsdXmlReader);
                        }
                        else
                        {
                            validationSettings.Schemas.Add(targetNameSpace, xsdXmlReader);
                        }
                    }
                }
                finally
                {
                    if (schemaReader != null)
                    {
                        schemaReader.Dispose();
                    }
                }
            }

            validationSettings.ValidationType = ValidationType.Schema;
            validationSettings.ConformanceLevel = ConformanceLevel.Document;
            validationSettings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
            validationSettings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);

            StringReader reader = null;
            try
            {
                reader = new StringReader(xmlString);
                using (XmlReader validationReader = XmlReader.Create(reader, validationSettings))
                {
                    while (validationReader.Read())
                    {
                    }
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }

        /// <summary>
        /// This method is a callback function which is used to record the schema validation errors and warnings.
        /// </summary>
        /// <param name="sender">An object instance which represents the sender of the events.</param>
        /// <param name="args">The ValidationEventArgs contains validation result.</param>
        private static void ValidationCallBack(object sender, ValidationEventArgs args)
        {
            if (args.Severity == XmlSeverityType.Warning)
            {
                validationResult = ValidationResult.Warning;
                xmlValidationWarnings.Add(args);
            }
            else
            {
                validationResult = ValidationResult.Error;
                xmlValidationErrors.Add(args);
            }
        }

        /// <summary>
        /// This method is used to get the target namespace from a schema string.
        /// </summary>
        /// <param name="fullSchema">The schema string</param>
        /// <returns>A return value represents the target namespace value</returns>
        private static string GetTargetNamespace(string fullSchema)
        {
            XmlDocument xd = new XmlDocument();
            xd.LoadXml(fullSchema);
            XmlAttributeCollection attributeList = xd.DocumentElement.Attributes;
            foreach (XmlAttribute attribute in attributeList)
            {
                if (attribute.Name.Equals("targetNamespace", StringComparison.OrdinalIgnoreCase))
                {
                    return attribute.Value;
                }
            }

            return string.Empty;
        }

        /// <summary>
        /// This method is used to initialize the schema definitions list which is used to set the schema validation settings.
        /// </summary>
        private static void InitSchemaList()
        {
            schemaList.Clear();

            // In the current stage, only one WSDL exists.
            schemaList.AddRange(GetSchemaStringFromWsdlFile("MS-FSSHTTP-FSSHTTPB.wsdl"));
        }

        /// <summary>
        /// A method used to get the schema definitions from full WSDL file. It is designed to read schema definition from full WSDL file.
        /// </summary>
        /// <param name="schemaLoadPath">A parameter represents a full WSDL file path where the schema definitions should be loaded.</param>
        /// <returns>A return value represents the schema definitions.</returns>
        private static string[] GetSchemaStringFromWsdlFile(string schemaLoadPath)
        {
            List<string> schemas = new List<string>();
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(schemaLoadPath);
            XmlNodeList wsdlTypes = xmlDoc.GetElementsByTagName("wsdl:types");
            XmlNodeList wsdlDefinitions = xmlDoc.GetElementsByTagName("wsdl:definitions");

            if (wsdlTypes != null && wsdlTypes.Count == 1)
            {
                foreach (XmlNode schemaElement in wsdlTypes[0].ChildNodes)
                {
                    if (schemaElement.NodeType != XmlNodeType.Comment)
                    {
                        foreach (XmlAttribute attribute in wsdlDefinitions[0].Attributes)
                        {
                            if (attribute.Prefix == "xmlns" && schemaElement.Attributes.GetNamedItem(attribute.Name) == null)
                            {
                                XmlAttribute namespaceAttribute = (XmlAttribute)attribute.Clone();
                                schemaElement.Attributes.Append(namespaceAttribute);
                            }
                        }

                        schemas.Add(schemaElement.OuterXml);
                    }
                }
            }

            return schemas.ToArray();
        }
    }
}


text:
<?php

namespace Smalot\Magento;

/**
 * Interface MultiCallQueueInterface
 *
 * @package Smalot\Magento
 */
interface MultiCallQueueInterface extends \ArrayAccess, \Iterator, \Countable
{
    /**
     * @param ActionInterface $action
     * @param callable        $callback
     *
     * @return MultiCallQueueInterface
     */
    public function addAction(ActionInterface $action, $callback = null);

    /**
     * @return $this
     */
    public function flush();

    /**
     * @return array
     */
    public function execute();
}


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

<meta name="collection" content="api">

<TITLE>
ModelMBeanConstructorInfo (Java 2 Platform SE 5.0)
</TITLE>

<META NAME="keywords" CONTENT="javax.management.modelmbean.ModelMBeanConstructorInfo class">
<META NAME="keywords" CONTENT="clone()">
<META NAME="keywords" CONTENT="getDescriptor()">
<META NAME="keywords" CONTENT="setDescriptor()">
<META NAME="keywords" CONTENT="toString()">

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

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JavaTM 2 Platform
Standard Ed. 5.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javax.management.modelmbean

Class ModelMBeanConstructorInfo

java.lang.Object
  javax.management.MBeanFeatureInfo
      javax.management.MBeanConstructorInfo
          javax.management.modelmbean.ModelMBeanConstructorInfo

All Implemented Interfaces:
Serializable, Cloneable, DescriptorAccess

public class ModelMBeanConstructorInfo
extends MBeanConstructorInfo
implements DescriptorAccess, Cloneable

The ModelMBeanConstructorInfo object describes a constructor of the ModelMBean.
 It is a subclass of MBeanConstructorInfo with the addition of an associated Descriptor
 and an implementation of the DescriptorAccess interface.

 The fields in the descriptor are defined, but not limited to, the following:

 name           : constructor name
 descriptorType : must be "operation"
 role           : must be "constructor"
 displayName    : human readable name of constructor
 visibility            : 1-4 where 1: always visible 4: rarely visible
 presentationString :  xml formatted string to describe how to present operation

 The persistPolicy and currencyTimeLimit fields are not valid for the constructor.
 The default descriptor will have the name, descriptorType, displayName and role fields.

Since:

1.5

See Also:
Serialized Form

Field Summary

Fields inherited from class javax.management.MBeanFeatureInfo

description, name

Constructor Summary

ModelMBeanConstructorInfo(String description,
                          Constructor constructorMethod)

          Constructs a MBeanConstructorInfo object with a default descriptor.

ModelMBeanConstructorInfo(String description,
                          Constructor constructorMethod,
                          Descriptor descriptor)

          Constructs a MBeanConstructorInfo object.

ModelMBeanConstructorInfo(String name,
                          String description,
                          MBeanParameterInfo[] signature)

          Constructs a ModelMBeanConstructorInfo object with a default descriptor.

ModelMBeanConstructorInfo(String name,
                          String description,
                          MBeanParameterInfo[] signature,
                          Descriptor descriptor)

          Constructs a MBeanConstructorInfo object.

Method Summary

 Object
clone()

          Creates and returns a new ModelMBeanConstructorInfo which is a duplicate of this ModelMBeanConstructorInfo.

 Descriptor
getDescriptor()

          Returns a copy of the associated Descriptor.

 void
setDescriptor(Descriptor inDescriptor)

          Sets associated Descriptor (full replace) of
 ModelMBeanConstructorInfo.

 String
toString()

          Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.

Methods inherited from class javax.management.MBeanConstructorInfo

equals, getSignature, hashCode

Methods inherited from class javax.management.MBeanFeatureInfo

getDescription, getName

Methods inherited from class java.lang.Object

finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

ModelMBeanConstructorInfo

public ModelMBeanConstructorInfo(String description,
                                 Constructor constructorMethod)

Constructs a MBeanConstructorInfo object with a default descriptor.

Parameters:
description - A human readable description of the constructor.
constructorMethod - The java.lang.reflect.Method object
 describing the MBean constructor.

ModelMBeanConstructorInfo

public ModelMBeanConstructorInfo(String description,
                                 Constructor constructorMethod,
                                 Descriptor descriptor)

Constructs a MBeanConstructorInfo object.

Parameters:
description - A human readable description of the constructor.
constructorMethod - The java.lang.reflect.Method object
 describing the ModelMBean constructor.
descriptor - An instance of Descriptor containing the
 appropriate metadata for this instance of the
 ModelMBeanConstructorInfo.  If it is null, then a default
 descriptor will be created.If the descriptor does not
 contain the field "displayName" this fields is added in the
 descriptor with its default value.

Throws:

RuntimeOperationsException - Wraps an
 IllegalArgumentException. The descriptor is invalid, or
 descriptor field "name" is not equal to name parameter, or
 descriptor field "DescriptorType" is not equal to
 "operation" or descriptor field "role" is not equal to
 "constructor".

ModelMBeanConstructorInfo

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature)

Constructs a ModelMBeanConstructorInfo object with a default descriptor.

Parameters:
name - The name of the constructor.
description - A human readable description of the constructor.
signature - MBeanParameterInfo object array describing the parameters(arguments) of the constructor.

ModelMBeanConstructorInfo

public ModelMBeanConstructorInfo(String name,
                                 String description,
                                 MBeanParameterInfo[] signature,
                                 Descriptor descriptor)

Constructs a MBeanConstructorInfo object.

Parameters:
name - The name of the constructor.
description - A human readable description of the constructor.
signature - MBeanParameterInfo objects describing the parameters(arguments) of the constructor.
descriptor - An instance of Descriptor containing the appropriate metadata
                   for this instance of the MBeanConstructorInfo. If it is null then a default descriptor will be created.
 If the descriptor does not contain the field "displayName" this field is added in the descriptor with its default value.

Throws:

RuntimeOperationsException - Wraps an IllegalArgumentException. The descriptor is invalid, or descriptor field "name"
 is not equal to name parameter, or descriptor field "DescriptorType" is not equal to "operation" or descriptor field "role"
 is not equal to "constructor".

Method Detail

clone

public Object clone()

Creates and returns a new ModelMBeanConstructorInfo which is a duplicate of this ModelMBeanConstructorInfo.

Overrides:
clone in class MBeanConstructorInfo

Returns:
a clone of this instance.
See Also:
Cloneable

getDescriptor

public Descriptor getDescriptor()

Returns a copy of the associated Descriptor.

Specified by:
getDescriptor in interface DescriptorAccess

Returns:
Descriptor associated with the
 ModelMBeanConstructorInfo object.
See Also:
setDescriptor(javax.management.Descriptor)

setDescriptor

public void setDescriptor(Descriptor inDescriptor)

Sets associated Descriptor (full replace) of
 ModelMBeanConstructorInfo.  If the new Descriptor is null,
 then the associated Descriptor reverts to a default
 descriptor.  The Descriptor is validated before it is
 assigned.  If the new Descriptor is invalid, then a
 RuntimeOperationsException wrapping an
 IllegalArgumentException is thrown.

Specified by:
setDescriptor in interface DescriptorAccess

Parameters:
inDescriptor - replaces the Descriptor associated with
 the ModelMBeanConstructor. If the descriptor does not
 contain the field "displayName" this field is added in the
 descriptor with its default value.

Throws:

RuntimeOperationsException - Wraps an
 IllegalArgumentException.  The descriptor is invalid, or
 descriptor field "name" is not equal to name parameter, or
 descriptor field "DescriptorType" is not equal to
 "operation" or descriptor field "role" is not equal to
 "constructor".
See Also:
getDescriptor()

toString

public String toString()

Returns a string containing the entire contents of the ModelMBeanConstructorInfo in human readable form.

Overrides:
toString in class Object

Returns:
a string representation of the object.

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JavaTM 2 Platform
Standard Ed. 5.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


text:
void
test_main(void)
{
  struct nettle_buffer buffer;
  uint8_t s[5];

  nettle_buffer_init(&buffer);
  ASSERT(nettle_buffer_write(&buffer, LDATA("foo")));

  ASSERT(NETTLE_BUFFER_PUTC(&buffer, 'x'));

  ASSERT(buffer.size == 4);
  ASSERT(buffer.alloc >= 4);
  ASSERT(MEMEQ(4, buffer.contents, "foox"));

  nettle_buffer_clear(&buffer);

  nettle_buffer_init_size(&buffer, sizeof(s), s);
  ASSERT(buffer.alloc == sizeof(s));
  ASSERT(nettle_buffer_write(&buffer, LDATA("foo")));
  ASSERT(buffer.size == 3);

  ASSERT(!nettle_buffer_write(&buffer, LDATA("bar")));
}


text:
package dotnet

var Usage = []string{"rt dotnet <dotnet sub-command> [command options]"}

func GetDescription() string {
	return "Run .NET Core CLI."
}

func GetArguments() string {
	return `	dotnet sub-command
		 Arguments and options for the dotnet command.`
}


text:
var webpack = require('webpack')
var baseConfig = require('./webpack.base.config.js')

baseConfig.devtool = 'cheap-module-source-map'
baseConfig.mode = 'production'

baseConfig.plugins = baseConfig.plugins.concat([
  new webpack.DefinePlugin({
    'process.env': {
      NODE_ENV: JSON.stringify('production')
    }
  }),
  //new webpack.optimize.UglifyJsPlugin({sourcemap: true})
])

module.exports = baseConfig


text:
package io.github.droidkaigi.confsched2017.view.fragment;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.FragmentMapBinding;

public class MapFragment extends BaseFragment {

    public static final String TAG = MapFragment.class.getSimpleName();

    private FragmentMapBinding binding;

    public static MapFragment newInstance() {
        return new MapFragment();
    }

    public MapFragment() {
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        getComponent().inject(this);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        setHasOptionsMenu(true);
        binding = FragmentMapBinding.inflate(inflater, container, false);

        initView();
        return binding.getRoot();
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.menu_map, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.item_nav:
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=35.6962371,139.6910577&mode=transit"));
                startActivity(intent);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    private void initView() {
        //
    }
}


text:
package cc.redpen.util;

import cc.redpen.RedPenException;
import cc.redpen.validator.Validator;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

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

public class DictionaryLoaderTest extends Validator {
    @Test
    public void testCreateWordList() throws IOException {
        String sampleWordSet = "Saitama\n";
        sampleWordSet += "Gumma\n";
        sampleWordSet += "Gifu\n";

        Set<String> result = WORD_LIST.load(new ByteArrayInputStream(sampleWordSet.getBytes(StandardCharsets.UTF_8)));
        assertEquals(3, result.size());
    }

    @Test
    public void testCreateVacantWordList() throws IOException {
        String sampleWordSet = "";

        Set<String> result = WORD_LIST.load(new ByteArrayInputStream(sampleWordSet.getBytes(StandardCharsets.UTF_8)));
        assertEquals(0, result.size());
    }

    @Test
    public void testCreateKeyValueList() throws IOException {
        String sampleWordSet = "Saitama\t100\n";
        sampleWordSet += "Gumma\t530000\n";
        sampleWordSet += "Gifu\t1200\n";

        Map<String, String> result = KEY_VALUE.load(new ByteArrayInputStream(sampleWordSet.getBytes(StandardCharsets.UTF_8)));
        assertEquals(3, result.size());
        assertEquals("100", result.get("Saitama"));
        assertEquals("530000", result.get("Gumma"));
        assertEquals("1200", result.get("Gifu"));
    }

    @Test
    public void testCreateVacantKeyValueList() throws IOException {
        String sampleWordSet = "";
        Map<String, String> result = KEY_VALUE.load(new ByteArrayInputStream(sampleWordSet.getBytes(StandardCharsets.UTF_8)));
        assertEquals(0, result.size());
    }

    @Test
    public void testLoadCachedFile() throws IOException, RedPenException {
        Path path = Files.createTempFile("test", "txt");
        File file = path.toFile();
        System.setProperty("REDPEN_HOME", file.getParentFile().getAbsolutePath());
        Files.copy(new ByteArrayInputStream("foo".getBytes()), path, StandardCopyOption.REPLACE_EXISTING);
        Set<String> strings;
        strings = WORD_LIST.loadCachedFromFile(path.toFile(), "temp file");
        assertEquals(1, strings.size());
        assertTrue(strings.contains("foo"));

        // hopefully loaded from cache
        strings = WORD_LIST.loadCachedFromFile(path.toFile(), "temp file");
        assertEquals(1, strings.size());
        assertTrue(strings.contains("foo"));

        long lastModified = file.lastModified();

        Files.copy(new ByteArrayInputStream("foo\nbar".getBytes()), path, StandardCopyOption.REPLACE_EXISTING);
        file.setLastModified(lastModified);
        // won't be reloaded because the last modified date is not changed
        strings = WORD_LIST.loadCachedFromFile(path.toFile(), "temp file");
        assertEquals(1, strings.size());
        assertTrue(strings.contains("foo"));

        file.setLastModified(lastModified + 1000);
        // will be reloaded because the last modified date is changed
        strings = WORD_LIST.loadCachedFromFile(path.toFile(), "temp file");
        assertEquals(2, strings.size());
        assertTrue(strings.contains("foo"));
        assertTrue(strings.contains("bar"));
    }

    @Test
    public void testLoadingInexistingResourceReturnsAnEmptyCollection() throws Exception {
        Set<String> result = new DictionaryLoader<Set<String>>(HashSet::new, null).loadCachedFromResource("hello.xml", "hello");
        assertTrue(result.isEmpty());
    }
}


text:
module.exports = {
  stringify: require('./stringify.js')
}


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

namespace OKHOSTING.Code.Test
{
	[TestClass]
	public class UnitTest1
	{
		[TestMethod]
		public void TestMethod1()
		{
			var decompiler = new Net4.Decompiler();
			var source = decompiler.GetSourceCode(typeof(Decompiler));
		}
	}
}


text:
package main

import (
	"flag"
	"fmt"
	"github.com/LinioIT/rabbitmq-worker/config"
	"github.com/LinioIT/rabbitmq-worker/rabbitmq"
	"os"
)

func main() {
	flag.Usage = usage
	configFile := getArgs()

	config := config.ConfigParameters{}

	if err := config.ParseConfigFile(configFile); err != nil {
		fmt.Fprintln(os.Stderr, "Could not load the configuration file:", configFile, "-", err)
		os.Exit(1)
	}

	if err := rabbitmq.QueueDelete(&config); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	} else {
		fmt.Println("Queues", config.Queue.Name, "and", config.Queue.Name+"_wait", "deleted successfully.\n")
	}
}

func getArgs() (configFile string) {
	flag.Parse()

	argCnt := len(flag.Args())
	if argCnt == 1 {
		configFile = flag.Args()[0]
	} else {
		usage()
	}

	return
}

func usage() {
	fmt.Fprintln(os.Stderr, "Usage:", os.Args[0], "CONFIG_FILE\n")
	os.Exit(1)
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
    <link href="/css/star-rating.css" media="all" rel="stylesheet" type="text/css" />
    <title>${movie.title}</title>

    Home

                <form method="POST" action="" class="form-inline" style="margin-top:20px;">

                        <input name="rating" id="rating" type="number" class="rating" min="0" max="5" step="1" data-size="xs" data-show-clear="false" value="${movie.average_rating}">
                        <input type="hidden" name="movie" value=${movie.key.id()}>

                    <button class="btn btn-default" type="submit">Submit</button>
                </form>

${movie.title}

${movie.overview}


text:
package ottlfuncs

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"

	"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
)

func Test_concat(t *testing.T) {
	tests := []struct {
		name      string
		vals      []ottl.StandardGetSetter[interface{}]
		delimiter string
		expected  string
	}{
		{
			name: "concat strings",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "world", nil
					},
				},
			},
			delimiter: " ",
			expected:  "hello world",
		},
		{
			name: "nil",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return nil, nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "world", nil
					},
				},
			},
			delimiter: "",
			expected:  "hello<nil>world",
		},
		{
			name: "integers",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return int64(1), nil
					},
				},
			},
			delimiter: "",
			expected:  "hello1",
		},
		{
			name: "floats",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return 3.14159, nil
					},
				},
			},
			delimiter: "",
			expected:  "hello3.14159",
		},
		{
			name: "booleans",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return true, nil
					},
				},
			},
			delimiter: " ",
			expected:  "hello true",
		},
		{
			name: "byte slices",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0xd2, 0xe6, 0x3c, 0xbe, 0x71, 0xf5, 0xa8}, nil
					},
				},
			},
			delimiter: "",
			expected:  "00000000000000000ed2e63cbe71f5a8",
		},
		{
			name: "non-byte slices",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, nil
					},
				},
			},
			delimiter: "",
			expected:  "",
		},
		{
			name: "maps",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return map[string]string{"key": "value"}, nil
					},
				},
			},
			delimiter: "",
			expected:  "",
		},
		{
			name: "unprintable value in the middle",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return map[string]string{"key": "value"}, nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "world", nil
					},
				},
			},
			delimiter: "-",
			expected:  "hello--world",
		},
		{
			name: "empty string values",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "", nil
					},
				},
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "", nil
					},
				},
			},
			delimiter: "__",
			expected:  "____",
		},
		{
			name: "single argument",
			vals: []ottl.StandardGetSetter[interface{}]{
				{
					Getter: func(ctx context.Context, tCtx interface{}) (interface{}, error) {
						return "hello", nil
					},
				},
			},
			delimiter: "-",
			expected:  "hello",
		},
		{
			name:      "no arguments",
			vals:      []ottl.StandardGetSetter[interface{}]{},
			delimiter: "-",
			expected:  "",
		},
		{
			name:      "no arguments with an empty delimiter",
			vals:      []ottl.StandardGetSetter[interface{}]{},
			delimiter: "",
			expected:  "",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			getters := make([]ottl.Getter[interface{}], len(tt.vals))

			for i, val := range tt.vals {
				getters[i] = val
			}

			exprFunc, err := Concat(getters, tt.delimiter)
			assert.NoError(t, err)
			result, err := exprFunc(nil, nil)
			assert.NoError(t, err)
			assert.Equal(t, tt.expected, result)
		})
	}
}