text:
Sword::Sword(Equippable& sword)
:   m_p_sword (&sword)
{
    for (int i = 0 ; i <= 1 ; i++)
    {
        m_swordAnimation.addFrame({i * 50, 0, 50, 50}, 0);
    }
    sword.setTextureRect(m_swordAnimation.getFrame(0));

    m_slashEffect.setSize({SWORD_SIZE, SWORD_SIZE});
    for (int i = 0 ; i <= 2 ; i++)
    {
        m_slashAnimation.addFrame({i * 50, 0, 50, 50}, 0.1);
    }
    m_slashAnimation.addFrame({0, 0, 50, 50}, 0.15);
    m_slashEffect.setTextureRect(m_slashAnimation.getFrame(0));

    m_swordSwingSound.setBuffer(getResources().getSound(Sound_ID::Sword1));
}

void Sword::slash()
{
    if (!m_isSwinging)
    {
        m_p_sword->setTextureRect(m_slashAnimation.getFrame(1));
        m_isSwinging = true;
        m_slashTimer.restart();
        m_swordSwingSound.play();
    }
}

void Sword::draw()
{
    if (m_isSwinging)
    {
        Display::draw(m_slashEffect);
    }
}

void Sword::update()
{
    m_slashEffect.setOrigin     (m_p_sword->getSprite().getOrigin   ());
    m_slashEffect.setScale      (m_p_sword->getSprite().getScale    ());
    m_slashEffect.setPosition   (m_p_sword->getSprite().getPosition ());

    if(m_isSwinging)
    {
        m_slashEffect.setTextureRect(m_slashAnimation.getFrame());
        if (m_slashAnimation.isOnFinalFrame())
        {
            m_isSwinging = false;
            m_slashEffect.setTextureRect(m_slashAnimation.getFrame(0));
            m_p_sword->setTextureRect(m_swordAnimation.getFrame(0));
        }
    }
}

bool Sword::isSwinging() const
{
    return m_isSwinging;
}

void Sword::upgrade(Equipment::Tier tier)
{
    switch(tier)
    {
        case Equipment::Tier::Primitive:
            m_slashEffect.setTexture(&getResources().getTexture(Texture_ID::Player_Wood_Slash));
            break;

        case Equipment::Tier::Iron:
            break;

        case Equipment::Tier::Gold:
            break;

        case Equipment::Tier::Magma:
            break;
    }
}

sf::FloatRect Sword::getBounds() const
{
    return m_slashEffect.getGlobalBounds();
}

const Equippable& Sword::getEquipment() const
{
    return *m_p_sword;
}


text:
require "helper"
require "google/cloud/optimization"
require "gapic/common"
require "gapic/grpc"

class Google::Cloud::Optimization::ClientConstructionMinitest < Minitest::Test
  def test_fleet_routing
    Gapic::ServiceStub.stub :new, :stub do
      grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
      client = Google::Cloud::Optimization.fleet_routing do |config|
        config.credentials = grpc_channel
      end
      assert_kind_of Google::Cloud::Optimization::V1::FleetRouting::Client, client
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package io.advantageous.qbit.meta;

public enum GenericParamType {

    COLLECTION,
    MAP,
    ARRAY,
    NONE
}


text:
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */

import keyMirror from 'react/lib/keyMirror';

export default keyMirror({
  CHANGE_LOCATION: null
});


text:
const Promise = require('bluebird');
const csvParser = require('csv-parser');
const _ = require('lodash');
const fs = require('fs-extra');

module.exports = function readCSV(options) {
    const columnsToExtract = options.columnsToExtract || [];
    let results = [];
    const rows = [];

    return new Promise(function (resolve, reject) {
        const readFile = fs.createReadStream(options.path);

        readFile.on('err', function (err) {
            reject(err);
        })
            .pipe(csvParser())
            .on('data', function (row) {
                rows.push(row);
            })
            .on('end', function () {
            // If CSV is single column - return all values including header
                const headers = _.keys(rows[0]);

                let result = {};
                const columnMap = {};
                if (columnsToExtract.length === 1 && headers.length === 1) {
                    results = _.map(rows, function (value) {
                        result = {};
                        result[columnsToExtract[0].name] = value[headers[0]];
                        return result;
                    });
                } else {
                // If there are multiple columns in csv file
                // try to match headers using lookup value

                    _.map(columnsToExtract, function findMatches(column) {
                        _.each(headers, function checkheader(header) {
                            if (column.lookup.test(header)) {
                                columnMap[column.name] = header;
                            }
                        });
                    });

                    results = _.map(rows, function evaluateRow(row) {
                        const result = {};
                        _.each(columnMap, function returnMatches(value, key) {
                            result[key] = row[value];
                        });
                        return result;
                    });
                }
                resolve(results);
            });
    });
};


text:
angular.module("gepsens", ["gepsens.tpls", "gepsens.auth","gepsens.autogrow","gepsens.badges","gepsens.checkbox","gepsens.feedback","gepsens.paginate","gepsens.tracker"]);
angular.module("gepsens.tpls", ["template/badges/badges.html"]);
angular.module('gepsens.auth', ['ngCookies', 'ngResource'])
  .provider('Auth', function() {

    this.$get = function ($http, $resource, $cookieStore, $q, $window, $cookies, $location) {
        var authResource = $resource('auth/:provider', {

        }, {
            'authenticate' : {
                method: 'GET'
            }
        });
        var userResource = $resource('users/:id');
        var resolveUser = function(result, callback) {
            service.currentUser = result;
            service.currentUser.isLoggedIn = true;
            if(callback) {
                callback(service.currentUser);
            }
            return service.currentUser;
        };

        var service = {
            isAuthenticated: function() {return !!service.currentUser;},
            currentUser: null,
            setCurrentUser: function(user) {
                service.currentUser = user;
            },
            requestCurrentUser: function(callback) {
              if (service.isAuthenticated() ) {
                return service.currentUser;
              } else {
                return service.authenticate(callback);
              }
            },
            authenticate : function(callback) {
                return $http.get('auth', {withCredentials: true}).success(function(data, status, header, config) {
                    return resolveUser(data, callback);
                });
            },
            logout: function() {
                $http.get('/logout');
            },
            login: function(email, password, callback) {
                return $http.post('/login', {username: email, password: password}).success(function(res) {
                    return resolveUser(res, callback);
                });
            },
            loginOauth: function(type, callback) {
                if(type.trim() === '') {
                    return service.authenticate(callback);
                } else {
                    window.location.href = 'auth/' + type + '?callback='+window.location.href;
                }
            },
            users: function() {
                return userResource.query();
            }
        };

        return service;
      };
    });

angular.module("gepsens.autogrow", []).directive('autogrow', function() {
  return function(scope, element, attr){
    var minWidth = element[0].offsetWidth,
      paddingLeft = element.css('padding-left'),
      paddingRight = element.css('padding-right');

    // style the mirror
    var $mirror = angular.element('

').css({
      'font-size'         : element.css('font-size'),
      'font-family'       : element.css('font-family'),
      'height'             : element.css('height'),
      'padding-left'      : element.css('padding-left'),
      'padding-right'     : element.css('padding-right'),
      'padding-bottom'    : element.css('padding-bottom'),
      'padding-top'       : element.css('padding-top'),
      'border'            : element.css('border'),
      'position'          : 'absolute',
      'top'               : '-10000px',
      'left'              : '-10000px',
      'white-space'       : 'pre-wrap',
      'word-wrap'         : 'break-word',
      'box-sizing'          : element.css('box-sizing'),
      '-moz-box-sizing'     : element.css('-moz-box-sizing'),
      '-webkit-box-sizing'  : element.css('-webkit-box-sizing'),
      'line-height'         : element.css('line-height')

    });

    // create the mirror
    angular.element(document.body).append($mirror);

    // update the mirror
    var update = function() {
      var times = function(string, number) {
        for (var i = 0, r = ''; i < number; i++) {
          r += string;
        }
        return r;
      };

      // send content to the mirror
      var val = element.val().replace(/</g, '<')
        .replace(/>/g, '>')
        .replace(/&/g, '&')
        .replace(/\n$/, '
 ')
        .replace(/\n/g, '
')
        .replace(/\s{2,}/g, function(space) {
          return times(' ', space.length - 1) + ' ';
        });
      $mirror.html(val);

      // sync mirror width
      $mirror.css('height', element.css('height'));
      element.css('width', Math.max($mirror[0].offsetWidth + 10 /* the "threshold" */, minWidth) + 'px');
      element.css('overflow', 'hidden');
    };

    // bind to keypresses and window width changes
    element.bind('keyup keydown keypress change', update);
    update();
  };
});
angular.module('gepsens.badges', [])
  .directive('badges', function() {
    return {
      scope: {
        badgeList : '=',
        badgeClass : '@',
        badgeControl: '@',
        simple: '='
      },
      templateUrl: "template/badges/badges.html",
      restrict: 'E',
      controller: function($scope, $attrs, $parse) {
        $scope.remove = function(index) {
          $scope.badgeList.splice(index, 1);
        };
      },
      link: function($scope, element, attrs, ctrl) {
        $scope.$watch('badgeList', function(newVal, oldVal) {
          if($scope.$parent.form) {
            if(newVal && oldVal && !(newVal && newVal.length > 0)) {
              $scope.$parent.form.$setValidity($scope.badgeControl, false);
            } else {
              $scope.$parent.form.$setValidity($scope.badgeControl, true);
            }
          }
        }, true);
        $scope.focusInput = function() {
          element.find('input').focus();
        };
        $scope.validateAndPush = function(list, item) {
          if(item && item !== '' && list && list.indexOf(item) < 0) {
            list.push(item);
          }
        };
      }
    };
  })
  .directive('list-feed', function() {
    return {
      restrict: 'A',
      scope: {
        listFeed: '='
      },
      link: function($scope, element, attrs, ctrl) {

      }
    };
  });
angular.module('gepsens.checkbox', [])
	.directive('flatCheckbox', [function(){
	return {
		scope: {
			value : "="
		},
		template:
			''+
				''+
					''+
					''+
				''+
				'<input type="checkbox" data-toggle="checkbox" ng-model="value" />'+
				''+
			'',
		replace: true,
		transclude: true,
		restrict: 'E',
		link: function($scope, iElm, iAttrs, controller) {
			if($scope.value === undefined) {
				$scope.value = false;
			}
		}
	};
}]);
angular.module('gepsens.feedback', [])
	.directive('btnFeedback', ['promiseTracker', function(promiseTracker){
	return {
		scope: {
			btnFeedback : "=",
			tracker: "@"
		},
		template: "<button ng-transclude ng-class=\"{'error': 'btn-danger icon-meh', 'done': 'btn-success icon-ok', 'doing': 'icon-spinner icon-spin'}[btnFeedback]\"></button>",
		replace: true,
		transclude: true,
		restrict: 'A',

		link: function($scope, iElm, iAttrs, controller) {
			if($scope.tracker) {
				promiseTracker($scope.tracker).on('start', function() {
					btnFeedback = 'doing';
				}).on('done', function(response) {
					btnFeedback = 'done';
				}).on('error', function(response) {
					btnFeedback = 'error';
				});
			}
		}
	};
}]);
angular.module("gepsens.paginate", []).filter('paginate', ['$filter', function ($filter) {
   return function(input, current_page, page_size) {
      if (input) {
          return $filter('limitTo')(input.slice(current_page * page_size), page_size);
      }
   };
}]);
angular.module('gepsens.tracker', [])
	.factory('httpRequestTracker', ['$http', function($http){

	var httpRequestTracker = {};
	httpRequestTracker.hasPendingRequests = function() {
	return $http.pendingRequests.length > 0;
	};

	return httpRequestTracker;
}]);
angular.module("template/badges/badges.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("template/badges/badges.html",
    "
\n" +
    "	\n" +
    "	  {{badge}}\n" +
    "	   \n" +
    "	\n" +
    "
\n" +
    "
\n" +
    "			\n" +
    "
\n" +
    "		<input class=\"input-sm\" type='text' autogrow name=\"badgeListCmpl\" ng-model=\"badgeListCmpl\" ui-keydown=\"{'enter': 'validateAndPush(badgeList,badgeListCmpl)'}\" />\n" +
    "
\n" +
    "
");
}]);


