text:
salt.cloud.clouds.msazure
=========================

.. automodule:: salt.cloud.clouds.msazure
    :members:


text:
package com.google.devtools.moe.client.directives;

import static com.google.devtools.moe.client.codebase.expressions.Parser.parseExpression;

import com.google.devtools.moe.client.MoeProblem;
import com.google.devtools.moe.client.codebase.Codebase;
import com.google.devtools.moe.client.codebase.CodebaseCreationError;
import com.google.devtools.moe.client.codebase.CodebaseMerger;
import com.google.devtools.moe.client.codebase.ExpressionEngine;
import com.google.devtools.moe.client.codebase.expressions.Parser.ParseError;
import com.google.devtools.moe.client.project.ProjectContext;
import dagger.Provides;
import dagger.multibindings.IntoMap;
import dagger.multibindings.StringKey;
import javax.inject.Inject;
import org.kohsuke.args4j.Option;

/**
 * Merge three codebases into one.
 */
public class MergeCodebasesDirective extends Directive {
  @Option(
    name = "--original_codebase",
    required = true,
    usage = "Codebase expression for the original repository"
  )
  String originalExpression = "";

  @Option(
    name = "--modified_codebase",
    required = true,
    usage = "Codebase expression for the modified repository"
  )
  String modifiedExpression = "";

  @Option(
    name = "--destination_codebase",
    required = true,
    usage = "Codebase expression for the destination repository"
  )
  String destinationExpression = "";

  private final ProjectContext context;

  private final ExpressionEngine expressionEngine;
  private final CodebaseMerger merger;

  @Inject
  MergeCodebasesDirective(
      ProjectContext context, ExpressionEngine expressionEngine, CodebaseMerger merger) {
    this.context = context;
    this.expressionEngine = expressionEngine;
    this.merger = merger;
  }

  @Override
  protected int performDirectiveBehavior() {
    Codebase originalCodebase;
    Codebase modifiedCodebase;
    Codebase destinationCodebase;
    try {
      originalCodebase =
          expressionEngine.createCodebase(parseExpression(originalExpression), context);
      modifiedCodebase =
          expressionEngine.createCodebase(parseExpression(modifiedExpression), context);
      destinationCodebase =
          expressionEngine.createCodebase(parseExpression(destinationExpression), context);
    } catch (ParseError e) {
      throw new MoeProblem(e, "Error parsing");
    } catch (CodebaseCreationError e) {
      throw new MoeProblem(e, "Error creating codebase");
    }
    merger.merge(originalCodebase, modifiedCodebase, destinationCodebase);
    return 0;
  }

  /**
   * A module to supply the directive and a description into maps in the graph.
   */
  @dagger.Module
  public static class Module implements Directive.Module<MergeCodebasesDirective> {
    private static final String COMMAND = "merge_codebases";

    @Override
    @Provides
    @IntoMap
    @StringKey(COMMAND)
    public Directive directive(MergeCodebasesDirective directive) {
      return directive;
    }

    @Override
    @Provides
    @IntoMap
    @StringKey(COMMAND)
    public String description() {
      return "Merges three codebases into a new codebase";
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
function Get-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $WorkflowHostUri,

        [Parameter(Mandatory = $true)]
        [System.String]
        $SPSiteUrl,

        [Parameter()]
        [System.Boolean]
        $AllowOAuthHttp,

        [Parameter()]
        [System.Management.Automation.PSCredential]
        $InstallAccount
    )

    Write-Verbose -Message "Getting the current Workflow Service Configuration(s)"

    $result = Invoke-SPDSCCommand -Credential $InstallAccount `
                                  -Arguments $PSBoundParameters `
                                  -ScriptBlock {
        $params = $args[0]

        $returnval = @{
            WorkflowHostUri = $null
            SPSiteUrl = $null
            AllowOAuthHttp = $null
        }
        $workflowProxy = Get-SPWorkflowServiceApplicationProxy

        if($null -ne $workflowProxy)
        {
            $returnval = @{
                WorkflowHostUri = $workflowProxy.GetHostname($SPSiteUrl)
                SPSiteUrl = $params.SPSiteUrl
                AllowOAuthHttp = $params.AllowOAuthHttp
            }
        }

        return $returnval
    }
    return $result
}

function Set-TargetResource
{
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $WorkflowHostUri,

        [Parameter(Mandatory = $true)]
        [System.String]
        $SPSiteUrl,

        [Parameter()]
        [System.Boolean]
        $AllowOAuthHttp,

        [Parameter()]
        [System.Management.Automation.PSCredential]
        $InstallAccount
    )

    Write-Verbose -Message "Registering the Workflow Service"

    ## Perform changes
    Invoke-SPDSCCommand -Credential $InstallAccount `
                        -Arguments @($PSBoundParameters) `
                        -ScriptBlock {
        $params = $args[0]

        $site = Get-SPSite $params.SPSiteUrl

        if ($null -eq $site)
        {
            throw "Specified site collection could not be found."
        }

        Write-Verbose -Message "Processing changes"

        Register-SPWorkflowService -WorkflowHostUri $params.WorkflowHostUri `
            -SPSite $params.SPSiteUrl `
            -AllowOAuthHttp:$params.AllowOAuthHttp -Force
    }
}

function Test-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Boolean])]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $WorkflowHostUri,

        [Parameter(Mandatory = $true)]
        [System.String]
        $SPSiteUrl,

        [Parameter()]
        [System.Boolean]
        $AllowOAuthHttp,

        [Parameter()]
        [System.Management.Automation.PSCredential]
        $InstallAccount
    )

    Write-Verbose -Message "Testing Workflow Service"

    $CurrentValues = Get-TargetResource @PSBoundParameters

    if ($null -eq $CurrentValues.WorkflowHostUri)
    {
        return $false
    }

    return Test-SPDscParameterState -CurrentValues $CurrentValues `
    -DesiredValues $PSBoundParameters `
    -ValuesToCheck @("Ensure")
}

Export-ModuleMember -Function *-TargetResource


text:
Sets properties on a web
## Syntax
```powershell
Set-PnPWeb [-SiteLogoUrl <String>]
           [-AlternateCssUrl <String>]
           [-Title <String>]
           [-Description <String>]
           [-MasterUrl <String>]
           [-CustomMasterUrl <String>]
           [-Web <WebPipeBind>]
```

## Parameters
Parameter|Type|Required|Description
---------|----|--------|-----------
|AlternateCssUrl|String|False||
|CustomMasterUrl|String|False||
|Description|String|False||
|MasterUrl|String|False||
|SiteLogoUrl|String|False||
|Title|String|False||
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|


text:
                ${i18n.selectQuery}:

    			<input type="select" data-dojo-type="dijit/form/FilteringSelect" data-dojo-props="name:'query',autoComplete:true,required:true,searchAttr:'description','class':'querySelect'" data-dojo-attach-point="querySelectDijit" data-dojo-attach-event="onChange:_onQueryChange"/>

                ${i18n.searchText.label}:

    			<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="searchTextDijit" data-dojo-props="name:'searchText',trim:true,required:true,value:'',placeholder:'${i18n.searchText.placeholder}','class':'searchText'" />

                <input type="checkbox" data-dojo-attach-point="containsSearchText" data-dojo-type="dijit/form/CheckBox" data-dojo-props="'class':'containsCheck'"/>
                ${i18n.exactMatches}

                ${i18n.searchButton.label}

                ${i18n.clearButton.label}


text:
#ifndef LWSDK_SERVER_H
#define LWSDK_SERVER_H

#include    <lwtypes.h>

/*
 * External Entry Points.  All entry points which may be called from the
 * host must be declared as XCALL types.  The obsolete XCALL_INIT is
 * still present but defined as nothing.
 */
#ifdef _MSWIN
    #define XCALL_(t)   t
#endif
#ifdef _LINUX
    #define XCALL_(t)   t
#endif
#ifdef _MACOS
    #define XCALL_(t)   t
#endif

#define XCALL_INIT

/*
 * Global Function.  The global function is a callback provided by the
 * host taking the following form.  A pointer for the given service name
 * is returned for the given useage.  The use codes are for services
 * that will be used once or that will be used many times.
 */
typedef void *  GlobalFunc (const char *serviceName /* ascii encoded */, int useMode);

#define GFUSE_TRANSIENT         0
#define GFUSE_ACQUIRE           1
#define GFUSE_RELEASE           2

/*
 * Activation Function.  The server entry points are all functions of
 * this kind, taking a version number, global function pointer, local
 * (class-specific) data and module data.  The return value indicates
 * if the service could run and the reason for failure if it couldn't.
 */
typedef int ActivateFunc (  int          version,
                            GlobalFunc  *global,
                            void        *local,
                            void        *serverData );

#define AFUNC_OK                0
#define AFUNC_BADVERSION        1
#define AFUNC_BADGLOBAL         2
#define AFUNC_BADLOCAL          3
#define AFUNC_BADAPP            4
#define AFUNC_BADAPP_SILENT     5

/*
 * This is a selection of some of the more useful language ID's,
 * although this list is far from complete.  Remaining codes can be
 * found by searching the Microsoft Windows documentation for OLE
 * LANGID codes.  Japanese strings should be encoded as JIS on Windows
 * and EUC on Unix.
 */
#define LANGID_GERMAN               0x0407
#define LANGID_USENGLISH            0x0409
#define LANGID_UKENGLISH            0x0809
#define LANGID_SPANISH              0x040a
#define LANGID_FRENCH               0x040c
#define LANGID_ITALIAN              0x0410
#define LANGID_JAPANESE             0x0411
#define LANGID_KOREAN               0x0412
#define LANGID_RUSSIAN              0x0419
#define LANGID_SWEDISH              0x041D
#define LANGID_CHINESE_SIMPLIFIED   0x0804

/*
 * Each server can contain a list of tagged strings which declare
 * some of the static information about that server.  Tags are a bitwise
 * OR of a SRVTAG code which selects the type of information, and a
 * language ID word which selects the language for which the string is
 * valid.
 */
#define SRVTAG_USERNAME     0x00000
#define SRVTAG_BUTTONNAME   0x10000
#define SRVTAG_CMDGROUP     0x20000
#define SRVTAG_MENU         0x30000
#define SRVTAG_DESCRIPTION  0x40000
#define SRVTAG_ENABLE       0x50000
#define SRVTAG_SELECTCMD    0x60000
#define SRVTAG_NODEGROUP    0x70000
#define SRVTAG_NODECONTEXT  0x80000
#define SRVTAG_TOGGLE       0x90000

typedef struct st_ServerTagInfo
{
    const char      *string; /* ascii encoded? */
    unsigned int     tag;

} ServerTagInfo;

/*
 * Server Definition Record.  Each server record describes a single
 * activation entry point in the plug-in module.  Each has a class,
 * a name, an activation function, and an array of tag info structs
 * terminated with a zero tag code.
 */
typedef struct st_ServerRecord
{
    const char      *className; /* ascii encoded */
    const char      *name; /* ascii encoded? */
    ActivateFunc    *activate;
    ServerTagInfo   *tagInfo;

} ServerRecord;

#define ServerUserName ServerTagInfo

#define LWSERVERINFO_GLOBAL "LW Server Info"

