text:
// TEST_CONFIG MEM=mrc
// TEST_CRASHES
/*
TEST_RUN_OUTPUT
objc\[\d+\]: cannot form weak reference to instance \(0x[0-9a-f]+\) of class Crash
CRASHED: SIG(ILL|TRAP)
END
*/

#include "test.h"

#include <Foundation/NSObject.h>

static id weak;
static id weak2;
static bool did_dealloc;

@interface Test : NSObject @end
@implementation Test
-(void)dealloc {
    testassert(weak == self);
    testassert(weak2 == self);

    testprintf("Weak references clear during super dealloc\n");
    testassert(weak2 != NULL);
    [super dealloc];
    testassert(weak2 == NULL);

    did_dealloc = true;
}
@end

@interface Crash : NSObject @end
@implementation Crash
-(void)dealloc {
    testassert(weak == self);
    testassert(weak2 == self);

    testprintf("Weak store crashes while deallocating\n");
    objc_storeWeak(&weak, self);
    fail("objc_storeWeak of deallocating value should have crashed");
    [super dealloc];
}
@end

int main()
{
    Test *obj = [Test new];
    Test *obj2 = [Test new];
    id result;

    testprintf("Weak assignment\n");
    result = objc_storeWeak(&weak, obj);
    testassert(result == obj);
    testassert(weak == obj);

    testprintf("Weak assignment to the same value\n");
    result = objc_storeWeak(&weak, obj);
    testassert(result == obj);
    testassert(weak == obj);

    testprintf("Weak assignment to different value\n");
    result = objc_storeWeak(&weak, obj2);
    testassert(result == obj2);
    testassert(weak == obj2);

    testprintf("Weak assignment to NULL\n");
    result = objc_storeWeak(&weak, NULL);
    testassert(result == NULL);
    testassert(weak == NULL);

    testprintf("Weak clear\n");

    result = objc_storeWeak(&weak, obj);
    testassert(result == obj);
    testassert(weak == obj);

    result = objc_storeWeak(&weak2, obj);
    testassert(result == obj);
    testassert(weak2 == obj);

    did_dealloc = false;
    [obj release];
    testassert(did_dealloc);
    testassert(weak == NULL);
    testassert(weak2 == NULL);

    Crash *obj3 = [Crash new];
    result = objc_storeWeak(&weak, obj3);
    testassert(result == obj3);
    testassert(weak == obj3);

    result = objc_storeWeak(&weak2, obj3);
    testassert(result == obj3);
    testassert(weak2 == obj3);

    [obj3 release];
    fail("should have crashed in -[Crash dealloc]");
}


text:
@interface ZIKPubSubBroker ()

@property (nonatomic, retain) NSMutableDictionary *subscriptions;
@property (nonatomic, retain) ZIKSpdyDelegate *requestDelegate;

@end

@implementation ZIKPubSubBroker

+(instancetype) sharedBroker {
    static dispatch_once_t p = 0;

    __strong static ZIKPubSubBroker *_sharedObject = nil;

    dispatch_once(&p, ^{
        _sharedObject = [[self alloc] init];
        _sharedObject.subscriptions = [[NSMutableDictionary alloc] init];
        _sharedObject.requestDelegate = nil;
    });

    return _sharedObject;
}

//TODO: Implement
- (void) handleConnect:(ISpdy *)conn {

}

//TODO: Implement
- (void) connection:(ISpdy *)conn handleError:(ISpdyError *)err {

}

- (void) connection:(ISpdy *)conn handlePush:(ISpdyPush *)push {

    __block ZIKPubSubBroker *broker = self;
    if (!self.requestDelegate) {
        self.requestDelegate = [ZIKSpdyDelegate initWithCompletion:^(ISpdyError *err, NSDictionary *headers, NSData *data) {
            NSString *requestPath = push.associated.url;
            NSArray *handlers = broker.subscriptions[requestPath];
            for (NSDictionary *handler in handlers) {
                ZIKSpdyPushHandler handlerBlock = (ZIKSpdyPushHandler)handler[@"handler"];
                handlerBlock(data);
            }
        }];
    }
    push.delegate = self.requestDelegate;
}

-(NSUUID *)subscribe:(NSString *)path withHandler:(ZIKSpdyPushHandler) handler {
    NSUUID *uuid = [NSUUID UUID];
    if ([self.subscriptions objectForKey:path] == nil) {
        self.subscriptions[path] = [[NSMutableArray alloc] init];
        NSMutableArray *subscriptionsForPath = (NSMutableArray *)self.subscriptions[path];
        NSMutableDictionary *handlerObject = [[NSMutableDictionary alloc] initWithObjectsAndKeys:uuid, @"uuid", nil];
        [handlerObject setObject:[handler copy] forKey:@"handler"];
        [subscriptionsForPath addObject:handlerObject];
    } else {
        NSMutableArray *subscriptionsForPath = (NSMutableArray *)self.subscriptions[path];
        NSMutableDictionary *handlerObject = [[NSMutableDictionary alloc] initWithObjectsAndKeys:uuid, @"uuid", nil];
        [handlerObject setObject:[handler copy] forKey:@"handler"];
        [subscriptionsForPath addObject:handlerObject];
    }
    [self sendSubscriptionRequest:path];
    return uuid;
}

-(void)unsubscribe:(NSString *)path withDescriptor:(NSUUID *)descriptor {
    if ([self.subscriptions objectForKey:path] != nil) {
        NSMutableArray *handlersForPath = self.subscriptions[path];
        NSDictionary *handlerToDelete = nil;
        for (NSDictionary *handler in handlersForPath) {
            if ([handler[@"uuid"] isEqual:descriptor]) {
                handlerToDelete = handler;
                break;
            }
        }
        [handlersForPath removeObject:handlerToDelete];
    }
}

- (void) sendSubscriptionRequest:(NSString *)url {
    ZIKSession *session = [ZIKSession sharedSession];
    ISpdyRequest *request = [[ISpdyRequest alloc] init:@"GET" url:url];
    [session spdyPushTaskWithRequest:request];
}

- (void) logSpdyEvents:(ISpdy *)conn level:(ISpdyLogLevel)level message:(NSString *)message {
    //TODO: Implement in graceful way.
}

@end

redpajama_set_name: RedPajamaGithub


text:
#region copyright
// Copyright 2015 Sensics, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.IO;

namespace Sensics.SystemUtilities
{
    /// <summary>
    /// A uniform way to refer to directories and files, primarily for usage as temporary locations.
    /// </summary>
    interface IDeletableFileSystemObject
    {
        /// <summary>
        /// The (preferably full) path name
        /// </summary>
        string PathName { get; }
        /// <summary>
        /// The containing directory in the case of a file, otherwise the directory.
        /// </summary>
        string DirName { get; }

        /// <summary>
        /// Try to delete the file system object, catching harmless exceptions that don't interfere
        /// with cleaning up.
        /// </summary>
        void TryDelete();
    }

    public class DeletableFile : IDeletableFileSystemObject
    {
        public DeletableFile(string filename)
        {
            PathName = filename;
        }

        public string PathName { get; private set; }

        public string DirName
        {
            get
            {
                return Path.GetDirectoryName(PathName);
            }
        }

        public void TryDelete()
        {
            try
            {
                File.Delete(PathName);
            }
            catch (FileNotFoundException)
            {
                // that's OK
            }
            catch (IOException)
            {
                // also OK
            }
        }
    }

    public class DeletableDirectory : IDeletableFileSystemObject
    {
        public DeletableDirectory(string dirname)
        {
            DirName = dirname;
        }

        public string PathName
        {
            get
            {
                return DirName;
            }
        }

        public string DirName { get; private set; }

        public void TryDelete()
        {
            try
            {
                Directory.Delete(PathName, true);
            }
            catch (DirectoryNotFoundException)
            {
                // that's OK
            }
            catch (IOException)
            {
                // also OK
            }
        }
    }
}


text:
/*************************************************************************/
/*  collision_shape_2d.h                                                 */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#ifndef COLLISION_SHAPE_2D_H
#define COLLISION_SHAPE_2D_H

#include "scene/2d/node_2d.h"
#include "scene/resources/shape_2d.h"

class CollisionShape2D : public Node2D {

	OBJ_TYPE(CollisionShape2D,Node2D);
	Ref<Shape2D> shape;
	Rect2 rect;
	bool trigger;
	bool unparenting;
	bool can_update_body;
	void _shape_changed();
	int update_shape_index;

	void _set_update_shape_index(int p_index);
	int _get_update_shape_index() const;

protected:

	void _update_parent();
	void _notification(int p_what);
	static void _bind_methods();

	void _add_to_collision_object(Object *p_obj);
public:

	void set_shape(const Ref<Shape2D>& p_shape);
	Ref<Shape2D> get_shape() const;
	virtual Rect2 get_item_rect() const;
	void set_trigger(bool p_trigger);
	bool is_trigger() const;

	int get_collision_object_shape_index() const { return _get_update_shape_index(); }

	CollisionShape2D();
};

#endif // COLLISION_SHAPE_2D_H


text:
devel/annc-monitor
==================
Displays announcements and reports in the console.

:enable|start:      Begins monitoring
:disable|stop:      Stops monitoring
:interval X:        Sets the delay between checks for
                    new announcements to ``X`` frames

=end]]

VERSION = '0.2'

eventful = require 'plugins.eventful'

if enabled == nil then
    enabled = false
end