text:
/**
 *
 */
package com.github.sfragata.docker.client.message;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author sfragata
 *
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ContainerConfig {

	@JsonProperty("Hostname")
	private String hostname;

	@JsonProperty("Domainname")
	private String domainname;

	@JsonProperty("User")
	private String user;

	@JsonProperty("AttachStdin")
	private Boolean attachStdin;

	@JsonProperty("AttachStdout")
	private Boolean attachStdout;

	@JsonProperty("AttachStderr")
	private Boolean attachStderr;

	@JsonProperty("PortSpecs")
	private List<String> portSpecs;

	// @JsonProperty("ExposedPorts")
	// private Set<String> exposedPorts;

	@JsonProperty("Tty")
	private Boolean tty;

	@JsonProperty("OpenStdin")
	private Boolean openStdin;

	@JsonProperty("StdinOnce")
	private Boolean stdinOnce;

	@JsonProperty("Env")
	private List<String> env;

	@JsonProperty("Cmd")
	private List<String> cmd;

	@JsonProperty("Image")
	private String image;

	// @JsonProperty("Volumes")
	// private String volumes;

	@JsonProperty("WorkingDir")
	private String workingDir;

	@JsonProperty("Entrypoint")
	private List<String> entrypoint;

	@JsonProperty("NetworkDisabled")
	private Boolean networkDisabled;

	@JsonProperty("OnBuild")
	private List<String> onBuild;

	@JsonProperty("Labels")
	private Map<String, String> labels;

	@JsonProperty("MacAddress")
	private String macAddress;

	public String getHostname() {
		return hostname;
	}

	public String getDomainname() {
		return domainname;
	}

	public String getUser() {
		return user;
	}

	public Boolean getAttachStdin() {
		return attachStdin;
	}

	public Boolean getAttachStdout() {
		return attachStdout;
	}

	public Boolean getAttachStderr() {
		return attachStderr;
	}

	public List<String> getPortSpecs() {
		return portSpecs;
	}

	public Boolean getTty() {
		return tty;
	}

	public Boolean getOpenStdin() {
		return openStdin;
	}

	public Boolean getStdinOnce() {
		return stdinOnce;
	}

	public List<String> getEnv() {
		return env;
	}

	public List<String> getCmd() {
		return cmd;
	}

	public String getImage() {
		return image;
	}

	public String getWorkingDir() {
		return workingDir;
	}

	public List<String> getEntrypoint() {
		return entrypoint;
	}

	public Boolean getNetworkDisabled() {
		return networkDisabled;
	}

	public List<String> getOnBuild() {
		return onBuild;
	}

	public Map<String, String> getLabels() {
		return labels;
	}

	public String getMacAddress() {
		return macAddress;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((attachStderr == null) ? 0 : attachStderr.hashCode());
		result = prime * result
				+ ((attachStdin == null) ? 0 : attachStdin.hashCode());
		result = prime * result
				+ ((attachStdout == null) ? 0 : attachStdout.hashCode());
		result = prime * result + ((cmd == null) ? 0 : cmd.hashCode());
		result = prime * result
				+ ((domainname == null) ? 0 : domainname.hashCode());
		result = prime * result
				+ ((entrypoint == null) ? 0 : entrypoint.hashCode());
		result = prime * result + ((env == null) ? 0 : env.hashCode());
		result = prime * result
				+ ((hostname == null) ? 0 : hostname.hashCode());
		result = prime * result + ((image == null) ? 0 : image.hashCode());
		result = prime * result + ((labels == null) ? 0 : labels.hashCode());
		result = prime * result
				+ ((macAddress == null) ? 0 : macAddress.hashCode());
		result = prime * result
				+ ((networkDisabled == null) ? 0 : networkDisabled.hashCode());
		result = prime * result + ((onBuild == null) ? 0 : onBuild.hashCode());
		result = prime * result
				+ ((openStdin == null) ? 0 : openStdin.hashCode());
		result = prime * result
				+ ((portSpecs == null) ? 0 : portSpecs.hashCode());
		result = prime * result
				+ ((stdinOnce == null) ? 0 : stdinOnce.hashCode());
		result = prime * result + ((tty == null) ? 0 : tty.hashCode());
		result = prime * result + ((user == null) ? 0 : user.hashCode());
		result = prime * result
				+ ((workingDir == null) ? 0 : workingDir.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContainerConfig other = (ContainerConfig) obj;
		if (attachStderr == null) {
			if (other.attachStderr != null)
				return false;
		} else if (!attachStderr.equals(other.attachStderr))
			return false;
		if (attachStdin == null) {
			if (other.attachStdin != null)
				return false;
		} else if (!attachStdin.equals(other.attachStdin))
			return false;
		if (attachStdout == null) {
			if (other.attachStdout != null)
				return false;
		} else if (!attachStdout.equals(other.attachStdout))
			return false;
		if (cmd == null) {
			if (other.cmd != null)
				return false;
		} else if (!cmd.equals(other.cmd))
			return false;
		if (domainname == null) {
			if (other.domainname != null)
				return false;
		} else if (!domainname.equals(other.domainname))
			return false;
		if (entrypoint == null) {
			if (other.entrypoint != null)
				return false;
		} else if (!entrypoint.equals(other.entrypoint))
			return false;
		if (env == null) {
			if (other.env != null)
				return false;
		} else if (!env.equals(other.env))
			return false;
		if (hostname == null) {
			if (other.hostname != null)
				return false;
		} else if (!hostname.equals(other.hostname))
			return false;
		if (image == null) {
			if (other.image != null)
				return false;
		} else if (!image.equals(other.image))
			return false;
		if (labels == null) {
			if (other.labels != null)
				return false;
		} else if (!labels.equals(other.labels))
			return false;
		if (macAddress == null) {
			if (other.macAddress != null)
				return false;
		} else if (!macAddress.equals(other.macAddress))
			return false;
		if (networkDisabled == null) {
			if (other.networkDisabled != null)
				return false;
		} else if (!networkDisabled.equals(other.networkDisabled))
			return false;
		if (onBuild == null) {
			if (other.onBuild != null)
				return false;
		} else if (!onBuild.equals(other.onBuild))
			return false;
		if (openStdin == null) {
			if (other.openStdin != null)
				return false;
		} else if (!openStdin.equals(other.openStdin))
			return false;
		if (portSpecs == null) {
			if (other.portSpecs != null)
				return false;
		} else if (!portSpecs.equals(other.portSpecs))
			return false;
		if (stdinOnce == null) {
			if (other.stdinOnce != null)
				return false;
		} else if (!stdinOnce.equals(other.stdinOnce))
			return false;
		if (tty == null) {
			if (other.tty != null)
				return false;
		} else if (!tty.equals(other.tty))
			return false;
		if (user == null) {
			if (other.user != null)
				return false;
		} else if (!user.equals(other.user))
			return false;
		if (workingDir == null) {
			if (other.workingDir != null)
				return false;
		} else if (!workingDir.equals(other.workingDir))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return String
				.format("ContainerConfig [hostname=%s, domainname=%s, user=%s, attachStdin=%s, attachStdout=%s, attachStderr=%s, portSpecs=%s, tty=%s, openStdin=%s, stdinOnce=%s, env=%s, cmd=%s, image=%s, workingDir=%s, entrypoint=%s, networkDisabled=%s, onBuild=%s, labels=%s, macAddress=%s]",
						hostname, domainname, user, attachStdin, attachStdout,
						attachStderr, portSpecs, tty, openStdin, stdinOnce,
						env, cmd, image, workingDir, entrypoint,
						networkDisabled, onBuild, labels, macAddress);
	}

}


text:
package v2

import (
	"testing"

	"github.com/sirupsen/logrus"

	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
	"github.com/GoogleContainerTools/skaffold/proto/enums"
	proto "github.com/GoogleContainerTools/skaffold/proto/v2"
	"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestHandleSkaffoldLogEvent(t *testing.T) {
	testHandler := newHandler()
	testHandler.state = emptyState(mockCfg([]latest.Pipeline{{}}, "test"))

	messages := []string{
		"hi!",
		"how's it going",
		"hope you're well",
		"this is a skaffold test",
	}

	// ensure that messages sent through the SkaffoldLog function are populating the event log
	for _, message := range messages {
		testHandler.handleSkaffoldLogEvent(&proto.SkaffoldLogEvent{
			TaskId:    "Test-0",
			SubtaskId: "1",
			Level:     enums.LogLevel_INFO,
			Message:   message,
		})
	}
	wait(t, func() bool {
		testHandler.logLock.Lock()
		logLen := len(testHandler.eventLog)
		testHandler.logLock.Unlock()
		return logLen == len(messages)
	})
}

func TestLevelFromEntry(t *testing.T) {
	tests := []struct {
		name      string
		logrusLvl logrus.Level
		enumLvl   enums.LogLevel
	}{
		{
			name:      "panic",
			logrusLvl: logrus.PanicLevel,
			enumLvl:   enums.LogLevel_PANIC,
		},
		{
			name:      "fatal",
			logrusLvl: logrus.FatalLevel,
			enumLvl:   enums.LogLevel_FATAL,
		},
		{
			name:      "error",
			logrusLvl: logrus.ErrorLevel,
			enumLvl:   enums.LogLevel_ERROR,
		},
		{
			name:      "warn",
			logrusLvl: logrus.WarnLevel,
			enumLvl:   enums.LogLevel_WARN,
		},
		{
			name:      "info",
			logrusLvl: logrus.InfoLevel,
			enumLvl:   enums.LogLevel_INFO,
		},
		{
			name:      "debug",
			logrusLvl: logrus.DebugLevel,
			enumLvl:   enums.LogLevel_DEBUG,
		},
		{
			name:      "trace",
			logrusLvl: logrus.TraceLevel,
			enumLvl:   enums.LogLevel_TRACE,
		},
	}

	for _, test := range tests {
		testutil.Run(t, test.name, func(t *testutil.T) {
			got := levelFromEntry(&logrus.Entry{Level: test.logrusLvl})
			t.CheckDeepEqual(test.enumLvl, got)
		})
	}
}


text:
package org.apache.hadoop.hdfs.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.MiniDFSNNTopology;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
import org.apache.log4j.Level;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.net.InetSocketAddress;
import java.net.URI;

/**
 * Test WebHDFS with multiple NameNodes
 */
public class TestWebHdfsWithMultipleNameNodes {
  static final Log LOG = WebHdfsTestUtil.LOG;

  static private void setLogLevel() {
    ((Log4JLogger) LOG).getLogger().setLevel(Level.ALL);
    ((Log4JLogger) NamenodeWebHdfsMethods.LOG).getLogger().setLevel(Level.ALL);

    ((Log4JLogger) NameNode.stateChangeLog).getLogger().setLevel(Level.OFF);
    ((Log4JLogger) LeaseManager.LOG).getLogger().setLevel(Level.OFF);
    ((Log4JLogger) LogFactory.getLog(FSNamesystem.class)).getLogger()
        .setLevel(Level.OFF);
  }

  private static final Configuration conf = new HdfsConfiguration();
  private static MiniDFSCluster cluster;
  private static WebHdfsFileSystem[] webhdfs;

  @BeforeClass
  public static void setupTest() {
    setLogLevel();
    try {
      setupCluster(4, 3);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  private static void setupCluster(final int nNameNodes, final int nDataNodes)
      throws Exception {
    LOG.info("nNameNodes=" + nNameNodes + ", nDataNodes=" + nDataNodes);

    conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);

    cluster = new MiniDFSCluster.Builder(conf)
        .nnTopology(MiniDFSNNTopology.simpleHOPSTopology(nNameNodes))
        .numDataNodes(nDataNodes).format(true).build();
    cluster.waitActive();

    webhdfs = new WebHdfsFileSystem[nNameNodes];
    for (int i = 0; i < webhdfs.length; i++) {
      final InetSocketAddress addr = cluster.getNameNode(i).getHttpAddress();
      final String uri =
          WebHdfsFileSystem.SCHEME + "://" + addr.getHostName() + ":" +
              addr.getPort() + "/";
      webhdfs[i] = (WebHdfsFileSystem) FileSystem.get(new URI(uri), conf);
    }
  }

  @AfterClass
  public static void shutdownCluster() {
    if (cluster != null) {
      cluster.shutdown();
      cluster = null;
    }
  }

  private static String createString(String prefix, int i) {
    //The suffix is to make sure the strings have different lengths.
    final String suffix = "*********************".substring(0, i + 1);
    return prefix + i + suffix + "\n";
  }

  private static String[] createStrings(String prefix, String name) {
    final String[] strings = new String[webhdfs.length];
    for (int i = 0; i < webhdfs.length; i++) {
      strings[i] = createString(prefix, i);
      LOG.info(name + "[" + i + "] = " + strings[i]);
    }
    return strings;
  }

  //NDB is shared
  //this test write a file (same file name) to four NN. in ourcase only one inode
  //with same name can be stored. changed the test to store files with different file names
  //
  @Test
  public void testRedirect() throws Exception {
    final String dir = "/testRedirect/";
    final String filename = "file";

    final String[] writeStrings = createStrings("write to webhdfs ", "write");
    final String[] appendStrings =
        createStrings("append to webhdfs ", "append");

    //test create: create a file for each namenode
    for (int i = 0; i < webhdfs.length; i++) {
      final FSDataOutputStream out =
          webhdfs[i].create(new Path(dir, filename + i));
      out.write(writeStrings[i].getBytes());
      out.close();
    }

    for (int i = 0; i < webhdfs.length; i++) {
      //check file length
      final long expected = writeStrings[i].length();
      Assert.assertEquals(expected,
          webhdfs[i].getFileStatus(new Path(dir, filename + i)).getLen());
    }

    //test read: check file content for each namenode
    for (int i = 0; i < webhdfs.length; i++) {
      final FSDataInputStream in = webhdfs[i].open(new Path(dir, filename + i));
      for (int c, j = 0; (c = in.read()) != -1; j++) {
        Assert.assertEquals(writeStrings[i].charAt(j), c);
      }
      in.close();
    }

    //test append: append to the file for each namenode
    for (int i = 0; i < webhdfs.length; i++) {
      final FSDataOutputStream out =
          webhdfs[i].append(new Path(dir, filename + i));
      out.write(appendStrings[i].getBytes());
      out.close();
    }

    for (int i = 0; i < webhdfs.length; i++) {
      //check file length
      final long expected =
          writeStrings[i].length() + appendStrings[i].length();
      Assert.assertEquals(expected,
          webhdfs[i].getFileStatus(new Path(dir, filename + i)).getLen());
    }

    //test read: check file content for each namenode
    for (int i = 0; i < webhdfs.length; i++) {
      final StringBuilder b = new StringBuilder();
      final FSDataInputStream in = webhdfs[i].open(new Path(dir, filename + i));
      for (int c; (c = in.read()) != -1; ) {
        b.append((char) c);
      }
      final int wlen = writeStrings[i].length();
      Assert.assertEquals(writeStrings[i], b.substring(0, wlen));
      Assert.assertEquals(appendStrings[i], b.substring(wlen));
      in.close();
    }
  }
}


text:
add_plugin shellcheck

SHELLCHECK_TIMER=0

SHELLCHECK=${SHELLCHECK:-$(which shellcheck 2>/dev/null)}

SHELLCHECK_SPECIFICFILES=""

# if it ends in an explicit .sh, then this is shell code.
# if it doesn't have an extension, we assume it is shell code too
function shellcheck_filefilter
{
  local filename=$1

  if [[ ${filename} =~ \.sh$ ]]; then
    add_test shellcheck
    SHELLCHECK_SPECIFICFILES="${SHELLCHECK_SPECIFICFILES} ./${filename}"
  fi

  if [[ ! ${filename} =~ \. ]]; then
    add_test shellcheck
  fi
}

function shellcheck_private_findbash
{
  local i
  local value
  local list

  while read line; do
    value=$(find "${line}" ! -name '*.cmd' -type f \
      | ${GREP} -E -v '(.orig$|.rej$)')
    list="${list} ${value}"
  done < <(find . -type d -name bin -o -type d -name sbin -o -type d -name libexec -o -type d -name shellprofile.d)
  # shellcheck disable=SC2086
  echo ${list} ${SHELLCHECK_SPECIFICFILES} | tr ' ' '\n' | sort -u
}

function shellcheck_preapply
{
  local i

  verify_needed_test shellcheck
  if [[ $? == 0 ]]; then
    return 0
  fi

  big_console_header "shellcheck plugin: prepatch"

  if [[ ! -x "${SHELLCHECK}" ]]; then
    hadoop_error "shellcheck is not available."
    return 0
  fi

  start_clock

  # shellcheck disable=SC2016
  SHELLCHECK_VERSION=$(${SHELLCHECK} --version | ${GREP} version: | ${AWK} '{print $NF}')

  echo "Running shellcheck against all identifiable shell scripts"
  pushd "${BASEDIR}" >/dev/null
  for i in $(shellcheck_private_findbash); do
    if [[ -f ${i} ]]; then
      ${SHELLCHECK} -f gcc "${i}" >> "${PATCH_DIR}/${PATCH_BRANCH}shellcheck-result.txt"
    fi
  done
  popd > /dev/null
  # keep track of how much as elapsed for us already
  SHELLCHECK_TIMER=$(stop_clock)
  return 0
}

function shellcheck_calcdiffs
{
  local orig=$1
  local new=$2
  local diffout=$3
  local tmp=${PATCH_DIR}/sc.$$.${RANDOM}
  local count=0
  local j

  # first, pull out just the errors
  # shellcheck disable=SC2016
  ${AWK} -F: '{print $NF}' "${orig}" >> "${tmp}.branch"

  # shellcheck disable=SC2016
  ${AWK} -F: '{print $NF}' "${new}" >> "${tmp}.patch"

  # compare the errors, generating a string of line
  # numbers.  Sorry portability: GNU diff makes this too easy
  ${DIFF} --unchanged-line-format="" \
     --old-line-format="" \
     --new-line-format="%dn " \
     "${tmp}.branch" \
     "${tmp}.patch" > "${tmp}.lined"

  # now, pull out those lines of the raw output
  # shellcheck disable=SC2013
  for j in $(cat "${tmp}.lined"); do
    # shellcheck disable=SC2086
    head -${j} "${new}" | tail -1 >> "${diffout}"
  done

  if [[ -f "${diffout}" ]]; then
    # shellcheck disable=SC2016
    count=$(wc -l "${diffout}" | ${AWK} '{print $1}' )
  fi
  rm "${tmp}.branch" "${tmp}.patch" "${tmp}.lined" 2>/dev/null
  echo "${count}"
}

function shellcheck_postapply
{
  local i

  verify_needed_test shellcheck
  if [[ $? == 0 ]]; then
    return 0
  fi

  big_console_header "shellcheck plugin: postpatch"

  if [[ ! -x "${SHELLCHECK}" ]]; then
    hadoop_error "shellcheck is not available."
    add_jira_table 0 shellcheck "Shellcheck was not available."
    return 0
  fi

  start_clock

  # add our previous elapsed to our new timer
  # by setting the clock back
  offset_clock "${SHELLCHECK_TIMER}"

  echo "Running shellcheck against all identifiable shell scripts"
  # we re-check this in case one has been added
  for i in $(shellcheck_private_findbash); do
    ${SHELLCHECK} -f gcc "${i}" >> "${PATCH_DIR}/patchshellcheck-result.txt"
  done

  # shellcheck disable=SC2016
  numPrepatch=$(wc -l "${PATCH_DIR}/${PATCH_BRANCH}shellcheck-result.txt" | ${AWK} '{print $1}')
  # shellcheck disable=SC2016
  numPostpatch=$(wc -l "${PATCH_DIR}/patchshellcheck-result.txt" | ${AWK} '{print $1}')

  diffPostpatch=$(shellcheck_calcdiffs \
    "${PATCH_DIR}/${PATCH_BRANCH}shellcheck-result.txt" \
    "${PATCH_DIR}/patchshellcheck-result.txt" \
      "${PATCH_DIR}/diffpatchshellcheck.txt"
    )

  if [[ ${diffPostpatch} -gt 0 ]] ; then
    add_jira_table -1 shellcheck "The applied patch generated "\
      "${diffPostpatch} new shellcheck (v${SHELLCHECK_VERSION}) issues (total was ${numPrepatch}, now ${numPostpatch})."
    add_jira_footer shellcheck "@@BASE@@/diffpatchshellcheck.txt"
    return 1
  fi

  add_jira_table +1 shellcheck "There were no new shellcheck (v${SHELLCHECK_VERSION}) issues."
  return 0
}


text:
/**
 * This file is part of spy4js which is released under MIT license.
 *
 * The LICENSE file can be found in the root directory of this project.
 *
 */
import { createMock, initMocks, _mocks, setScope, defaultScope, Mockable } from '../../src/mock';

const IRL = {
    saveTheWorld: () => 'feed some koalas',
    doWithTree: (action: string) => `${action} the tree`,
    giveBanana: (to: string) => `Give ${to} a banana`,
};

const Matrix = { tearDown: () => 1337, startup: () => 1 };

const testSpyOn = (obj: Mockable, method: keyof typeof obj) => obj[method];

describe('Mocks', () => {
    beforeEach(() => {
        _mocks[defaultScope].length = 0;
        setScope(undefined);
    });

    it('creates uninitialized mocks', () => {
        const IRL$Mock = createMock(IRL, ['doWithTree', 'giveBanana']);

        expect(_mocks[defaultScope].length).toBe(1);
        expect(_mocks[defaultScope][0].mock).toBe(IRL$Mock);
        expect(_mocks[defaultScope][0].mocked).toBe(IRL);

        expect((IRL$Mock as any).saveTheWorld).toBe(undefined);
        expect(IRL$Mock.doWithTree).toThrowErrorMatchingInlineSnapshot(
            `"Method 'doWithTree' was not initialized on Mock."`
        );
        expect(IRL$Mock.giveBanana).toThrowErrorMatchingInlineSnapshot(
            `"Method 'giveBanana' was not initialized on Mock."`
        );
    });

    it('mocks specified methods', () => {
        setScope('Test Scope');
        const IRL$Mock = createMock(IRL, ['doWithTree', 'giveBanana']);
        expect(_mocks['Test Scope'].length).toBe(1);
        initMocks(testSpyOn, 'Test Scope');

        expect((IRL$Mock as any).saveTheWorld).toBe(undefined);
        expect(IRL$Mock.doWithTree('kiss')).toBe('kiss the tree');
        expect(IRL$Mock.giveBanana('Joe')).toBe('Give Joe a banana');
    });

    it('creates multiple mocks', () => {
        const IRL$Mock = createMock(IRL, ['saveTheWorld']);
        const Matrix$Mock = createMock(Matrix, ['tearDown']);
        expect(_mocks[defaultScope].length).toBe(2);
        initMocks(testSpyOn);

        expect(IRL$Mock.saveTheWorld()).toBe('feed some koalas');
        expect((IRL$Mock as any).doWithTree).toBe(undefined);
        expect((IRL$Mock as any).giveBanana).toBe(undefined);

        expect(Matrix$Mock.tearDown()).toBe(1337);
        expect((Matrix$Mock as any).startup).toBe(undefined);
    });
});


text:
<?php
require_once vc_path_dir( 'SHORTCODES_DIR', 'paginator/class-vc-pageable.php' );

class WPBakeryShortCode_VC_Basic_Grid extends WPBakeryShortCodeVc_Pageable {
	public $pagable_type = 'grid';
	public $items = array();
	public static $excluded_ids = array();
	protected $element_template = '';
	protected static $default_max_items = 1000;
	public $post_id = false;
	protected $filter_terms;
	//protected $atts = array();
	public $attributes_defaults = array(
		'full_width' => '',
		'layout' => '',
		'element_width' => '4',
		'items_per_page' => '5',
		'gap' => '',
		'style' => 'all',
		'show_filter' => '',
		'exclude_filter' => '',
		'filter_style' => '',
		'filter_size' => 'md',
		'filter_align' => '',
		'filter_color' => '',
		'button_style' => '',
		'button_color' => '',
		'button_size' => 'md',
		'arrows_design' => '',
		'arrows_position' => '',
		'arrows_color' => '',
		'paging_design' => '',
		'paging_color' => '',
		'paging_animation_in' => '',
		'paging_animation_out' => '',
		'loop' => '',
		'autoplay' => '',
		'post_type' => 'post',
		'filter_source' => 'category',
		'orderby' => '',
		'order' => 'DESC',
		'meta_key' => '',
		'max_items' => '10',
		'offset' => '0',
		'taxonomies' => '',
		'custom_query' => '',
		'data_type' => 'query',
		'include' => '',
		'exclude' => '',
		'item' => 'none',
		'grid_id' => '',
	);
	protected $grid_settings = array();
	protected $grid_id_unique_name = 'vc_gid'; // if you change this also change in hook-vc-grid.php

	function __construct( $settings ) {
		parent::__construct( $settings );

		$this->shortcodeScripts();
	}

	public function shortcodeScripts() {
		parent::shortcodeScripts();

		wp_register_script( 'vc_grid-js-imagesloaded',
			vc_asset_url( 'lib/bower/imagesloaded/imagesloaded.pkgd.min.js' ) );
		wp_register_script( 'vc_grid-style-all', vc_asset_url( 'js/components/vc_grid_style_all.js' ),
			array(), WPB_VC_VERSION, true );
		wp_register_script( 'vc_grid-style-load-more', vc_asset_url( 'js/components/vc_grid_style_load_more.js' ),
			array(), WPB_VC_VERSION, true );
		wp_register_script( 'vc_grid-style-lazy', vc_asset_url( 'js/components/vc_grid_style_lazy.js' ),
			array( 'waypoints' ), WPB_VC_VERSION, true );
		wp_register_script( 'vc_grid-style-pagination', vc_asset_url( 'js/components/vc_grid_style_pagination.js' ),
			array(), WPB_VC_VERSION, true );
		wp_register_script( 'vc_grid', vc_asset_url( 'js/components/vc_grid.js' ), array(
			'jquery',
			'underscore',
			'vc_pageable_owl-carousel',
			'waypoints',
			//'isotope',
			'vc_grid-style-all',
			'vc_grid-style-load-more',
			'vc_grid-style-lazy',
			'vc_grid-style-pagination',
		), WPB_VC_VERSION, true );
	}

	public function enqueueScripts() {
		parent::enqueueScripts();
		wp_enqueue_script( 'vc_grid-js-imagesloaded' );
		wp_enqueue_script( 'vc_grid' );
	}

	public static function addExcludedId( $id ) {
		self::$excluded_ids[] = $id;
	}

	public static function excludedIds() {
		return self::$excluded_ids;
	}

	/**
	 * Get shortcode hash by it content and attributes
	 *
	 * @param $atts
	 * @param $content
	 *
	 * @deprecated since 4.4.3
	 * @return string
	 */
	public function getHash( $atts, $content ) {
		if ( vc_is_page_editable() || is_preview() ) {
			/* We are in Frontend editor
			 * We need to send RAW shortcode data, so hash is just json_encode of atts and content
			 */
			return urlencode( json_encode( array(
				'tag' => $this->shortcode,
				'atts' => $atts,
				'content' => $content
			) ) );
		}

		/** Else
		 * We are in preview mode (viewing page).
		 * So hash is shortcode atts and content hash
		 */

		return sha1( serialize( array(
			'tag' => $this->shortcode,
			'atts' => $atts,
			'content' => $content,
		) ) );

	}

	public function getId( $atts, $content ) {
		if ( vc_is_page_editable() || is_preview() ) {
			/* We are in Frontend editor
			 * We need to send RAW shortcode data, so hash is just json_encode of atts and content
			 */
			return urlencode( json_encode( array(
				'tag' => $this->shortcode,
				'atts' => $atts,
				'content' => $content
			) ) );
		}

		$id_pattern = '/' . $this->grid_id_unique_name . '\:([\w-_]+)/';

		$id_value = $atts['grid_id'];

		preg_match( $id_pattern, $id_value, $id_matches );
		$id_to_save = '{failed_to_get_id:"' . esc_attr( $atts['grid_id'] ) . '"}';

		if ( ! empty( $id_matches ) ) {
			$id_to_save = $id_matches[1];
		}

		return $id_to_save;
	}

	/**
	 * Search in post meta vc_post_settings value
	 * For shortcode data by hash
	 *
	 * @param $page_id
	 * @param $hash
	 *
	 * @deprecated since 4.4.3
	 * @return bool|array
	 */
	public function findPostShortcodeByHash( $page_id, $hash ) {
		if ( $hash ) {
			if ( preg_match( '/\"tag\"\:/', urldecode( $hash ) ) ) {
				return json_decode( urldecode( $hash ), true ); // if frontend, no hash exists - just RAW data
			}
			$post_meta = get_post_meta( $page_id, '_vc_post_settings' );
			if ( is_array( $post_meta ) ) {
				foreach ( $post_meta as $meta ) {
					if ( isset( $meta['vc_grid'] ) && ! empty( $meta['vc_grid']['shortcodes'] ) && isset( $meta['vc_grid']['shortcodes'][ $hash ] ) ) {
						return $meta['vc_grid']['shortcodes'][ $hash ];
					}
				}
			}
		}

		return false;
	}

	public function findPostShortcodeById( $page_id, $grid_id ) {
		if ( preg_match( '/\"tag\"\:/', urldecode( $grid_id ) ) ) {
			return json_decode( urldecode( $grid_id ), true ); // if frontend, no hash exists - just RAW data
		}
		$post_meta = get_post_meta( $page_id, '_vc_post_settings' );
		if ( is_array( $post_meta ) ) {
			foreach ( $post_meta as $meta ) {
				if ( isset( $meta['vc_grid_id'] ) && ! empty( $meta['vc_grid_id']['shortcodes'] ) && isset( $meta['vc_grid_id']['shortcodes'][ $grid_id ] ) ) {
					return $meta['vc_grid_id']['shortcodes'][ $grid_id ];
				}
			}
		}

		return false;
	}

	private function renderItems() {
		$output = $items = '';
		$this->buildGridSettings();
		$css_classes = 'vc_grid' . esc_attr( $this->atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $this->atts['gap'] . 'px' : '' );
		if ( is_array( $this->items ) && ! empty( $this->items ) ) {
			require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
			$grid_item = new Vc_Grid_Item();
			$grid_item->setGridAttributes( $this->atts );
			$grid_item->setIsEnd( isset( $this->is_end ) && $this->is_end );
			$grid_item->setTemplateById( $this->atts['item'] );
			$output .= $grid_item->addShortcodesCustomCss();
			ob_start();
			wp_print_styles();
			$output .= ob_get_clean();
			$output .= vc_get_template( 'shortcodes/vc_basic_grid_filter.php', array(
				'filter_terms' => $this->filter_terms,
				'atts' => $this->atts
			) );
			while ( have_posts() ) {
				the_post();
				$items .= $grid_item->renderItem( get_post() );
			}
			/*
			foreach ( $this->items as $post ) {
				$post->the_post();
				$items .= $grid_item->renderItem( $post );

				$items .= trim( vc_get_template( 'shortcodes/vc_grid_item.php', array(
					'post' => $post,
					'element_width' => $this->atts['element_width'],
				) ) );
			*/
		}
		$items = apply_filters( $this->shortcode . '_items_list', $items );
		$output .= $this->renderPagination( $this->atts['style'], $this->grid_settings, $items, $css_classes ) . "\n";

		return $output;
	}

	public function setContentLimits() {
		$atts = $this->atts;
		if ( $this->atts['post_type'] === 'ids' ) {
			$this->atts['max_items'] = 0;
			$this->atts['offset'] = 0;
			$this->atts['items_per_page'] = apply_filters( 'vc_basic_grid_max_items', self::$default_max_items );
		} else {
			$this->atts['offset'] = $offset = isset( $atts['offset'] ) ? (int) $atts['offset'] : $this->attributes_defaults['offset'];
			$this->atts['max_items'] = isset( $atts['max_items'] )
				? (int) $atts['max_items'] : (int) $this->attributes_defaults['max_items'];
			$this->atts['items_per_page'] = ! isset( $atts['items_per_page'] )
				? (int) $this->attributes_defaults['items_per_page']
				: (int) $atts['items_per_page'];
			if ( $this->atts['max_items'] < 1 ) {
				$this->atts['max_items'] = apply_filters( 'vc_basic_grid_max_items', self::$default_max_items );
			}
		}
		$this->setPagingAll( $this->atts['max_items'] );
	}

	protected function setPagingAll(
		$max_items
	) {
		$atts = $this->atts;
		$this->atts['items_per_page'] = $this->atts['query_items_per_page'] = $max_items > 0
			? $max_items
			: apply_filters( 'vc_basic_grid_items_per_page_all_max_items', self::$default_max_items );
		$this->atts['query_offset'] = isset( $atts['offset'] )
			? (int) $atts['offset']
			: $this->attributes_defaults['offset'];
	}

	public function renderAjax( $vc_request_param ) {
		$this->items = array(); // clear this items array (if used more than once);

		$shortcode = false;
		$id = isset( $vc_request_param['shortcode_id'] ) ? $vc_request_param['shortcode_id'] : false;
		if ( ! empty( $id ) ) {
			$shortcode = $this->findPostShortcodeById( $vc_request_param['page_id'], $id );
		} else {
			/**
			 * @deprecated since 4.4.3 due to invalid logic in hash algorithm
			 */
			$hash = isset( $vc_request_param['shortcode_hash'] ) ? $vc_request_param['shortcode_hash'] : false;
			$shortcode = $this->findPostShortcodeByHash( $vc_request_param['page_id'], $hash );
		}

		if ( ! is_array( $shortcode ) ) {
			return "{'status':'Nothing found'}"; // Nothing found
		}
		// Set post id
		$this->post_id = (int) $vc_request_param['page_id'];

		$shortcode_atts = $shortcode['atts'];
		$this->shortcode_content = $shortcode['content'];
		$this->buildAtts( $shortcode_atts, $shortcode['content'] );
		if ( isset( $vc_request_param['taxonomies'] ) ) {
			$this->atts['taxonomies'] = $vc_request_param['taxonomies'];
		}

		$this->buildItems();

		return $this->renderItems();
	}

	public function postID() {
		if ( $this->post_id == false ) {
			$this->post_id = get_the_ID();
		}

		return $this->post_id;
	}

	public function buildAtts( $atts, $content ) {
		$arr_keys = array_keys( $atts );
		for ( $i = 0; $i < count( $atts ); $i ++ ) {
			$atts[ $arr_keys[ $i ] ] = html_entity_decode( $atts[ $arr_keys[ $i ] ], ENT_QUOTES, 'utf-8' );
		}
		if ( ! isset( $atts['grid_id'] ) || empty( $atts['grid_id'] ) ) {
			$hash = $this->getHash( $atts, $content );
			$this->atts['shortcode_hash'] = $hash;

		} else {
			$id_to_save = $this->getId( $atts, $content );
			$this->atts['shortcode_id'] = $id_to_save;
		}
		$this->atts = shortcode_atts( $this->attributes_defaults, $atts );
		$this->atts['page_id'] = $this->postID();
		if ( isset( $hash ) ) {
			$this->atts['shortcode_hash'] = $hash;
		}
		if ( isset( $id_to_save ) ) {
			$this->atts['shortcode_id'] = $id_to_save;
		}

		$this->element_template = $content;
		// @since 4.4.3
		if ( 'custom' === $this->attr( 'post_type' ) ) {
			$this->atts['style'] = 'all';
		}
	}

	/**
	 * Getter attribute.
	 *
	 * @param $key
	 *
	 * @return mixed|null
	 */
	public function attr( $key ) {
		return isset( $this->atts[ $key ] ) ? $this->atts[ $key ] : null;
	}

	public function buildGridSettings() {
		$this->grid_settings = array(
			'page_id' => $this->atts['page_id'],
			// used in basic grid for initialization
			'style' => $this->atts['style'],
			'action' => 'vc_get_vc_grid_data',
			// 'grid_options' => $isotope_options
			// animation_in used everywhere.. (in filter)
			'animation_in' => 'zoomIn',
		);
		// used in ajax request for items
		if ( isset( $this->atts['shortcode_hash'] ) && ! empty( $this->atts['shortcode_hash'] ) ) {
			$this->grid_settings['shortcode_hash'] = $this->atts['shortcode_hash'];
		} else if ( isset( $this->atts['shortcode_id'] ) && ! empty( $this->atts['shortcode_id'] ) ) {
			$this->grid_settings['shortcode_id'] = $this->atts['shortcode_id'];
		}
		if ( $this->atts['style'] == 'load-more' ) {
			$this->grid_settings = array_merge( $this->grid_settings, array(
				// used in dispaly style load more button, lazy, pagination
				'items_per_page' => $this->atts['items_per_page'],
				// used in load more button style
				'button_style' => $this->atts['button_style'],
				// load more btn style
				'button_color' => $this->atts['button_color'],
				// load more btn color
				'button_size' => $this->atts['button_size'],
				// load more btn size
			) );
		} else if ( $this->atts['style'] == 'lazy' ) {
			$this->grid_settings = array_merge( $this->grid_settings, array(
				'items_per_page' => $this->atts['items_per_page'],
			) );
		} else if ( $this->atts['style'] == 'pagination' ) {
			$this->grid_settings = array_merge( $this->grid_settings, array(
				'items_per_page' => $this->atts['items_per_page'],
				// used in pagination style
				'auto_play' => $this->atts['autoplay'] > 0 ? true : false,
				'gap' => (int) $this->atts['gap'], // not used yet, but can be used in isotope..
				'speed' => (int) $this->atts['autoplay'] * 1000,
				'loop' => $this->atts['loop'],
				'animation_in' => $this->atts['paging_animation_in'],
				'animation_out' => $this->atts['paging_animation_out'],
				'arrows_design' => $this->atts['arrows_design'],
				'arrows_color' => $this->atts['arrows_color'],
				'arrows_position' => $this->atts['arrows_position'],
				'paging_design' => $this->atts['paging_design'],
				'paging_color' => $this->atts['paging_color'],
			) );
		}
		$this->grid_settings['tag'] = $this->shortcode;
	}

	// TODO: setter & getter to attributes
	public function buildQuery( $atts ) {
		// Set include & exclude
		if ( $atts['post_type'] !== 'ids' && ! empty( $atts['exclude'] ) ) {
			$atts['exclude'] .= ',' . implode( ',', $this->excludedIds() );
		} else {
			$atts['exclude'] = implode( ',', $this->excludedIds() );
		}
		if ( $atts['post_type'] !== 'ids' ) {
			$settings = array(
				'posts_per_page' => $atts['query_items_per_page'],
				'offset' => $atts['query_offset'],
				'orderby' => $atts['orderby'],
				'order' => $atts['order'],
				'meta_key' => $atts['orderby'] == 'meta_key' ? $atts['meta_key'] : '',
				'post_type' => $atts['post_type'],
				'exclude' => $atts['exclude'],
			);
			if ( ! empty( $atts['taxonomies'] ) ) {
				$vc_taxonomies_types = get_taxonomies( array( 'public' => true ) );
				$terms = get_terms( array_keys( $vc_taxonomies_types ), array(
					'hide_empty' => false,
					'include' => $atts['taxonomies'],
				) );
				$settings['tax_query'] = array();
				$tax_queries = array(); // List of taxnonimes
				foreach ( $terms as $t ) {
					if ( ! isset( $tax_queries[ $t->taxonomy ] ) ) {
						$tax_queries[ $t->taxonomy ] = array(
							'taxonomy' => $t->taxonomy,
							'field' => 'id',
							'terms' => array( $t->term_id ),
							'relation' => 'IN'
						);
					} else {
						$tax_queries[ $t->taxonomy ]['terms'][] = $t->term_id;
					}
				}
				$settings['tax_query'] = array_values( $tax_queries );
				$settings['tax_query']['relation'] = 'OR';
			}
		} else {
			if ( empty( $atts['include'] ) ) {
				$atts['include'] = - 1;
			} elseif ( ! empty( $atts['exclude'] ) ) {
				$atts['include'] = preg_replace(
					'/(('
					. preg_replace(
						array( '/^\,\*/', '/\,\s*$/', '/\s*\,\s*/' ),
						array( '', '', '|' ),
						$atts['exclude']
					)
					. ')\,*\s*)/', '', $atts['include'] );
			}
			$settings = array(
				'include' => $atts['include'],
				'posts_per_page' => $atts['query_items_per_page'],
				'offset' => $atts['query_offset'],
				'post_type' => 'any', // $atts['post_type'],
				'orderby' => 'post__in',
			);
			$this->atts['items_per_page'] = - 1;
		}

		return $settings;
	}

	public function buildItems() {
		$this->filter_terms = $this->items = array();

		$this->setContentLimits();

		//wp_enqueue_script( 'isotope' );

		$this->addExcludedId( $this->postID() );
		if ( 'custom' == $this->atts['post_type'] && ! empty( $this->atts['custom_query'] ) ) {
			$query = html_entity_decode( vc_value_from_safe( $this->atts['custom_query'] ), ENT_QUOTES, "utf-8" );
			$post_data = query_posts( $query );
			$this->atts['items_per_page'] = - 1;
		} elseif ( false !== $this->atts['query_items_per_page'] ) {
			$settings = $this->filterQuerySettings( $this->buildQuery( $this->atts ) );
			$post_data = query_posts( $settings );
		} else {
			return;
		}
		if ( $this->atts['items_per_page'] > 0 && count( $post_data ) > $this->atts['items_per_page'] ) {
			$post_data = array_slice( $post_data, 0, $this->atts['items_per_page'] );
		}
		foreach ( $post_data as $post ) {
			$post->filter_terms = wp_get_object_terms( $post->ID, $this->atts['filter_source'], array( 'fields' => 'ids' ) );
			$this->filter_terms = wp_parse_args( $this->filter_terms, $post->filter_terms );
			$this->items[] = $post;
		}
	}

	public function filterQuerySettings( $args ) {
		$defaults = array(
			'numberposts' => 5,
			'offset' => 0,
			'category' => 0,
			'orderby' => 'date',
			'order' => 'DESC',
			'include' => array(),
			'exclude' => array(),
			'meta_key' => '',
			'meta_value' => '',
			'post_type' => 'post',
			'suppress_filters' => apply_filters( 'vc_basic_grid_filter_query_suppress_filters', true ),
			'public' => true
		);

		$r = wp_parse_args( $args, $defaults );
		if ( empty( $r['post_status'] ) ) {
			$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
		}
		if ( ! empty( $r['numberposts'] ) && empty( $r['posts_per_page'] ) ) {
			$r['posts_per_page'] = $r['numberposts'];
		}
		if ( ! empty( $r['category'] ) ) {
			$r['cat'] = $r['category'];
		}
		if ( ! empty( $r['include'] ) ) {
			$incposts = wp_parse_id_list( $r['include'] );
			$r['posts_per_page'] = count( $incposts );  // only the number of posts included
			$r['post__in'] = $incposts;
		} elseif ( ! empty( $r['exclude'] ) ) {
			$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
		}

		$r['ignore_sticky_posts'] = true;
		$r['no_found_rows'] = true;

		return $r;
	}
}


text:
. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testCompileGetsDefaultSystemProperties() {
  createPom "$(withDependency)"

  compile

  assertCapturedSuccess

  assertCaptured "Installing Maven 3.0.3"
  assertFileMD5 "7d2bdb60388da32ba499f953389207fe"  ${CACHE_DIR}/.maven/bin/mvn
  assertTrue "mvn should be executable" "[ -x ${CACHE_DIR}/.maven/bin/mvn ]"

  assertCaptured "executing $CACHE_DIR/.maven/bin/mvn -B -Duser.home=$BUILD_DIR -Dmaven.repo.local=$CACHE_DIR/.m2/repository -DskipTests=true clean install"
  assertCaptured "BUILD SUCCESS"
  assertCaptured "Installing OpenJDK 1.6"
  assertTrue "Java should be present in runtime." "[ -d ${BUILD_DIR}/.jdk ]"
  assertTrue "Java version file should be present." "[ -f ${BUILD_DIR}/.jdk/version ]"
  assertTrue "System properties file should be present in build dir." "[ -f ${BUILD_DIR}/system.properties ]"
}

createPom()
{
  cat > ${BUILD_DIR}/pom.xml <<EOF
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
$1
  </dependencies>
</project>
EOF
}

withDependency()
{
  cat <<EOF
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.0</version>
      <type>jar</type>
      <scope>test</scope>
    </dependency>
EOF
}

testCompile()
{
  createPom "$(withDependency)"

  compile

  assertCapturedSuccess

  assertCaptured "Installing Maven 3.0.3"
  assertFileMD5 "7d2bdb60388da32ba499f953389207fe" ${CACHE_DIR}/.maven/bin/mvn
  assertTrue "mvn should be executable" "[ -x ${CACHE_DIR}/.maven/bin/mvn ]"

  assertCaptured "executing $CACHE_DIR/.maven/bin/mvn -B -Duser.home=$BUILD_DIR -Dmaven.repo.local=$CACHE_DIR/.m2/repository -DskipTests=true clean install"
  assertCaptured "BUILD SUCCESS"
}

testCompilationFailure()
{
  # Don't create POM to fail build

  compile

  assertCapturedError "Failed to build app with Maven"
}

testDownloadCaching()
{
  createPom

  # simulate a primed cache
  mkdir -p ${CACHE_DIR}/.maven
  mkdir -p ${CACHE_DIR}/.m2

  compile

  assertNotCaptured "Maven should not be installed again when already cached" "Installing Maven"
}

testNewAppsRemoveM2Cache()
{
  createPom
  rm -r ${CACHE_DIR} # simulate a brand new app without a cache dir

  assertFalse "Precondition: New apps should not have a CACHE_DIR prior to running" "[ -d ${CACHE_DIR} ]"
  assertFalse "Precondition: New apps should not have a removeM2Cache file prior to running" "[ -f ${CACHE_DIR}/removeM2Cache ]"

  compile

  assertCapturedSuccess
  assertTrue "removeM2Cache file should now exist in cache" "[ -f ${CACHE_DIR}/removeM2Cache ]"
  assertFalse ".m2 should not be copied to build dir" "[ -d ${BUILD_DIR}/.m2 ]"
  assertFalse ".maven should not be copied to build dir" "[ -d ${BUILD_DIR}/.maven ]"
}

testNonLegacyExistingAppsRemoveCache()
{
  createPom
  touch ${CACHE_DIR}/removeM2Cache # simulate a previous run with no cache dir

  assertTrue "Precondition: Existing apps should have a CACHE_DIR from previous run" "[ -d ${CACHE_DIR} ]"
  assertTrue "Precondition: Existing apps should have a removeM2Cache file from previous run" "[ -f ${CACHE_DIR}/removeM2Cache ]"

  compile

  assertCapturedSuccess
  assertTrue "removeM2Cache file should still exist in cache" "[ -f ${CACHE_DIR}/removeM2Cache ]"
  assertFalse ".m2 should not be copied to build dir" "[ -d ${BUILD_DIR}/.m2 ]"
  assertFalse ".maven should not be copied to build dir" "[ -d ${BUILD_DIR}/.maven ]"
}

testLegacyAppsKeepM2Cache()
{
  createPom

  assertTrue  "Precondition: Legacy apps should have a CACHE_DIR from a previous run" "[ -d ${CACHE_DIR} ]"
  assertFalse "Precondition: Legacy apps should not have a removeM2Cache file" "[ -f ${CACHE_DIR}/removeM2Cache ]"

  compile

  assertCapturedSuccess
  assertFalse "removeM2Cache file should not exist in cache" "[ -f ${CACHE_DIR}/removeM2Cache ]"
  assertEquals ".m2 should be copied to build dir" "" "$(diff -r ${CACHE_DIR}/.m2 ${BUILD_DIR}/.m2)"
  assertEquals ".maven should be copied to build dir" "" "$(diff -r ${CACHE_DIR}/.maven ${BUILD_DIR}/.maven)"
}


text:
package org.apache.activemq.artemis.tests.integration.openwire.amq;

import java.util.Arrays;
import java.util.Collection;

import javax.jms.DeliveryMode;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;

import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

/**
 * adapted from: org.apache.activemq.JMSConsumerTest
 */
@RunWith(Parameterized.class)
public class JMSConsumer4Test extends BasicOpenWireTest
{
   @Parameterized.Parameters(name = "deliveryMode={0} destinationType={1}")
   public static Collection<Object[]> getParams()
   {
      return Arrays.asList(new Object[][] {
         {DeliveryMode.NON_PERSISTENT, ActiveMQDestination.TOPIC_TYPE},
         {DeliveryMode.PERSISTENT, ActiveMQDestination.TOPIC_TYPE}
      });
   }

   public int deliveryMode;
   public byte destinationType;

   public JMSConsumer4Test(int deliveryMode, byte destinationType)
   {
      this.deliveryMode = deliveryMode;
      this.destinationType = destinationType;
   }

   @Test
   public void testDurableConsumerSelectorChange() throws Exception
   {
      // Receive a message with the JMS API
      connection.setClientID("test");
      connection.start();
      Session session = connection.createSession(false,
            Session.AUTO_ACKNOWLEDGE);
      ActiveMQDestination destination = createDestination(session,
            destinationType);
      MessageProducer producer = session.createProducer(destination);
      producer.setDeliveryMode(deliveryMode);
      MessageConsumer consumer = session.createDurableSubscriber(
            (Topic) destination, "test", "color='red'", false);

      // Send the messages
      TextMessage message = session.createTextMessage("1st");
      message.setStringProperty("color", "red");
      producer.send(message);

      Message m = consumer.receive(1000);
      assertNotNull(m);
      assertEquals("1st", ((TextMessage) m).getText());

      // Change the subscription.
      consumer.close();
      consumer = session.createDurableSubscriber((Topic) destination, "test",
            "color='blue'", false);

      message = session.createTextMessage("2nd");
      message.setStringProperty("color", "red");
      producer.send(message);
      message = session.createTextMessage("3rd");
      message.setStringProperty("color", "blue");
      producer.send(message);

      // Selector should skip the 2nd message.
      m = consumer.receive(1000);
      assertNotNull(m);
      assertEquals("3rd", ((TextMessage) m).getText());

      assertNull(consumer.receiveNoWait());
   }

}


text:
/*
 * There are multiple caching levels in v8cgi.
 * - getHandle checks file's MTIME and provides source code / DSO handle
 * - getScript checks file's MTIME and provides compiled source code
 * - getExports returns module's "exports" object. No checks are performed, exports are valid through whole request.
 */

#ifndef _JS_CACHE_H
#define _JS_CACHE_H

#include <string>
#include <map>
#include "v8.h"

class Cache {
public:
	void * getHandle(std::string filename);
	v8::Handle<v8::Script> getScript(std::string filename);
	v8::Handle<v8::Object> getExports(std::string filename);
	void clearExports();
	void addExports(std::string filename, v8::Handle<v8::Object> obj);
	void removeExports(std::string filename);

private:
	typedef std::map<std::string, time_t> TimeValue;
	typedef std::map<std::string, void*> HandleValue;
	typedef std::map<std::string, v8::Persistent<v8::Script> > ScriptValue;
	typedef std::map<std::string, v8::Persistent<v8::Object> > ExportsValue;

	/* mtimes */
	TimeValue modified;
	/* DSO handles */
	HandleValue handles;
	/* compiled scripts */
	ScriptValue scripts;
	/* exports */
	ExportsValue exports;

	std::string getSource(std::string filename);
	std::string wrapExports(std::string code);
	void mark(std::string filename);
	bool isCached(std::string filename);
	void erase(std::string filename);
};

#endif


text:
var path = require("path");
var webpack = require("../../");
module.exports = {
	entry: {
		main: "./example",
		common: ["./vendor"] // optional
	},
	output: {
		path: path.join(__dirname, "js"),
		filename: "[name].chunkhash.js",
		chunkFilename: "[chunkhash].js"
	},
	plugins: [
		new webpack.optimize.CommonsChunkPlugin({
			names: ["common", "manifest"]
		})
		/* without the "common" chunk:
		new webpack.optimize.CommonsChunkPlugin({
			name: "manifest"
		})
		*/
	]
};


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.laykun.recast;

public class SWIGTYPE_p_p_rcPolyMesh {
  private long swigCPtr;

  protected SWIGTYPE_p_p_rcPolyMesh(long cPtr, boolean futureUse) {
    swigCPtr = cPtr;
  }

  protected SWIGTYPE_p_p_rcPolyMesh() {
    swigCPtr = 0;
  }

  protected static long getCPtr(SWIGTYPE_p_p_rcPolyMesh obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }
}


text:
namespace Doh3d
{

	class Drawer
	{
	public:

		static bool beginScene();
		static bool endScene();

	};

} // ns Doh3d


text:
package com.alibaba.json.bvt.bug;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class Issue101_field extends TestCase {

    public void test_for_issure() throws Exception {
        VO vo = new VO();
        vo.a = new Object();
        vo.b = vo.a;
        vo.c = vo.a;

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"a\":{},\"b\":{},\"c\":{\"$ref\":\"$.b\"}}", text);
    }

    public static class VO {

        private Object a;
        private Object b;
        private Object c;

        public Object getA() {
            return a;
        }

        public void setA(Object a) {
            this.a = a;
        }

        @JSONField(serialzeFeatures=SerializerFeature.DisableCircularReferenceDetect)
        public Object getB() {
            return b;
        }

        public void setB(Object b) {
            this.b = b;
        }

        public Object getC() {
            return c;
        }

        public void setC(Object c) {
            this.c = c;
        }

    }
}


text:
package net.genesishub.gFeaturesSponge.Configuration;

import java.io.File;
import java.io.IOException;
import java.util.List;

import net.genesishub.gFeaturesSponge.Basic;
import net.genesishub.gFeaturesSponge.Extension;
import net.genesishub.gFeaturesSponge.ExtensionsType;
import net.genesishub.gFeaturesSponge.gFeature;

import org.bukkit.configuration.file.YamlConfiguration;

public class SetupConfig {
	static Config config = new Config();
	static File f = new File("plugins/gFeatures/Config.yml");
	static List<gFeature> features = Basic.getFeatures();
	static List<Extension> extensions = Basic.getExtensions();
	public static void setup(){
		config.createDirectory("plugins/gFeatures", "Setup the gFeatures directory for use!");
		config.createFile("plugins/gFeatures/Config.yml", "Setup the gFeatures config for use!");
		YamlConfiguration yamlFile = YamlConfiguration.loadConfiguration(f);
		if(!(yamlFile.contains("Config"))){
		yamlFile.createSection("Config");
		}
		if(!(yamlFile.contains("Config.Plugins"))){
		yamlFile.createSection("Config.Plugins");
		}
		for(gFeature feature : features){
			if(!(yamlFile.contains("Config.Plugins." + feature.getName()))){
				yamlFile.createSection("Config.Plugins." + feature.getName());
				yamlFile.set("Config.Plugins." + feature.getName() , "false");
			}
		}
		if(!(yamlFile.contains("Config.Extensions"))){
			yamlFile.createSection("Config.Extensions");
		}
		for(ExtensionsType type : ExtensionsType.values()){
			if(!(yamlFile.contains("Config.Extensions." + type.toString()))){
				yamlFile.createSection("Config.Extensions." + type.toString());
			}
		}
		for(Extension extend : extensions){
			if(!(yamlFile.contains("Config.Extensions." + extend.getType().toString() + "." + extend.getName()))){
				yamlFile.createSection("Config.Extensions." + extend.getType().toString() + "." + extend.getName());
				yamlFile.set("Config.Extensions." + extend.getType().toString() + "." + extend.getName() , "false");
			}
		}
		try {
			yamlFile.save(f);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}


text:
<?php

namespace Gems\Screens\Respondent\Browse;

use Gems\Screens\BrowseScreenAbstract;

/**
 *
 * @package    Gems
 * @subpackage Screens\Respondent\Browse
 * @copyright  Copyright (c) 2016, Erasmus MC and MagnaFacta B.V.
 * @license    New BSD License
 * @since      Class available since version 1.8.2 Jan 20, 2017 3:49:35 PM
 */
class ProjectDefaultBrowse extends BrowseScreenAbstract
{
    /**
     *
     * @return array Added before all other parameters
     */
    public function getAutofilterParameters()
    {
        return [
            'useColumns' => true,
            ];
    }

    /**
     *
     * @return mixed Something to display as label. Can be an \MUtil_Html_HtmlElement
     */
    public function getScreenLabel()
    {
        return $this->_('(default project specific table display)');
    }

    /**
     *
     * @return array Of snippets or false to use original
     */
    public function getStartSnippets()
    {
        return false;
    }
}


text:
package p01Logger.models;

import p01Logger.enumerations.LogType;
import p01Logger.logger.Handler;
import p01Logger.observer.ObservableTarget;
import p01Logger.observer.Observer;

public abstract class AbstractHero implements Attacker, Observer {

    private static final String TARGET_NULL_MESSAGE = "p01Logger.models.Target null";
    private static final String NO_TARGET_MESSAGE = "%s has no target";
    private static final String TARGET_DEAD_MESSAGE = "%s is dead";
    private static final String SET_TARGET_MESSAGE = "%s targets %s";
    private static final String REWARD_RECEIVING_MESSAGE = "%s received %d reward";

    private String id;
    private int dmg;
    private ObservableTarget target;
    private Handler handler;

    public AbstractHero(String id, int dmg, Handler handler) {
        this.id = id;
        this.dmg = dmg;
        this.handler = handler;
    }

    public void setTarget(ObservableTarget target) {
        if (target == null) {
            this.handler.handle(LogType.ERROR, TARGET_NULL_MESSAGE);
        } else {
            this.target = target;
            this.target.register(this);
            this.handler.handle(LogType.TARGET, String.format(SET_TARGET_MESSAGE, this, target));
        }
    }

    public final void attack() {
        if (this.target == null) {
            this.handler.handle(LogType.ERROR, String.format(NO_TARGET_MESSAGE, this));
        } else if (this.target.isDead()) {
            this.handler.handle(LogType.ERROR, String.format(TARGET_DEAD_MESSAGE, target));

        } else {
            this.executeClassSpecificAttack(this.target, this.dmg, this.handler);

        }
    }

    @Override
    public String toString() {
        return this.id;
    }

    public void update(int reward) {
        this.handler.handle(LogType.EVENT, String.format(REWARD_RECEIVING_MESSAGE, this, reward));
    }

    protected abstract void executeClassSpecificAttack(ObservableTarget target, int dmg, Handler handler);
}


text:
package config

import (
	"gost/config"
	"os"
)

const (
	envApplicationName   = "GOST_TESTAPP_NAME"
	envAPIInstance       = "GOST_TESTAPP_INSTANCE"
	envHTTPServerAddress = "GOST_TESTAPP_HTTP"
)

// InitTestsApp initializes the application used for testing
func InitTestsApp() {
	config.ApplicationName = os.Getenv(envApplicationName)
	config.APIInstance = os.Getenv(envAPIInstance)
	config.HTTPServerAddress = os.Getenv(envHTTPServerAddress)
}


text:
date: 2014-11-11
author: Erwin Sterrenburg
title: EPA SWMM / Giswater Tutorial 5: Outfalls
slug: swmm-giswater-tutorial-5-outfalls
tags: SWMM, Giswater, Water
summary: This is the 5th episode in my tutorial on using EPA Storm Water Management Model (EPA SWMM) and Giswater for rainfall-runoff modeling for an urban drainage network system.

This is the 5th episode in my tutorial on using EPA Storm Water Management Model (EPA SWMM) and Giswater for rainfall-runoff modeling for an urban drainage network system.

> Outfalls are terminal nodes of the drainage system used to define final downstream boundaries under Dynamic Wave flow routing. For other types of flow routing they behave as a junction. Only a single link can be connected to an outfall node.
>
> The boundary conditions at an outfall can be described by any one of the following stage relationships:
> * the critical or normal flow depth in the connecting conduit
>
> * a fixed stage elevation
>
> * a tidal stage described in a table of tide height versus hour of the day
>
> * a user-defined time series of stage versus time.
>
> The principal input parameters for outfalls include:
>
> * invert elevation
>
> * boundary condition type and stage description
>
> * presence of a flap gate to prevent backflow through the outfall.

Name
 User-assigned outfall name.

X-Coordinate
 Horizontal location of the outfall on the Study Area Map. If left blank then the outfall will not appear on the map.

Y-Coordinate
 Vertical location of the outfall on the Study Area Map. If left blank then the outfall will not appear on the map.

Description
 Click the ellipsis button (or press Enter) to edit an optional description of the outfall.

Tag
 Optional label used to categorize or classify the outfall.

Inflows
 Click the ellipsis button (or press Enter) to assign external direct, dry weather or RDII inflows to the outfall.

Treatment
 Click the ellipsis button (or press Enter) to edit a set of treatment functions for pollutants entering the node.

Invert El.
 Invert elevation of the outfall (feet or meters).

Tide Gate
 YES - tide gate present to prevent backflow
NO - no tide gate present

Type
 Type of outfall boundary condition:
FREE: outfall stage determined by minimum of critical flow depth and normal flow depth in the connecting conduit
NORMAL: outfall stage based on normal flow depth in the connecting conduit
FIXED: outfall stage set to a fixed value
TIDAL: outfall stage given by a table of tide elevation versus time of day
TIMESERIES: outfall stage supplied from a time series of elevations

Fixed Stage
 Water elevation for a FIXED type of outfall (feet or meters).

Tidal Curve Name
 Name of the Tidal Curve relating water elevation to hour of the day for a TIDAL outfall (double-click to edit the curve).

Time Series Name
 Name of time series containing time history of outfall stage for a TIMESERIES outfall (double-click to edit the series).

Only thing required before running the model is possible is to create an outfall.

Create outfall
Run EPA SWMM (not that the results make any sense without inflows)

GISWATER: run not possilbe

#CONCLUSIONS:

Convert - absent in GISWATER

Sectors are relevant :)


text:
.container {
  display: flex;
  flex-direction: column;
}

.editor {
}

/* Preview styles */
.previewContainer {
  margin-top: 1em;
}

.previewContainer span {
  text-transform: uppercase;
  font-size: 0.8em;
  text-decoration: underline;
}

.preview {
}