typedef struct st_LWServerInfo
{
    const char* /* language encoded */ (*path)        (const char* server_class /* ascii encoded */,const char* server_name /* ascii encoded? */);
    const char** /* ascii encoded? */  (*list)        (const char* server_class /* ascii encoded */);
} LWServerInfo;

#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="14" failures="0" errors="0" time="8.279">
  <testsuite name="undefined" errors="0" failures="0" skipped="0" timestamp="2022-10-25T19:36:50" time="6.975" tests="3">
    <testcase classname=" Parent element receives `checked="mixed"` state when some (but not all) children are checked" name=" Parent element receives `checked="mixed"` state when some (but not all) children are checked" time="0.199">
    </testcase>
    <testcase classname=" Parent element receives `checked="true"` state all children are checked" name=" Parent element receives `checked="true"` state all children are checked" time="0.093">
    </testcase>
    <testcase classname=" Clicking Parent element toggles all children" name=" Clicking Parent element toggles all children" time="0.077">
    </testcase>
  </testsuite>
  <testsuite name="Checkbox" errors="0" failures="0" skipped="0" timestamp="2022-10-25T19:36:50" time="7.354" tests="11">
    <testcase classname="Checkbox renders" name="Checkbox renders" time="0.15">
    </testcase>
    <testcase classname="Checkbox checked" name="Checkbox checked" time="0.069">
    </testcase>
    <testcase classname="Checkbox mixed" name="Checkbox mixed" time="0.058">
    </testcase>
    <testcase classname="Checkbox disabled" name="Checkbox disabled" time="0.041">
    </testcase>
    <testcase classname="Checkbox disabled & checked" name="Checkbox disabled & checked" time="0.04">
    </testcase>
    <testcase classname="Checkbox Accepts defaultChecked prop, and toggles value without change handler" name="Checkbox Accepts defaultChecked prop, and toggles value without change handler" time="0.046">
    </testcase>
    <testcase classname="Checkbox Accepts checked prop, and is readOnly without a change handler" name="Checkbox Accepts checked prop, and is readOnly without a change handler" time="0.043">
    </testcase>
    <testcase classname="Checkbox Triggers onChange handler" name="Checkbox Triggers onChange handler" time="0.054">
    </testcase>
    <testcase classname="Checkbox Checkbox readOnly doesn't register change events" name="Checkbox Checkbox readOnly doesn't register change events" time="0.056">
    </testcase>
    <testcase classname="Checkbox Supports aria-describedby" name="Checkbox Supports aria-describedby" time="0.035">
    </testcase>
    <testcase classname="Checkbox ripple effect" name="Checkbox ripple effect" time="0.065">
    </testcase>
  </testsuite>
</testsuites>


text:
require( 'mocha-runner/lib/chai-init' );

var isBroken = require( 'phantom-ownpropertynames/detect' );
if ( isBroken ) {
  Object.getOwnPropertyNames = function ( obj ) {
    return Object.keys( obj );
  };
}

var oldit = global.it;
var counter = 0;
global.it = function ( name, callback ) {
  counter++;
  oldit && oldit.call( null, counter + '. ' + name, callback );
};

var dom = require( 'domquery' );