function usage()
    print [[
Usage:
    annc-monitor start|enable: Begin monitoring
    annc-monitor stop|disable: End monitoring
]]
end

function log(s, color)
    dfhack.color(color)
    print(dfhack.df2utf(s))
    dfhack.color(COLOR_RESET)
end

function annc_handler(id)
    if enabled and dfhack.isWorldLoaded() then
        local annc = df.report.find(id)
        local color = annc.color + (annc.bright and 8 or 0)
        log(annc.text, color)
    end
end

args = {...}
if dfhack_flags and dfhack_flags.enable then
    table.insert(args, dfhack_flags.enable_state and 'enable' or 'disable')
end
if #args >= 1 then
    if args[1] == 'start' or args[1] == 'enable' then
        enabled = true
    elseif args[1] == 'stop' or args[1] == 'disable' then
        enabled = false
    else
        usage()
    end
else
    usage()
end

eventful.enableEvent(eventful.eventType.REPORT, 1)
eventful.onReport.annc_monitor = annc_handler


text:
SVG.utils = {
  // Map function
  map: function(array, block) {
    var i
      , il = array.length
      , result = []

    for (i = 0; i < il; i++)
      result.push(block(array[i]))

    return result
  }

  // Filter function
, filter: function(array, block) {
    var i
      , il = array.length
      , result = []

    for (i = 0; i < il; i++)
      if (block(array[i]))
        result.push(array[i])

    return result
  }

  // Degrees to radians
, radians: function(d) {
    return d % 360 * Math.PI / 180
  }

  // Radians to degrees
, degrees: function(r) {
    return r * 180 / Math.PI % 360
  }

, filterSVGElements: function(nodes) {
    return this.filter( nodes, function(el) { return el instanceof SVGElement })
  }

}


text:
package performance

import (
	"flag"
	"os"
	"strconv"

	. "github.com/onsi/ginkgo/v2"
)

var (
	RunPerfTests                bool
	cyclicTestDurationInSeconds uint
	RunPerfRealtime             bool
	realtimeThreshold           uint
)

func init() {
	flag.BoolVar(&RunPerfTests, "performance-test", false, "run performance tests. If false, all performance tests will be skiped.")
	if ptest, _ := strconv.ParseBool(os.Getenv("KUBEVIRT_E2E_PERF_TEST")); ptest {
		RunPerfTests = true
	}
	flag.BoolVar(&RunPerfRealtime, "realtime-test", false, "run realtime performance tests only.")
	if run, _ := strconv.ParseBool(os.Getenv("KUBEVIRT_E2E_REALTIME_PERF_TEST")); run {
		RunPerfRealtime = true
	}
	flag.UintVar(&cyclicTestDurationInSeconds, "cyclictest-duration", 60, "time in seconds to run the cyclic test (for realtime performance)")
	if duration, err := strconv.ParseUint(os.Getenv("KUBEVIRT_E2E_CYCLIC_DURATION_IN_SECONDS"), 10, 64); err != nil {
		cyclicTestDurationInSeconds = uint(duration)
	}
	flag.UintVar(&realtimeThreshold, "realtime-threshold", 40, "sets the threshold for maximum cpu latency time in microseconds (for realtime performance)")
	if threshold, err := strconv.ParseUint(os.Getenv("KUBEVIRT_E2E_REALTIME_LATENCY_THRESHOLD_IN_MICROSECONDS"), 10, 64); err != nil {
		realtimeThreshold = uint(threshold)
	}
}

func SIGDescribe(text string, args ...interface{}) bool {
	return Describe("[sig-performance][Serial] "+text, Serial, args)
}

func FSIGDescribe(text string, args ...interface{}) bool {
	return FDescribe("[sig-performance][Serial] "+text, Serial, args)
}

func skipIfNoPerformanceTests() {
	if !RunPerfTests {
		Skip("Performance tests are not enabled.")
	}
}

func skipIfNoRealtimePerformanceTests() {
	if !RunPerfRealtime {
		Skip("Realtime performance tests are not enabled")
	}
}


