text:
package com.amazonaws.services.kms.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetKeyRotationStatusResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * A Boolean value that specifies whether key rotation is enabled.
     *

     */
    private Boolean keyRotationEnabled;

    /**
     *

     * A Boolean value that specifies whether key rotation is enabled.
     *

     *
     * @param keyRotationEnabled
     *        A Boolean value that specifies whether key rotation is enabled.
     */

    public void setKeyRotationEnabled(Boolean keyRotationEnabled) {
        this.keyRotationEnabled = keyRotationEnabled;
    }

    /**
     *

     * A Boolean value that specifies whether key rotation is enabled.
     *

     *
     * @return A Boolean value that specifies whether key rotation is enabled.
     */

    public Boolean getKeyRotationEnabled() {
        return this.keyRotationEnabled;
    }

    /**
     *

     * A Boolean value that specifies whether key rotation is enabled.
     *

     *
     * @param keyRotationEnabled
     *        A Boolean value that specifies whether key rotation is enabled.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetKeyRotationStatusResult withKeyRotationEnabled(Boolean keyRotationEnabled) {
        setKeyRotationEnabled(keyRotationEnabled);
        return this;
    }

    /**
     *

     * A Boolean value that specifies whether key rotation is enabled.
     *

     *
     * @return A Boolean value that specifies whether key rotation is enabled.
     */

    public Boolean isKeyRotationEnabled() {
        return this.keyRotationEnabled;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getKeyRotationEnabled() != null)
            sb.append("KeyRotationEnabled: ").append(getKeyRotationEnabled());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetKeyRotationStatusResult == false)
            return false;
        GetKeyRotationStatusResult other = (GetKeyRotationStatusResult) obj;
        if (other.getKeyRotationEnabled() == null ^ this.getKeyRotationEnabled() == null)
            return false;
        if (other.getKeyRotationEnabled() != null && other.getKeyRotationEnabled().equals(this.getKeyRotationEnabled()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getKeyRotationEnabled() == null) ? 0 : getKeyRotationEnabled().hashCode());
        return hashCode;
    }

    @Override
    public GetKeyRotationStatusResult clone() {
        try {
            return (GetKeyRotationStatusResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
PWD         = $(shell pwd)
TOPDIR      = $(abspath ../../../..)
TESTDIR     = ../../..

# user-defined source files
CODE_DIR    = .
ORG_SRCS    =

# parameters for run
glevel      = 5
rlevel      = 0
nmpi        = 10
zlayer      = 10
vgrid       = vgrid10_1000m_dcmip.dat

# build, makedir, run, jobshell, allclean, clean is inside of common Makefile
include $(TESTDIR)/Makefile.common

redpajama_set_name: RedPajamaGithub


text:
There are a series of micro controller devices you can use to drive this air quality monitoring device.

one being ...

Air Quality .net Montoring Device based off Netduino

more details [here](http://canterburyregionalcouncil.github.io/AirQualityMonitoringDevice/)


text: export { default } from 'ember-bootstrap/components/bs-link-to';


text:
class CPDF_VariableText;
class CPVT_LineInfo;
struct CPVT_WordLine;
struct CPVT_WordPlace;

class CSection final {
 public:
  explicit CSection(CPDF_VariableText* pVT);
  ~CSection();

  void ResetLinePlace();
  CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
                         const CPVT_WordInfo& wordinfo);
  CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo);
  void ClearWords(const CPVT_WordRange& PlaceRange);
  void ClearWord(const CPVT_WordPlace& place);
  CPVT_FloatRect Rearrange();
  CFX_SizeF GetSectionSize(float fFontSize);
  CPVT_WordPlace GetBeginWordPlace() const;
  CPVT_WordPlace GetEndWordPlace() const;
  CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
  CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
  void UpdateWordPlace(CPVT_WordPlace& place) const;
  CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
  CPVT_WordPlace SearchWordPlace(float fx,
                                 const CPVT_WordPlace& lineplace) const;
  CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordRange& range) const;

  CPVT_WordPlace SecPlace;
  CPVT_FloatRect m_Rect;
  std::vector<std::unique_ptr<CLine>> m_LineArray;
  std::vector<std::unique_ptr<CPVT_WordInfo>> m_WordArray;

 private:
  friend class CTypeset;

  void ClearLeftWords(int32_t nWordIndex);
  void ClearRightWords(int32_t nWordIndex);
  void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex);

  UnownedPtr<CPDF_VariableText> const m_pVT;
};

#endif  // CORE_FPDFDOC_CSECTION_H_


text:
module ActiveRecordPermissions
  # ActiveRecordPermissions needs to know what method on your ApplicationController will return the current user,
  # if available. This defaults to the :current_user method. You may configure this in your environment.rb if you
  # have a different setup.
  def self.current_user_method=(v); @@current_user_method = v; end
  def self.current_user_method; @@current_user_method; end
  @@current_user_method = :current_user

  # Whether the default permission is permissive or not
  # If set to true, then everything's allowed until configured otherwise
  def self.default_permission=(v); @@default_permission = v; end
  def self.default_permission; @@default_permission; end
  @@default_permission = true

  # This is a module aimed at making the current_user available to ActiveRecord models for permissions.
  module ModelUserAccess
    module Controller
      def self.included(base)
        base.prepend_before_filter :assign_current_user_to_models
      end

      # We need to give the ActiveRecord classes a handle to the current user. We don't want to just pass the object,
      # because the object may change (someone may log in or out). So we give ActiveRecord a proc that ties to the
      # current_user_method on this ApplicationController.
      def assign_current_user_to_models
        ActiveRecord::Base.current_user_proc = proc {send(ActiveRecordPermissions.current_user_method)}
      end
    end

    module Model
      def self.included(base)
        base.extend ClassMethods
        base.send :include, ActiveRecordPermissions::Permissions
      end

      module ClassMethods
        # The proc to call that retrieves the current_user from the ApplicationController.
        attr_accessor :current_user_proc

        # Class-level access to the current user
        def current_user
          ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc
        end
      end

      # Instance-level access to the current user
      def current_user
        self.class.current_user
      end
    end
  end

  module Permissions
    def self.included(base)
      base.extend SecurityMethods
      base.send :include, SecurityMethods
    end

    # Because any class-level queries get delegated to the instance level via a new record,
    # it's useful to know when the authorization query is meant for a specific record or not.
    # But using new_record? is confusing, even though accurate. So this is basically just a wrapper.
    def existing_record_check?
      !new_record?
    end

    module SecurityMethods
      # A generic authorization query. This is what will be called programatically, since
      # the actual permission methods can't be guaranteed to exist. And because we want to
      # intelligently combine multiple applicable methods.
      #
      # options[:crud_type] should be a CRUD verb (:create, :read, :update, :destroy)
      # options[:column] should be the name of a model attribute
      # options[:action] is the name of a method
      def authorized_for?(options = {})
        raise ArgumentError, "unknown crud type #{options[:crud_type]}" if options[:crud_type] and ![:create, :read, :update, :delete].include?(options[:crud_type])

        # column_authorized_for_crud_type? has the highest priority over other methods,
        # you can disable a crud verb and enable that verb for a column
        # (for example, disable update and enable inplace_edit in a column)
        method = column_and_crud_type_security_method(options[:column], options[:crud_type])
        return send(method) if method and respond_to?(method)

        # authorized_for_action? has higher priority than other methods,
        # you can disable a crud verb and enable an action with that crud verb
        # (for example, disable update and enable an action with update as crud type)
        method = action_security_method(options[:action])
        return send(method) if method and respond_to?(method)

        # collect other possibly-related methods that actually exist
        methods = [
          column_security_method(options[:column]),
          crud_type_security_method(options[:crud_type]),
        ].compact.select {|m| respond_to?(m)}

        # if any method returns false, then return false
        return false if methods.any? {|m| !send(m)}

        # if any method actually exists then it must've returned true, so return true
        return true unless methods.empty?

        # if no method exists, return the default permission
        return ActiveRecordPermissions.default_permission
      end

      private

      def column_security_method(column)
        "#{column}_authorized?" if column
      end

      def crud_type_security_method(crud_type)
        "authorized_for_#{crud_type}?" if crud_type
      end

      def action_security_method(action)
        "authorized_for_#{action}?" if action
      end

      def column_and_crud_type_security_method(column, crud_type)
        "#{column}_authorized_for_#{crud_type}?" if column and crud_type
      end
    end
  end