beforeEach( function ( done ) {
  var me = this;
  dom( '

' ).insert( 'body' );
  me.$fixtures = dom( '#fixtures' );
  done && done();
} );

afterEach( function ( done ) {
  var me = this;
  dom( 'body' ).remove( '#fixtures' );
  me.$fixtures = null;
  done && done();
} );


text:
'use strict';

/**
 * Json object representing a recognized text region
 *
 */
class TextRecognitionResult {
  /**
   * Create a TextRecognitionResult.
   * @property {number} [page] The 1-based page number of the recognition
   * result.
   * @property {number} [clockwiseOrientation] The orientation of the image in
   * degrees in the clockwise direction. Range between [0, 360).
   * @property {number} [width] The width of the image in pixels or the PDF in
   * inches.
   * @property {number} [height] The height of the image in pixels or the PDF
   * in inches.
   * @property {string} [unit] The unit used in the Width, Height and
   * BoundingBox. For images, the unit is "pixel". For PDF, the unit is "inch".
   * Possible values include: 'pixel', 'inch'
   * @property {array} lines A list of recognized text lines.
   */
  constructor() {
  }

  /**
   * Defines the metadata of TextRecognitionResult
   *
   * @returns {object} metadata of TextRecognitionResult
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'TextRecognitionResult',
      type: {
        name: 'Composite',
        className: 'TextRecognitionResult',
        modelProperties: {
          page: {
            required: false,
            serializedName: 'page',
            type: {
              name: 'Number'
            }
          },
          clockwiseOrientation: {
            required: false,
            serializedName: 'clockwiseOrientation',
            type: {
              name: 'Number'
            }
          },
          width: {
            required: false,
            serializedName: 'width',
            type: {
              name: 'Number'
            }
          },
          height: {
            required: false,
            serializedName: 'height',
            type: {
              name: 'Number'
            }
          },
          unit: {
            required: false,
            nullable: true,
            serializedName: 'unit',
            type: {
              name: 'Enum',
              allowedValues: [ 'pixel', 'inch' ]
            }
          },
          lines: {
            required: true,
            serializedName: 'lines',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'LineElementType',
                  type: {
                    name: 'Composite',
                    className: 'Line'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = TextRecognitionResult;


text:
default : test
.PHONY : test setup

# Run all tests
test :
	mocha -R tap

# Run this in production
install :
	npm install

# Setup everything
setup :
	npm install

# Create fake data for testing
fake :
	coffee lib/fake_it 1000

send :
	curl http://localhost:3000/v1/activity -H "Content-Type: application/json" -d \
		'{ "actor": { "displayName": "Assaf" }, "verb": "posted" }'

# UI for ElasticSearch
es-view :
	dir=/usr/local/Cellar/elasticsearch/* ;\
	if [[ ! -f $${dir}/plugins/head/index.html ]] ; then \
		echo "Installing ElasticSearch head ..." ; \
		$${dir}/bin/plugin -install mobz/elasticsearch-head ; \
  fi
	open http://localhost:9200/_plugin/head/


text:
(function (exports){
  'use strict';

  exports.dLinkCamera = function (deviceId, markup, state, value, fragments, language) {
    var photo           = fragments.photo,
        photos          = fragments.photos,
        video           = fragments.video,
        videos          = fragments.videos,
        thumb           = fragments.thumb,
        stateOn         = '',
        stateOff        = '',
        status          = '',
        arm,
        disarm,
        tempPhotoMarkup = '',
        tempVideoMarkup = '',
        photoList,
        photoListParent,
        videoList,
        videoListParent,
        thumbPath,
        i               = 0,
        j               = 0,
        translate       = function (message) {
          var util;

          if ((typeof SB === 'object') && (typeof SB.util === 'object')) {
            message = SB.util.translate(message, 'dLinkCamera');
          }

          else {
            util    = require(__dirname + '/../../lib/sharedUtil').util;
            message = util.translate(message, 'dLinkCamera', language);
          }

          return message;
        };

    value = value || {};

    if (value.alarm === 'on') {
      stateOn = ' device-active';
      status  = translate('CAMERA_ARMED');
    }

    else if (value.alarm === 'off') {
      stateOff = ' device-active';
      status   = translate('CAMERA_DISARMED');
    }

    markup = markup.split('{{DEVICE_STATE_ON}}').join(stateOn);
    markup = markup.split('{{DEVICE_STATE_OFF}}').join(stateOff);
    markup = markup.split('{{ARMED_STATUS}}').join(status);
    markup = markup.split('{{DISARMED_STATUS}}').join(status);

    markup = markup.split('{{SCREENSHOT}}').join(translate('SCREENSHOT'));
    markup = markup.split('{{THUMBNAIL}}').join(translate('THUMBNAIL'));
    markup = markup.split('{{VIDEO}}').join(translate('VIDEO'));

    if ((value.photos) && (value.photos.length)) {
      for (i; i < value.photos.length; i += 1) {
        tempPhotoMarkup = tempPhotoMarkup + photo.split('{{PHOTO_NAME}}').join(value.photos[i].name);
        tempPhotoMarkup = tempPhotoMarkup.split('{{PHOTO_URL}}').join(value.photos[i].photo);
      }

      tempPhotoMarkup = tempPhotoMarkup.split('{{PHOTO}}').join(translate('PHOTO'));
      tempPhotoMarkup = tempPhotoMarkup.split('{{DEVICE_ID}}').join(deviceId);
      tempPhotoMarkup = photos.split('{{DLINKCAMERA_PHOTOS}}').join(tempPhotoMarkup);

      markup = markup.split('{{DLINKCAMERA_PHOTO_LIST}}').join(tempPhotoMarkup);
    }

    markup = markup.split('{{DLINKCAMERA_PHOTO_LIST}}').join('');

    if ((value.videos) && (value.videos.length)) {
      for (j; j < value.videos.length; j += 1) {
        thumbPath = value.videos[j].thumb || '';

        if (thumbPath) {
          tempVideoMarkup = tempVideoMarkup.split('{{VIDEO_THUMB}}').join(thumb);
          tempVideoMarkup = tempVideoMarkup.split('{{THUMB_URL}}').join(thumbPath);
        }

        tempVideoMarkup = tempVideoMarkup + video.split('{{VIDEO_NAME}}').join(value.videos[j].name);
        tempVideoMarkup = tempVideoMarkup.split('{{SCREEN_URL}}').join(value.videos[j].screen);
        tempVideoMarkup = tempVideoMarkup.split('{{VIDEO_URL}}').join(value.videos[j].video);
      }

      tempVideoMarkup = tempVideoMarkup.split('{{VIDEO_THUMB}}').join('');
      tempVideoMarkup = tempVideoMarkup.split('{{SCREENSHOT}}').join(translate('SCREENSHOT'));
      tempVideoMarkup = tempVideoMarkup.split('{{THUMBNAIL}}').join(translate('THUMBNAIL'));
      tempVideoMarkup = tempVideoMarkup.split('{{VIDEO}}').join(translate('VIDEO'));
      tempVideoMarkup = tempVideoMarkup.split('{{DEVICE_ID}}').join(deviceId);
      tempVideoMarkup = videos.split('{{DLINKCAMERA_VIDEOS}}').join(tempVideoMarkup);

      markup = markup.split('{{DLINKCAMERA_VIDEO_LIST}}').join(tempVideoMarkup);
    }

    markup = markup.split('{{DLINKCAMERA_VIDEO_LIST}}').join('');

    if (typeof SB === 'object') {
      photoListParent = SB.getByClass('image-list', SB.get(deviceId), 'div')[0];
      photoList       = SB.getByTag('ol', photoListParent)[0];
      videoListParent = SB.getByClass('video-list', SB.get(deviceId), 'div')[0];
      videoList       = SB.getByTag('ol', videoListParent)[0];

      if (SB.hasClass(SB.getByClass('selected', null, 'li')[0], deviceId)) {
        markup = markup.split('{{LAZY_LOAD_IMAGE}}').join('src');
      }

      markup = markup.split('{{LAZY_LOAD_IMAGE}}').join('data-src');
      markup = markup.split('{{LAZY_PLACEHOLDER_IMAGE}}').join('data-placeholder-image');

      arm    = SB.getByClass('fa-lock',   SB.get(deviceId), 'a')[0];
      disarm = SB.getByClass('fa-unlock', SB.get(deviceId), 'a')[0];

      if ((photoList) && (tempPhotoMarkup !== photoList.outerHTML)) {
        photoListParent.removeChild(photoList);
      }

      if ((value.photos) && ((!photoList) || (tempPhotoMarkup !== photoList.outerHTML))) {
        // Since this markup is explicitly inserted via the parser, we'll also
        // have to explicitly set the lazyload property.
        if (SB.hasClass(SB.getByClass('selected', null, 'li')[0], deviceId)) {
          tempPhotoMarkup = tempPhotoMarkup.split('{{LAZY_LOAD_IMAGE}}').join('src');
          tempPhotoMarkup = tempPhotoMarkup.split('{{LAZY_PLACEHOLDER_IMAGE}}').join('data-placeholder-src');
        }

        else {
          tempPhotoMarkup = tempPhotoMarkup.split('{{LAZY_LOAD_IMAGE}}').join('data-src');
          tempPhotoMarkup = tempPhotoMarkup.split('{{LAZY_PLACEHOLDER_IMAGE}}').join('src');
        }

        photoListParent.innerHTML = tempPhotoMarkup;
      }

      if ((videoList) && (tempVideoMarkup !== videoList.outerHTML)) {
        videoListParent.removeChild(videoList);
      }

      if ((value.videos) && ((!videoList) || (tempVideoMarkup !== videoList.outerHTML))) {
        // Since this markup is explicitly inserted via the parser, we'll also
        // have to explicitly set the lazyload property.
        if (SB.hasClass(SB.getByClass('selected', null, 'li')[0], deviceId)) {
          tempVideoMarkup = tempVideoMarkup.split('{{LAZY_LOAD_IMAGE}}').join('src');
          tempVideoMarkup = tempVideoMarkup.split('{{LAZY_PLACEHOLDER_IMAGE}}').join('data-placeholder-src');
        }

        else {
          tempVideoMarkup = tempVideoMarkup.split('{{LAZY_LOAD_IMAGE}}').join('data-src');
          tempVideoMarkup = tempVideoMarkup.split('{{LAZY_PLACEHOLDER_IMAGE}}').join('src');
        }

        videoListParent.innerHTML = tempVideoMarkup;
      }

      if ((value.alarm === 'on') && (!SB.hasClass(arm, 'device-on'))) {
        SB.addClass(arm,       'device-active');
        SB.removeClass(disarm, 'device-active');
        SB.putText(SB.getByTag('em', arm)[0],    status);
        SB.putText(SB.getByTag('em', disarm)[0], status);
        markup = '';
      }

      else if ((value.alarm === 'off') && (!SB.hasClass(disarm, 'device-on'))) {
        SB.addClass(disarm, 'device-active');
        SB.removeClass(arm, 'device-active');
        SB.putText(SB.getByTag('em', arm)[0],    status);
        SB.putText(SB.getByTag('em', disarm)[0], status);
        markup = '';
      }
    }

    return markup;
  };
})(typeof exports === 'undefined' ? this.SB.spec.parsers : exports);


text:
import type { CascaderOption } from './cascader-view'

export const optionSkeleton: CascaderOption[] = []


text:
virtual-host-generator
======================


text:
Suppose you have some class:

```java
class Conf {
    SubConf<List<String>> sub;
}
```

And some other class:

```java
class Listener {
    listen(SubConf<List<Integer>> obj);
}
```

And you want to check if field value from `Conf` could be used in listener:

```java
// for more complex cases there may be generics resolution too
// pure reflection just for clarity
Type listenerArg = Listener.class
                        .getMethod("listen", SubConf.class)
                        .getGenericParameterTypes()[0];
Type confField = Conf.getField("sub").getGenericType();

// not assignable because of list generics: String vs Integer
TypeUtils.isAssignable(confField, listnerArg) == false
```

!!! note
    Possible name variables (not resolved) in types are replaced with Object.class
    (`List<T> == List<Object>`). Use `context.resolveType(type)` to replace type variables
    with known types before comparison (and use `context.resolveTypeGenerics(type)` to get direct generics of type).

Types may also be checked for compatibility:

```java
Type one = List<Number> // ParameterizedType
Type two = List<Integer> // ParameterizedType

TypeUtils.isAssignable(one, two) == false
// means one assignable to two or two assignable to one
TypeUtils.isCompatible(one, two) == true
// detects type with more specific definition
TypeUtils.isMoreSpecific(one, two) == false
TypeUtils.getMoreSpecific(one, two) == two
```

If required, you can implement your own logic based on types comparison: see [types walker](../guide/walker.md) section.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/post_action_bar_height"
    android:baselineAligned="false"
    android:clickable="true"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/post_state_text"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="10dp"
        android:layout_weight="1"
        android:drawableLeft="@drawable/icon_post_action_bar_audit"
        android:drawablePadding="@dimen/post_action_bar_drawable_padding"
        android:gravity="center_vertical"
        android:text="@string/post_question_audit_success"
        android:textColor="@color/post_action_bar_text_color"
        android:textSize="@dimen/post_action_bar_text_size" />

    <View
        android:id="@+id/post_line"
        style="@style/line_gray_vertical"
        android:layout_height="20dp"
        android:layout_gravity="center_vertical" />

    <TextView
        android:id="@+id/post_action_text"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="@drawable/bg_item_action_bar"
        android:gravity="center"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:text="@string/post_question_view_question"
        android:textColor="@color/post_action_bar_text_color"
        android:textSize="@dimen/post_action_bar_text_size" />

</LinearLayout>


text:
<?php

//initilize the page
require_once("inc/init.php");

//require UI configuration (nav, ribbon, etc.)
require_once("inc/config.ui.php");

/*---------------- PHP Custom Scripts ---------

YOU CAN SET CONFIGURATION VARIABLES HERE BEFORE IT GOES TO NAV, RIBBON, ETC.
E.G. $page_title = "Custom Title" */

$page_title = "Button PHP Class";

/* ---------------- END PHP Custom Scripts ------------- */

//include header
//you can add your custom css in $page_css array.
//Note: all css files are inside css/ folder
$page_css[] = "your_style.css";
include("inc/header.php");

//include left panel (navigation)
//follow the tree in inc/config.ui.php
$page_nav["smartui"]["sub"]["button"]["active"] = true;
include("inc/nav.php");

?>

	<?php
		//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
		//$breadcrumbs["New Crumb"] => "http://url.com"
		$breadcrumbs["Misc"] = "";
		include("inc/ribbon.php");
	?>

			<?php
				$ui = new SmartUI;
				$btn_simple = $ui->create_button('Click Me!', 'danger')
					->attr('href', 'http://facebook.com')->attr('target', '_blank')->container('a')
				    ->icon('fa-gear')
				    ->print_html(true);

				$btn_spinning = $ui->create_button('', 'success')
					->class(array('bg-color-green', 'txt-color-white'))
					->icon('fa-refresh fa-4x fa-spin')
					->print_html(true);

				$btn_circle = $ui->create_button('', 'primary')
					->class('btn-circle')->size('lg')
					->icon('fa-check')->print_html(true);

				$btn_labeled = $ui->create_button('A Labeled Button', 'success')
					->icon('fa-check')
					->options('labeled', true)
					->print_html(true);

				// dropdown
				$items = array(
					'Some action',
					'Some other action',
					'-',
					array(
						'content' => 'Hover me for more options',
						'submenu' => array(
							'Second level',
							array(
								'content' => 'Even More..',
								'submenu' => array(
									'3rd level',
									'3rd level'
								)
							),
							'Second level',
							'Second level'
						)
					)
				);

				$dropdown = $ui->create_button('Simple Dropdown')
				    ->dropdown('items', $items)->dropdown('split', false)
				    ->print_html(true);

				$dropdown_split = $ui->create_button('Split Dropdown')
					->dropdown('items', $items)->dropdown(
						'split', array( // set to 'true' for defaults, or string for the type key
							'type' => 'success',
							'disabled' => false,
							'dropup' => false,
							'class' => array('class-1', 'class-2', 'class-custom'),
							'attr' => array('data-custom-attr' => '12345')
						)
					)
					->dropdown('multilevel', true)
					->attr('href', 'http://twitter.com')->attr('data-custom-id', '34343')
					->size(Button::BUTTON_SIZE_XSMALL)
					->print_html(true);

				$run_time = $ui->run_time(false);

				$widget = $ui->create_widget();
				$body = $btn_simple.$btn_spinning.$btn_circle.$btn_labeled.'

					'.$dropdown.'

					'.$dropdown_split;
				$widget->body('content', $body)
					->options('editbutton', false)
				    ->header('title', '
SmartUI::Button
')->print_html();

				$options = array(
					"editbutton" => false,
					"colorbutton" => false,
					"collapsed" => true
				);

				// print html output
				$hb = new HTMLIndent();
				$html_snippet = SmartUtil::clean_html_string($hb->indent($body), false);
				$contents = array(
					"body" => '
'.$html_snippet.'
',
					"header" => array(
						"icon" => 'fa fa-code',
						"title" => '
HTML Output (Run Time: '.$run_time.')
'
					)
				);

				$ui->create_widget($options, $contents)->color('pink')->print_html();
			?>

						<?php

							$md = file_get_contents("docs/smartui/button.md");
							$parsedown = new Parsedown();
							$doc = $parsedown->parse($md);
							echo str_replace('<pre', '

<?php
	//include required scripts
	include("inc/scripts.php");
?>

<?php
	//include footer
	include("inc/footer.php");
?>


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gov.va.escreening.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author jocchiuzzo
 */
@Entity
@Table(name = "assessment_variable_type")
@NamedQueries({
    @NamedQuery(name = "AssessmentVariableType.findAll", query = "SELECT a FROM AssessmentVariableType a")})
public class AssessmentVariableType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "assessment_variable_type_id")
    private Integer assessmentVariableTypeId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @Column(name = "date_created")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreated;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "assessmentVariableTypeId")
    private List<AssessmentVariable> assessmentVariableList;

    public AssessmentVariableType() {
    }

    public AssessmentVariableType(Integer assessmentVariableTypeId) {
        this.assessmentVariableTypeId = assessmentVariableTypeId;
    }

    public AssessmentVariableType(Integer assessmentVariableTypeId, String name, Date dateCreated) {
        this.assessmentVariableTypeId = assessmentVariableTypeId;
        this.name = name;
        this.dateCreated = dateCreated;
    }

    public Integer getAssessmentVariableTypeId() {
        return assessmentVariableTypeId;
    }

    public void setAssessmentVariableTypeId(Integer assessmentVariableTypeId) {
        this.assessmentVariableTypeId = assessmentVariableTypeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public List<AssessmentVariable> getAssessmentVariableList() {
        return assessmentVariableList;
    }

    public void setAssessmentVariableList(List<AssessmentVariable> assessmentVariableList) {
        this.assessmentVariableList = assessmentVariableList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (assessmentVariableTypeId != null ? assessmentVariableTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AssessmentVariableType)) {
            return false;
        }
        AssessmentVariableType other = (AssessmentVariableType) object;
        if ((this.assessmentVariableTypeId == null && other.assessmentVariableTypeId != null) || (this.assessmentVariableTypeId != null && !this.assessmentVariableTypeId.equals(other.assessmentVariableTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gov.va.escreening.entity.AssessmentVariableType[ assessmentVariableTypeId=" + assessmentVariableTypeId + " ]";
    }

}


text:
'use strict';

/**
 * Module dependencies.
 */

 /*
 [
 {"number":"3-1","name":"releaseToIssueMap",
 "columns":[{"name":"release","value":""},{"name":"neIssue","value":""}]},
 {"number":"3-2","name":"neSummary",
 "columns":[{"name":"fieldName","value":""},{"name":"validValues","value":""},{"name":"neValue","value":""},{"name":"notes","value":""}]},
 {"number":"3-7","name":"equipProv",
 "columns":[{"name":"issue","value":""},{"name":"devcd","value":""},{"name":"devId-unitMapping","value":""},{"name":"devidRange","value":""},{"name":"unitId-frameData","value":""},{"name":"protectDevId","value":""},{"name":"parentDevcd","value":""},{"name":"parentDevid","value":""},{"name":"temsAction","value":""},{"name":"provCmd","value":""},{"name":"tl1AID","value":""}]}]
 */
var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

/*
var indexData = new Schema({
	vendor:{
		type: String,
		required: 'Please enter valid Vendor',
		trim: true
	},
	model:{
		type: String,
		required: 'Please enter valid Model',
		trim: true
	},
	issue:{
		type: String,
		required: 'Please enter valid Issue',
		trim: true
	},
	version:{
		type: String,
		required: 'Please enter valid Version letter',
		trim: true
	}
});
*/

/**
 * A Validation function for local strategy password
 */
var validateInput = function(fieldValue) {
	console.log('fieldValue =====' + fieldValue);
	if (fieldValue === '' || fieldValue === null) return false;
	return true;
};

var tabcat = 'EQ CC FT'.split();

var table = new Schema({
	_number:{
		type: String,
		trim: true
	},
	_name:{
		type: String,
		trim: true
	},
	_displayName:{
		type: String,
		trim: true
	},
	_tableCategory:{
		type: String,
		enum: tabcat,
		trim: true
	},
	_appRelease:{
		type: String,
		trim: true
	}
},{strict: false});

/**
 * Gafxml Schema
 */
var GafxmlSchema = new Schema({
	vendor:{
		type: String,
		required: 'Please enter valid Vendor',
		trim: true
	},
	model:{
		type: String,
		required: 'Please enter valid Model',
		trim: true
	},
	issue:{
		type: String,
		required: 'Please enter valid Issue',
		trim: true
	},
	version:{
		type: String,
		required: 'Please enter valid Version letter',
		trim: true
	},
	created: {
		type: Date,
		default: Date.now
	},
	user: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	updated: {
		type: Date
	},
	updateUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	editUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	edited: {
		type: Date
	},
	eqUpdated: {
		type: Date
	},
	eqUpdateUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	eqEditUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	eqEdited: {
		type: Date
	},
	ccUpdated: {
		type: Date
	},
	ccUpdateUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	ccEditUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	ccEdited: {
		type: Date
	},
	ftUpdated: {
		type: Date
	},
	ftUpdateUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	ftEditUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	ftEdited: {
		type: Date
	},
	publishUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	published: {
		type: Date
	},
	freezeDocUser: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	freezeDoc: {
		type: Date
	},
	tables: [table]
}, {collection: 'gafxmls',
    toObject: {
      retainKeyOrder: true
    },
    toJSON: {
      retainKeyOrder: true
    }});

mongoose.model('Gafxml', GafxmlSchema);


text:
/* Hardware timers driver for ISH High Precision Event Timers (HPET) */

#include "console.h"
#include "hpet.h"
#include "hwtimer.h"
#include "timer.h"
#include "registers.h"
#include "task.h"
#include "util.h"

#define CPUTS(outstr) cputs(CC_CLOCK, outstr)
#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ##args)

static uint32_t last_deadline;

/*
 * The ISH hardware needs at least 25 ticks of leeway to arms the timer.
 * ISH4/5 are the slowest with 32kHz timers, so we wait at least 800us when
 * scheduling events in the future
 */
#define MINIMUM_EVENT_DELAY_US 800

/*
 * ISH HPET timer HW has latency for interrupt, on ISH5, this latency is about
 * 3 ticks, defined this configuration to calibrate the 'last_deadline' which is
 * updated in event timer interrupt ISR. Without this calibration, we could
 * get negative sleep time in idle task for low power sleep process.
 */
#define HPET_INT_LATENCY_TICKS 3

/* Scaling helper methods for different ISH chip variants */
#ifdef CHIP_FAMILY_ISH3
#define CLOCK_FACTOR 12
BUILD_ASSERT(CLOCK_FACTOR *SECOND == ISH_HPET_CLK_FREQ);

static inline uint64_t scale_us2ticks(uint64_t us)
{
	return us * CLOCK_FACTOR;
}

static inline uint32_t scale_us2ticks_32(uint32_t us)
{
	/* no optimization for ISH3 */
	return us * CLOCK_FACTOR;
}

static inline uint64_t scale_ticks2us(uint64_t ticks)
{
	return ticks / CLOCK_FACTOR;
}

static inline void wait_while_settling(uint32_t mask)
{
	/* Do nothing on ISH3, only ISH4 and ISH5 need settling */
}

#elif defined(CHIP_FAMILY_ISH4) || defined(CHIP_FAMILY_ISH5)
#define CLOCK_SCALE_BITS 15
BUILD_ASSERT(BIT(CLOCK_SCALE_BITS) == ISH_HPET_CLK_FREQ);

/* Slow version, for 64-bit precision */
static inline uint64_t scale_us2ticks(uint64_t us)
{
	/* ticks = us * ISH_HPET_CLK_FREQ / SECOND */

	return (us << CLOCK_SCALE_BITS) / SECOND;
}

/* Fast version, for 32-bit precision */
static inline uint32_t scale_us2ticks_32(uint32_t us)
{
	/*
	 * GCC optimizes this shift/divide into multiplication by a
	 * magic number
	 */
	return (us << CLOCK_SCALE_BITS) / SECOND;
}

static inline uint64_t scale_ticks2us(uint64_t ticks)
{
	return (ticks * SECOND) >> CLOCK_SCALE_BITS;
}

/*
 * HPET Control & Status register may indicate that a value which has
 * been written still needs propogated by hardware. Before updating
 * HPET_TIMER_CONF_CAP(N), be sure to wait on the value settling with
 * the corresponding mask (see hpet.h).
 */
static inline void wait_while_settling(uint32_t mask)
{
	/* Wait for timer settings to settle ~ 150us */
	while (HPET_CTRL_STATUS & mask)
		continue;
}

#else
#error "Must define CHIP_FAMILY_ISH(3|4|5)"
#endif

/*
 * The 64-bit read on a 32-bit chip can tear during the read. Ensure that the
 * value returned for 64-bit didn't rollover while we were reading it.
 */
static inline uint64_t read_main_timer(void)
{
	timestamp_t t;
	uint32_t hi;

	/* need check main counter if valid when exit low power TCG mode */
	wait_while_settling(HPET_MAIN_COUNTER_VALID);

	do {
		t.le.hi = HPET_MAIN_COUNTER_64_HI;
		t.le.lo = HPET_MAIN_COUNTER_64_LO;
		hi = HPET_MAIN_COUNTER_64_HI;
	} while (t.le.hi != hi);

	return t.val;
}

void __hw_clock_event_set(uint32_t deadline)
{
	uint32_t remaining_us;
	uint32_t current_us;
	uint64_t current_ticks;

	/* 'current_ticks' is the current absolute 64bit HW timer counter */
	current_ticks = read_main_timer();

	/*
	 * 'current_us' is the low 32bit part of current time in 64bit micro
	 * seconds format, it's can express 2^32 micro seconds in maximum.
	 */
	current_us = scale_ticks2us(current_ticks);

	/*
	 * To ensure HW has enough time to react to the new timer value,
	 * we make remaining time not less than 'MINIMUM_EVENT_DELAY_US'
	 */
	remaining_us = deadline - current_us;
	remaining_us = MAX(remaining_us, MINIMUM_EVENT_DELAY_US);

	/*
	 * Set new 64bit absolute timeout ticks to Timer 1 comparator
	 * register.
	 * For ISH3, this assumes that remaining_us is less than 360 seconds
	 * (2^32 us / 12Mhz), otherwise we would need to handle 32-bit rollover
	 * of 12Mhz timer comparator value. Watchdog refresh happens at least
	 * every 10 seconds.
	 */
	wait_while_settling(HPET_T1_CMP_SETTLING);
	HPET_TIMER_COMP(1) = current_ticks + scale_us2ticks_32(remaining_us);

	/*
	 * Update 'last_deadline' and add calibrate delta due to HPET timer
	 * interrupt latency.
	 */
	last_deadline = current_us + remaining_us;
	last_deadline += scale_ticks2us(HPET_INT_LATENCY_TICKS);

	/* Enable timer interrupt */
	wait_while_settling(HPET_T1_SETTLING);
	HPET_TIMER_CONF_CAP(1) |= HPET_Tn_INT_ENB_CNF;
}

uint32_t __hw_clock_event_get(void)
{
	return last_deadline;
}

void __hw_clock_event_clear(void)
{
	/*
	 * We need to make sure that process_timers is called when the
	 * event timer rolls over, set for deadline when
	 * process_timers clears the event timer.
	 */
	__hw_clock_event_set(0xFFFFFFFF);
}

uint64_t __hw_clock_source_read64(void)
{
	return scale_ticks2us(read_main_timer());
}

void __hw_clock_source_set64(uint64_t timestamp)
{
	/* Reset both clock and overflow comparators */
	wait_while_settling(HPET_ANY_SETTLING);
	HPET_GENERAL_CONFIG &= ~HPET_ENABLE_CNF;

	HPET_MAIN_COUNTER_64 = scale_us2ticks(timestamp);

	wait_while_settling(HPET_ANY_SETTLING);
	HPET_GENERAL_CONFIG |= HPET_ENABLE_CNF;
}

static void hw_clock_event_isr(void)
{
	/* Clear interrupt */
	wait_while_settling(HPET_INT_STATUS_SETTLING);
	HPET_INTR_CLEAR = BIT(1);

	process_timers(0);
}
DECLARE_IRQ(ISH_HPET_TIMER1_IRQ, hw_clock_event_isr);

int __hw_clock_source_init64(uint64_t start_t)
{
	/*
	 * Timer 1 is used as an event timer. Timer 0 is unused, as
	 * CONFIG_HWTIMER_64BIT is enabled.
	 */
	uint32_t timer1_config = 0x00000000;

	/* Disable HPET */
	wait_while_settling(HPET_ANY_SETTLING);
	HPET_GENERAL_CONFIG &= ~HPET_ENABLE_CNF;

	/* Disable T0 */
	HPET_TIMER_CONF_CAP(0) &= ~HPET_Tn_INT_ENB_CNF;

	/* Disable T1 until we get it set up (below) */
	HPET_TIMER_CONF_CAP(1) &= ~HPET_Tn_INT_ENB_CNF;

	/* Initialize main counter */
	HPET_MAIN_COUNTER_64 = scale_us2ticks(start_t);

	/* Clear any interrupts from previously running image */
	HPET_INTR_CLEAR = BIT(0);
	HPET_INTR_CLEAR = BIT(1);

	/* Timer 1 - IRQ routing */
	timer1_config &= ~HPET_Tn_INT_ROUTE_CNF_MASK;
	timer1_config |= (ISH_HPET_TIMER1_IRQ << HPET_Tn_INT_ROUTE_CNF_SHIFT);

	/* Level triggered interrupt */
	timer1_config |= HPET_Tn_INT_TYPE_CNF;

	/* Initialize last_deadline until an event is scheduled */
	last_deadline = 0xFFFFFFFF;

	/* Before enabling, previous values must have settled */
	wait_while_settling(HPET_ANY_SETTLING);

	/* Unmask HPET IRQ in IOAPIC */
	task_enable_irq(ISH_HPET_TIMER1_IRQ);

	/* Copy timer config to hardware register */
	HPET_TIMER_CONF_CAP(1) |= timer1_config;

	/* Enable HPET */
	HPET_GENERAL_CONFIG |= (HPET_ENABLE_CNF | HPET_LEGACY_RT_CNF);

	/* Return IRQ value for OS event timer */
	return ISH_HPET_TIMER1_IRQ;
}


text:
ANSIBLE_METADATA = {'status': ['preview'],
                    'supported_by': 'community',
                    'version': '1.0'}

DOCUMENTATION = '''
---
module: gce_pd
version_added: "1.4"
short_description: utilize GCE persistent disk resources
description:
    - This module can create and destroy unformatted GCE persistent disks
      U(https://developers.google.com/compute/docs/disks#persistentdisks).
      It also supports attaching and detaching disks from running instances.
      Full install/configuration instructions for the gce* modules can
      be found in the comments of ansible/test/gce_tests.py.
options:
  detach_only:
    description:
      - do not destroy the disk, merely detach it from an instance
    required: false
    default: "no"
    choices: ["yes", "no"]
    aliases: []
  instance_name:
    description:
      - instance name if you wish to attach or detach the disk
    required: false
    default: null
    aliases: []
  mode:
    description:
      - GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
    required: false
    default: "READ_ONLY"
    choices: ["READ_WRITE", "READ_ONLY"]
    aliases: []
  name:
    description:
      - name of the disk
    required: true
    default: null
    aliases: []
  size_gb:
    description:
      - whole integer size of disk (in GB) to create, default is 10 GB
    required: false
    default: 10
    aliases: []
  image:
    description:
      - the source image to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  snapshot:
    description:
      - the source snapshot to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  state:
    description:
      - desired state of the persistent disk
    required: false
    default: "present"
    choices: ["active", "present", "absent", "deleted"]
    aliases: []
  zone:
    description:
      - zone in which to create the disk
    required: false
    default: "us-central1-b"
    aliases: []
  service_account_email:
    version_added: "1.6"
    description:
      - service account email
    required: false
    default: null
    aliases: []
  pem_file:
    version_added: "1.6"
    description:
      - path to the pem file associated with the service account email
        This option is deprecated. Use 'credentials_file'.
    required: false
    default: null
    aliases: []
  credentials_file:
    version_added: "2.1.0"
    description:
      - path to the JSON file associated with the service account email
    required: false
    default: null
    aliases: []
  project_id:
    version_added: "1.6"
    description:
      - your GCE project ID
    required: false
    default: null
    aliases: []
  disk_type:
    version_added: "1.9"
    description:
      - type of disk provisioned
    required: false
    default: "pd-standard"
    choices: ["pd-standard", "pd-ssd"]
    aliases: []

requirements:
    - "python >= 2.6"
    - "apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials"
author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
'''

EXAMPLES = '''
# Simple attachment action to an existing instance
- local_action:
    module: gce_pd
    instance_name: notlocalhost
    size_gb: 5
    name: pd
'''

try:
    from libcloud.compute.types import Provider
    from libcloud.compute.providers import get_driver
    from libcloud.common.google import GoogleBaseError, QuotaExceededError, \
            ResourceExistsError, ResourceNotFoundError, ResourceInUseError
    _ = Provider.GCE
    HAS_LIBCLOUD = True
except ImportError:
    HAS_LIBCLOUD = False

def main():
    module = AnsibleModule(
        argument_spec = dict(
            detach_only = dict(type='bool'),
            instance_name = dict(),
            mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']),
            name = dict(required=True),
            size_gb = dict(default=10),
            disk_type = dict(default='pd-standard'),
            image = dict(),
            snapshot = dict(),
            state = dict(default='present'),
            zone = dict(default='us-central1-b'),
            service_account_email = dict(),
            pem_file = dict(),
            credentials_file = dict(),
            project_id = dict(),
        )
    )
    if not HAS_LIBCLOUD:
        module.fail_json(msg='libcloud with GCE support (0.17.0+) is required for this module')

    gce = gce_connect(module)

    detach_only = module.params.get('detach_only')
    instance_name = module.params.get('instance_name')
    mode = module.params.get('mode')
    name = module.params.get('name')
    size_gb = module.params.get('size_gb')
    disk_type = module.params.get('disk_type')
    image = module.params.get('image')
    snapshot = module.params.get('snapshot')
    state = module.params.get('state')
    zone = module.params.get('zone')

    if detach_only and not instance_name:
        module.fail_json(
            msg='Must specify an instance name when detaching a disk',
            changed=False)

    disk = inst = None
    changed = is_attached = False

    json_output = { 'name': name, 'zone': zone, 'state': state, 'disk_type': disk_type  }
    if detach_only:
        json_output['detach_only'] = True
        json_output['detached_from_instance'] = instance_name

    if instance_name:
        # user wants to attach/detach from an existing instance
        try:
            inst = gce.ex_get_node(instance_name, zone)
            # is the disk attached?
            for d in inst.extra['disks']:
                if d['deviceName'] == name:
                    is_attached = True
                    json_output['attached_mode'] = d['mode']
                    json_output['attached_to_instance'] = inst.name
        except:
            pass

    # find disk if it already exists
    try:
        disk = gce.ex_get_volume(name)
        json_output['size_gb'] = int(disk.size)
    except ResourceNotFoundError:
        pass
    except Exception as e:
        module.fail_json(msg=unexpected_error_msg(e), changed=False)

    # user wants a disk to exist.  If "instance_name" is supplied the user
    # also wants it attached
    if state in ['active', 'present']:

        if not size_gb:
            module.fail_json(msg="Must supply a size_gb", changed=False)
        try:
            size_gb = int(round(float(size_gb)))
            if size_gb < 1:
                raise Exception
        except:
            module.fail_json(msg="Must supply a size_gb larger than 1 GB",
                    changed=False)

        if instance_name and inst is None:
            module.fail_json(msg='Instance %s does not exist in zone %s' % (
                    instance_name, zone), changed=False)

        if not disk:
            if image is not None and snapshot is not None:
                module.fail_json(
                    msg='Cannot give both image (%s) and snapshot (%s)' % (
                        image, snapshot), changed=False)
            lc_image = None
            lc_snapshot = None
            if image is not None:
                lc_image = gce.ex_get_image(image)
            elif snapshot is not None:
                lc_snapshot = gce.ex_get_snapshot(snapshot)
            try:
                disk = gce.create_volume(
                    size_gb, name, location=zone, image=lc_image,
                    snapshot=lc_snapshot, ex_disk_type=disk_type)
            except ResourceExistsError:
                pass
            except QuotaExceededError:
                module.fail_json(msg='Requested disk size exceeds quota',
                        changed=False)
            except Exception as e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['size_gb'] = size_gb
            if image is not None:
                json_output['image'] = image
            if snapshot is not None:
                json_output['snapshot'] = snapshot
            changed = True
        if inst and not is_attached:
            try:
                gce.attach_volume(inst, disk, device=name, ex_mode=mode)
            except Exception as e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['attached_to_instance'] = inst.name
            json_output['attached_mode'] = mode
            changed = True

    # user wants to delete a disk (or perhaps just detach it).
    if state in ['absent', 'deleted'] and disk:

        if inst and is_attached:
            try:
                gce.detach_volume(disk, ex_node=inst)
            except Exception as e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True
        if not detach_only:
            try:
                gce.destroy_volume(disk)
            except ResourceInUseError as e:
                module.fail_json(msg=str(e.value), changed=False)
            except Exception as e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True

    json_output['changed'] = changed
    module.exit_json(**json_output)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.gce import *

if __name__ == '__main__':
    main()


text:
package downloader

import (
	"context"
	"errors"
	"fmt"
	"github.com/iikira/BaiduPCS-Go/pcsutil/cachepool"
	"github.com/iikira/BaiduPCS-Go/pcsverbose"
	"github.com/iikira/BaiduPCS-Go/requester"
	"github.com/iikira/BaiduPCS-Go/requester/rio/speeds"
	"github.com/iikira/BaiduPCS-Go/requester/transfer"
	"io"
	"net/http"
	"sync"
)

type (
	//Worker 工作单元
	Worker struct {
		totalSize    int64 // 整个文件的大小, worker请求range时会获取尝试获取该值, 如果不匹配, 则返回错误
		wrange       *transfer.Range
		speedsStat   *speeds.Speeds
		id           int    //id
		url          string //下载地址
		referer      string //来源地址
		acceptRanges string
		client       *requester.HTTPClient
		firstResp    *http.Response // 第一个响应
		writerAt     io.WriterAt
		writeMu      *sync.Mutex
		execMu       sync.Mutex

		pauseChan              chan struct{}
		workerCancelFunc       context.CancelFunc
		resetFunc              context.CancelFunc
		readRespBodyCancelFunc func()
		err                    error //错误信息
		status                 WorkerStatus
		downloadStatus         *transfer.DownloadStatus //总的下载状态
	}

	// WorkerList worker列表
	WorkerList []*Worker
)

// Duplicate 构造新的列表
func (wl WorkerList) Duplicate() WorkerList {
	n := make(WorkerList, len(wl))
	copy(n, wl)
	return n
}

//NewWorker 初始化Worker
func NewWorker(id int, durl string, writerAt io.WriterAt) *Worker {
	return &Worker{
		id:       id,
		url:      durl,
		writerAt: writerAt,
	}
}

//ID 返回worker ID
func (wer *Worker) ID() int {
	return wer.id
}

func (wer *Worker) lazyInit() {
	if wer.client == nil {
		wer.client = requester.NewHTTPClient()
	}
	if wer.pauseChan == nil {
		wer.pauseChan = make(chan struct{})
	}
	if wer.wrange == nil {
		wer.wrange = &transfer.Range{}
	}
	if wer.wrange.LoadBegin() == 0 && wer.wrange.LoadEnd() == 0 {
		// 取消多线程下载
		wer.acceptRanges = ""
		wer.wrange.StoreEnd(-2)
	}
	if wer.speedsStat == nil {
		wer.speedsStat = &speeds.Speeds{}
	}
}

// SetTotalSize 设置整个文件的大小, worker请求range时会获取尝试获取该值, 如果不匹配, 则返回错误
func (wer *Worker) SetTotalSize(size int64) {
	wer.totalSize = size
}

//SetClient 设置http客户端
func (wer *Worker) SetClient(c *requester.HTTPClient) {
	wer.client = c
}

//SetAcceptRange 设置AcceptRange
func (wer *Worker) SetAcceptRange(acceptRanges string) {
	wer.acceptRanges = acceptRanges
}

//SetRange 设置请求范围
func (wer *Worker) SetRange(r *transfer.Range) {
	if wer.wrange == nil {
		wer.wrange = r
		return
	}
	wer.wrange.StoreBegin(r.LoadBegin())
	wer.wrange.StoreEnd(r.LoadEnd())
}

//SetReferer 设置来源
func (wer *Worker) SetReferer(referer string) {
	wer.referer = referer
}

//SetWriteMutex 设置数据写锁
func (wer *Worker) SetWriteMutex(mu *sync.Mutex) {
	wer.writeMu = mu
}

//SetDownloadStatus 增加其他需要统计的数据
func (wer *Worker) SetDownloadStatus(downloadStatus *transfer.DownloadStatus) {
	wer.downloadStatus = downloadStatus
}

//GetStatus 返回下载状态
func (wer *Worker) GetStatus() WorkerStatuser {
	// 空接口与空指针不等价
	return &wer.status
}

//GetRange 返回worker范围
func (wer *Worker) GetRange() *transfer.Range {
	return wer.wrange
}

//GetSpeedsPerSecond 获取每秒的速度
func (wer *Worker) GetSpeedsPerSecond() int64 {
	return wer.speedsStat.GetSpeeds()
}

//Pause 暂停下载
func (wer *Worker) Pause() {
	wer.lazyInit()
	if wer.acceptRanges == "" {
		pcsverbose.Verbosef("WARNING: worker unsupport pause")
		return
	}

	if wer.status.statusCode == StatusCodePaused {
		return
	}
	wer.pauseChan <- struct{}{}
	wer.status.statusCode = StatusCodePaused
}

//Resume 恢复下载
func (wer *Worker) Resume() {
	if wer.status.statusCode != StatusCodePaused {
		return
	}
	go wer.Execute()
}

//Cancel 取消下载
func (wer *Worker) Cancel() error {
	if wer.workerCancelFunc == nil {
		return errors.New("cancelFunc not set")
	}
	wer.workerCancelFunc()
	if wer.readRespBodyCancelFunc != nil {
		wer.readRespBodyCancelFunc()
	}
	return nil
}

//Reset 重设连接
func (wer *Worker) Reset() {
	if wer.resetFunc == nil {
		pcsverbose.Verbosef("DEBUG: worker: resetFunc not set")
		return
	}
	wer.resetFunc()
	if wer.readRespBodyCancelFunc != nil {
		wer.readRespBodyCancelFunc()
	}
	wer.ClearStatus()
	go wer.Execute()
}

// Canceled 是否已经取消
func (wer *Worker) Canceled() bool {
	return wer.status.statusCode == StatusCodeCanceled
}

//Completed 是否已经完成
func (wer *Worker) Completed() bool {
	switch wer.status.statusCode {
	case StatusCodeSuccessed, StatusCodeCanceled:
		return true
	default:
		return false
	}
}

//Failed 是否失败
func (wer *Worker) Failed() bool {
	switch wer.status.statusCode {
	case StatusCodeFailed, StatusCodeInternalError, StatusCodeTooManyConnections, StatusCodeNetError:
		return true
	default:
		return false
	}
}

//ClearStatus 清空状态
func (wer *Worker) ClearStatus() {
	wer.status.statusCode = StatusCodeInit
}

//Err 返回worker错误
func (wer *Worker) Err() error {
	return wer.err
}

//Execute 执行任务
func (wer *Worker) Execute() {
	wer.lazyInit()

	wer.execMu.Lock()
	defer wer.execMu.Unlock()

	wer.status.statusCode = StatusCodeInit
	single := wer.acceptRanges == ""

	// 如果已暂停, 退出
	if wer.status.statusCode == StatusCodePaused {
		return
	}

	if !single {
		// 已完成
		if rlen := wer.wrange.Len(); rlen <= 0 {
			if rlen < 0 {
				pcsverbose.Verbosef("DEBUG: RangeLen is negative at begin: %v, %d\n", wer.wrange, wer.wrange.Len())
			}
			wer.status.statusCode = StatusCodeSuccessed
			return
		}
	}

	workerCancelCtx, workerCancelFunc := context.WithCancel(context.Background())
	wer.workerCancelFunc = workerCancelFunc
	resetCtx, resetFunc := context.WithCancel(context.Background())
	wer.resetFunc = resetFunc

	header := map[string]string{}
	if wer.referer != "" {
		header["Referer"] = wer.referer
	}
	//检测是否支持range
	if wer.acceptRanges != "" && wer.wrange.Len() >= 0 {
		header["Range"] = fmt.Sprintf("%s=%d-%d", wer.acceptRanges, wer.wrange.LoadBegin(), wer.wrange.LoadEnd()-1)
	}

	wer.status.statusCode = StatusCodePending

	var resp *http.Response
	if wer.firstResp != nil {
		resp = wer.firstResp // 使用第一个连接
	} else {
		resp, wer.err = wer.client.Req(http.MethodGet, wer.url, nil, header)
	}
	if resp != nil {
		defer func() {
			resp.Body.Close()
			wer.firstResp = nil // 去掉第一个连接
		}()
		wer.readRespBodyCancelFunc = func() {
			resp.Body.Close()
		}
	}
	if wer.err != nil {
		wer.status.statusCode = StatusCodeNetError
		return
	}

	// 判断响应状态
	switch resp.StatusCode {
	case 200, 206:
		// do nothing, continue
	case 416: //Requested Range Not Satisfiable
		fallthrough
	case 403: // Forbidden
		fallthrough
	case 406: // Not Acceptable
		wer.status.statusCode = StatusCodeNetError
		wer.err = errors.New(resp.Status)
		return
	case 429, 509: // Too Many Requests
		wer.status.SetStatusCode(StatusCodeTooManyConnections)
		wer.err = errors.New(resp.Status)
		return
	default:
		wer.status.statusCode = StatusCodeNetError
		wer.err = fmt.Errorf("unexpected http status code, %d, %s", resp.StatusCode, resp.Status)
		return
	}

	var (
		contentLength = resp.ContentLength
		rangeLength   = wer.wrange.Len()
	)

	if !single {
		// 检查请求长度
		if contentLength != rangeLength && wer.firstResp == nil { // 跳过检查第一个连接
			wer.status.statusCode = StatusCodeNetError
			wer.err = fmt.Errorf("Content-Length is unexpected: %d, need %d", contentLength, rangeLength)
			return
		}
		// 检查总大小
		if wer.totalSize > 0 {
			total := ParseContentRange(resp.Header.Get("Content-Range"))
			if total > 0 {
				if total != wer.totalSize {
					wer.status.statusCode = StatusCodeInternalError // 这里设置为内部错误, 强制停止下载
					wer.err = fmt.Errorf("Content-Range total length is unexpected: %d, need %d", total, wer.totalSize)
					return
				}
			}
		}
	}

	var (
		buf       = cachepool.SyncPool.Get().([]byte)
		n, nn     int
		n64, nn64 int64
	)
	defer cachepool.SyncPool.Put(buf)

	for {
		select {
		case <-workerCancelCtx.Done(): //取消
			wer.status.statusCode = StatusCodeCanceled
			return
		case <-resetCtx.Done(): //重设连接
			wer.status.statusCode = StatusCodeReseted
			return
		case <-wer.pauseChan: //暂停
			return
		default:
			wer.status.statusCode = StatusCodeDownloading

			// 初始化数据
			var readErr error
			n = 0

			// 读取数据
			for n < len(buf) && readErr == nil && (single || wer.wrange.Len() > 0) {
				nn, readErr = resp.Body.Read(buf[n:])
				nn64 = int64(nn)

				// 更新速度统计
				if wer.downloadStatus != nil {
					wer.downloadStatus.AddSpeedsDownloaded(nn64) // 限速在这里阻塞
				}
				wer.speedsStat.Add(nn64)
				n += nn
			}

			if n > 0 && readErr == io.EOF {
				readErr = io.ErrUnexpectedEOF
			}

			n64 = int64(n)

			// 非单线程模式下
			if !single {
				rangeLength = wer.wrange.Len()

				// 已完成 (未雨绸缪)
				if rangeLength <= 0 {
					wer.status.statusCode = StatusCodeCanceled
					wer.err = errors.New("worker already complete")
					return
				}

				if n64 > rangeLength {
					// 数据大小不正常
					n64 = rangeLength
					n = int(rangeLength)
					readErr = io.EOF
				}
			}

			// 写入数据
			if wer.writerAt != nil {
				wer.status.statusCode = StatusCodeWaitToWrite
				if wer.writeMu != nil {
					wer.writeMu.Lock() // 加锁, 减轻硬盘的压力
				}
				_, wer.err = wer.writerAt.WriteAt(buf[:n], wer.wrange.Begin) // 写入数据
				if wer.err != nil {
					if wer.writeMu != nil {
						wer.writeMu.Unlock() //解锁
					}
					wer.status.statusCode = StatusCodeInternalError
					return
				}

				if wer.writeMu != nil {
					wer.writeMu.Unlock() //解锁
				}
				wer.status.statusCode = StatusCodeDownloading
			}

			// 更新下载统计数据
			wer.wrange.AddBegin(n64)
			if wer.downloadStatus != nil {
				wer.downloadStatus.AddDownloaded(n64)
				if single {
					wer.downloadStatus.AddTotalSize(n64)
				}
			}

			if readErr != nil {
				rlen := wer.wrange.Len()
				switch {
				case single && readErr == io.ErrUnexpectedEOF:
					// 单线程判断下载成功
					fallthrough
				case readErr == io.EOF:
					fallthrough
				case rlen <= 0:
					// 下载完成
					// 小于0可能是因为 worker 被 duplicate
					wer.status.statusCode = StatusCodeSuccessed
					if rlen < 0 {
						pcsverbose.Verbosef("DEBUG: RangeLen is negative at end: %v, %d\n", wer.wrange, wer.wrange.Len())
					}
					return
				default:
					// 其他错误, 返回
					wer.status.statusCode = StatusCodeFailed
					wer.err = readErr
					return
				}
			}
		}
	}
}


text:
package cz.metacentrum.perun.core.impl.modules.attributes;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributeDefinition;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.Facility;
import cz.metacentrum.perun.core.api.SecurityTeam;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.impl.PerunSessionImpl;
import cz.metacentrum.perun.core.implApi.modules.attributes.SkipValueCheckDuringDependencyCheck;
import cz.metacentrum.perun.core.implApi.modules.attributes.UserFacilityVirtualAttributesModuleAbstract;

import java.util.List;

/**
 * Get boolean value. TRUE if user is blacklisted by one of the security teams which are added to facilty.
 *
 * @author Ondrej Velisek <ondrejvelisek@gmail.com>
 */
@SkipValueCheckDuringDependencyCheck
public class urn_perun_user_facility_attribute_def_virt_blacklisted extends UserFacilityVirtualAttributesModuleAbstract {
	@Override
	public Attribute getAttributeValue(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attributeDefinition) throws InternalErrorException {
		Attribute attribute = new Attribute(attributeDefinition);

		List<SecurityTeam> securityTeams = sess.getPerunBl().getFacilitiesManagerBl().getAssignedSecurityTeams(sess, facility);

		for (SecurityTeam st : securityTeams) {
			if (sess.getPerunBl().getSecurityTeamsManagerBl().isUserBlacklisted(sess, st, user)) {
				attribute.setValue(true);
				return attribute;
			}
		}

		attribute.setValue(null);
		return attribute;
	}

	@Override
	public AttributeDefinition getAttributeDefinition() {
		AttributeDefinition attr = new AttributeDefinition();
		attr.setNamespace(AttributesManager.NS_USER_ATTR_VIRT);
		attr.setFriendlyName("blacklisted");
		attr.setDisplayName("Blacklisted");
		attr.setType(Boolean.class.getName());
		attr.setDescription("Flag which means if user is banned by Security team");
		return attr;
	}
}


text:
<?php

final class FundInitiativeQuery
  extends PhabricatorCursorPagedPolicyAwareQuery {

  private $ids;
  private $phids;
  private $ownerPHIDs;
  private $statuses;

  private $needProjectPHIDs;

  public function withIDs(array $ids) {
    $this->ids = $ids;
    return $this;
  }

  public function withPHIDs(array $phids) {
    $this->phids = $phids;
    return $this;
  }

  public function withOwnerPHIDs(array $phids) {
    $this->ownerPHIDs = $phids;
    return $this;
  }

  public function withStatuses(array $statuses) {
    $this->statuses = $statuses;
    return $this;
  }

  public function needProjectPHIDs($need) {
    $this->needProjectPHIDs = $need;
    return $this;
  }

  protected function loadPage() {
    $table = new FundInitiative();
    $conn_r = $table->establishConnection('r');

    $rows = queryfx_all(
      $conn_r,
      'SELECT * FROM %T %Q %Q %Q',
      $table->getTableName(),
      $this->buildWhereClause($conn_r),
      $this->buildOrderClause($conn_r),
      $this->buildLimitClause($conn_r));

    return $table->loadAllFromArray($rows);
  }

  protected function didFilterPage(array $initiatives) {

    if ($this->needProjectPHIDs) {
      $edge_query = id(new PhabricatorEdgeQuery())
        ->withSourcePHIDs(mpull($initiatives, 'getPHID'))
        ->withEdgeTypes(
          array(
            PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
          ));
      $edge_query->execute();

      foreach ($initiatives as $initiative) {
        $phids = $edge_query->getDestinationPHIDs(
          array(
            $initiative->getPHID(),
          ));
        $initiative->attachProjectPHIDs($phids);
      }
    }

    return $initiatives;
  }

  private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
    $where = array();

    $where[] = $this->buildPagingClause($conn_r);

    if ($this->ids !== null) {
      $where[] = qsprintf(
        $conn_r,
        'id IN (%Ld)',
        $this->ids);
    }

    if ($this->phids !== null) {
      $where[] = qsprintf(
        $conn_r,
        'phid IN (%Ls)',
        $this->phids);
    }

    if ($this->ownerPHIDs !== null) {
      $where[] = qsprintf(
        $conn_r,
        'ownerPHID IN (%Ls)',
        $this->ownerPHIDs);
    }

    if ($this->statuses !== null) {
      $where[] = qsprintf(
        $conn_r,
        'status IN (%Ls)',
        $this->statuses);
    }

    return $this->formatWhereClause($where);
  }

  public function getQueryApplicationClass() {
    return 'PhabricatorFundApplication';
  }

}


text:
package com.samvbeckmann.parity.model;

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;

/**
 * parity, class made on 2015-08-04
 *
 * @author Sam Beckmann
 */
public class ConnectionModel
{
    private CommunityModel community;
    private IntegerProperty numConnections;

    public ConnectionModel(CommunityModel community, int numConnections)
    {
        this.community = community;
        this.numConnections = new SimpleIntegerProperty(numConnections);
    }

    public CommunityModel getCommunity()
    {
        return community;
    }

    public void setCommunity(CommunityModel community)
    {
        this.community = community;
    }

    public int getNumConnections()
    {
        return numConnections.get();
    }

    public IntegerProperty numConnectionsProperty()
    {
        return numConnections;
    }

    public void setNumConnections(int numConnections)
    {
        this.numConnections.set(numConnections);
    }
}


text:
package org.lwjgl.system.rpmalloc;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to the rpmalloc library. rpmalloc is a public domain cross platform lock free
 * thread caching 16-byte aligned memory allocator implemented in C.
 *
 *
You are required to call these functions from your own code in order to initialize and finalize the allocator in your process and threads:

 *
 *

 *
{@link #rpmalloc_initialize malloc_initialize}: Call at process start to initialize the allocator

 *
{@link #rpmalloc_finalize malloc_finalize}: Call at process exit to finalize the allocator

 *
{@link #rpmalloc_thread_initialize malloc_thread_initialize}: Call at each thread start to initialize the thread local data for the allocator

 *
{@link #rpmalloc_thread_finalize malloc_thread_finalize}: Call at each thread exit to finalize and release thread cache back to global cache

 *

 *
 *
Then simply use the {@link #rpmalloc malloc}/{@link #rpfree free} and the other malloc style replacement functions. Remember all allocations are 16-byte aligned, so no need to
 * call the explicit {@link #rpmemalign memalign}/{@link #rpaligned_alloc aligned_alloc}/{@link #rpposix_memalign posix_memalign} functions unless you need greater alignment, they are simply wrappers to make it
 * easier to replace in existing code.

 *
 *
The rpmalloc build in LWJGL is configured with {@code RPMALLOC_CONFIGURABLE=1} and {@code ENABLE_STATISTICS=0}.

 */
public class RPmalloc {

    static { LibRPmalloc.initialize(); }

    /** Flag to {@link #rpaligned_realloc aligned_realloc} to not preserve content in reallocation. */
    public static final int RPMALLOC_NO_PRESERVE = 1;

    /**
     * Flag to {@link #rpaligned_realloc aligned_realloc} to fail and return null pointer if grow cannot be done in-place, in which case the original pointer is still valid (just
     * like a call to realloc which failes to allocate a new block).
     */
    public static final int RPMALLOC_GROW_OR_FAIL = 2;

    protected RPmalloc() {
        throw new UnsupportedOperationException();
    }

    // --- [ rpmalloc_address ] ---

    /** The {@link #rpmalloc malloc} function address. */
    @NativeType("void *")
    static native long rpmalloc_address();

    // --- [ rpcalloc_address ] ---

    /** The {@link #rpcalloc calloc} function address. */
    @NativeType("void *")
    static native long rpcalloc_address();

    // --- [ rprealloc_address ] ---

    /** The {@link #rprealloc realloc} function address. */
    @NativeType("void *")
    static native long rprealloc_address();

    // --- [ rpfree_address ] ---

    /** The {@link #rpfree free} function address. */
    @NativeType("void *")
    static native long rpfree_address();

    // --- [ rpaligned_alloc_address ] ---

    /** The {@link #rpaligned_alloc aligned_alloc} function address. */
    @NativeType("void *")
    static native long rpaligned_alloc_address();

    // --- [ rpmalloc_initialize ] ---

    /** Unsafe version of: {@link #rpmalloc_initialize malloc_initialize} */
    public static native int nrpmalloc_initialize();

    /** Initializes allocator with default configuration. */
    @NativeType("int")
    public static boolean rpmalloc_initialize() {
        return nrpmalloc_initialize() != 0;
    }

    // --- [ rpmalloc_initialize_config ] ---

    /** Unsafe version of: {@link #rpmalloc_initialize_config malloc_initialize_config} */
    public static native int nrpmalloc_initialize_config(long config);

    /**
     * Initializes allocator with given configuration.
     *
     * @param config an optional {@link RPMallocConfig} instance
     */
    @NativeType("int")
    public static boolean rpmalloc_initialize_config(@Nullable @NativeType("rpmalloc_config_t const *") RPMallocConfig config) {
        return nrpmalloc_initialize_config(memAddressSafe(config)) != 0;
    }

    // --- [ rpmalloc_config ] ---

    /** Unsafe version of: {@link #rpmalloc_config malloc_config} */
    public static native long nrpmalloc_config();

    /** Gets allocator configuration. */
    @NativeType("rpmalloc_config_t const *")
    public static RPMallocConfig rpmalloc_config() {
        long __result = nrpmalloc_config();
        return RPMallocConfig.create(__result);
    }

    // --- [ rpmalloc_finalize ] ---

    /** Finalizes allocator. */
    public static native void rpmalloc_finalize();

    // --- [ rpmalloc_thread_initialize ] ---

    /** Initializes allocator for calling thread. */
    public static native void rpmalloc_thread_initialize();

    // --- [ rpmalloc_thread_finalize ] ---

    /** Unsafe version of: {@link #rpmalloc_thread_finalize malloc_thread_finalize} */
    public static native void nrpmalloc_thread_finalize(int release_caches);

    /**
     * Finalizes allocator for calling thread.
     *
     * @param release_caches pass non-zero to release thread caches to global cache
     */
    public static void rpmalloc_thread_finalize(@NativeType("int") boolean release_caches) {
        nrpmalloc_thread_finalize(release_caches ? 1 : 0);
    }

    // --- [ rpmalloc_thread_collect ] ---

    /** Performs deferred deallocations pending for the calling thread heap. */
    public static native void rpmalloc_thread_collect();

    // --- [ rpmalloc_is_thread_initialized ] ---

    /** Unsafe version of: {@link #rpmalloc_is_thread_initialized malloc_is_thread_initialized} */
    public static native int nrpmalloc_is_thread_initialized();

    /** Query if allocator is initialized for calling thread. */
    @NativeType("int")
    public static boolean rpmalloc_is_thread_initialized() {
        return nrpmalloc_is_thread_initialized() != 0;
    }

    // --- [ rpmalloc_thread_statistics ] ---

    /** Unsafe version of: {@link #rpmalloc_thread_statistics malloc_thread_statistics} */
    public static native void nrpmalloc_thread_statistics(long stats);

    /** Gets per-thread statistics. */
    public static void rpmalloc_thread_statistics(@NativeType("rpmalloc_thread_statistics_t *") RPmallocThreadStatistics stats) {
        nrpmalloc_thread_statistics(stats.address());
    }

    // --- [ rpmalloc_global_statistics ] ---

    /** Unsafe version of: {@link #rpmalloc_global_statistics malloc_global_statistics} */
    public static native void nrpmalloc_global_statistics(long stats);

    /** Gets global statistics. */
    public static void rpmalloc_global_statistics(@NativeType("rpmalloc_global_statistics_t *") RPmallocGlobalStatistics stats) {
        nrpmalloc_global_statistics(stats.address());
    }

    // --- [ rpmalloc ] ---

    /** Unsafe version of: {@link #rpmalloc malloc} */
    public static native long nrpmalloc(long size);

    /** Allocates a memory block of at least the given size. */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc(@NativeType("size_t") long size) {
        long __result = nrpmalloc(size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpfree ] ---

    /** Unsafe version of: {@link #rpfree free} */
    public static native void nrpfree(long ptr);

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") ByteBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") ShortBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") IntBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") LongBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") FloatBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") DoubleBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    /** Frees the given memory block. */
    public static void rpfree(@Nullable @NativeType("void *") PointerBuffer ptr) {
        nrpfree(memAddressSafe(ptr));
    }

    // --- [ rpcalloc ] ---

    /** Unsafe version of: {@link #rpcalloc calloc} */
    public static native long nrpcalloc(long num, long size);

    /** Allocates a memory block of at least the given size and zero initializes it. */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpcalloc(@NativeType("size_t") long num, @NativeType("size_t") long size) {
        long __result = nrpcalloc(num, size);
        return memByteBufferSafe(__result, (int)num * (int)size);
    }

    // --- [ rprealloc ] ---

    /** Unsafe version of: {@link #rprealloc realloc} */
    public static native long nrprealloc(long ptr, long size);

    /** Reallocates the given block to at least the given size. */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rprealloc(@Nullable @NativeType("void *") ByteBuffer ptr, @NativeType("size_t") long size) {
        long __result = nrprealloc(memAddressSafe(ptr), size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpaligned_realloc ] ---

    /** Unsafe version of: {@link #rpaligned_realloc aligned_realloc} */
    public static native long nrpaligned_realloc(long ptr, long alignment, long size, long oldsize, int flags);

    /**
     * Reallocates the given block to at least the given size and alignment, with optional control flags (see {@link #RPMALLOC_NO_PRESERVE MALLOC_NO_PRESERVE}).
     *
     *
Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     *
     * @param flags {@link #RPMALLOC_NO_PRESERVE MALLOC_NO_PRESERVE} {@link #RPMALLOC_GROW_OR_FAIL MALLOC_GROW_OR_FAIL}
     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpaligned_realloc(@Nullable @NativeType("void *") ByteBuffer ptr, @NativeType("size_t") long alignment, @NativeType("size_t") long size, @NativeType("unsigned int") int flags) {
        long __result = nrpaligned_realloc(memAddressSafe(ptr), alignment, size, remainingSafe(ptr), flags);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpaligned_alloc ] ---

    /** Unsafe version of: {@link #rpaligned_alloc aligned_alloc} */
    public static native long nrpaligned_alloc(long alignment, long size);

    /**
     * Allocates a memory block of at least the given size and alignment.
     *
     *
Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpaligned_alloc(@NativeType("size_t") long alignment, @NativeType("size_t") long size) {
        long __result = nrpaligned_alloc(alignment, size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpaligned_calloc ] ---

    /** Unsafe version of: {@link #rpaligned_calloc aligned_calloc} */
    public static native long nrpaligned_calloc(long alignment, long num, long size);

    /**
     * Allocates a memory block of at least the given size and alignment, and zero initializes it.
     *
     *
Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpaligned_calloc(@NativeType("size_t") long alignment, @NativeType("size_t") long num, @NativeType("size_t") long size) {
        long __result = nrpaligned_calloc(alignment, num, size);
        return memByteBufferSafe(__result, (int)num * (int)size);
    }

    // --- [ rpmemalign ] ---

    /** Unsafe version of: {@link #rpmemalign memalign} */
    public static native long nrpmemalign(long alignment, long size);

    /**
     * Allocates a memory block of at least the given size and alignment.
     *
     *
Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmemalign(@NativeType("size_t") long alignment, @NativeType("size_t") long size) {
        long __result = nrpmemalign(alignment, size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpposix_memalign ] ---

    /** Unsafe version of: {@link #rpposix_memalign posix_memalign} */
    public static native int nrpposix_memalign(long memptr, long alignment, long size);

    /**
     * Allocates a memory block of at least the given size and alignment.
     *
     *
Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     */
    public static int rpposix_memalign(@NativeType("void **") PointerBuffer memptr, @NativeType("size_t") long alignment, @NativeType("size_t") long size) {
        if (CHECKS) {
            check(memptr, 1);
        }
        return nrpposix_memalign(memAddress(memptr), alignment, size);
    }

    // --- [ rpmalloc_usable_size ] ---

    /** Unsafe version of: {@link #rpmalloc_usable_size malloc_usable_size} */
    public static native long nrpmalloc_usable_size(long ptr);

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") ByteBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") ShortBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") IntBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") LongBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") FloatBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") DoubleBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    /** Queries the usable size of the given memory block (from given pointer to the end of block). */
    @NativeType("size_t")
    public static long rpmalloc_usable_size(@NativeType("void *") PointerBuffer ptr) {
        return nrpmalloc_usable_size(memAddress(ptr));
    }

    // --- [ rpmalloc_heap_acquire ] ---

    /**
     * Acquires a new heap.
     *
     *
Will reuse existing released heaps or allocate memory for a new heap if none available. Heap API is implemented with the strict assumption that only
     * one single thread will call heap functions for a given heap at any given time, no functions are thread safe.

     */
    @NativeType("rpmalloc_heap_t *")
    public static native long rpmalloc_heap_acquire();

    // --- [ rpmalloc_heap_release ] ---

    /**
     * Releases a heap (does NOT free the memory allocated by the heap, use {@link #rpmalloc_heap_free_all malloc_heap_free_all} before destroying the heap).
     *
     *
Releasing a heap will enable it to be reused by other threads. Safe to pass a null pointer.

     */
    public static native void rpmalloc_heap_release(@NativeType("rpmalloc_heap_t *") long heap);

    // --- [ rpmalloc_heap_alloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_alloc malloc_heap_alloc} */
    public static native long nrpmalloc_heap_alloc(long heap, long size);

    /** Allocates a memory block of at least the given size using the given heap. */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_alloc(@NativeType("rpmalloc_heap_t *") long heap, @NativeType("size_t") long size) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_alloc(heap, size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpmalloc_heap_aligned_alloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_aligned_alloc malloc_heap_aligned_alloc} */
    public static native long nrpmalloc_heap_aligned_alloc(long heap, long alignment, long size);

    /**
     * Allocates a memory block of at least the given size using the given heap.
     *
     *
The returned block will have the requested alignment. Alignment must be a power of two and a multiple of {@code sizeof(void*)}, and should ideally be
     * less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_aligned_alloc(@NativeType("rpmalloc_heap_t *") long heap, @NativeType("size_t") long alignment, @NativeType("size_t") long size) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_aligned_alloc(heap, alignment, size);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpmalloc_heap_calloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_calloc malloc_heap_calloc} */
    public static native long nrpmalloc_heap_calloc(long heap, long num, long size);

    /** Allocates a memory block of at least the given size using the given heap and zero initializes it. */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_calloc(@NativeType("rpmalloc_heap_t *") long heap, @NativeType("size_t") long num, @NativeType("size_t") long size) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_calloc(heap, num, size);
        return memByteBufferSafe(__result, (int)num * (int)size);
    }

    // --- [ rpmalloc_heap_aligned_calloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_aligned_calloc malloc_heap_aligned_calloc} */
    public static native long nrpmalloc_heap_aligned_calloc(long heap, long alignment, long num, long size);

    /**
     * Allocates a memory block of at least the given size using the given heap and zero initializes it.
     *
     *
The returned block will have the requested alignment. Alignment must either be zero, or a power of two and a multiple of {@code sizeof(void*)}, and
     * should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default
     * {@code 64KiB}).

     *
     * @param num '
     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_aligned_calloc(@NativeType("rpmalloc_heap_t *") long heap, @NativeType("size_t") long alignment, @NativeType("size_t") long num, @NativeType("size_t") long size) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_aligned_calloc(heap, alignment, num, size);
        return memByteBufferSafe(__result, (int)num * (int)size);
    }

    // --- [ rpmalloc_heap_realloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_realloc malloc_heap_realloc} */
    public static native long nrpmalloc_heap_realloc(long heap, long ptr, long size, int flags);

    /**
     * Reallocates the given block to at least the given size.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     *
     * @param flags {@link #RPMALLOC_NO_PRESERVE MALLOC_NO_PRESERVE} {@link #RPMALLOC_GROW_OR_FAIL MALLOC_GROW_OR_FAIL}
     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_realloc(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") ByteBuffer ptr, @NativeType("size_t") long size, @NativeType("unsigned int") int flags) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_realloc(heap, memAddressSafe(ptr), size, flags);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpmalloc_heap_aligned_realloc ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_aligned_realloc malloc_heap_aligned_realloc} */
    public static native long nrpmalloc_heap_aligned_realloc(long heap, long ptr, long alignment, long size, int flags);

    /**
     * Reallocates the given block to at least the given size.
     *
     *
The memory block MUST be allocated by the same heap given to this function. The returned block will have the requested alignment. Alignment must be
     * either zero, or a power of two and a multiple of {@code sizeof(void*)}, and should ideally be less than memory page size. A caveat of rpmalloc
     * internals is that this must also be strictly less than the span size (default {@code 64KiB}).

     *
     * @param flags {@link #RPMALLOC_NO_PRESERVE MALLOC_NO_PRESERVE} {@link #RPMALLOC_GROW_OR_FAIL MALLOC_GROW_OR_FAIL}
     */
    @Nullable
    @NativeType("void *")
    public static ByteBuffer rpmalloc_heap_aligned_realloc(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") ByteBuffer ptr, @NativeType("size_t") long alignment, @NativeType("size_t") long size, @NativeType("unsigned int") int flags) {
        if (CHECKS) {
            check(heap);
        }
        long __result = nrpmalloc_heap_aligned_realloc(heap, memAddressSafe(ptr), alignment, size, flags);
        return memByteBufferSafe(__result, (int)size);
    }

    // --- [ rpmalloc_heap_free ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_free malloc_heap_free} */
    public static native void nrpmalloc_heap_free(long heap, long ptr);

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") ByteBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") ShortBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") IntBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") LongBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") FloatBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") DoubleBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    /**
     * Frees the given memory block from the given heap.
     *
     *
The memory block MUST be allocated by the same heap given to this function.

     */
    public static void rpmalloc_heap_free(@NativeType("rpmalloc_heap_t *") long heap, @Nullable @NativeType("void *") PointerBuffer ptr) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free(heap, memAddressSafe(ptr));
    }

    // --- [ rpmalloc_heap_free_all ] ---

    /** Unsafe version of: {@link #rpmalloc_heap_free_all malloc_heap_free_all} */
    public static native void nrpmalloc_heap_free_all(long heap);

    /** Frees all memory allocated by the heap. */
    public static void rpmalloc_heap_free_all(@NativeType("rpmalloc_heap_t *") long heap) {
        if (CHECKS) {
            check(heap);
        }
        nrpmalloc_heap_free_all(heap);
    }

    // --- [ rpmalloc_heap_thread_set_current ] ---

    /**
     * Sets the given heap as the current heap for the calling thread.
     *
     *
A heap MUST only be current heap for a single thread, a heap can never be shared between multiple threads. The previous current heap for the calling
     * thread is released to be reused by other threads.

     */
    public static native void rpmalloc_heap_thread_set_current(@NativeType("rpmalloc_heap_t *") long heap);

}