text:
<TITLE>Review for Vatel (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Vatel (2000)

reviewed by
Susan Granger

http://www.susangranger.com/

Susan Granger's review of  "VATEL" (Miramax Films)

   Based on a true story and adapted into English by Tom
Stoppard from Jeanne Labrune's French screenplay, this elegant,
elaborate 17th century costume drama is propelled by the scheme of a
nearly bankrupt French prince (Julian Glover) to save his province by
entertaining King Louis XIV (Julian Sands) and his courtiers so
lavishly that he will gain favor and patronage.  To this end, he
relies on his master steward Vatel (Gerard Depardieu), an artist with
the power to "create and astonish," to design and orchestrate an
incredibly decadent weekend-in-the-country, a bacchanal of eating,
drinking, sport and opulent theatrical spectacles. What's unexpected
is that, amidst the various sensual pleasures and treacherous sexual
liaisons, the King's new courtesan, Anne de Montausier (Uma Thurman),
will take a fancy to Vatel, seeking him out amidst his army of
peasants in the kitchen galleys, which infuriates the King's scheming
confidante (Tim Roth), whom she spurns.  Director Roland Joffe ("The
Killing Fields") concocts an indulgent feast-for-the eye but what he
sacrifices at the banquet is character development. Many relationships
and political intrigues are left unexplored and unexplained. As a
result, the audience remains emotionally uninvolved. Cinematographer
Robert Fraisse, designer Jean Rabasse and costumer Yvonne Sassinot de
Nesle create magnificent pageantry and authentically gilded excess
within the vast chateau where Vatel, literally, has a finger in every
pot, inventing whipped cream when the eggs go bad, drawing miraculous
confections out of spun sugar, and defending a scullery lad from the
unwanted advances of the Sun King's gay brother. On the Granger Movie
Gauge of 1 to 10, "Vatel" is a sumptuous 7, appealing particularly to
the appetites of art-house audiences.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
var output = [];
var cmd = executeCommand("cb-command-create",{session: args.sessionid, wait: "true", name: "process list"});
var id = cmd[0].Contents.id;
var result = executeCommand("cb-command-info",{session: args.sessionid, command: id.toString()});
output.push({ContentsFormat: formats.table, Type: entryTypes.note, Contents: result[0].Contents.processes});
return output;


text:
var common = require('./common');
var os = require('os');
var fs = require('fs');

// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
function writeableDir(dir) {
  if (!dir || !fs.existsSync(dir))
    return false;

  if (!fs.statSync(dir).isDirectory())
    return false;

  var testFile = dir+'/'+common.randomFileName();
  try {
    fs.writeFileSync(testFile, ' ');
    common.unlinkSync(testFile);
    return dir;
  } catch (e) {
    return false;
  }
}

//@
//@ ### tempdir()
//@
//@ Examples:
//@
//@ ```javascript
//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
//@ ```
//@
//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
function _tempDir() {
  var state = common.state;
  if (state.tempDir)
    return state.tempDir; // from cache

  state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+
                  writeableDir(process.env['TMPDIR']) ||
                  writeableDir(process.env['TEMP']) ||
                  writeableDir(process.env['TMP']) ||
                  writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
                  writeableDir('C:\\TEMP') || // Windows
                  writeableDir('C:\\TMP') || // Windows
                  writeableDir('\\TEMP') || // Windows
                  writeableDir('\\TMP') || // Windows
                  writeableDir('/tmp') ||
                  writeableDir('/var/tmp') ||
                  writeableDir('/usr/tmp') ||
                  writeableDir('.'); // last resort

  return state.tempDir;
}
module.exports = _tempDir;


text:
obj-y = main.o
ccflags-y += -I${ZEPHYR_BASE}/lib/json/

include $(ZEPHYR_BASE)/tests/Makefile.test


text:
@interface SChartSeriesDataBinSearchStrategyFactory : NSObject
{
}

+ (id)dataBinSearchStrategyForChartSeries:(id)arg1;

@end


text:
package com.hazelcast.config.helpers;

import com.hazelcast.config.Config;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Function;

public class DeclarativeConfigFileHelper {
    private static final String HAZELCAST_START_TAG = "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n";
    private static final String HAZELCAST_END_TAG = "</hazelcast>\n";
    private static final String HAZELCAST_CLIENT_START_TAG =
            "<hazelcast-client xmlns=\"http://www.hazelcast.com/schema/client-config\">\n";
    private static final String HAZELCAST_CLIENT_END_TAG = "</hazelcast-client>";
    private static final String HAZELCAST_CLIENT_FAILOVER_START_TAG =
            "<hazelcast-client-failover xmlns=\"http://www.hazelcast.com/schema/client-config\">\n";
    private static final String HAZELCAST_CLIENT_FAILOVER_END_TAG = "</hazelcast-client-failover>";

    private List<String> testConfigPaths = new LinkedList<>();

    // MEMBER

    public File givenXmlConfigFileInWorkDir(String instanceName) throws Exception {
        return givenXmlConfigFileInWorkDir("hazelcast.xml", instanceName);
    }

    public File givenXmlConfigFileInWorkDir(String filename, String instanceName) throws Exception {
        String xml = xmlConfig(instanceName);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public File givenYamlConfigFileInWorkDir(String instanceName) throws Exception {
        return givenYamlConfigFileInWorkDir("hazelcast.yaml", instanceName);
    }

    public File givenYmlConfigFileInWorkDir(String instanceName) throws Exception {
        return givenYamlConfigFileInWorkDir("hazelcast.yml", instanceName);
    }

    public File givenYamlConfigFileInWorkDir(String filename, String instanceName) throws Exception {
        String xml = yamlConfig(instanceName);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public URL givenXmlConfigFileOnClasspath(String instanceName) throws Exception {
        return givenXmlConfigFileOnClasspath("hazelcast.xml", instanceName);
    }

    public URL givenXmlConfigFileOnClasspath(String filename, String instanceName) throws Exception {
        String xml = xmlConfig(instanceName);
        return givenConfigFileOnClasspath(filename, xml);
    }

    public URL givenYamlConfigFileOnClasspath(String instanceName) throws Exception {
        return givenYamlConfigFileOnClasspath("hazelcast.yaml", instanceName);
    }

    public URL givenYmlConfigFileOnClasspath(String instanceName) throws Exception {
        return givenYamlConfigFileOnClasspath("hazelcast.yml", instanceName);
    }

    public URL givenYamlConfigFileOnClasspath(String filename, String instanceName) throws Exception {
        String yaml = yamlConfig(instanceName);
        return givenConfigFileOnClasspath(filename, yaml);
    }

    // CLIENT

    public File givenXmlClientConfigFileInWorkDir(String instanceName) throws Exception {
        return givenXmlClientConfigFileInWorkDir("hazelcast-client.xml", instanceName);
    }

    public File givenXmlClientConfigFileInWorkDir(String filename, String instanceName) throws Exception {
        String xml = xmlClientConfig(instanceName);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public URL givenXmlClientConfigFileOnClasspath(String instanceName) throws Exception {
        return givenXmlClientConfigFileOnClasspath("hazelcast-client.xml", instanceName);
    }

    public URL givenXmlClientConfigFileOnClasspath(String filename, String instanceName) throws Exception {
        String xml = xmlClientConfig(instanceName);
        return givenConfigFileOnClasspath(filename, xml);
    }

    public File givenYamlClientConfigFileInWorkDir(String instanceName) throws Exception {
        return givenYamlClientConfigFileInWorkDir("hazelcast-client.yaml", instanceName);
    }

    public File givenYmlClientConfigFileInWorkDir(String instanceName) throws Exception {
        return givenYamlClientConfigFileInWorkDir("hazelcast-client.yml", instanceName);
    }

    public File givenYamlClientConfigFileInWorkDir(String filename, String instanceName) throws Exception {
        String xml = yamlClientConfig(instanceName);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public URL givenYamlClientConfigFileOnClasspath(String instanceName) throws Exception {
        return givenYamlClientConfigFileOnClasspath("hazelcast-client.yaml", instanceName);
    }

    public URL givenYmlClientConfigFileOnClasspath(String instanceName) throws Exception {
        return givenYamlClientConfigFileOnClasspath("hazelcast-client.yml", instanceName);
    }

    public URL givenYamlClientConfigFileOnClasspath(String filename, String instanceName) throws Exception {
        String yaml = yamlClientConfig(instanceName);
        return givenConfigFileOnClasspath(filename, yaml);
    }

    // CLIENT-FAILOVER

    public File givenXmlClientFailoverConfigFileInWorkDir(int tryCount) throws Exception {
        return givenXmlClientFailoverConfigFileInWorkDir("hazelcast-client-failover.xml", tryCount);
    }

    public File givenXmlClientFailoverConfigFileInWorkDir(String filename, int tryCount) throws Exception {
        String xml = xmlFailoverClientConfig(tryCount);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public URL givenXmlClientFailoverConfigFileOnClasspath(int tryCount) throws Exception {
        return givenXmlClientFailoverConfigFileOnClasspath("hazelcast-client-failover.xml", tryCount);
    }

    public URL givenXmlClientFailoverConfigFileOnClasspath(String filename, int tryCount) throws Exception {
        String xml = xmlFailoverClientConfig(tryCount);
        return givenConfigFileOnClasspath(filename, xml);
    }

    public File givenYamlClientFailoverConfigFileInWorkDir(int tryCount) throws Exception {
        return givenYamlClientFailoverConfigFileInWorkDir("hazelcast-client-failover.yaml", tryCount);
    }

    public File givenYmlClientFailoverConfigFileInWorkDir(int tryCount) throws Exception {
        return givenYamlClientFailoverConfigFileInWorkDir("hazelcast-client-failover.yml", tryCount);
    }

    public File givenYamlClientFailoverConfigFileInWorkDir(String filename, int tryCount) throws Exception {
        String xml = yamlFailoverClientConfig(tryCount);
        return givenConfigFileInWorkDir(filename, xml);
    }

    public URL givenYamlClientFailoverConfigFileOnClasspath(int tryCount) throws Exception {
        return givenYamlClientFailoverConfigFileOnClasspath("hazelcast-client-failover.yaml", tryCount);
    }

    public URL givenYmlClientFailoverConfigFileOnClasspath(int tryCount) throws Exception {
        return givenYamlClientFailoverConfigFileOnClasspath("hazelcast-client-failover.yml", tryCount);
    }

    public URL givenYamlClientFailoverConfigFileOnClasspath(String filename, int tryCount) throws Exception {
        String yaml = yamlFailoverClientConfig(tryCount);
        return givenConfigFileOnClasspath(filename, yaml);
    }

    public File givenConfigFileInWorkDir(String filename, String content) throws IOException {
        File file = new File(filename);
        PrintWriter writer = new PrintWriter(file, "UTF-8");
        writer.print(content);
        writer.close();

        testConfigPaths.add(file.getAbsolutePath());

        return file;
    }

    public URL givenConfigFileOnClasspath(String filename, String content) throws Exception {
        URL classPathConfigUrl = Config.class.getClassLoader().getResource(".");
        String configFilePath = classPathConfigUrl.getFile() + "/" + filename;
        File file = new File(configFilePath);
        PrintWriter writer = new PrintWriter(file, "UTF-8");
        writer.println(content);
        writer.close();

        testConfigPaths.add(file.getAbsolutePath());

        return getClass().getClassLoader().getResource(filename);
    }

    public String createFilesWithCycleImports(Function<String, String> fileContentWithImportResource, String... paths) throws Exception {
        for (int i = 1; i < paths.length; i++) {
            createFileWithDependencyImport(paths[i - 1], paths[i], fileContentWithImportResource);
        }
        return createFileWithDependencyImport(paths[0], paths[1], fileContentWithImportResource);
    }

    private String createFileWithDependencyImport(
        String dependent,
        String pathToDependency,
        Function<String, String> fileContentWithImportResource) throws Exception {
        final String xmlContent = fileContentWithImportResource.apply(pathToDependency);
        givenConfigFileInWorkDir(dependent, xmlContent);
        return xmlContent;
    }

    private String xmlConfig(String instanceName) {
        return ""
                + HAZELCAST_START_TAG
                + "  <instance-name>" + instanceName + "</instance-name>"
                + HAZELCAST_END_TAG;
    }

    private String xmlClientConfig(String instanceName) {
        return ""
                + HAZELCAST_CLIENT_START_TAG
                + "  <instance-name>" + instanceName + "</instance-name>"
                + "  <connection-strategy async-start=\"true\" reconnect-mode=\"OFF\">"
                + "  </connection-strategy>"
                + HAZELCAST_CLIENT_END_TAG;
    }

    private String xmlFailoverClientConfig(int tryCount) {
        return ""
                + HAZELCAST_CLIENT_FAILOVER_START_TAG
                + "  <try-count>" + tryCount + "</try-count>"
                + "  <clients>"
                + "    <client>hazelcast-client-c1.xml</client>"
                + "  </clients>"
                + HAZELCAST_CLIENT_FAILOVER_END_TAG;
    }

    private String yamlConfig(String instanceName) {
        return ""
                + "hazelcast:\n"
                + "  instance-name: " + instanceName;
    }

    private String yamlClientConfig(String instanceName) {
        return ""
                + "hazelcast-client:\n"
                + "  instance-name: " + instanceName + "\n"
                + "  connection-strategy:\n"
                + "    async-start: true\n"
                + "    reconnect-mode: OFF\n";
    }

    private String yamlFailoverClientConfig(int tryCount) {
        return ""
                + "hazelcast-client-failover:\n"
                + "  try-count: " + tryCount + "\n"
                + "  clients:\n"
                + "    - hazelcast-client-c1.yaml";
    }

    public void ensureTestConfigDeleted() {
        if (!testConfigPaths.isEmpty()) {
            for (String testConfigPath : testConfigPaths) {
                File file = new File(testConfigPath);
                file.delete();
            }
        }
    }
}


text:
<!DOCTYPE html>

		<title>Paginated Dropdown Widget - Downloads</title>
		<link rel="stylesheet" type="text/css" href="assets/style.css" />

Paginated Dropdown Widget

- Uncompressed Code

- Minified Code

Filter JSON Plugin

- Uncompressed Code

- Minified Code


text:
Attributes in extended form (array)
--FILE--
<?php
include __DIR__.'/../bootstrap.php';
echo h::{'h1.main-title'}(
	'Heading',
	[
		'title' => 'Some heading title'
	]
);
echo h::input(
	[
		'readonly'
	]
);
?>
--EXPECT--

Heading

<input readonly type="text">


text:
PointCloudFrame.Shade Method
============================

Produces a shaded image from the point cloud frame, based only on point position.

Syntax
======

<colgroup>
<col width="100%" />
</colgroup>

C++

public:
void Shade(
         Matrix4x4 worldToCameraTransform,
         Matrix4x4 worldToRGBTransform,
         ColorImageFrame^ shadedSurfaceFrame
)

<colgroup>
<col width="100%" />
</colgroup>

C#

public void Shade (
         Matrix4x4 worldToCameraTransform,
         Matrix4x4 worldToRGBTransform,
         ColorImageFrameshadedSurfaceFrame
)

<colgroup>
<col width="100%" />
</colgroup>

JavaScript

pointCloudFrame.shade(worldToCameraTransform, worldToRGBTransform, shadedSurfaceFrame);

#### Parameters

*worldToCameraTransform*
Type: [Matrix4x4](../../Matrix4x4_Structure.md)
The transform used to determine the perspective of the shaded point cloud relative to the world. This affects the application of the worldToRGBTramsform to the point cloud. To achieve consistent results, this should match the world-to-camera transform that was used to create the [PointCloudFrame](../../PointCloudFrame_Class.md).

*worldToRGBTransform*
Type: [Matrix4x4](../../Matrix4x4_Structure.md)
The transform that defines a mapping from position to RGB color space. The X, Y, Z components of the point positions transformed by this matrix are used as the R, G, B values in the rendered frame.

*shadedSurfaceFrame*
Type: [ColorImageFrame](../../ColorImageFrame_Class.md)
A color image frame that receives the shaded frame.

Remarks
=======

This method is provided to enable interactive display of point cloud data.

Requirements
============

**Namespace:**Microsoft.Kinect.Fusion
**Metadata:**microsoft.kinect.fusion.winmd

See also
========

#### Reference

[PointCloudFrame Class](../../PointCloudFrame_Class.md)
 [Microsoft.Kinect.Fusion Namespace](../../../Kinect.Fusion.md)


text:
<?php

namespace Kanboard\Model;

use Kanboard\Event\TaskLinkEvent;

/**
 * TaskLink model
 *
 * @package model
 * @author  Olivier Maridat
 * @author  Frederic Guillot
 */
class TaskLink extends Base
{
    /**
     * SQL table name
     *
     * @var string
     */
    const TABLE = 'task_has_links';

    /**
     * Events
     *
     * @var string
     */
    const EVENT_CREATE_UPDATE = 'tasklink.create_update';

    /**
     * Get a task link
     *
     * @access public
     * @param  integer   $task_link_id   Task link id
     * @return array
     */
    public function getById($task_link_id)
    {
        return $this->db->table(self::TABLE)->eq('id', $task_link_id)->findOne();
    }

    /**
     * Get the opposite task link (use the unique index task_has_links_unique)
     *
     * @access public
     * @param  array     $task_link
     * @return array
     */
    public function getOppositeTaskLink(array $task_link)
    {
        $opposite_link_id = $this->link->getOppositeLinkId($task_link['link_id']);

        return $this->db->table(self::TABLE)
                    ->eq('opposite_task_id', $task_link['task_id'])
                    ->eq('task_id', $task_link['opposite_task_id'])
                    ->eq('link_id', $opposite_link_id)
                    ->findOne();
    }

    /**
     * Get all links attached to a task
     *
     * @access public
     * @param  integer   $task_id   Task id
     * @return array
     */
    public function getAll($task_id)
    {
        return $this->db
                    ->table(self::TABLE)
                    ->columns(
                        self::TABLE.'.id',
                        self::TABLE.'.opposite_task_id AS task_id',
                        Link::TABLE.'.label',
                        Task::TABLE.'.title',
                        Task::TABLE.'.is_active',
                        Task::TABLE.'.project_id',
                        Task::TABLE.'.column_id',
                        Task::TABLE.'.color_id',
                        Task::TABLE.'.time_spent AS task_time_spent',
                        Task::TABLE.'.time_estimated AS task_time_estimated',
                        Task::TABLE.'.owner_id AS task_assignee_id',
                        User::TABLE.'.username AS task_assignee_username',
                        User::TABLE.'.name AS task_assignee_name',
                        Column::TABLE.'.title AS column_title',
                        Project::TABLE.'.name AS project_name'
                    )
                    ->eq(self::TABLE.'.task_id', $task_id)
                    ->join(Link::TABLE, 'id', 'link_id')
                    ->join(Task::TABLE, 'id', 'opposite_task_id')
                    ->join(Column::TABLE, 'id', 'column_id', Task::TABLE)
                    ->join(User::TABLE, 'id', 'owner_id', Task::TABLE)
                    ->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
                    ->asc(Link::TABLE.'.id')
                    ->desc(Column::TABLE.'.position')
                    ->desc(Task::TABLE.'.is_active')
                    ->asc(Task::TABLE.'.position')
                    ->asc(Task::TABLE.'.id')
                    ->findAll();
    }

    /**
     * Get all links attached to a task grouped by label
     *
     * @access public
     * @param  integer   $task_id   Task id
     * @return array
     */
    public function getAllGroupedByLabel($task_id)
    {
        $links = $this->getAll($task_id);
        $result = array();

        foreach ($links as $link) {
            if (! isset($result[$link['label']])) {
                $result[$link['label']] = array();
            }

            $result[$link['label']][] = $link;
        }

        return $result;
    }

    /**
     * Publish events
     *
     * @access private
     * @param  array $events
     */
    private function fireEvents(array $events)
    {
        foreach ($events as $event) {
            $event['project_id'] = $this->taskFinder->getProjectId($event['task_id']);
            $this->container['dispatcher']->dispatch(self::EVENT_CREATE_UPDATE, new TaskLinkEvent($event));
        }
    }

    /**
     * Create a new link
     *
     * @access public
     * @param  integer   $task_id            Task id
     * @param  integer   $opposite_task_id   Opposite task id
     * @param  integer   $link_id            Link id
     * @return integer                       Task link id
     */
    public function create($task_id, $opposite_task_id, $link_id)
    {
        $events = array();
        $this->db->startTransaction();

        // Get opposite link
        $opposite_link_id = $this->link->getOppositeLinkId($link_id);

        $values = array(
            'task_id' => $task_id,
            'opposite_task_id' => $opposite_task_id,
            'link_id' => $link_id,
        );

        // Create the original task link
        $this->db->table(self::TABLE)->insert($values);
        $task_link_id = $this->db->getLastId();
        $events[] = $values;

        // Create the opposite task link
        $values = array(
            'task_id' => $opposite_task_id,
            'opposite_task_id' => $task_id,
            'link_id' => $opposite_link_id,
        );

        $this->db->table(self::TABLE)->insert($values);
        $events[] = $values;

        $this->db->closeTransaction();

        $this->fireEvents($events);

        return (int) $task_link_id;
    }

    /**
     * Update a task link
     *
     * @access public
     * @param  integer   $task_link_id          Task link id
     * @param  integer   $task_id               Task id
     * @param  integer   $opposite_task_id      Opposite task id
     * @param  integer   $link_id               Link id
     * @return boolean
     */
    public function update($task_link_id, $task_id, $opposite_task_id, $link_id)
    {
        $events = array();
        $this->db->startTransaction();

        // Get original task link
        $task_link = $this->getById($task_link_id);

        // Find opposite task link
        $opposite_task_link = $this->getOppositeTaskLink($task_link);

        // Get opposite link
        $opposite_link_id = $this->link->getOppositeLinkId($link_id);

        // Update the original task link
        $values = array(
            'task_id' => $task_id,
            'opposite_task_id' => $opposite_task_id,
            'link_id' => $link_id,
        );

        $rs1 = $this->db->table(self::TABLE)->eq('id', $task_link_id)->update($values);
        $events[] = $values;

        // Update the opposite link
        $values = array(
            'task_id' => $opposite_task_id,
            'opposite_task_id' => $task_id,
            'link_id' => $opposite_link_id,
        );

        $rs2 = $this->db->table(self::TABLE)->eq('id', $opposite_task_link['id'])->update($values);
        $events[] = $values;

        $this->db->closeTransaction();

        if ($rs1 && $rs2) {
            $this->fireEvents($events);
            return true;
        }

        return false;
    }

    /**
     * Remove a link between two tasks
     *
     * @access public
     * @param  integer   $task_link_id
     * @return boolean
     */
    public function remove($task_link_id)
    {
        $this->db->startTransaction();

        $link = $this->getById($task_link_id);
        $link_id = $this->link->getOppositeLinkId($link['link_id']);

        $this->db->table(self::TABLE)->eq('id', $task_link_id)->remove();

        $this->db
            ->table(self::TABLE)
            ->eq('opposite_task_id', $link['task_id'])
            ->eq('task_id', $link['opposite_task_id'])
            ->eq('link_id', $link_id)->remove();

        $this->db->closeTransaction();

        return true;
    }
}


text:
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */

/**
 * Functions for iterating through tokens in the current editor buffer. Useful for doing
 * light parsing that can rely purely on information gathered by the code coloring mechanism.
 */

define(function (require, exports, module) {
    "use strict";

    var _           = require("thirdparty/lodash"),
        CodeMirror  = require("thirdparty/CodeMirror2/lib/codemirror");

    var cache;

    function _clearCache(cm) {
        cache = null;
        if (cm) { // event handler
            cm.off("changes", _clearCache);
        }
    }

    /*
     * Caches the tokens for the given editor/line if needed
     * @param {!CodeMirror} cm
     * @param {!number} line
     * @return {Array.<Object>} (Cached) array of tokens
     */
    function _manageCache(cm, line) {
        if (!cache || !cache.tokens || cache.line !== line || cache.cm !== cm) {
            // Cache is no longer matching -> Update
            var tokens = cm.getLineTokens(line, false);
            // Add empty beginning-of-line token for backwards compatibility
            tokens.unshift(cm.getTokenAt({line: line, ch: 0}, false));
            cache = {
                cm: cm,
                line: line,
                timeStamp: Date.now(),
                tokens: tokens,
            };
            cm.off("changes", _clearCache);
            cm.on("changes", _clearCache);
        }
        return cache.tokens;
    }

    /*
     * Like cm.getTokenAt, but with caching
     * @param {!CodeMirror} cm
     * @param {!{ch:number, line:number}} pos
     * @param {boolean} precise If given, results in more current results. Suppresses caching.
     * @return {Object} Token for position
     */
    function _getToken(cm, pos, precise) {
        if (precise) {
            _clearCache(); // reset cache
            return cm.getTokenAt(pos, precise);
        }
        var cachedTokens    = _manageCache(cm, pos.line),
            tokenIndex      = _.sortedIndex(cachedTokens, {end: pos.ch}, "end"), // binary search is faster for long arrays
            token           = cachedTokens[tokenIndex];
        return token || cm.getTokenAt(pos, precise); // fall back to CMs getTokenAt, for example in an empty line
    }

   /**
     * Creates a context object for the given editor and position, suitable for passing to the
     * move functions.
     * @param {!CodeMirror} cm
     * @param {!{ch:number, line:number}} pos
     * @return {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}}
     */
    function getInitialContext(cm, pos) {
        return {
            "editor": cm,
            "pos": pos,
            "token": cm.getTokenAt(pos, true)
        };
    }

    /**
     * Moves the given context backwards by one token.
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
     * @param {boolean=} precise If code is being edited, use true (default) for accuracy.
     *      If parsing unchanging code, use false to use cache for performance.
     * @return {boolean} whether the context changed
     */
    function movePrevToken(ctx, precise) {
        if (precise === undefined) {
            precise = true;
        }

        if (ctx.pos.ch <= 0 || ctx.token.start <= 0) {
            //move up a line
            if (ctx.pos.line <= 0) {
                return false; //at the top already
            }
            ctx.pos.line--;
            ctx.pos.ch = ctx.editor.getLine(ctx.pos.line).length;
        } else {
            ctx.pos.ch = ctx.token.start;
        }
        ctx.token = _getToken(ctx.editor, ctx.pos, precise);
        return true;
    }

    /**
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
     * @return {boolean} true if movePrevToken() would return false without changing pos
     */
    function isAtStart(ctx) {
        return (ctx.pos.ch <= 0 || ctx.token.start <= 0) && (ctx.pos.line <= 0);
    }

    /**
     * Moves the given context forward by one token.
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
     * @param {boolean=} precise If code is being edited, use true (default) for accuracy.
     *      If parsing unchanging code, use false to use cache for performance.
     * @return {boolean} whether the context changed
     */
    function moveNextToken(ctx, precise) {
        var eol = ctx.editor.getLine(ctx.pos.line).length;
        if (precise === undefined) {
            precise = true;
        }

        if (ctx.pos.ch >= eol || ctx.token.end >= eol) {
            //move down a line
            if (ctx.pos.line >= ctx.editor.lineCount() - 1) {
                return false; //at the bottom
            }
            ctx.pos.line++;
            ctx.pos.ch = 0;
        } else {
            ctx.pos.ch = ctx.token.end + 1;
        }
        ctx.token = _getToken(ctx.editor, ctx.pos, precise);
        return true;
    }

    /**
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
     * @return {boolean} true if moveNextToken() would return false without changing pos
     */
    function isAtEnd(ctx) {
        var eol = ctx.editor.getLine(ctx.pos.line).length;
        return (ctx.pos.ch >= eol || ctx.token.end >= eol) && (ctx.pos.line >= ctx.editor.lineCount() - 1);
    }

   /**
     * Moves the given context in the given direction, skipping any whitespace it hits.
     * @param {function} moveFxn the function to move the context
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
     * @return {boolean} whether the context changed
     */
    function moveSkippingWhitespace(moveFxn, ctx) {
        if (!moveFxn(ctx)) {
            return false;
        }
        while (!ctx.token.type && !/\S/.test(ctx.token.string)) {
            if (!moveFxn(ctx)) {
                return false;
            }
        }
        return true;
    }

    /**
     * In the given context, get the character offset of pos from the start of the token.
     * @param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} context
     * @return {number}
     */
    function offsetInToken(ctx) {
        var offset = ctx.pos.ch - ctx.token.start;
        if (offset < 0) {
            console.log("CodeHintUtils: _offsetInToken - Invalid context: pos not in the current token!");
        }
        return offset;
    }

    /**
     * Returns the mode object and mode name string at a given position
     * @param {!CodeMirror} cm CodeMirror instance
     * @param {!{line:number, ch:number}} pos Position to query for mode
     * @return {mode:{Object}, name:string}
     */
    function getModeAt(cm, pos) {
        var outerMode = cm.getMode(),
            modeData = CodeMirror.innerMode(outerMode, cm.getTokenAt(pos, true).state),
            name;

        name = (modeData.mode.name === "xml") ?
                modeData.mode.configuration : modeData.mode.name;

        return {mode: modeData.mode, name: name};
    }

    exports.movePrevToken           = movePrevToken;
    exports.moveNextToken           = moveNextToken;
    exports.isAtStart               = isAtStart;
    exports.isAtEnd                 = isAtEnd;
    exports.moveSkippingWhitespace  = moveSkippingWhitespace;
    exports.getInitialContext       = getInitialContext;
    exports.offsetInToken           = offsetInToken;
    exports.getModeAt               = getModeAt;
});


text: ./monitor.sh start client


text:
<?php

namespace Google\Service\GoogleAnalyticsAdmin;

class GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse extends \Google\Collection
{
  protected $collection_key = 'customDimensions';
  protected $customDimensionsType = GoogleAnalyticsAdminV1alphaCustomDimension::class;
  protected $customDimensionsDataType = 'array';
  /**
   * @var string
   */
  public $nextPageToken;

  /**
   * @param GoogleAnalyticsAdminV1alphaCustomDimension[]
   */
  public function setCustomDimensions($customDimensions)
  {
    $this->customDimensions = $customDimensions;
  }
  /**
   * @return GoogleAnalyticsAdminV1alphaCustomDimension[]
   */
  public function getCustomDimensions()
  {
    return $this->customDimensions;
  }
  /**
   * @param string
   */
  public function setNextPageToken($nextPageToken)
  {
    $this->nextPageToken = $nextPageToken;
  }
  /**
   * @return string
   */
  public function getNextPageToken()
  {
    return $this->nextPageToken;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse::class, 'Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaListCustomDimensionsResponse');


text:
/**
 * Created by Raphson on 6/27/16.
 */
var mongoose = require('mongoose');
var secrets = require('./secrets');

var db = mongoose.connection;
mongoose.Promise = global.Promise;
console.log(secrets.db);
mongoose.connect(secrets.db);

module.exports = {
    dbconnect : function(){
        db.on('error', console.error.bind(console, 'MongoDB Connection Error. Mongodb seems to be down'));
        db.on('open', function callback(){
            console.log('Connection came through');
        });
    }
}


text:
package org.insightech.er.editor.view.action.option.notation.design;

import org.insightech.er.editor.ERDiagramEditor;

public class ChangeDesignToFunnyAction extends AbstractChangeDesignAction {

    public static final String ID = ChangeDesignToFunnyAction.class.getName();

    public static final String TYPE = "funny";

    public ChangeDesignToFunnyAction(final ERDiagramEditor editor) {
        super(ID, TYPE, editor);
    }

}


text:
package me.otisdiver.otisarena.event;

import java.util.WeakHashMap;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;

import me.otisdiver.otisarena.OtisArena;
import me.otisdiver.otisarena.game.Game;
import me.otisdiver.otisarena.game.GameState;
import me.otisdiver.otisarena.game.Kit;

public class ClickHandler extends EasyListener {

    private static final String errorChat = ChatColor.DARK_RED + "Internal error! Check console or contact a developer.";
    private WeakHashMap<Player, ItemStack> activeButtons = new WeakHashMap<>();

    private Game game;

    public ClickHandler(OtisArena main) {
        super(main);
        game = main.getGame();
    }

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onClick(PlayerInteractEvent e) {
        // only pay attention to right click events with the main hand
        Action act = e.getAction();
        if (!(act.equals(Action.RIGHT_CLICK_AIR) || act.equals(Action.RIGHT_CLICK_BLOCK))) return;
        if (e.getHand() != EquipmentSlot.HAND) return;

        Player player = e.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();

        // check if the item is a kit button, assign kit if it is
        if (item.getType().equals(Kit.buttonDefault) && item.getItemMeta().hasDisplayName()) {
            String name = item.getItemMeta().getDisplayName();

            Kit[] kits = Kit.values();
            for(int i = 0; i < kits.length; i++) {

                // if the item name is the same as the kit's button
                Kit kit = kits[i];
                if (name.equals(kit.getDisplayName())) {
                    game.setKit(player, kit);
                    ItemStack oldButton = activeButtons.get(player);
                    if (oldButton != null) oldButton.setType(Kit.buttonDefault);
                    item.setType(Kit.buttonChosen);
                    activeButtons.put(player, item);
                    e.setCancelled(true);
                }
            }
            return;
        }

        // check if the item is a chosen kit button, reset kit if it is
        else if (item.getType().equals(Kit.buttonChosen)) {
            // if the button is for the player's chosen kit, unset their kit
            if (item.equals(activeButtons.get(player))) {
                item.setType(Kit.buttonDefault);
                activeButtons.remove(player);
                game.setKit(player, null);
                e.setCancelled(true);
            }
            return;
        }

        // check if the item is a kit tool and game is running, activate ability if so
        if (item.getType().equals(Kit.abilityTool) && GameState.getCurrent().equals(GameState.PLAYING)) {
            try {
                game.getKit(player).getAbility().newInstance().playerUse(player);
            } catch (Exception e1) {
                e1.printStackTrace();
                player.sendMessage(errorChat);
            }
            return;
        }
    }
}


text:
<?php

class Struts_Option_Select extends Struts_Option {
	public function input_html() {
		$id = esc_attr( $this->html_id() );
		$name = esc_attr( $this->html_name() );

		$output = "<select id='$id' name='$name'>";

		foreach ( $this->valid_values() as $value => $text ) {
			// If this value is selected, mark it so
			$selected = selected( $this->value(), $value, false );

			$value = esc_attr( $value );

			$output .= "<option value='$value' $selected >$text</option>";
		}

		$output .= "</select>";

		echo $output;
	}

	protected function standard_validation( $value ) {
		$valid_values = $this->valid_values();
		if ( array_key_exists( $value, $valid_values ) ) {
			return $value;
		}

		return $this->default_value();
	}

	protected function customizer_control_options( $setting_name, $priority = 1000 ) {
		return array_merge(
			parent::customizer_control_options( $setting_name, $priority ),
			array(
				'type' => 'radio',
				'choices' => $this->valid_values()
			)
		);
	}
}


text:
WebFontConfig = {
  google: { families: [ 'Dosis:400,700:latin', 'Bitter:400,400italic,700:latin' ] }
};
(function() {
  var wf = document.createElement('script');
  wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  wf.type = 'text/javascript';
  wf.async = 'true';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(wf, s);
})();


text:
<title>Phing API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="css/jquery-ui.css" type="text/css"></link><link rel="stylesheet" href="css/docblox/jquery-ui-1.8.16.custom.css" type="text/css"></link><link rel="stylesheet" href="css/jquery.treeview.css" type="text/css"></link><link rel="stylesheet" href="css/theme.css" type="text/css"></link>

tasks/ext/VersionTask.php

              Show:
              inherited

                          Classes

\VersionTask

              Table of Contents

VersionTask

Increments a three-part version number from a given file
and writes it back to the file.
Incrementing is based on given releasetype, which can be one
of Major, Minor and Bugfix.
Resulting version number is also published under supplied property.

Author

Mike Wittje

Package

phing.tasks.ext

Version

$Id: VersionTask.php 1084 2011-05-06 09:55:25Z mrook $ $Rev $Revision: 1084 $ $Date: 2011-05-06 11:55:25 +0200 (Fri, 06 May 2011) $ $Author: mrook $

\VersionTask
jump to top

Package: phing\tasks\ext
VersionTask

Increments a three-part version number from a given file
and writes it back to the file.
Incrementing is based on given releasetype, which can be one
of Major, Minor and Bugfix.
Resulting version number is also published under supplied property.

Parent(s)

\Task
            <
            \ProjectComponent

Author

Mike Wittje

Version

$Id: VersionTask.php 1084 2011-05-06 09:55:25Z mrook $ $Rev $Revision: 1084 $ $Date: 2011-05-06 11:55:25 +0200 (Fri, 06 May 2011) $ $Author: mrook $

Constants

                RELEASETYPE_MAJOR
                = 'MAJOR'

                RELEASETYPE_MINOR
                = 'MINOR'

                RELEASETYPE_BUGFIX
                = 'BUGFIX'

Properties

\PhingFile
                 $file= ''

Property for File
file

Details

Type

\PhingFile

string
                 $property= ''

Property to be set

Details

Type

string

string
                 $releasetype= ''

Property for Releasetype

Details

Type

string

Methods

checkFile(

          )

        :
          void

checks file attribute

Throws

Exception
Description

\BuildException

checkProperty(

          )

        :
          void

checks property attribute

Throws

Exception
Description

\BuildException

checkReleasetype(

          )

        :
          void

checks releasetype attribute

Throws

Exception
Description

\BuildException

getDescription(

          )

        :
          void

getLocation(

          )

        :
          void

getOwningTarget(

          )

        :
          void

getProject(

          )

        :
          void

getRegisterSlot(

          )

        :
          void

getRuntimeConfigurableWrapper(

          )

        :
          void

getTaskName(

          )

        :
          void

getTaskType(

          )

        :
          void

getVersion(
          string $filecontent
          )

        :
          string

Returns new version number corresponding to Release type

Parameters

Name
Type
Description

$filecontent
string

Returns

Type
Description

string

init(

          )

        :
          void

log(

          )

        :
          void

main(

          )

        :
          void

Main-Method for the Task

Throws

Exception
Description

\BuildException

maybeConfigure(

          )

        :
          void

perform(

          )

        :
          void

setDescription(

          )

        :
          void

setFile(
          \PhingFile $file
          )

        :
          void

Set Property for File containing versioninformation

Parameters

Name
Type
Description

$file
\PhingFile

setLocation(

          )

        :
          void

setOwningTarget(

          )

        :
          void

setProject(

          )

        :
          void

setProperty(
           $property
          )

        :
          void

Set name of property to be set

Parameters

Name
Type
Description

$property

setReleasetype(
          string $releasetype
          )

        :
          void

Set Property for Releasetype (Minor, Major, Bugfix)

Parameters

Name
Type
Description

$releasetype
string

setRuntimeConfigurableWrapper(

          )

        :
          void

setTaskName(

          )

        :
          void

setTaskType(

          )

        :
          void

Documentation was generated by DocBlox 0.17.1.


text:
<?php

namespace DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIROperationOutcome;

use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRCodeableConcept;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueSeverity;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueType;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRTypeInterface;

/**
 * A collection of error, warning, or information messages that result from a
 * system action.
 *
 * Class FHIROperationOutcomeIssue
 * @package \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIROperationOutcome
 */
class FHIROperationOutcomeIssue extends FHIRBackboneElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE;
    const FIELD_CODE = 'code';
    const FIELD_CODE_EXT = '_code';
    const FIELD_DETAILS = 'details';
    const FIELD_DIAGNOSTICS = 'diagnostics';
    const FIELD_DIAGNOSTICS_EXT = '_diagnostics';
    const FIELD_EXPRESSION = 'expression';
    const FIELD_EXPRESSION_EXT = '_expression';
    const FIELD_LOCATION = 'location';
    const FIELD_LOCATION_EXT = '_location';
    const FIELD_SEVERITY = 'severity';
    const FIELD_SEVERITY_EXT = '_severity';

    /** @var string */
    private $_xmlns = 'http://hl7.org/fhir';

    /**
     * A code that describes the type of issue.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Describes the type of the issue. The system that creates an OperationOutcome
     * SHALL choose the most applicable code from the IssueType value set, and may
     * additional provide its own code for the error in the details element.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueType
     */
    protected $code = null;

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * If the element is present, it must have a value for at least one of the defined
     * elements, an \@id referenced from the Narrative, or extensions
     *
     * Additional details about the error. This may be a text description of the error
     * or a system code that identifies the error.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRCodeableConcept
     */
    protected $details = null;

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Additional diagnostic information about the issue.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString
     */
    protected $diagnostics = null;

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[]
     */
    protected $expression = [];

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * This element is deprecated because it is XML specific. It is replaced by
     * issue.expression, which is format independent, and simpler to parse. For
     * resource issues, this will be a simple XPath limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised. For HTTP errors,
     * will be "http." + the parameter name.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[]
     */
    protected $location = [];

    /**
     * How the issue affects the success of the action.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Indicates whether the issue indicates a variation from successful processing.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueSeverity
     */
    protected $severity = null;

    /**
     * Validation map for fields in type OperationOutcome.Issue
     * @var array
     */
    private static $_validationRules = [    ];

    /**
     * FHIROperationOutcomeIssue Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIROperationOutcomeIssue::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_CODE]) || isset($data[self::FIELD_CODE_EXT])) {
            if (isset($data[self::FIELD_CODE])) {
                $value = $data[self::FIELD_CODE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_CODE_EXT]) && is_array($data[self::FIELD_CODE_EXT])) {
                $ext = $data[self::FIELD_CODE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRIssueType) {
                    $this->setCode($value);
                } else if (is_array($value)) {
                    $this->setCode(new FHIRIssueType(array_merge($ext, $value)));
                } else {
                    $this->setCode(new FHIRIssueType([FHIRIssueType::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setCode(new FHIRIssueType($ext));
            }
        }
        if (isset($data[self::FIELD_DETAILS])) {
            if ($data[self::FIELD_DETAILS] instanceof FHIRCodeableConcept) {
                $this->setDetails($data[self::FIELD_DETAILS]);
            } else {
                $this->setDetails(new FHIRCodeableConcept($data[self::FIELD_DETAILS]));
            }
        }
        if (isset($data[self::FIELD_DIAGNOSTICS]) || isset($data[self::FIELD_DIAGNOSTICS_EXT])) {
            if (isset($data[self::FIELD_DIAGNOSTICS])) {
                $value = $data[self::FIELD_DIAGNOSTICS];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_DIAGNOSTICS_EXT]) && is_array($data[self::FIELD_DIAGNOSTICS_EXT])) {
                $ext = $data[self::FIELD_DIAGNOSTICS_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setDiagnostics($value);
                } else if (is_array($value)) {
                    $this->setDiagnostics(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setDiagnostics(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setDiagnostics(new FHIRString($ext));
            }
        }
        if (isset($data[self::FIELD_EXPRESSION]) || isset($data[self::FIELD_EXPRESSION_EXT])) {
            if (isset($data[self::FIELD_EXPRESSION])) {
                $value = $data[self::FIELD_EXPRESSION];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_EXPRESSION_EXT]) && is_array($data[self::FIELD_EXPRESSION_EXT])) {
                $ext = $data[self::FIELD_EXPRESSION_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->addExpression($value);
                } else if (is_array($value)) {
                    foreach($value as $i => $v) {
                        if ($v instanceof FHIRString) {
                            $this->addExpression($v);
                        } else {
                            $iext = (isset($ext[$i]) && is_array($ext[$i])) ? $ext[$i] : [];
                            if (is_array($v)) {
                                $this->addExpression(new FHIRString(array_merge($v, $iext)));
                            } else {
                                $this->addExpression(new FHIRString([FHIRString::FIELD_VALUE => $v] + $iext));
                            }
                        }
                    }
                } elseif (is_array($value)) {
                    $this->addExpression(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->addExpression(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                foreach($ext as $iext) {
                    $this->addExpression(new FHIRString($iext));
                }
            }
        }
        if (isset($data[self::FIELD_LOCATION]) || isset($data[self::FIELD_LOCATION_EXT])) {
            if (isset($data[self::FIELD_LOCATION])) {
                $value = $data[self::FIELD_LOCATION];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_LOCATION_EXT]) && is_array($data[self::FIELD_LOCATION_EXT])) {
                $ext = $data[self::FIELD_LOCATION_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->addLocation($value);
                } else if (is_array($value)) {
                    foreach($value as $i => $v) {
                        if ($v instanceof FHIRString) {
                            $this->addLocation($v);
                        } else {
                            $iext = (isset($ext[$i]) && is_array($ext[$i])) ? $ext[$i] : [];
                            if (is_array($v)) {
                                $this->addLocation(new FHIRString(array_merge($v, $iext)));
                            } else {
                                $this->addLocation(new FHIRString([FHIRString::FIELD_VALUE => $v] + $iext));
                            }
                        }
                    }
                } elseif (is_array($value)) {
                    $this->addLocation(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->addLocation(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                foreach($ext as $iext) {
                    $this->addLocation(new FHIRString($iext));
                }
            }
        }
        if (isset($data[self::FIELD_SEVERITY]) || isset($data[self::FIELD_SEVERITY_EXT])) {
            if (isset($data[self::FIELD_SEVERITY])) {
                $value = $data[self::FIELD_SEVERITY];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_SEVERITY_EXT]) && is_array($data[self::FIELD_SEVERITY_EXT])) {
                $ext = $data[self::FIELD_SEVERITY_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRIssueSeverity) {
                    $this->setSeverity($value);
                } else if (is_array($value)) {
                    $this->setSeverity(new FHIRIssueSeverity(array_merge($ext, $value)));
                } else {
                    $this->setSeverity(new FHIRIssueSeverity([FHIRIssueSeverity::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setSeverity(new FHIRIssueSeverity($ext));
            }
        }
    }

    /**
     * @return string
     */
    public function _getFHIRTypeName()
    {
        return self::FHIR_TYPE_NAME;
    }

    /**
     * @return string
     */
    public function _getFHIRXMLElementDefinition()
    {
        $xmlns = $this->_getFHIRXMLNamespace();
        if (null !== $xmlns) {
            $xmlns = " xmlns=\"{$xmlns}\"";
        }
        return "<OperationOutcomeIssue{$xmlns}></OperationOutcomeIssue>";
    }

    /**
     * A code that describes the type of issue.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Describes the type of the issue. The system that creates an OperationOutcome
     * SHALL choose the most applicable code from the IssueType value set, and may
     * additional provide its own code for the error in the details element.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueType
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * A code that describes the type of issue.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Describes the type of the issue. The system that creates an OperationOutcome
     * SHALL choose the most applicable code from the IssueType value set, and may
     * additional provide its own code for the error in the details element.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueType $code
     * @return static
     */
    public function setCode(FHIRIssueType $code = null)
    {
        $this->code = $code;
        return $this;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * If the element is present, it must have a value for at least one of the defined
     * elements, an \@id referenced from the Narrative, or extensions
     *
     * Additional details about the error. This may be a text description of the error
     * or a system code that identifies the error.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRCodeableConcept
     */
    public function getDetails()
    {
        return $this->details;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * If the element is present, it must have a value for at least one of the defined
     * elements, an \@id referenced from the Narrative, or extensions
     *
     * Additional details about the error. This may be a text description of the error
     * or a system code that identifies the error.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRCodeableConcept $details
     * @return static
     */
    public function setDetails(FHIRCodeableConcept $details = null)
    {
        $this->details = $details;
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Additional diagnostic information about the issue.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString
     */
    public function getDiagnostics()
    {
        return $this->diagnostics;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Additional diagnostic information about the issue.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString $diagnostics
     * @return static
     */
    public function setDiagnostics($diagnostics = null)
    {
        if (null === $diagnostics) {
            $this->diagnostics = null;
            return $this;
        }
        if ($diagnostics instanceof FHIRString) {
            $this->diagnostics = $diagnostics;
            return $this;
        }
        $this->diagnostics = new FHIRString($diagnostics);
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[]
     */
    public function getExpression()
    {
        return $this->expression;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString $expression
     * @return static
     */
    public function addExpression($expression = null)
    {
        if (null === $expression) {
            $this->expression = [];
            return $this;
        }
        if ($expression instanceof FHIRString) {
            $this->expression[] = $expression;
            return $this;
        }
        $this->expression[] = new FHIRString($expression);
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised.
     *
     * @param \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[] $expression
     * @return static
     */
    public function setExpression(array $expression = [])
    {
        $this->expression = [];
        if ([] === $expression) {
            return $this;
        }
        foreach($expression as $v) {
            if ($v instanceof FHIRString) {
                $this->addExpression($v);
            } else {
                $this->addExpression(new FHIRString($v));
            }
        }
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * This element is deprecated because it is XML specific. It is replaced by
     * issue.expression, which is format independent, and simpler to parse. For
     * resource issues, this will be a simple XPath limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised. For HTTP errors,
     * will be "http." + the parameter name.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[]
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * This element is deprecated because it is XML specific. It is replaced by
     * issue.expression, which is format independent, and simpler to parse. For
     * resource issues, this will be a simple XPath limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised. For HTTP errors,
     * will be "http." + the parameter name.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString $location
     * @return static
     */
    public function addLocation($location = null)
    {
        if (null === $location) {
            $this->location = [];
            return $this;
        }
        if ($location instanceof FHIRString) {
            $this->location[] = $location;
            return $this;
        }
        $this->location[] = new FHIRString($location);
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * This element is deprecated because it is XML specific. It is replaced by
     * issue.expression, which is format independent, and simpler to parse. For
     * resource issues, this will be a simple XPath limited to element names,
     * repetition indicators and the default child accessor that identifies one of the
     * elements in the resource that caused this issue to be raised. For HTTP errors,
     * will be "http." + the parameter name.
     *
     * @param \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString[] $location
     * @return static
     */
    public function setLocation(array $location = [])
    {
        $this->location = [];
        if ([] === $location) {
            return $this;
        }
        foreach($location as $v) {
            if ($v instanceof FHIRString) {
                $this->addLocation($v);
            } else {
                $this->addLocation(new FHIRString($v));
            }
        }
        return $this;
    }

    /**
     * How the issue affects the success of the action.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Indicates whether the issue indicates a variation from successful processing.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueSeverity
     */
    public function getSeverity()
    {
        return $this->severity;
    }

    /**
     * How the issue affects the success of the action.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Indicates whether the issue indicates a variation from successful processing.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRIssueSeverity $severity
     * @return static
     */
    public function setSeverity(FHIRIssueSeverity $severity = null)
    {
        $this->severity = $severity;
        return $this;
    }

    /**
     * Returns the validation rules that this type's fields must comply with to be considered "valid"
     * The returned array is in ["fieldname[.offset]" => ["rule" => {constraint}]]
     *
     * @return array
     */
    public function _getValidationRules()
    {
        return self::$_validationRules;
    }

    /**
     * Validates that this type conforms to the specifications set forth for it by FHIR.  An empty array must be seen as
     * passing.
     *
     * @return array
     */
    public function _getValidationErrors()
    {
        $errs = parent::_getValidationErrors();
        $validationRules = $this->_getValidationRules();
        if (null !== ($v = $this->getCode())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_CODE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getDetails())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_DETAILS] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getDiagnostics())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_DIAGNOSTICS] = $fieldErrs;
            }
        }
        if ([] !== ($vs = $this->getExpression())) {
            foreach($vs as $i => $v) {
                if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                    $errs[sprintf('%s.%d', self::FIELD_EXPRESSION, $i)] = $fieldErrs;
                }
            }
        }
        if ([] !== ($vs = $this->getLocation())) {
            foreach($vs as $i => $v) {
                if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                    $errs[sprintf('%s.%d', self::FIELD_LOCATION, $i)] = $fieldErrs;
                }
            }
        }
        if (null !== ($v = $this->getSeverity())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_SEVERITY] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_CODE])) {
            $v = $this->getCode();
            foreach($validationRules[self::FIELD_CODE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_CODE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_CODE])) {
                        $errs[self::FIELD_CODE] = [];
                    }
                    $errs[self::FIELD_CODE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_DETAILS])) {
            $v = $this->getDetails();
            foreach($validationRules[self::FIELD_DETAILS] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_DETAILS, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DETAILS])) {
                        $errs[self::FIELD_DETAILS] = [];
                    }
                    $errs[self::FIELD_DETAILS][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_DIAGNOSTICS])) {
            $v = $this->getDiagnostics();
            foreach($validationRules[self::FIELD_DIAGNOSTICS] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_DIAGNOSTICS, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DIAGNOSTICS])) {
                        $errs[self::FIELD_DIAGNOSTICS] = [];
                    }
                    $errs[self::FIELD_DIAGNOSTICS][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_EXPRESSION])) {
            $v = $this->getExpression();
            foreach($validationRules[self::FIELD_EXPRESSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_EXPRESSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_EXPRESSION])) {
                        $errs[self::FIELD_EXPRESSION] = [];
                    }
                    $errs[self::FIELD_EXPRESSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_LOCATION])) {
            $v = $this->getLocation();
            foreach($validationRules[self::FIELD_LOCATION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_LOCATION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_LOCATION])) {
                        $errs[self::FIELD_LOCATION] = [];
                    }
                    $errs[self::FIELD_LOCATION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_SEVERITY])) {
            $v = $this->getSeverity();
            foreach($validationRules[self::FIELD_SEVERITY] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_OPERATION_OUTCOME_DOT_ISSUE, self::FIELD_SEVERITY, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_SEVERITY])) {
                        $errs[self::FIELD_SEVERITY] = [];
                    }
                    $errs[self::FIELD_SEVERITY][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_MODIFIER_EXTENSION])) {
            $v = $this->getModifierExtension();
            foreach($validationRules[self::FIELD_MODIFIER_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_BACKBONE_ELEMENT, self::FIELD_MODIFIER_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_MODIFIER_EXTENSION])) {
                        $errs[self::FIELD_MODIFIER_EXTENSION] = [];
                    }
                    $errs[self::FIELD_MODIFIER_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_EXTENSION])) {
            $v = $this->getExtension();
            foreach($validationRules[self::FIELD_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_EXTENSION])) {
                        $errs[self::FIELD_EXTENSION] = [];
                    }
                    $errs[self::FIELD_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_ID])) {
            $v = $this->getId();
            foreach($validationRules[self::FIELD_ID] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_ID, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ID])) {
                        $errs[self::FIELD_ID] = [];
                    }
                    $errs[self::FIELD_ID][$rule] = $err;
                }
            }
        }
        return $errs;
    }

    /**
     * @param \SimpleXMLElement|string|null $sxe
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIROperationOutcome\FHIROperationOutcomeIssue $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIROperationOutcome\FHIROperationOutcomeIssue
     */
    public static function xmlUnserialize($sxe = null, PHPFHIRTypeInterface $type = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            return null;
        }
        if (is_string($sxe)) {
            libxml_use_internal_errors(true);
            $sxe = new \SimpleXMLElement($sxe, $libxmlOpts, false);
            if ($sxe === false) {
                throw new \DomainException(sprintf('FHIROperationOutcomeIssue::xmlUnserialize - String provided is not parseable as XML: %s', implode(', ', array_map(function(\libXMLError $err) { return $err->message; }, libxml_get_errors()))));
            }
            libxml_use_internal_errors(false);
        }
        if (!($sxe instanceof \SimpleXMLElement)) {
            throw new \InvalidArgumentException(sprintf('FHIROperationOutcomeIssue::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIROperationOutcomeIssue;
        } elseif (!is_object($type) || !($type instanceof FHIROperationOutcomeIssue)) {
            throw new \RuntimeException(sprintf(
                'FHIROperationOutcomeIssue::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIROperationOutcome\FHIROperationOutcomeIssue or null, %s seen.',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }
        FHIRBackboneElement::xmlUnserialize($sxe, $type);
        $xmlNamespaces = $sxe->getDocNamespaces(false, false);
        if ([] !== $xmlNamespaces) {
            $ns = reset($xmlNamespaces);
            if (false !== $ns && '' !== $ns) {
                $type->_xmlns = $ns;
            }
        }
        $attributes = $sxe->attributes();
        $children = $sxe->children();
        if (isset($children->code)) {
            $type->setCode(FHIRIssueType::xmlUnserialize($children->code));
        }
        if (isset($children->details)) {
            $type->setDetails(FHIRCodeableConcept::xmlUnserialize($children->details));
        }
        if (isset($children->diagnostics)) {
            $type->setDiagnostics(FHIRString::xmlUnserialize($children->diagnostics));
        }
        if (isset($attributes->diagnostics)) {
            $pt = $type->getDiagnostics();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->diagnostics);
            } else {
                $type->setDiagnostics((string)$attributes->diagnostics);
            }
        }
        if (isset($children->expression)) {
            foreach($children->expression as $child) {
                $type->addExpression(FHIRString::xmlUnserialize($child));
            }
        }
        if (isset($children->location)) {
            foreach($children->location as $child) {
                $type->addLocation(FHIRString::xmlUnserialize($child));
            }
        }
        if (isset($children->severity)) {
            $type->setSeverity(FHIRIssueSeverity::xmlUnserialize($children->severity));
        }
        return $type;
    }

    /**
     * @param null|\SimpleXMLElement $sxe
     * @param null|int $libxmlOpts
     * @return \SimpleXMLElement
     */
    public function xmlSerialize(\SimpleXMLElement $sxe = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            $sxe = new \SimpleXMLElement($this->_getFHIRXMLElementDefinition(), $libxmlOpts, false);
        }
        parent::xmlSerialize($sxe);
        if (null !== ($v = $this->getCode())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_CODE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getDetails())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_DETAILS, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getDiagnostics())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_DIAGNOSTICS, null, $v->_getFHIRXMLNamespace()));
        }
        if ([] !== ($vs = $this->getExpression())) {
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $v->xmlSerialize($sxe->addChild(self::FIELD_EXPRESSION, null, $v->_getFHIRXMLNamespace()));
            }
        }
        if ([] !== ($vs = $this->getLocation())) {
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $v->xmlSerialize($sxe->addChild(self::FIELD_LOCATION, null, $v->_getFHIRXMLNamespace()));
            }
        }
        if (null !== ($v = $this->getSeverity())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_SEVERITY, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getCode())) {
            $a[self::FIELD_CODE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRIssueType::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRIssueType::FIELD_VALUE]);
                $a[self::FIELD_CODE_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getDetails())) {
            $a[self::FIELD_DETAILS] = $v;
        }
        if (null !== ($v = $this->getDiagnostics())) {
            $a[self::FIELD_DIAGNOSTICS] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRString::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRString::FIELD_VALUE]);
                $a[self::FIELD_DIAGNOSTICS_EXT] = $enc;
            }
        }
        if ([] !== ($vs = $this->getExpression())) {
            $a[self::FIELD_EXPRESSION] = [];
            $encs = [];
            $encValued = false;
            foreach ($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $a[self::FIELD_EXPRESSION][] = $v->getValue();
                $enc = $v->jsonSerialize();
                $cnt = count($enc);
                if (0 === $cnt || (1 === $cnt && (isset($enc[FHIRString::FIELD_VALUE]) || array_key_exists(FHIRString::FIELD_VALUE, $enc)))) {
                    $encs[] = null;
                } else {
                    unset($enc[FHIRString::FIELD_VALUE]);
                    $encs[] = $enc;
                    $encValued = true;
                }
            }
            if ($encValued) {
                $a[self::FIELD_EXPRESSION_EXT] = $encs;
            }
        }
        if ([] !== ($vs = $this->getLocation())) {
            $a[self::FIELD_LOCATION] = [];
            $encs = [];
            $encValued = false;
            foreach ($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $a[self::FIELD_LOCATION][] = $v->getValue();
                $enc = $v->jsonSerialize();
                $cnt = count($enc);
                if (0 === $cnt || (1 === $cnt && (isset($enc[FHIRString::FIELD_VALUE]) || array_key_exists(FHIRString::FIELD_VALUE, $enc)))) {
                    $encs[] = null;
                } else {
                    unset($enc[FHIRString::FIELD_VALUE]);
                    $encs[] = $enc;
                    $encValued = true;
                }
            }
            if ($encValued) {
                $a[self::FIELD_LOCATION_EXT] = $encs;
            }
        }
        if (null !== ($v = $this->getSeverity())) {
            $a[self::FIELD_SEVERITY] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRIssueSeverity::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRIssueSeverity::FIELD_VALUE]);
                $a[self::FIELD_SEVERITY_EXT] = $enc;
            }
        }
        if ([] !== ($vs = $this->_getFHIRComments())) {
            $a[PHPFHIRConstants::JSON_FIELD_FHIR_COMMENTS] = $vs;
        }
        return $a;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return self::FHIR_TYPE_NAME;
    }
}