end


text:
[![Quality Gate](https://sonarqube.com/api/badges/gate?key=com.codenotfound:spring-kafka-json)](https://sonarqube.com/dashboard/index/com.codenotfound:spring-kafka-json)

A detailed step-by-step tutorial on how to configure a JSON Serializer & Deserializer using Spring Kafka and Spring Boot.

[https://www.codenotfound.com/spring-kafka-json-serializer-deserializer-example.html](https://www.codenotfound.com/spring-kafka-json-serializer-deserializer-example.html)


text:
package com.intellij.java.codeInsight.daemon;

import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;

public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTestCase {

  public void testHidingOnDemandImports() {
    myFixture.addClass("package foo; public class Foo {" +
                       "  public static String foo;" +
                       "}");

    myFixture.addClass("package foo; public class Bar {" +
                       "  public static void foo(String s) {}" +
                       "}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting(false, false, false);
  }

  public void testPackageNamedAsClassInDefaultPackage() {
    myFixture.addClass("package test; public class A {}");
    final PsiClass aClass = myFixture.addClass("public class test {}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();

    assertNull(ReferencesSearch.search(aClass).findFirst());
  }

  public void testInaccessibleFunctionalTypeParameter() {
    myFixture.addClass("package test; class A {}");
    myFixture.addClass("package test; public interface I { void m(A a);}");
    myFixture.addClass("package test; public interface J { A m();}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testBoundsPromotionWithCapturedWildcards() {
    myFixture.addClass("package a; public interface Provider<A> {}");
    myFixture.addClass("package b; public interface Provider<B> {}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testStaticImportCompoundWithInheritance() {
    myFixture.addClass("package a; public interface A { static void foo(Object o){} static void foo(String str) {}}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testSuppressedInGenerated() {
    myFixture.addClass("package javax.annotation; public @interface Generated {}");
    final RedundantCastInspection inspection = new RedundantCastInspection();
    try {
      myFixture.enableInspections(inspection);
      myFixture.configureByFile(getTestName(false) + ".java");
      myFixture.checkHighlighting();
    }
    finally {
      myFixture.disableInspections(inspection);
    }

  }

  public void testUsageOfProtectedAnnotationOutsideAPackage() {
    myFixture.addClass("package a;\n" +
                       "import java.lang.annotation.ElementType;\n" +
                       "import java.lang.annotation.Target;\n" +
                       "\n" +
                       "public class A {\n" +
                       "    @Target( { ElementType.METHOD, ElementType.TYPE } )\n" +
                       "    protected @interface Test{\n" +
                       "    }\n" +
                       "}");

    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testPackageLocalClassUsedinArrayTypeOutsidePackage() {
    myFixture.addClass("package a; class A {}");
    myFixture.addClass("package a; public class B {public static A[] getAs() {return null;}}");
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testProtectedFieldUsedInAnnotationParameterOfInheritor() {
    myFixture.addClass("package a; public class A {protected final static String A_FOO = \"A\";}");
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testStaticImportClassConflictingWithPackageName() {
    myFixture.addClass("package p.P1; class Unrelated {}");
    myFixture.addClass("package p; public class P1 {public static final int FOO = 1;}");
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  public void testAmbiguousMethodCallWhenStaticImported() {
    myFixture.addClass("package p;" +
                       "class A<K> {\n" +
                       "  static <T> A<T> of(T t) {\n" +
                       "    return null;\n" +
                       "  }\n" +
                       "}\n" +
                       "class B<K> {\n" +
                       "  static <T> B<T> of(T t) {\n" +
                       "    return null;\n" +
                       "  }\n" +
                       "  static <T> B<T> of(T... t) {\n" +
                       "    return null;\n" +
                       "  }\n" +
                       "}\n");
    myFixture.configureByFile(getTestName(false) + ".java");
    myFixture.checkHighlighting();
  }

  @Override
  protected String getBasePath() {
    return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
  }

  @NotNull
  @Override
  protected LightProjectDescriptor getProjectDescriptor() {
    return JAVA_8;
  }
}


text:
import os
import subprocess

import ajenti
from ajenti.api import *
from ajenti.plugins.main.api import SectionPlugin
from ajenti.ui import on
from ajenti.ui.binder import Binder

from reconfigure.configs import CTDBConfig, CTDBNodesConfig, CTDBPublicAddressesConfig
from reconfigure.items.ctdb import NodeData, PublicAddressData

@plugin
class CTDB (SectionPlugin):
    nodes_file = '/etc/ctdb/nodes'
    addresses_file = '/etc/ctdb/public_addresses'

    def init(self):
        self.title = _('Samba Cluster')
        self.icon = 'folder-close'
        self.category = _('Software')

        self.append(self.ui.inflate('ctdb:main'))

        self.config_path = {
            'debian': '/etc/default/ctdb',
            'centos': '/etc/sysconfig/ctdb',
            'mageia': '/etc/sysconfig/ctdb'
        }[ajenti.platform]

        self.config = CTDBConfig(path=self.config_path)
        self.config.load()

        self.binder = Binder(None, self.find('main-config'))
        self.n_binder = Binder(None, self.find('nodes-config'))
        self.a_binder = Binder(None, self.find('addresses-config'))
        self.find('nodes').new_item = lambda c: NodeData()
        self.find('addresses').new_item = lambda c: self.new_address()

    def new_address(self):
        a = PublicAddressData()
        a.address = '192.168.0.1/24'
        return a

    def on_page_load(self):
        n_path = self.config.tree.nodes_file
        self.nodes_config = CTDBNodesConfig(path=n_path)
        if not os.path.exists(n_path):
            open(n_path, 'w').close()
        self.nodes_config.load()

        a_path = self.config.tree.public_addresses_file
        self.addresses_config = CTDBPublicAddressesConfig(path=a_path)
        if not os.path.exists(a_path):
            open(a_path, 'w').close()
        self.addresses_config.load()

        self.config.load()
        self.binder.setup(self.config.tree).populate()
        self.n_binder.setup(self.nodes_config.tree).populate()
        self.a_binder.setup(self.addresses_config.tree).populate()
        self.refresh()

    @on('refresh', 'click')
    def refresh(self):
        try:
            self.find('status').value = subprocess.check_output(['ctdb', 'status'])
            self.find('status-ip').value = subprocess.check_output(['ctdb', 'ip'])
        except:
            self.find('status').value = _('Failed to obtain CTDB status')

    @on('save', 'click')
    def save(self):
        self.binder.update()
        self.n_binder.update()
        self.a_binder.update()
        self.config.save()
        self.nodes_config.save()
        self.addresses_config.save()
        self.context.notify('info', _('Saved'))


text:
How to Build a Marvel Universe Movie CLI Gem

1. Plan your gem, imagine your interface
2. Start with the project structure - google
3. Start with the entry point - the file run
4. force that to build the CLI interface
5. stub out the interface
6. start making things real
7. discover objects.
8. program

A command line interface for upcoming, and available now Marvel Universe Movies

user types marvel-movies

Show a list of options: (FIRST MENU)
1. Show a list of All Movies
2. Show only Upcoming Movies
3. Show movies Available Now on DVD
4. Exit

When movies are displayed this menu will be displaced

1. Which movie do you want to see a description about
2. Back
3. Exit


text:
package main

import (
	"context"
	"fmt"
	"os"
	"text/tabwriter"
	"time"
)

var cmdList = &Command{
	Name: "list",
	Run:  runList,
}

func runList(ctx context.Context, args []string) (err error) {
	// Ask the registry for a list.
	registry := getRegistry(ctx)
	jobs, err := registry.ListBackups(ctx)
	if err != nil {
		err = fmt.Errorf("ListBackups: %v", err)
		return
	}

	// Print each.
	const minwidth = 0
	const tabwidth = 8
	const padding = 4
	const padchar = '\t'
	const flags = 0

	w := new(tabwriter.Writer)
	w.Init(os.Stdout, minwidth, tabwidth, padding, padchar, flags)

	fmt.Fprintln(w)
	fmt.Fprintln(w, "Start time\tJob name\tScore")

	for _, job := range jobs {
		fmt.Fprintf(
			w,
			"%s\t%s\t%s\n",
			job.StartTime.Format(time.RFC3339Nano),
			job.Name,
			job.Score.Hex(),
		)
	}

	w.Flush()

	return
}


text:
<?php
require_once '../JSLikeHTMLElement.php';
header('Content-Type: text/plain');
$doc = new DOMDocument();
$doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement');
$doc->loadHTML('

Para 1

Para 2

');
$elem = $doc->getElementsByTagName('div')->item(0);

// print innerHTML
echo $elem->innerHTML; // prints '
Para 1

Para 2
'
echo "\n\n";

// set innerHTML
$elem->innerHTML = 'FiveFilters.org';
echo $elem->innerHTML; // prints 'FiveFilters.org'
echo "\n\n";

// print document (with our changes)
echo $doc->saveXML();
?>


text:
exports.getCommands = function () {
    var packageName = 'yantra';
    var masterCommand = 'yantra';
    return [
        {
            "shortcut": packageName + "-init",
            "command": masterCommand + " init"
        },
        {
            "shortcut": packageName + "-server",
            "command": masterCommand + " server -c ./configurations/configurations.json -p 9000 -a 11000 -d true"
        },
        {
            "shortcut": packageName + "-build",
            "command": masterCommand + " compile -e dev -c ./configurations/configurations.json -d true"
        },
        {
            "shortcut": packageName + "-publish",
            "command": masterCommand + " publish -e dev -c ./configurations/configurations.json -d false"
        },
        {
            "shortcut": packageName + "-release",
            "command": masterCommand + " publish -e prod -c ./configurations/configurations.json -d false"
        }
    ];
};


text:
<?php
/**
 * class for user entered input
 *
 * @since  2014-05-08
 * @author Patrick Forget <patforg@geekpad.ca>
 */

namespace Informant\Input;

/**
 * class for user entered input
 *
 * @since  2014-05-08
 * @author Patrick Forget <patforg@geekpad.ca>
 */
class ChoiceListInput extends BaseInput
{

    /**
     * @since  2014-05-10
     * @author Patrick Forget <patforg@geekpad.ca>
     */
    protected static function getDefaultValues() {
        static $defaultValues = null;
        if ($defaultValues === null) {
            $defaultValues = array_merge(parent::getDefaultValues(), array(
                'choices' => array()
            ));
        } //if

        return $defaultValues;
    } // getDefaultValues()

    /**
     * adds choice key values
     *
     * @since  2014-05-09
     * @author Patrick Forget <patforg@geekpad.ca>
     */
    public function addChoice($label, $value = null) {
        if ($value === null) {
            $value = $label;
        } //if
        $this->addToList('choices', $label, $value);
    } // addInstruction()

    /**
     * add multiple choices messages
     *
     * @since  2014-05-10
     * @author Patrick Forget <patforg@geekpad.ca>
     */
    public function addChoices($choices) {
        $this->addMultipleToList('choices', $choices);
    } // addChoices()

} //  ChoiceListInput class


text:
namespace app { namespace Experimental { namespace Physics { struct PointerVelocity__float2; } } }
namespace app { namespace Fuse { namespace Elements { struct Element; } } }
namespace app { namespace Fuse { namespace Gestures { struct SwipeGestureHelper; } } }
namespace app { namespace Fuse { namespace Input { struct PointerMovedArgs; } } }
namespace app { namespace Fuse { namespace Input { struct PointerPressedArgs; } } }
namespace app { namespace Fuse { namespace Input { struct PointerReleasedArgs; } } }

namespace app {
namespace Fuse {
namespace Gestures {
namespace Internal {

struct EdgeSwiper;

extern ::uStaticStrong< ::app::Fuse::Gestures::SwipeGestureHelper*> EdgeSwiper___leftRightSwipe;
extern ::uStaticStrong< ::app::Fuse::Gestures::SwipeGestureHelper*> EdgeSwiper___upDownSwipe;

struct EdgeSwiper__uType : ::uClassType
{
};

EdgeSwiper__uType* EdgeSwiper__typeof();

void EdgeSwiper___ObjInit(EdgeSwiper* __this);
void EdgeSwiper___TypeInit(::uStatic* __this);
void EdgeSwiper__add_ProgressChanged(EdgeSwiper* __this, ::uDelegate* value);
void EdgeSwiper__CalcProgress(EdgeSwiper* __this);
void EdgeSwiper__CheckNeedUpdated(EdgeSwiper* __this, bool off);
void EdgeSwiper__Disable(EdgeSwiper* __this);
void EdgeSwiper__Enable(EdgeSwiper* __this);
::app::Uno::Float2 EdgeSwiper__FromWindow(EdgeSwiper* __this, ::app::Uno::Float2 p);
int EdgeSwiper__get_Edge(EdgeSwiper* __this);
float EdgeSwiper__get_EdgeThreshold(EdgeSwiper* __this);
bool EdgeSwiper__get_IsEnabled(EdgeSwiper* __this);
double EdgeSwiper__get_Progress(EdgeSwiper* __this);
::app::Fuse::Elements::Element* EdgeSwiper__get_Target(EdgeSwiper* __this);
bool EdgeSwiper__IsWithinSwipeBounds(EdgeSwiper* __this, ::app::Uno::Float2 windowPoint);
void EdgeSwiper__MoveUser(EdgeSwiper* __this, ::app::Uno::Float2 coord);
EdgeSwiper* EdgeSwiper__New_1(::uStatic* __this);
void EdgeSwiper__OnLostCapture(EdgeSwiper* __this);
void EdgeSwiper__OnPointerMoved(EdgeSwiper* __this, ::uObject* sender, ::app::Fuse::Input::PointerMovedArgs* args);
void EdgeSwiper__OnPointerPressed(EdgeSwiper* __this, ::uObject* sender, ::app::Fuse::Input::PointerPressedArgs* args);
void EdgeSwiper__OnPointerReleased(EdgeSwiper* __this, ::uObject* sender, ::app::Fuse::Input::PointerReleasedArgs* args);
void EdgeSwiper__OnUpdated(EdgeSwiper* __this);
float EdgeSwiper__PrimaryValue(EdgeSwiper* __this, ::app::Uno::Float2 v);
void EdgeSwiper__remove_ProgressChanged(EdgeSwiper* __this, ::uDelegate* value);
void EdgeSwiper__Rooted(EdgeSwiper* __this, ::app::Fuse::Elements::Element* e);
void EdgeSwiper__Seek(EdgeSwiper* __this, double progress);
void EdgeSwiper__set_Edge(EdgeSwiper* __this, int value);
void EdgeSwiper__set_EdgeThreshold(EdgeSwiper* __this, float value);
void EdgeSwiper__set_Progress(EdgeSwiper* __this, double value);
void EdgeSwiper__set_Target(EdgeSwiper* __this, ::app::Fuse::Elements::Element* value);
void EdgeSwiper__Unrooted(EdgeSwiper* __this);

struct EdgeSwiper : ::uObject
{
    ::uStrong< ::uObject*> _pointBody1D;
    float _edgeThreshold;
    double _progress;
    int _edge;
    ::uStrong< ::app::Fuse::Elements::Element*> _target;
    ::app::Uno::Float2 _previousCoord;
    ::app::Uno::Float2 _currentCoord;
    ::app::Uno::Float2 _startCoord;
    double _startProgress;
    double _prevTime;
    float _velocityThreshold;
    int _down;
    bool _isHardCapture;
    ::uStrong< ::app::Experimental::Physics::PointerVelocity__float2*> _velocity;
    ::uStrong< ::app::Fuse::Elements::Element*> _element;
    bool _hasUpdated;
    ::uStrong< ::uDelegate*> ProgressChanged;

    void _ObjInit() { EdgeSwiper___ObjInit(this); }
    void add_ProgressChanged(::uDelegate* value) { EdgeSwiper__add_ProgressChanged(this, value); }
    void CalcProgress() { EdgeSwiper__CalcProgress(this); }
    void CheckNeedUpdated(bool off) { EdgeSwiper__CheckNeedUpdated(this, off); }
    void Disable() { EdgeSwiper__Disable(this); }
    void Enable() { EdgeSwiper__Enable(this); }
    ::app::Uno::Float2 FromWindow(::app::Uno::Float2 p) { return EdgeSwiper__FromWindow(this, p); }
    int Edge() { return EdgeSwiper__get_Edge(this); }
    float EdgeThreshold() { return EdgeSwiper__get_EdgeThreshold(this); }
    bool IsEnabled() { return EdgeSwiper__get_IsEnabled(this); }
    double Progress() { return EdgeSwiper__get_Progress(this); }
    ::app::Fuse::Elements::Element* Target() { return EdgeSwiper__get_Target(this); }
    bool IsWithinSwipeBounds(::app::Uno::Float2 windowPoint) { return EdgeSwiper__IsWithinSwipeBounds(this, windowPoint); }
    void MoveUser(::app::Uno::Float2 coord) { EdgeSwiper__MoveUser(this, coord); }
    void OnLostCapture() { EdgeSwiper__OnLostCapture(this); }
    void OnPointerMoved(::uObject* sender, ::app::Fuse::Input::PointerMovedArgs* args) { EdgeSwiper__OnPointerMoved(this, sender, args); }
    void OnPointerPressed(::uObject* sender, ::app::Fuse::Input::PointerPressedArgs* args) { EdgeSwiper__OnPointerPressed(this, sender, args); }
    void OnPointerReleased(::uObject* sender, ::app::Fuse::Input::PointerReleasedArgs* args) { EdgeSwiper__OnPointerReleased(this, sender, args); }
    void OnUpdated() { EdgeSwiper__OnUpdated(this); }
    float PrimaryValue(::app::Uno::Float2 v) { return EdgeSwiper__PrimaryValue(this, v); }
    void remove_ProgressChanged(::uDelegate* value) { EdgeSwiper__remove_ProgressChanged(this, value); }
    void Rooted(::app::Fuse::Elements::Element* e) { EdgeSwiper__Rooted(this, e); }
    void Seek(double progress) { EdgeSwiper__Seek(this, progress); }
    void Edge(int value) { EdgeSwiper__set_Edge(this, value); }
    void EdgeThreshold(float value) { EdgeSwiper__set_EdgeThreshold(this, value); }
    void Progress(double value) { EdgeSwiper__set_Progress(this, value); }
    void Target(::app::Fuse::Elements::Element* value) { EdgeSwiper__set_Target(this, value); }
    void Unrooted() { EdgeSwiper__Unrooted(this); }
};

}}}}

#endif


text:
/*
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

Note:
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
*/

public class Solution {
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int index1 = m - 1;
        int index2 = n - 1;
        int index = m + n - 1;
        while (index1 > -1 && index2 > -1)
            nums1[index--] = nums1[index1] < nums2[index2] ? nums2[index2--] : nums1[index1--];
        while (index2 > -1)
            nums1[index--] = nums2[index2--];
    }
}


text:
import { accessSync } from "fs";
import { workspace } from "vscode";

class FileType {
  constructor(public found: boolean, public name: string) { }
}

export class MappedList {
  private mUntrackedList: Map<string, FileType[]> | null = null;

  constructor() {
    if (workspace.workspaceFolders !== undefined && workspace.workspaceFolders.length > 0) {
      this.mUntrackedList = new Map<string, FileType[]>();
      workspace.workspaceFolders.forEach((val) => {
        this.mUntrackedList?.set(val.uri.fsPath, []);
      });
    }
  }

  exists(iVal: string): boolean {
    if (this.mUntrackedList !== null) {
      const keys = this.mUntrackedList.keys();
      for (const key of keys) {
        if (iVal.includes(key)) {
          const v = this.mUntrackedList.get(key);
          const o = v?.find((val) => val.name === iVal);
          if (undefined !== o) {
            return true;
          }
        }
      }
    }
    return false;
  }

  addString(iVal: string): void {
    if (this.mUntrackedList !== null && workspace.workspaceFolders !== undefined) {
      let i = 0;
      for (; i < workspace.workspaceFolders.length; i++) {
        if (iVal.includes(workspace.workspaceFolders[i].uri.fsPath)) {
          break;
        }
      }
      if (i < workspace.workspaceFolders.length) {
        const v = this.mUntrackedList.get(workspace.workspaceFolders[i].uri.fsPath);
        if (v !== undefined) {
          v.push(new FileType(true, iVal));
          this.mUntrackedList.set(workspace.workspaceFolders[i].uri.fsPath, v);
        }
      }
    }
  }

  addStringByKey(iVal: string, iKey: string): void {
    if (this.mUntrackedList !== null) {
      if (this.mUntrackedList.get(iKey) !== undefined) {
        const v = this.mUntrackedList.get(iKey);
        const o = v?.find((val) => val.name === iVal);
        if (undefined === o && v !== undefined) {
          v.push(new FileType(true, iVal));
          this.mUntrackedList.set(iKey, v);
        } else if (o !== undefined) {
          o.found = true;
        }
      }
    }
  }

  addStringsByKey(iVal: FileType[], iKey: string): void {
    if (this.mUntrackedList !== null) {
      if (this.mUntrackedList.get(iKey) !== undefined) {
        this.mUntrackedList.set(iKey, iVal);
      }
    }
  }

  getStringsByKey(iKey: string | undefined): string[] | undefined {
    if (iKey === undefined) {
      return;
    }
    if (this.mUntrackedList !== null) {
      if (this.mUntrackedList.get(iKey) !== undefined) {
        return this.mUntrackedList.get(iKey)?.map((val) => val.name);
      }
    }
    return [];
  }

  clearStringsOfKey(iKey: string): void {
    if (this.mUntrackedList !== null) {
      if (this.mUntrackedList.get(iKey) !== undefined) {
        this.mUntrackedList.set(iKey, []);
      }
    }
  }

  parse(filelist: string[]): void {
    if (filelist !== null && this.mUntrackedList !== null) {
      for (let i = 0; i < filelist.length; i = i + 2) {
        this.mUntrackedList.set(
          filelist[i],
          filelist[i + 1].split(";").map((val) => new FileType(false, val))
        );
      }
    }
  }

  stringify(): string[] {
    const f = [];
    if (this.mUntrackedList !== null) {
      const keys = this.mUntrackedList.keys();
      for (const key of keys) {
        const objs = this.mUntrackedList
          .get(key)
          ?.map((val) => val.name)
          .join(";");
        if (objs !== undefined) {
          f.push(key);
          f.push(objs);
        }
      }
    }
    return f;
  }

  cleanMap(): void {
    if (this.mUntrackedList !== null) {
      const keys = this.mUntrackedList.keys();
      for (const key of keys) {
        const objs = this.mUntrackedList.get(key)?.filter((val) => val.found);
        if (objs !== undefined) {
          this.mUntrackedList.set(
            key,
            objs.map((val) => {
              val.found = false;
              return val;
            })
          );
        }
      }
    }
  }

  updateEntryExistsOnFileSystem(): void {
    if (this.mUntrackedList !== null) {
      const keys = this.mUntrackedList.keys();
      for (const key of keys) {
        const objs = this.mUntrackedList.get(key)?.filter((val) => {
          try {
            accessSync(val.name);
            val.found = true;
          } catch {
            val.found = false;
          }
        });
        if (objs !== undefined) {
          this.mUntrackedList.set(key, objs);
        }
      }
    }
  }

  resetFoundState(): void {
    if (this.mUntrackedList !== null) {
      const keys = this.mUntrackedList.keys();
      for (const key of keys) {
        const objs = this.mUntrackedList.get(key);
        if (objs !== undefined) {
          this.mUntrackedList.set(
            key,
            objs.map((val) => {
              val.found = false;
              return val;
            })
          );
        }
      }
    }
  }
}


text:
<?php
/**
 * Module Name: Photon
 * Module Description: Serve images from our servers
 * Jumpstart Description: Mirrors and serves your images from our free and fast image CDN, improving your site's performance with no additional load on your servers.
 * Sort Order: 25
 * Recommendation Order: 1
 * First Introduced: 2.0
 * Requires Connection: Yes
 * Auto Activate: No
 * Module Tags: Photos and Videos, Appearance, Recommended
 * Feature: Recommended, Jumpstart, Appearance
 * Additional Search Queries: photon, image, cdn, performance, speed
 */

Jetpack::dns_prefetch( array(
	'//i0.wp.com',
	'//i1.wp.com',
	'//i2.wp.com',
) );

Jetpack_Photon::instance();


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" />

    <leaflet lf-center="center" layers="layers" width="100%" height="480px"></leaflet>

HeatMap example

This example uses the Leaflet.heat library.

The example is inspired in this Google Maps Heat example.


text:
using System.Web.Mvc;

namespace Snittlistan.Web.HtmlHelpers;
public static class CustomHtmlHelpers
{
    /// <summary>
    /// Returns link to BITS for match facts.
    /// </summary>
    /// <param name="html">The HTML helper instance that this method extends.</param>
    /// <param name="bitsMatchId">BITS match id.</param>
    /// <returns>The HTML markup with an anchor link to BITS.</returns>
    public static string GenerateBitsUrl(this HtmlHelper html, int bitsMatchId)
    {
        return GenerateBitsUrl(bitsMatchId);
    }

    public static string GenerateBitsUrl(int bitsMatchId)
    {
        return $"https://bits.swebowl.se/match-detail?matchid={bitsMatchId}";
    }
}


text:
namespace Google.Cloud.ApigeeRegistry.V1.Snippets
{
    // [START apigeeregistry_v1_generated_Registry_ReplaceArtifact_sync_flattened]
    using Google.Cloud.ApigeeRegistry.V1;

    public sealed partial class GeneratedRegistryClientSnippets
    {
        /// <summary>Snippet for ReplaceArtifact</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ReplaceArtifact()
        {
            // Create client
            RegistryClient registryClient = RegistryClient.Create();
            // Initialize request argument(s)
            Artifact artifact = new Artifact();
            // Make the request
            Artifact response = registryClient.ReplaceArtifact(artifact);
        }
    }
    // [END apigeeregistry_v1_generated_Registry_ReplaceArtifact_sync_flattened]
}


text:
// .NAME vtkRBNNGraphFilter - creates a RBNN graph on a vtkPointSet
//
// .SECTION Description
// vtkRBNNGraphFilter creates a Radially Bounded Nearest Neighbor (RBNN) graph on a
// vtkPointSet. That is, it and creates a graph with every point connected to all of its
// neighbors within Radius.
//
// .SECTION See Also

#ifndef __vtkRBNNGraphFilter_h
#define __vtkRBNNGraphFilter_h

#include "vtkPointGraphFilter.h" //superclass

class vtkRBNNGraphFilter : public vtkPointGraphFilter
{
public:
  static vtkRBNNGraphFilter *New();
  vtkTypeMacro(vtkRBNNGraphFilter, vtkGraphAlgorithm);
  void PrintSelf(ostream &os, vtkIndent indent);

  // Description:
  // The radius of the sphere to look for neighbors.
  vtkSetMacro(Radius, double);
  vtkGetMacro(Radius, double);

  // Description:
  // The maximum number of neighbors to find for each point. This is
  // zero by default, indicating we want all of the neighbors within
  // Radius.
  vtkSetMacro(MaxNeighbors, int);
  vtkGetMacro(MaxNeighbors, int);

protected:
  // Description:
  // This is the function that the superclass requires that we implement.
  // It creates an edge between every vertex and all of its neigbors within
  // Radius (up to MaxNeighbors).
  void CreateEdgesOnPoints();

  vtkRBNNGraphFilter();
  ~vtkRBNNGraphFilter() {};

  // Description:
  // The radius of the sphere to look for neighbors.
  double Radius;

  // Description:
  // The maximum number of neighbors to find for each point.
  int MaxNeighbors;

private:

  vtkRBNNGraphFilter(const vtkRBNNGraphFilter&);  // Not implemented.
  void operator=(const vtkRBNNGraphFilter&);  // Not implemented.
};

#endif


text:
package com.netflix.simianarmy.basic;

import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.netflix.simianarmy.MonkeyRecorder;

/**
 * The Class BasicRecorderEvent.
 */
public class BasicRecorderEvent implements MonkeyRecorder.Event {

    /** The monkey type. */
    private Enum monkeyType;

    /** The event type. */
    private Enum eventType;

    /** The event id. */
    private String id;

    /** The event region. */
    private String region;

    /** The fields. */
    private Map<String, String> fields = new HashMap<String, String>();

    /** The event time. */
    private Date date;

    /**
     * Instantiates a new basic recorder event.
     *
     * @param monkeyType
     *            the monkey type
     * @param eventType
     *            the event type
     * @param region
     *            the region event occured in
     * @param id
     *            the event id
     */
    public BasicRecorderEvent(Enum monkeyType, Enum eventType, String region, String id) {
        this.monkeyType = monkeyType;
        this.eventType = eventType;
        this.id = id;
        this.region = region;
        this.date = new Date();
    }

    /**
     * Instantiates a new basic recorder event.
     *
     * @param monkeyType
     *            the monkey type
     * @param eventType
     *            the event type
     * @param region
     *            the region event occured in
     * @param id
     *            the event id
     * @param time
     *            the event time
     */
    public BasicRecorderEvent(Enum monkeyType, Enum eventType, String region, String id, long time) {
        this.monkeyType = monkeyType;
        this.eventType = eventType;
        this.id = id;
        this.region = region;
        this.date = new Date(time);
    }

    /** {@inheritDoc} */
    public String id() {
        return id;
    }

    /** {@inheritDoc} */
    public String region() {
        return region;
    }

    /** {@inheritDoc} */
    public Date eventTime() {
        return new Date(date.getTime());
    }

    /** {@inheritDoc} */
    public Enum monkeyType() {
        return monkeyType;
    }

    /** {@inheritDoc} */
    public Enum eventType() {
        return eventType;
    }

    /** {@inheritDoc} */
    public Map<String, String> fields() {
        return Collections.unmodifiableMap(fields);
    }

    /** {@inheritDoc} */
    public String field(String name) {
        return fields.get(name);
    }

    /**
     * Adds the fields.
     *
     * @param toAdd
     *            the fields to set
     * @return <b>this</b> so you can chain many addFields calls together
     */
    public MonkeyRecorder.Event addFields(Map<String, String> toAdd) {
        fields.putAll(toAdd);
        return this;
    }

    /** {@inheritDoc} */
    public MonkeyRecorder.Event addField(String name, String value) {
        fields.put(name, value);
        return this;
    }
}


text:
import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import routes from './routes'

Vue.use(VueRouter)

const router = new VueRouter({
  scrollBehavior: () => ({ y: 0 }),
  routes
})

new Vue({
  router,
  el: '#app',
  render: h => h(App)
})


text:
package servenv

import (
	"testing"
	"time"

	"vitess.io/vitess/go/event"
)

func TestFireOnTermSyncHooksFinished(t *testing.T) {
	onTermSyncHooks = event.Hooks{}

	triggered1 := false
	OnTermSync(func() {
		triggered1 = true
	})
	triggered2 := false
	OnTermSync(func() {
		triggered2 = true
	})

	if finished, want := fireOnTermSyncHooks(1*time.Second), true; finished != want {
		t.Errorf("finished = %v, want %v", finished, want)
	}
	if want := true; triggered1 != want {
		t.Errorf("triggered1 = %v, want %v", triggered1, want)
	}
	if want := true; triggered2 != want {
		t.Errorf("triggered1 = %v, want %v", triggered2, want)
	}
}

func TestFireOnTermSyncHooksTimeout(t *testing.T) {
	onTermSyncHooks = event.Hooks{}

	OnTermSync(func() {
		time.Sleep(1 * time.Second)
	})

	if finished, want := fireOnTermSyncHooks(1*time.Nanosecond), false; finished != want {
		t.Errorf("finished = %v, want %v", finished, want)
	}
}

func TestFireOnCloseHooksTimeout(t *testing.T) {
	onCloseHooks = event.Hooks{}

	OnClose(func() {
		time.Sleep(1 * time.Second)
	})

	// we deliberatly test the flag to make sure it's not accidently set to a
	// high value.
	if finished, want := fireOnCloseHooks(onCloseTimeout), false; finished != want {
		t.Errorf("finished = %v, want %v", finished, want)
	}
}


text:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Web;

namespace Custom.Containers
{
    using Custom.Mapping;
    using Custom.Social;

    public class SocialDbContext : DbContext
    {
        public SocialDbContext()
            : base("name=SocialDbContext")
        {
        }

        public DbSet<Message> Messages { get; set; }
        public DbSet<Identity> Identities { get; set; }
        public DbSet<Contact> Contacts { get; set; }
        public DbSet<Circle> Circles { get; set; }
        public DbSet<Exchange> Exchanges { get; set; }
        public DbSet<Broadcast> Broadcasts { get; set; }
        public DbSet<Session> Sessions { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations
                .Add(new IdentityMap())
                .Add(new CircleMap())
                .Add(new ContactMap())
                .Add(new MessageMap())
                .Add(new ExchangeMap())
                .Add(new BroadcastMap())
                .Add(new SessionMap());

            base.OnModelCreating(modelBuilder);
        }

    }
}


text:
using System;
using Remotion.Linq.Clauses;

namespace Remotion.Linq
{
  /// <summary>
  /// Defines an interface for visiting the clauses of a <see cref="QueryModel"/>.
  /// </summary>
  /// <remarks>
  /// <para>
  /// When implement this interface, implement <see cref="VisitQueryModel"/>, then call <c>Accept</c> on every clause that should
  /// be visited. Child clauses, joins, orderings, and result operators are not visited automatically; they always need to be explicitly visited
  /// via <see cref="IBodyClause.Accept"/>, <see cref="JoinClause.Accept(IQueryModelVisitor, QueryModel, int)"/>, <see cref="Ordering.Accept"/>,
  /// <see cref="ResultOperatorBase.Accept"/>, and so on.
  /// </para>
  /// <para>
  /// <see cref="QueryModelVisitorBase"/> provides a robust default implementation of this interface that can be used as a base for other visitors.
  /// </para>
  /// </remarks>
  internal interface IQueryModelVisitor
  {
    void VisitQueryModel (QueryModel queryModel);
    void VisitMainFromClause (MainFromClause fromClause, QueryModel queryModel);
    void VisitAdditionalFromClause (AdditionalFromClause fromClause, QueryModel queryModel, int index);
    void VisitJoinClause (JoinClause joinClause, QueryModel queryModel, int index);
    void VisitJoinClause (JoinClause joinClause, QueryModel queryModel, GroupJoinClause groupJoinClause);
    void VisitGroupJoinClause (GroupJoinClause joinClause, QueryModel queryModel, int index);
    void VisitWhereClause (WhereClause whereClause, QueryModel queryModel, int index);
    void VisitOrderByClause (OrderByClause orderByClause, QueryModel queryModel, int index);
    void VisitOrdering (Ordering ordering, QueryModel queryModel, OrderByClause orderByClause, int index);
    void VisitSelectClause (SelectClause selectClause, QueryModel queryModel);
    void VisitResultOperator (ResultOperatorBase resultOperator, QueryModel queryModel, int index);
  }
}


text:
package edu.umd.cs.findbugs.classfile.engine.bcel;

import org.apache.bcel.classfile.Method;
import org.apache.bcel.generic.MethodGen;

import edu.umd.cs.findbugs.ba.AnalysisContext;
import edu.umd.cs.findbugs.ba.AnalysisFeatures;
import edu.umd.cs.findbugs.ba.CFG;
import edu.umd.cs.findbugs.ba.ClassContext;
import edu.umd.cs.findbugs.ba.DepthFirstSearch;
import edu.umd.cs.findbugs.ba.MethodUnprofitableException;
import edu.umd.cs.findbugs.ba.type.ExceptionSetFactory;
import edu.umd.cs.findbugs.ba.type.TypeAnalysis;
import edu.umd.cs.findbugs.ba.type.TypeDataflow;
import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
import edu.umd.cs.findbugs.classfile.IAnalysisCache;
import edu.umd.cs.findbugs.classfile.MethodDescriptor;

/**
 * Analysis engine to produce TypeDataflow objects for analyzed methods.
 *
 * @author David Hovemeyer
 */
public class TypeDataflowFactory extends AnalysisFactory<TypeDataflow> {
    /**
     * Constructor.
     */
    public TypeDataflowFactory() {
        super("type analysis", TypeDataflow.class);
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * edu.umd.cs.findbugs.classfile.IAnalysisEngine#analyze(edu.umd.cs.findbugs
     * .classfile.IAnalysisCache, java.lang.Object)
     */
    public TypeDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
        MethodGen methodGen = getMethodGen(analysisCache, descriptor);
        if (methodGen == null) {
            throw new MethodUnprofitableException(descriptor);
        }
        CFG cfg = getCFG(analysisCache, descriptor);
        DepthFirstSearch dfs = getDepthFirstSearch(analysisCache, descriptor);
        ExceptionSetFactory exceptionSetFactory = getExceptionSetFactory(analysisCache, descriptor);
        Method method = getMethod(analysisCache, descriptor);

        TypeAnalysis typeAnalysis = new TypeAnalysis(method, methodGen, cfg, dfs, AnalysisContext.currentAnalysisContext()
                .getLookupFailureCallback(), exceptionSetFactory);

        if (AnalysisContext.currentAnalysisContext().getBoolProperty(AnalysisFeatures.MODEL_INSTANCEOF)) {
            typeAnalysis.setValueNumberDataflow(getValueNumberDataflow(analysisCache, descriptor));
        }

        // Field store type database.
        // If present, this can give us more accurate type information
        // for values loaded from fields.
        typeAnalysis.setFieldStoreTypeDatabase(AnalysisContext.currentAnalysisContext().getFieldStoreTypeDatabase());

        TypeDataflow typeDataflow = new TypeDataflow(cfg, typeAnalysis);
        try {
            typeDataflow.execute();
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error performing type dataflow analysis of " + descriptor, e);
            throw e;
        }
        if (TypeAnalysis.DEBUG || ClassContext.DUMP_DATAFLOW_ANALYSIS) {
            ClassContext.dumpTypeDataflow(method, cfg, typeDataflow);
        }

        return typeDataflow;
    }
}


text:
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Andrey Abramov
/// @author Vasiliy Nabatchikov
////////////////////////////////////////////////////////////////////////////////

#include "Basics/Common.h"  // required for RocksDBColumnFamilyManager.h
#include "IResearchLinkHelper.h"
#include "IResearchView.h"
#include "Indexes/IndexFactory.h"
#include "Logger/LogMacros.h"
#include "Logger/Logger.h"
#include "RocksDBEngine/RocksDBColumnFamilyManager.h"
#include "RocksDBEngine/RocksDBLogValue.h"
#include "StorageEngine/EngineSelectorFeature.h"
#include "VocBase/LogicalCollection.h"
#include "VocBase/LogicalView.h"

#include <rocksdb/env_encryption.h>

#include "IResearchRocksDBLink.h"
#include "utils/encryption.hpp"

namespace arangodb {
namespace iresearch {

IResearchRocksDBLink::IResearchRocksDBLink(IndexId iid, LogicalCollection& collection, uint64_t objectId)
    : RocksDBIndex(iid, collection, IResearchLinkHelper::emptyIndexSlice(objectId).slice(),
                   RocksDBColumnFamilyManager::get(RocksDBColumnFamilyManager::Family::Invalid),
                   false),
      IResearchLink(iid, collection) {
  TRI_ASSERT(!ServerState::instance()->isCoordinator());
  _unique = false;  // cannot be unique since multiple fields are indexed
  _sparse = true;   // always sparse
}

void IResearchRocksDBLink::toVelocyPack(
    VPackBuilder& builder,
    std::underlying_type<Index::Serialize>::type flags) const {
  if (builder.isOpenObject()) {
    THROW_ARANGO_EXCEPTION(Result(  // result
        TRI_ERROR_BAD_PARAMETER,              // code
        std::string("failed to generate link definition for arangosearch view "
                    "RocksDB link '") +
            std::to_string(Index::id().id()) + "'"));
  }

  auto forPersistence = Index::hasFlag(flags, Index::Serialize::Internals);

  builder.openObject();

  if (!IResearchLink::properties(builder, forPersistence).ok()) {
    THROW_ARANGO_EXCEPTION(Result(
        TRI_ERROR_INTERNAL,
        std::string("failed to generate link definition for arangosearch view "
                    "RocksDB link '") +
            std::to_string(Index::id().id()) + "'"));
  }

  if (Index::hasFlag(flags, Index::Serialize::Internals)) {
    TRI_ASSERT(objectId() != 0);  // If we store it, it cannot be 0
    builder.add("objectId", VPackValue(std::to_string(objectId())));
  }

  if (Index::hasFlag(flags, Index::Serialize::Figures)) {
    builder.add("figures", VPackValue(VPackValueType::Object));
    toVelocyPackFigures(builder);
    builder.close();
  }

  builder.close();
}

class RocksDBCipherStream final : public irs::encryption::stream {
 public:
  typedef std::unique_ptr<rocksdb::BlockAccessCipherStream> StreamPtr;

  explicit RocksDBCipherStream(StreamPtr&& stream) noexcept
      : _stream(std::move(stream)) {
    TRI_ASSERT(_stream);
  }

  virtual size_t block_size() const override { return _stream->BlockSize(); }

  virtual bool decrypt(uint64_t offset, irs::byte_type* data, size_t size) override {
    return _stream->Decrypt(offset, reinterpret_cast<char*>(data), size).ok();
  }

  virtual bool encrypt(uint64_t offset, irs::byte_type* data, size_t size) override {
    return _stream->Encrypt(offset, reinterpret_cast<char*>(data), size).ok();
  }

 private:
  StreamPtr _stream;
};  // RocksDBCipherStream

class RocksDBEncryptionProvider final : public irs::encryption {
 public:
  static std::shared_ptr<RocksDBEncryptionProvider> make(rocksdb::EncryptionProvider& encryption,
                                                         rocksdb::Options const& options) {
    return std::make_shared<RocksDBEncryptionProvider>(encryption, options);
  }

  explicit RocksDBEncryptionProvider(rocksdb::EncryptionProvider& encryption,
                                     rocksdb::Options const& options)
      : _encryption(&encryption), _options(options) {}

  virtual size_t header_length() override {
    return _encryption->GetPrefixLength();
  }

  virtual bool create_header(std::string const& filename, irs::byte_type* header) override {
    return _encryption
        ->CreateNewPrefix(filename, reinterpret_cast<char*>(header), header_length())
        .ok();
  }

  virtual encryption::stream::ptr create_stream(std::string const& filename,
                                                irs::byte_type* header) override {
    rocksdb::Slice headerSlice(reinterpret_cast<char const*>(header), header_length());

    std::unique_ptr<rocksdb::BlockAccessCipherStream> stream;
    if (!_encryption
             ->CreateCipherStream(filename, _options, headerSlice, &stream)
             .ok()) {
      return nullptr;
    }

    return std::make_unique<RocksDBCipherStream>(std::move(stream));
  }

 private:
  rocksdb::EncryptionProvider* _encryption;
  rocksdb::EnvOptions _options;
};  // RocksDBEncryptionProvider

IResearchRocksDBLink::IndexFactory::IndexFactory(application_features::ApplicationServer& server)
    : IndexTypeFactory(server) {}

bool IResearchRocksDBLink::IndexFactory::equal(
    VPackSlice const& lhs,
    VPackSlice const& rhs,
    std::string const& dbname) const {
  return IResearchLinkHelper::equal(_server, lhs, rhs, dbname);
}

std::shared_ptr<Index> IResearchRocksDBLink::IndexFactory::instantiate(
    LogicalCollection& collection, VPackSlice const& definition,
    IndexId id, bool /*isClusterConstructor*/) const {
  uint64_t objectId = basics::VelocyPackHelper::stringUInt64(definition, StaticStrings::ObjectId);
  auto link = std::make_shared<IResearchRocksDBLink>(id, collection, objectId);

  auto const res = link->init(definition, [this](irs::directory& dir) {
    auto& selector = _server.getFeature<EngineSelectorFeature>();
    TRI_ASSERT(selector.isRocksDB());
    auto& engine = selector.engine<RocksDBEngine>();
    auto* encryption = engine.encryptionProvider();
    if (encryption) {
      dir.attributes().emplace<RocksDBEncryptionProvider>(*encryption,
                                                          engine.rocksDBOptions());
    }
  });

  if (!res.ok()) {
    THROW_ARANGO_EXCEPTION(res);
  }

  return link;
}

Result IResearchRocksDBLink::IndexFactory::normalize(
    VPackBuilder& normalized,
    VPackSlice definition,
    bool isCreation,
    TRI_vocbase_t const& vocbase) const {
  return IResearchLinkHelper::normalize(
      normalized, definition, isCreation, vocbase);
}

std::shared_ptr<IResearchRocksDBLink::IndexFactory> IResearchRocksDBLink::createFactory(
    application_features::ApplicationServer& server) {
  return std::shared_ptr<IResearchRocksDBLink::IndexFactory>(
      new IResearchRocksDBLink::IndexFactory(server));
}

}  // namespace iresearch
}  // namespace arangodb

namespace iresearch {

// use base irs::encryption type for ancestors
template<>
struct type<arangodb::iresearch::RocksDBEncryptionProvider> : type<irs::encryption> { };

}