text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace Microsoft.CodeAnalysis.Host
{
    /// <summary>
    /// This service allows you to persist information relative to solution, projects and documents.
    /// </summary>
    public interface IPersistentStorageService : IWorkspaceService
    {
        IPersistentStorage GetStorage(Solution solution);
    }

    internal interface IPersistentStorageService2 : IPersistentStorageService
    {
        IPersistentStorage GetStorage(Solution solution, bool checkBranchId);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/tv_expense_list_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:textSize="25sp" />

    <TextView
        android:id="@+id/tv_expense_date"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_expense_list_title"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false" />

    <TextView
        android:id="@+id/tv_expense_list_category"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_expense_date"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false" />

    <TextView
        android:id="@+id/tv_expense_list_amount"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_expense_list_category"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false" />

    <TextView
        android:id="@+id/tv_expense_list_status"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_expense_list_amount"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:textColor="@color/error_color" />

    <TextView
        android:id="@+id/tv_expense_has_location"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tv_expense_list_status"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:textColor="@color/error_color" />

    <ImageView
        android:id="@+id/iv_expense_receipt"
        android:layout_width="130dp"
        android:layout_height="130dp"
        android:layout_alignParentEnd="true"
        android:scaleType="fitCenter"
        android:src="@drawable/image_button_hint" />

</RelativeLayout>


text:
;(function(){
    'use strict';
  angular.module('contactApp')
      .config(function($routeProvider){
          $routeProvider
              .when('/', {
                  templateUrl: 'views/create.html',
                  controller: 'ContactController'

              })
              .when('/:id', {
                  templateUrl: 'views/wish.html',
                  controller: 'ShowController',
                  controllerAs: 'show'
              })
              .otherwise({redirectTo: '/'});
      })
}());


text:
package com.robert.httphelper;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.w3c.dom.Document;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.robert.httphelper.sample.Student;

/**
 * <p>
 * Unit test with testng and mockito.
 * </p>
 *
 * @author Robert Lee
 * @version 1.0
 * @since Jul 15, 2015
 */

public class HttpHelperTest {

	@BeforeClass
	public void setUp() {
		// code that will be invoked when this test is instantiated
	}

	@Test(groups = { "primaryDataType" })
	public void intConverterTest() throws ClientProtocolException, IOException {

		HttpResponse httpResponse = mockResponse("1");

		int result = HttpHelper.IntConverter().handleResponse(httpResponse);

		Assert.assertEquals(result, 1);
	}

	@Test(groups = { "primaryDataType" })
	public void longConverterTest() throws ClientProtocolException, IOException {

		HttpResponse httpResponse = mockResponse("1");

		long result = HttpHelper.LongConverter().handleResponse(httpResponse);

		Assert.assertEquals(result, 1);
	}

	@Test(groups = { "primaryDataType" })
	public void floatConverterTest() throws ClientProtocolException,
			IOException {

		HttpResponse httpResponse = mockResponse("1.1");

		float result = HttpHelper.FloatConverter().handleResponse(httpResponse);

		Assert.assertEquals(result, 1.1f);
	}

	@Test(groups = { "primaryDataType" })
	public void doubleConverterTest() throws ClientProtocolException,
			IOException {

		HttpResponse httpResponse = mockResponse("1.11111");

		double result = HttpHelper.DoubleConverter().handleResponse(
				httpResponse);

		Assert.assertEquals(result, 1.11111d);
	}

	@Test(groups = { "primaryDataType" })
	public void bigDecimalConverterTest() throws ClientProtocolException,
			IOException {

		HttpResponse httpResponse = mockResponse("1.1111111111");

		BigDecimal result = HttpHelper.BitDecimalConverter().handleResponse(
				httpResponse);

		Assert.assertEquals(result, new BigDecimal("1.1111111111"));
	}

	@Test(groups = { "xml" })
	public void xml2DocumentConverterTest() throws ClientProtocolException,
			IOException {

		HttpResponse httpResponse = mockResponse("<test>test</test>");

		Document result = HttpHelper.Xml2DocumentConverter().handleResponse(
				httpResponse);

		Assert.assertEquals(result.getDocumentElement().getTextContent(),
				"test");
	}

	@Test(groups = { "json" })
	public void json2ObjectConverterTest() throws ClientProtocolException,
			IOException {

		HttpResponse httpResponse = mockResponse("{\"name\":\"robert\", \"years\":8}");

		JSONObject result = HttpHelper.Json2ObjectConverter().handleResponse(
				httpResponse);

		Assert.assertEquals(result.getString("name"), "robert");
		Assert.assertEquals(result.getIntValue("years"), 8);
	}

	@Test(groups = { "json" })
	public void json2BeanConverterTest() throws ClientProtocolException,
			IOException {
		Student student = new Student("robert", 8);
		HttpResponse httpResponse = mockResponse(JSON.toJSONString(student));

		Student result = HttpHelper.Json2BeanConverter(Student.class)
				.handleResponse(httpResponse);

		Assert.assertEquals(result, student);
	}

	@Test(groups = { "json" })
	public void json2BeansConverterTest() throws ClientProtocolException,
			IOException {
		List<Student> students = new ArrayList<Student>();
		students.add(new Student("robert", 8));
		students.add(new Student("robert", 8));
		HttpResponse httpResponse = mockResponse(JSON.toJSONString(students));

		List<Student> result = HttpHelper.Json2BeansConverter(Student.class)
				.handleResponse(httpResponse);

		Assert.assertEquals(result.size(), 2);
		Assert.assertEquals(result, students);
	}

	private HttpResponse mockResponse(String content) throws IOException {
		HttpResponse httpResponse = mock(HttpResponse.class);
		StatusLine statusLine = mock(StatusLine.class);
		HttpEntity httpEntity = mock(HttpEntity.class);

		when(httpResponse.getStatusLine()).thenReturn(statusLine);
		when(statusLine.getStatusCode()).thenReturn(200);

		when(httpResponse.getEntity()).thenReturn(httpEntity);
		when(httpEntity.getContent()).thenReturn(
				new ByteArrayInputStream(content.getBytes()));
		return httpResponse;
	}

}


text:
package com.github.epiicthundercat.tameablemobs.mobs;

import java.util.List;
import java.util.UUID;

import javax.annotation.Nullable;

import com.github.epiicthundercat.tameablemobs.init.TMItems;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;

import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.BlockPistonExtension;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityBodyHelper;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.IEntityOwnable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAITarget;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityShulkerBullet;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.pathfinding.Path;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.server.management.PreYggdrasilConverter;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.datafix.DataFixer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class TameableShulker extends EntityAnimal implements IEntityOwnable, IMob {

	private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager.<Float>createKey(TameableShulker.class,
			DataSerializers.FLOAT);
	private static final DataParameter<Boolean> BEGGING = EntityDataManager.<Boolean>createKey(TameableShulker.class,
			DataSerializers.BOOLEAN);
	protected static final DataParameter<Byte> TAMED = EntityDataManager.<Byte>createKey(TameableShulker.class,
			DataSerializers.BYTE);
	protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager
			.<Optional<UUID>>createKey(TameableShulker.class, DataSerializers.OPTIONAL_UNIQUE_ID);

	private static final UUID COVERED_ARMOR_BONUS_ID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
	private static final AttributeModifier COVERED_ARMOR_BONUS_MODIFIER = (new AttributeModifier(COVERED_ARMOR_BONUS_ID,
			"Covered armor bonus", 20.0D, 0)).setSaved(false);
	protected static final DataParameter<EnumFacing> ATTACHED_FACE = EntityDataManager
			.<EnumFacing>createKey(TameableShulker.class, DataSerializers.FACING);
	protected static final DataParameter<Optional<BlockPos>> ATTACHED_BLOCK_POS = EntityDataManager
			.<Optional<BlockPos>>createKey(TameableShulker.class, DataSerializers.OPTIONAL_BLOCK_POS);
	protected static final DataParameter<Byte> PEEK_TICK = EntityDataManager.<Byte>createKey(TameableShulker.class,
			DataSerializers.BYTE);

	protected EntityAISit aiSit;
	private float prevPeekAmount;
	private float peekAmount;
	private BlockPos currentAttachmentPosition;
	private int clientSideTeleportInterpolation;

	public TameableShulker(World worldIn) {
		super(worldIn);
		setTamed(false);
		setSize(1.0F, 1.0F);
		prevRenderYawOffset = 180.0F;
		renderYawOffset = 180.0F;
		isImmuneToFire = true;
		currentAttachmentPosition = null;
		experienceValue = 5;
	}

	@Override
	protected void initEntityAI() {

		tasks.addTask(4, new TameableShulker.AIAttack());
		tasks.addTask(7, new TameableShulker.AIPeek());
		tasks.addTask(8, new EntityAILookIdle(this));

		tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.ENDER_PEARL, false));
		tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
		aiSit = new TameableShulker.EntityAISit(this);
		tasks.addTask(1, aiSit);
		tasks.addTask(5, new EntityAIFollowOwner(this, 2.0D, 5.0F, 2.0F));

		tasks.addTask(6, new EntityAIMate(this, 1.0D));
		tasks.addTask(7, new EntityAIWander(this, 1.0D));
		tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
		tasks.addTask(8, new TameableShulker.EntityAIBeg(this, 8.0F));

		targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
		targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this));
		targetTasks.addTask(3, new TameableShulker.AIFindPlayer(this));
		targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0]));
		targetTasks.addTask(2, new TameableShulker.AIAttackNearest(this));
		targetTasks.addTask(3, new TameableShulker.AIDefenseAttack(this));

	}

	@Override
	protected void applyEntityAttributes() {
		super.applyEntityAttributes();
		getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
		if (isTamed()) {
			getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(16.0D);
			getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.4D);
			getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D);
		} else {
			getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0D);
			getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(1.0D);
			this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
		}

		getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(100.0D);
	}

	@Override
	protected void entityInit() {
		super.entityInit();
		dataManager.register(ATTACHED_FACE, EnumFacing.DOWN);
		dataManager.register(ATTACHED_BLOCK_POS, Optional.<BlockPos>absent());
		dataManager.register(PEEK_TICK, Byte.valueOf((byte) 0));
		dataManager.register(TAMED, Byte.valueOf((byte) 0));
		dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent());
		dataManager.register(DATA_HEALTH_ID, Float.valueOf(getHealth()));
		dataManager.register(BEGGING, Boolean.valueOf(false));

	}

	private boolean shouldAttackPlayer(EntityPlayer player) {
		return false;
	}

	@Override
	public void writeEntityToNBT(NBTTagCompound compound) {
		super.writeEntityToNBT(compound);
		compound.setByte("AttachFace", (byte) ((EnumFacing) this.dataManager.get(ATTACHED_FACE)).getIndex());
		compound.setByte("Peek", ((Byte) this.dataManager.get(PEEK_TICK)).byteValue());
		BlockPos blockpos = this.getAttachmentPos();

		if (blockpos != null) {
			compound.setInteger("APX", blockpos.getX());
			compound.setInteger("APY", blockpos.getY());
			compound.setInteger("APZ", blockpos.getZ());
		}
		if (getOwnerId() == null) {
			compound.setString("OwnerUUID", "");
		} else {
			compound.setString("OwnerUUID", getOwnerId().toString());
		}

		compound.setBoolean("Sitting", isSitting());
	}

	@Override
	public void readEntityFromNBT(NBTTagCompound compound) {
		super.readEntityFromNBT(compound);
		this.dataManager.set(ATTACHED_FACE, EnumFacing.getFront(compound.getByte("AttachFace")));
		this.dataManager.set(PEEK_TICK, Byte.valueOf(compound.getByte("Peek")));

		if (compound.hasKey("APX")) {
			int i = compound.getInteger("APX");
			int j = compound.getInteger("APY");
			int k = compound.getInteger("APZ");
			this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(new BlockPos(i, j, k)));
		} else {
			this.dataManager.set(ATTACHED_BLOCK_POS, Optional.<BlockPos>absent());
		}
		String s;

		if (compound.hasKey("OwnerUUID", 8)) {
			s = compound.getString("OwnerUUID");
		} else {
			String s1 = compound.getString("Owner");
			s = PreYggdrasilConverter.convertMobOwnerIfNeeded(getServer(), s1);
		}

		if (!s.isEmpty()) {
			try {
				setOwnerId(UUID.fromString(s));
				setTamed(true);
			} catch (Throwable var4) {
				setTamed(false);
			}
		}

		if (aiSit != null) {
			aiSit.setSitting(compound.getBoolean("Sitting"));
		}

		setSitting(compound.getBoolean("Sitting"));
	}

	@Override
	public boolean canBeLeashedTo(EntityPlayer player) {
		return isTamed() && isOwner(player);
	}

	public boolean isBreedingItem(@Nullable ItemStack stack) {
		return stack == null ? false : stack.getItem() == TMItems.nullified_ender_pearl;
	}

	@Override
	public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack) {

		if (isTamed()) {
			if (stack != null) {
				if (stack.getItem() == Items.ENDER_PEARL) {
					if (dataManager.get(DATA_HEALTH_ID).floatValue() < 60.0F) {
						if (!player.capabilities.isCreativeMode) {
							--stack.stackSize;
						}

						heal(20.0F);
						return true;
					}
				}
				if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(stack)) {
					this.aiSit.setSitting(!this.isSitting());
					this.isJumping = false;
					this.navigator.clearPathEntity();
					this.setAttackTarget((EntityLivingBase) null);
				}
			} else {
				if (isOwner(player) && !worldObj.isRemote) {
					aiSit.setSitting(!isSitting());
					isJumping = false;
					navigator.clearPathEntity();
					setAttackTarget((EntityLivingBase) null);
				}
			}
		} else if (stack != null && stack.getItem() == TMItems.ender_tamer) {
			if (!player.capabilities.isCreativeMode) {
				--stack.stackSize;
			}

			if (!worldObj.isRemote) {
				if (rand.nextInt(5) == 0) {
					setTamed(true);
					navigator.clearPathEntity();
					setAttackTarget((EntityLivingBase) null);
					// aiSit.setSitting(true);
					setHealth(60.0F);
					setOwnerId(player.getUniqueID());
					playTameEffect(true);
					worldObj.setEntityState(this, (byte) 7);
				} else {
					playTameEffect(false);
					worldObj.setEntityState(this, (byte) 6);
				}

			}

			return true;
		}

		return super.processInteract(player, hand, stack);
	}

	public boolean isTamed() {
		return (dataManager.get(TAMED).byteValue() & 4) != 0;
	}

	public void setTamed(boolean tamed) {
		byte b0 = dataManager.get(TAMED).byteValue();

		if (tamed) {
			dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 4)));
			getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D);
		} else {
			dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -5)));
			getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0D);
		}
		// getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(16.0D);

	}

	public boolean isSitting() {
		return (dataManager.get(TAMED).byteValue() & 1) != 0;
	}

	public void setSitting(boolean sitting) {
		byte b0 = dataManager.get(TAMED).byteValue();

		if (sitting) {
			dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 1)));
		} else {
			dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -2)));
		}
	}

	public boolean isBegging() {
		return ((Boolean) this.dataManager.get(BEGGING)).booleanValue();
	}

	public void setBegging(boolean beg) {
		this.dataManager.set(BEGGING, Boolean.valueOf(beg));
	}

	@Override
	public int getMaxSpawnedInChunk() {
		return 8;
	}

	public boolean canMateWith(EntityAnimal otherAnimal) {
		if (otherAnimal == this) {
			return false;
		} else if (!this.isTamed()) {
			return false;
		} else if (!(otherAnimal instanceof TameableShulker)) {
			return false;
		} else {
			TameableShulker entityTameableShulker = (TameableShulker) otherAnimal;
			return !entityTameableShulker.isTamed() ? false
					: (entityTameableShulker.isSitting() ? false : this.isInLove() && entityTameableShulker.isInLove());
		}
	}

	@Override
	@Nullable
	public UUID getOwnerId() {
		return (UUID) ((Optional) dataManager.get(OWNER_UNIQUE_ID)).orNull();
	}

	public void setOwnerId(@Nullable UUID p_184754_1_) {
		dataManager.set(OWNER_UNIQUE_ID, Optional.fromNullable(p_184754_1_));
	}

	@Override
	@Nullable
	public EntityLivingBase getOwner() {
		try {
			UUID uuid = getOwnerId();
			return uuid == null ? null : worldObj.getPlayerEntityByUUID(uuid);
		} catch (IllegalArgumentException var2) {
			return null;
		}
	}

	public boolean isOwner(EntityLivingBase entityIn) {
		return entityIn == getOwner();
	}

	public EntityAISit getAISit() {
		return aiSit;
	}

	protected void playTameEffect(boolean play) {
		EnumParticleTypes enumparticletypes = EnumParticleTypes.HEART;

		if (!play) {
			enumparticletypes = EnumParticleTypes.SMOKE_LARGE;
		}

		for (int i = 0; i < 7; ++i) {
			double d0 = rand.nextGaussian() * 0.02D;
			double d1 = rand.nextGaussian() * 0.02D;
			double d2 = rand.nextGaussian() * 0.02D;
			worldObj.spawnParticle(enumparticletypes, posX + rand.nextFloat() * width * 2.0F - width,
					posY + 0.5D + rand.nextFloat() * height, posZ + rand.nextFloat() * width * 2.0F - width, d0, d1, d2,
					new int[0]);
		}
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void handleStatusUpdate(byte id) {

		if (id == 7) {
			playTameEffect(true);
		} else if (id == 6) {
			playTameEffect(false);
		}
		super.handleStatusUpdate(id);

	}

	public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
		if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
			if (p_142018_1_ instanceof TameableShulker) {
				TameableShulker entityChicken = (TameableShulker) p_142018_1_;

				if (entityChicken.isTamed() && entityChicken.getOwner() == p_142018_2_) {
					return false;
				}
			}

			return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer
					&& !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false
							: !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
		} else {
			return false;
		}
	}

	static class EntityAIBeg extends EntityAIBase {
		private final TameableShulker theBat;
		private EntityPlayer thePlayer;
		private final World worldObject;
		private final float minPlayerDistance;
		private int timeoutCounter;

		public EntityAIBeg(TameableShulker blaze, float minDistance) {
			theBat = blaze;
			worldObject = blaze.worldObj;
			minPlayerDistance = minDistance;
			setMutexBits(2);
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		@Override
		public boolean shouldExecute() {

			thePlayer = worldObject.getClosestPlayerToEntity(theBat, (double) minPlayerDistance);
			return thePlayer == null ? false : hasPlayerGotNullifiedEnderPearlInHand(this.thePlayer);
		}

		/**
		 * Returns whether an in-progress EntityAIBase should continue executing
		 */
		@Override
		public boolean continueExecuting() {

			return !thePlayer.isEntityAlive() ? false
					: (theBat.getDistanceSqToEntity(thePlayer) > (double) (minPlayerDistance * minPlayerDistance)
							? false : timeoutCounter > 0 && hasPlayerGotNullifiedEnderPearlInHand(thePlayer));
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		@Override
		public void startExecuting() {

			theBat.setBegging(true);
			timeoutCounter = 40 + theBat.getRNG().nextInt(40);
		}

		/**
		 * Resets the task
		 */
		@Override
		public void resetTask() {

			theBat.setBegging(false);
			thePlayer = null;
		}

		/**
		 * Updates the task
		 */
		@Override
		public void updateTask() {
			theBat.getLookHelper().setLookPosition(thePlayer.posX, thePlayer.posY + (double) thePlayer.getEyeHeight(),
					thePlayer.posZ, 10.0F, (float) theBat.getVerticalFaceSpeed());
			--timeoutCounter;
		}

		/**
		 * Gets if the Player has the NullifiedEnderPearl in the hand.
		 */
		private boolean hasPlayerGotNullifiedEnderPearlInHand(EntityPlayer player) {
			for (EnumHand enumhand : EnumHand.values()) {
				ItemStack itemstack = player.getHeldItem(enumhand);

				if (itemstack != null) {
					if (theBat.isTamed() && itemstack.getItem() == TMItems.nullified_ender_pearl) {
						return true;
					}

					if (theBat.isBreedingItem(itemstack)) {
						return true;
					}
				}
			}

			return false;
		}
	}

	static class EntityAISit extends EntityAIBase {
		private final TameableShulker theEntity;

		/** If the EntityTameable is sitting. */

		private boolean isSitting;

		public EntityAISit(TameableShulker entityIn) {
			theEntity = entityIn;
			setMutexBits(5);
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		@Override
		public boolean shouldExecute() {
			if (!theEntity.isTamed()) {
				return false;
			} else if (theEntity.isInWater()) {
				return false;
			} else if (!theEntity.onGround) {
				return false;
			} else {
				EntityLivingBase entitylivingbase = theEntity.getOwner();
				return entitylivingbase == null ? true
						: (theEntity.getDistanceSqToEntity(entitylivingbase) < 144.0D
								&& entitylivingbase.getAITarget() != null ? false : isSitting);
			}
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		@Override
		public void startExecuting() {
			theEntity.getNavigator().clearPathEntity();
			theEntity.setSitting(true);
		}

		/**
		 * Resets the task
		 */
		@Override
		public void resetTask() {
			theEntity.setSitting(false);
		}

		/**
		 * Sets the sitting flag.
		 */
		public void setSitting(boolean sitting) {
			isSitting = sitting;
		}
	}

	@Override
	public TameableShulker createChild(EntityAgeable ageable) {
		TameableShulker entityTameableShulker = new TameableShulker(this.worldObj);
		UUID uuid = this.getOwnerId();

		if (uuid != null) {
			entityTameableShulker.setOwnerId(uuid);
			entityTameableShulker.setTamed(true);
		}

		return entityTameableShulker;
	}

	static class EntityAIFollowOwner extends EntityAIBase {
		private final TameableShulker thePet;
		private EntityLivingBase theOwner;
		World theWorld;
		private final double followSpeed;
		private final PathNavigate petPathfinder;
		private int timeToRecalcPath;
		float maxDist;
		float minDist;
		private float oldWaterCost;

		public EntityAIFollowOwner(TameableShulker thePetIn, double followSpeedIn, float minDistIn, float maxDistIn) {
			thePet = thePetIn;
			theWorld = thePetIn.worldObj;
			followSpeed = followSpeedIn;
			petPathfinder = thePetIn.getNavigator();
			minDist = minDistIn;
			maxDist = maxDistIn;
			setMutexBits(3);

			if (!(thePetIn.getNavigator() instanceof PathNavigateGround)) {
				throw new IllegalArgumentException("Unsupported mob type for FollowOwnerGoal");
			}
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		@Override
		public boolean shouldExecute() {
			EntityLivingBase entitylivingbase = thePet.getOwner();

			if (entitylivingbase == null) {
				return false;
			} else if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer) entitylivingbase).isSpectator()) {
				return false;
			} else if (thePet.isSitting()) {
				return false;
			} else if (thePet.getDistanceSqToEntity(entitylivingbase) < minDist * minDist) {
				return false;
			} else {
				theOwner = entitylivingbase;
				return true;
			}
		}

		/**
		 * Returns whether an in-progress EntityAIBase should continue executing
		 */
		@Override
		public boolean continueExecuting() {
			return !petPathfinder.noPath() && thePet.getDistanceSqToEntity(theOwner) > maxDist * maxDist
					&& !thePet.isSitting();
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		@Override
		public void startExecuting() {
			timeToRecalcPath = 0;
			oldWaterCost = thePet.getPathPriority(PathNodeType.WATER);
			thePet.setPathPriority(PathNodeType.WATER, 0.0F);
		}

		/**
		 * Resets the task
		 */
		@Override
		public void resetTask() {
			theOwner = null;
			petPathfinder.clearPathEntity();
			thePet.setPathPriority(PathNodeType.WATER, oldWaterCost);
		}

		private boolean isEmptyBlock(BlockPos pos) {
			IBlockState iblockstate = theWorld.getBlockState(pos);
			return iblockstate.getMaterial() == Material.AIR ? true : !iblockstate.isFullCube();
		}

		/**
		 * Updates the task
		 */
		@Override
		public void updateTask() {
			thePet.getLookHelper().setLookPositionWithEntity(theOwner, 10.0F, thePet.getVerticalFaceSpeed());

			if (!thePet.isSitting()) {
				if (--timeToRecalcPath <= 0) {
					timeToRecalcPath = 20;

					if (!petPathfinder.tryMoveToEntityLiving(theOwner, followSpeed)) {
						if (!thePet.getLeashed()) {
							if (thePet.getDistanceSqToEntity(theOwner) >= 200.0D) {
								int i = MathHelper.floor_double(theOwner.posX) - 2;
								int j = MathHelper.floor_double(theOwner.posZ) - 2;
								int k = MathHelper.floor_double(theOwner.getEntityBoundingBox().minY);

								for (int l = 0; l <= 4; ++l) {
									for (int i1 = 0; i1 <= 4; ++i1) {
										if ((l < 1 || i1 < 1 || l > 3 || i1 > 3)
												&& theWorld.getBlockState(new BlockPos(i + l, k - 1, j + i1))
														.isFullyOpaque()
												&& isEmptyBlock(new BlockPos(i + l, k, j + i1))
												&& isEmptyBlock(new BlockPos(i + l, k + 1, j + i1))) {
											thePet.setLocationAndAngles(i + l + 0.5F, k, j + i1 + 0.5F,
													thePet.rotationYaw, thePet.rotationPitch);
											petPathfinder.clearPathEntity();
											return;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

	static class EntityAIOwnerHurtByTarget extends EntityAITarget {
		TameableShulker theDefendingTameable;
		EntityLivingBase theOwnerAttacker;
		private int timestamp;

		public EntityAIOwnerHurtByTarget(TameableShulker theDefendingTameableIn) {
			super(theDefendingTameableIn, false);
			theDefendingTameable = theDefendingTameableIn;
			setMutexBits(1);
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		@Override
		public boolean shouldExecute() {
			if (!theDefendingTameable.isTamed()) {
				return false;
			} else {
				EntityLivingBase entitylivingbase = theDefendingTameable.getOwner();

				if (entitylivingbase == null) {
					return false;
				} else {
					theOwnerAttacker = entitylivingbase.getAITarget();
					int i = entitylivingbase.getRevengeTimer();
					return i != timestamp && this.isSuitableTarget(theOwnerAttacker, false)
							&& theDefendingTameable.shouldAttackEntity(theOwnerAttacker, entitylivingbase);
				}
			}
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		@Override
		public void startExecuting() {
			taskOwner.setAttackTarget(theOwnerAttacker);
			EntityLivingBase entitylivingbase = theDefendingTameable.getOwner();

			if (entitylivingbase != null) {
				timestamp = entitylivingbase.getRevengeTimer();
			}

			super.startExecuting();
		}
	}

	static class AIFindPlayer extends EntityAINearestAttackableTarget<EntityPlayer> {
		private final TameableShulker TameableShulker;
		private EntityPlayer player;
		private int aggroTime;
		private int teleportTime;

		public AIFindPlayer(TameableShulker p_i45842_1_) {
			super(p_i45842_1_, EntityPlayer.class, false);
			TameableShulker = p_i45842_1_;
		}

		@Override
		public boolean shouldExecute() {
			double d0 = getTargetDistance();
			player = TameableShulker.worldObj.getNearestAttackablePlayer(TameableShulker.posX, TameableShulker.posY,
					TameableShulker.posZ, d0, d0, (Function) null,
					(@Nullable EntityPlayer player) -> (player != null) && (TameableShulker.shouldAttackPlayer(player)));
			return player != null;
		}

		@Override
		public void startExecuting() {
			aggroTime = 5;
			teleportTime = 0;
		}

		@Override
		public void resetTask() {
			player = null;
			super.resetTask();
		}

		@Override
		public boolean continueExecuting() {
			if (player != null) {
				if (!TameableShulker.shouldAttackPlayer(player)) {
					return false;
				}
				TameableShulker.faceEntity(player, 10.0F, 10.0F);
				return true;
			}
			return (targetEntity != null) && (targetEntity.isEntityAlive()) ? true : super.continueExecuting();
		}

		@Override
		public void updateTask() {
			if (player != null) {
				if (--aggroTime <= 0) {
					targetEntity = player;
					player = null;
					super.startExecuting();
				}
			} else {
				if (targetEntity != null) {
					if (TameableShulker.shouldAttackPlayer(targetEntity)) {
						if (targetEntity.getDistanceSqToEntity(TameableShulker) < 16.0D) {
						}
						teleportTime = 0;
					} else if ((targetEntity.getDistanceSqToEntity(TameableShulker) > 256.0D) && (teleportTime++ >= 30)
							&& (TameableShulker.teleportToEntity(targetEntity))) {
						teleportTime = 0;
					}
				}
				super.updateTask();
			}
		}
	}

	protected boolean teleportToEntity(Entity p_70816_1_) {
		Vec3d vec3d = new Vec3d(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY
				+ (double) (this.height / 2.0F) - p_70816_1_.posY + (double) p_70816_1_.getEyeHeight(),
				this.posZ - p_70816_1_.posZ);
		vec3d = vec3d.normalize();
		double d0 = 16.0D;
		double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.xCoord * 16.0D;
		double d2 = this.posY + (double) (this.rand.nextInt(16) - 8) - vec3d.yCoord * 16.0D;
		double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.zCoord * 16.0D;
		return this.teleportTo(d1, d2, d3);
	}

	private boolean teleportTo(double x, double y, double z) {
		net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(
				this, x, y, z, 0);
		if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
			return false;
		boolean flag = this.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ());

		if (flag) {
			this.worldObj.playSound((EntityPlayer) null, this.prevPosX, this.prevPosY, this.prevPosZ,
					SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F);
			this.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
		}

		return flag;
	}

	public boolean attackEntityAsMob(Entity entityIn) {
		boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this),
				(float) ((int) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()));

		if (flag) {
			this.applyEnchantments(this, entityIn);
		}

		return flag;
	}

	static class AIMeleeAttack extends EntityAIAttackMelee {

		World worldObj;
		protected EntityCreature attacker;
		/**
		 * An amount of decrementing ticks that allows the entity to attack once
		 * the tick reaches 0.
		 */
		protected int attackTick;
		/** The speed with which the mob will approach the target */
		double speedTowardsTarget;
		/**
		 * When true, the mob will continue chasing its target, even if it can't
		 * find a path to them right now.
		 */
		boolean longMemory;
		/** The PathEntity of our entity. */
		Path entityPathEntity;
		private int delayCounter;
		private double targetX;
		private double targetY;
		private double targetZ;
		protected final int attackInterval = 20;
		private int failedPathFindingPenalty = 0;
		private boolean canPenalize = false;

		public AIMeleeAttack(EntityCreature creature, double speedIn, boolean useLongMemory) {
			super(creature, speedIn, useLongMemory);
			this.attacker = creature;
			this.worldObj = creature.worldObj;
			this.speedTowardsTarget = speedIn;
			this.longMemory = useLongMemory;
			this.setMutexBits(3);

		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		public boolean shouldExecute() {
			EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();

			if (entitylivingbase == null) {
				return false;
			} else if (!entitylivingbase.isEntityAlive()) {
				return false;
			} else {
				if (canPenalize) {
					if (--this.delayCounter <= 0) {
						this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
						this.delayCounter = 4 + this.attacker.getRNG().nextInt(7);
						return this.entityPathEntity != null;
					} else {
						return true;
					}
				}
				this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
				return this.entityPathEntity != null;
			}
		}

		/**
		 * Returns whether an in-progress EntityAIBase should continue executing
		 */
		public boolean continueExecuting() {
			EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
			return entitylivingbase == null ? false
					: (!entitylivingbase.isEntityAlive() ? false
							: (!this.longMemory ? !this.attacker.getNavigator().noPath()
									: (!this.attacker.isWithinHomeDistanceFromPosition(new BlockPos(entitylivingbase))
											? false
											: !(entitylivingbase instanceof EntityPlayer)
													|| !((EntityPlayer) entitylivingbase).isSpectator()
															&& !((EntityPlayer) entitylivingbase).isCreative())));
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		public void startExecuting() {
			this.attacker.getNavigator().setPath(this.entityPathEntity, this.speedTowardsTarget);
			this.delayCounter = 0;
		}

		/**
		 * Resets the task
		 */
		public void resetTask() {
			EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();

			if (entitylivingbase instanceof EntityPlayer && (((EntityPlayer) entitylivingbase).isSpectator()
					|| ((EntityPlayer) entitylivingbase).isCreative())) {
				this.attacker.setAttackTarget((EntityLivingBase) null);
			}

			this.attacker.getNavigator().clearPathEntity();
		}

		/**
		 * Updates the task
		 */
		public void updateTask() {
			EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
			this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F);
			double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.getEntityBoundingBox().minY,
					entitylivingbase.posZ);
			--this.delayCounter;

			if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) && this.delayCounter <= 0
					&& (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D
							|| entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D
							|| this.attacker.getRNG().nextFloat() < 0.05F)) {
				this.targetX = entitylivingbase.posX;
				this.targetY = entitylivingbase.getEntityBoundingBox().minY;
				this.targetZ = entitylivingbase.posZ;
				this.delayCounter = 4 + this.attacker.getRNG().nextInt(7);

				if (this.canPenalize) {
					this.delayCounter += failedPathFindingPenalty;
					if (this.attacker.getNavigator().getPath() != null) {
						net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath()
								.getFinalPathPoint();
						if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord,
								finalPathPoint.yCoord, finalPathPoint.zCoord) < 1)
							failedPathFindingPenalty = 0;
						else
							failedPathFindingPenalty += 10;
					} else {
						failedPathFindingPenalty += 10;
					}
				}

				if (d0 > 1024.0D) {
					this.delayCounter += 10;
				} else if (d0 > 256.0D) {
					this.delayCounter += 5;
				}

				if (!this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) {
					this.delayCounter += 15;
				}
			}

			this.attackTick = Math.max(this.attackTick - 1, 0);
			this.checkAndPerformAttack(entitylivingbase, d0);
		}

		protected void checkAndPerformAttack(EntityLivingBase p_190102_1_, double p_190102_2_) {
			double d0 = this.getAttackReachSqr(p_190102_1_);

			if (p_190102_2_ <= d0 && this.attackTick <= 0) {
				this.attackTick = 20;
				this.attacker.swingArm(EnumHand.MAIN_HAND);
				this.attacker.attackEntityAsMob(p_190102_1_);
			}
		}

		protected double getAttackReachSqr(EntityLivingBase attackTarget) {
			return (double) (this.attacker.width * 2.0F * this.attacker.width * 2.0F + attackTarget.width);
		}

	}

	/**
	 * Called only once on an entity when first time spawned, via egg, mob
	 * spawner, natural spawning etc, but not called when entity is reloaded
	 * from nbt. Mainly used for initializing attributes and inventory
	 */
	@Nullable
	public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
		this.renderYawOffset = 180.0F;
		this.prevRenderYawOffset = 180.0F;
		this.rotationYaw = 180.0F;
		this.prevRotationYaw = 180.0F;
		this.rotationYawHead = 180.0F;
		this.prevRotationYawHead = 180.0F;
		return super.onInitialSpawn(difficulty, livingdata);
	}

	/**
	 * returns if this entity triggers Block.onEntityWalking on the blocks they
	 * walk on. used for spiders and wolves to prevent them from trampling crops
	 */
	protected boolean canTriggerWalking() {
		return false;
	}

	public SoundCategory getSoundCategory() {
		return SoundCategory.HOSTILE;
	}

	protected SoundEvent getAmbientSound() {
		return SoundEvents.ENTITY_SHULKER_AMBIENT;
	}

	/**
	 * Plays living's sound at its position
	 */
	public void playLivingSound() {
		if (!this.isClosed()) {
			super.playLivingSound();
		}
	}

	protected SoundEvent getDeathSound() {
		return SoundEvents.ENTITY_SHULKER_DEATH;
	}

	protected SoundEvent getHurtSound() {
		return this.isClosed() ? SoundEvents.ENTITY_SHULKER_HURT_CLOSED : SoundEvents.ENTITY_SHULKER_HURT;
	}

	protected EntityBodyHelper createBodyHelper() {
		return new TameableShulker.BodyHelper(this);
	}

	public static void registerFixesTameableShulker(DataFixer fixer) {
		EntityLiving.registerFixesMob(fixer, "TameableShulker");
	}

	/**
	 * Called to update the entity's position/logic.
	 */
	public void onUpdate() {
		super.onUpdate();
		BlockPos blockpos = (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull();

		if (blockpos == null && !this.worldObj.isRemote) {
			blockpos = new BlockPos(this);
			this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos));
		}

		if (this.isRiding()) {
			blockpos = null;
			float f = this.getRidingEntity().rotationYaw;
			this.rotationYaw = f;
			this.renderYawOffset = f;
			this.prevRenderYawOffset = f;
			this.clientSideTeleportInterpolation = 0;
		} else if (!this.worldObj.isRemote) {
			IBlockState iblockstate = this.worldObj.getBlockState(blockpos);

			if (iblockstate.getMaterial() != Material.AIR) {
				if (iblockstate.getBlock() == Blocks.PISTON_EXTENSION) {
					EnumFacing enumfacing = (EnumFacing) iblockstate.getValue(BlockPistonBase.FACING);
					blockpos = blockpos.offset(enumfacing);
					this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos));
				} else if (iblockstate.getBlock() == Blocks.PISTON_HEAD) {
					EnumFacing enumfacing3 = (EnumFacing) iblockstate.getValue(BlockPistonExtension.FACING);
					blockpos = blockpos.offset(enumfacing3);
					this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos));
				} else {
					this.tryTeleportToNewPosition();
				}
			}

			BlockPos blockpos1 = blockpos.offset(this.getAttachmentFacing());

			if (!this.worldObj.isBlockNormalCube(blockpos1, false)) {
				boolean flag = false;

				for (EnumFacing enumfacing1 : EnumFacing.values()) {
					blockpos1 = blockpos.offset(enumfacing1);

					if (this.worldObj.isBlockNormalCube(blockpos1, false)) {
						this.dataManager.set(ATTACHED_FACE, enumfacing1);
						flag = true;
						break;
					}
				}

				if (!flag) {
					this.tryTeleportToNewPosition();
				}
			}

			BlockPos blockpos2 = blockpos.offset(this.getAttachmentFacing().getOpposite());

			if (this.worldObj.isBlockNormalCube(blockpos2, false)) {
				this.tryTeleportToNewPosition();
			}
		}

		float f1 = (float) this.getPeekTick() * 0.01F;
		this.prevPeekAmount = this.peekAmount;

		if (this.peekAmount > f1) {
			this.peekAmount = MathHelper.clamp_float(this.peekAmount - 0.05F, f1, 1.0F);
		} else if (this.peekAmount < f1) {
			this.peekAmount = MathHelper.clamp_float(this.peekAmount + 0.05F, 0.0F, f1);
		}

		if (blockpos != null) {
			if (this.worldObj.isRemote) {
				if (this.clientSideTeleportInterpolation > 0 && this.currentAttachmentPosition != null) {
					--this.clientSideTeleportInterpolation;
				} else {
					this.currentAttachmentPosition = blockpos;
				}
			}

			this.posX = (double) blockpos.getX() + 0.5D;
			this.posY = (double) blockpos.getY();
			this.posZ = (double) blockpos.getZ() + 0.5D;
			this.prevPosX = this.posX;
			this.prevPosY = this.posY;
			this.prevPosZ = this.posZ;
			this.lastTickPosX = this.posX;
			this.lastTickPosY = this.posY;
			this.lastTickPosZ = this.posZ;
			double d3 = 0.5D - (double) MathHelper.sin((0.5F + this.peekAmount) * (float) Math.PI) * 0.5D;
			double d4 = 0.5D - (double) MathHelper.sin((0.5F + this.prevPeekAmount) * (float) Math.PI) * 0.5D;
			double d5 = d3 - d4;
			double d0 = 0.0D;
			double d1 = 0.0D;
			double d2 = 0.0D;
			EnumFacing enumfacing2 = this.getAttachmentFacing();

			switch (enumfacing2) {
			case DOWN:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D,
						this.posX + 0.5D, this.posY + 1.0D + d3, this.posZ + 0.5D));
				d1 = d5;
				break;
			case UP:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY - d3, this.posZ - 0.5D,
						this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D));
				d1 = -d5;
				break;
			case NORTH:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D,
						this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D + d3));
				d2 = d5;
				break;
			case SOUTH:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D - d3,
						this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D));
				d2 = -d5;
				break;
			case WEST:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D, this.posY, this.posZ - 0.5D,
						this.posX + 0.5D + d3, this.posY + 1.0D, this.posZ + 0.5D));
				d0 = d5;
				break;
			case EAST:
				this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.5D - d3, this.posY, this.posZ - 0.5D,
						this.posX + 0.5D, this.posY + 1.0D, this.posZ + 0.5D));
				d0 = -d5;
			}

			if (d5 > 0.0D) {
				List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,
						this.getEntityBoundingBox());

				if (!list.isEmpty()) {
					for (Entity entity : list) {
						if (!(entity instanceof TameableShulker) && !entity.noClip) {
							entity.moveEntity(d0, d1, d2);
						}
					}
				}
			}
		}
	}

	/**
	 * Sets the x,y,z of the entity from the given parameters. Also seems to set
	 * up a bounding box.
	 */
	public void setPosition(double x, double y, double z) {
		super.setPosition(x, y, z);

		if (this.dataManager != null && this.ticksExisted != 0) {
			Optional<BlockPos> optional = (Optional) this.dataManager.get(ATTACHED_BLOCK_POS);
			Optional<BlockPos> optional1 = Optional.<BlockPos>of(new BlockPos(x, y, z));

			if (!optional1.equals(optional)) {
				this.dataManager.set(ATTACHED_BLOCK_POS, optional1);
				this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0));
				this.isAirBorne = true;
			}
		}
	}

	protected boolean tryTeleportToNewPosition() {
		if (!this.isAIDisabled() && this.isEntityAlive()) {
			BlockPos blockpos = new BlockPos(this);

			for (int i = 0; i < 5; ++i) {
				BlockPos blockpos1 = blockpos.add(8 - this.rand.nextInt(17), 8 - this.rand.nextInt(17),
						8 - this.rand.nextInt(17));

				if (blockpos1.getY() > 0 && this.worldObj.isAirBlock(blockpos1)
						&& this.worldObj.isInsideBorder(this.worldObj.getWorldBorder(), this)
						&& this.worldObj.getCollisionBoxes(this, new AxisAlignedBB(blockpos1)).isEmpty()) {
					boolean flag = false;

					for (EnumFacing enumfacing : EnumFacing.values()) {
						if (this.worldObj.isBlockNormalCube(blockpos1.offset(enumfacing), false)) {
							this.dataManager.set(ATTACHED_FACE, enumfacing);
							flag = true;
							break;
						}
					}

					if (flag) {
						net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(
								this, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ(), 0);
						if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
							flag = false;
						blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
					}

					if (flag) {
						this.playSound(SoundEvents.ENTITY_SHULKER_TELEPORT, 1.0F, 1.0F);
						this.dataManager.set(ATTACHED_BLOCK_POS, Optional.of(blockpos1));
						this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) 0));
						this.setAttackTarget((EntityLivingBase) null);
						return true;
					}
				}
			}

			return false;
		} else {
			return true;
		}
	}

	/**
	 * Called frequently so the entity can update its state every tick as
	 * required. For example, zombies and skeletons use this to react to
	 * sunlight and start to burn.
	 */
	public void onLivingUpdate() {
		super.onLivingUpdate();
		this.motionX = 0.0D;
		this.motionY = 0.0D;
		this.motionZ = 0.0D;
		this.prevRenderYawOffset = 180.0F;
		this.renderYawOffset = 180.0F;
		this.rotationYaw = 180.0F;
	}

	public void notifyDataManagerChange(DataParameter<?> key) {
		if (ATTACHED_BLOCK_POS.equals(key) && this.worldObj.isRemote && !this.isRiding()) {
			BlockPos blockpos = this.getAttachmentPos();

			if (blockpos != null) {
				if (this.currentAttachmentPosition == null) {
					this.currentAttachmentPosition = blockpos;
				} else {
					this.clientSideTeleportInterpolation = 6;
				}

				this.posX = (double) blockpos.getX() + 0.5D;
				this.posY = (double) blockpos.getY();
				this.posZ = (double) blockpos.getZ() + 0.5D;
				this.prevPosX = this.posX;
				this.prevPosY = this.posY;
				this.prevPosZ = this.posZ;
				this.lastTickPosX = this.posX;
				this.lastTickPosY = this.posY;
				this.lastTickPosZ = this.posZ;
			}
		}

		super.notifyDataManagerChange(key);
	}

	/**
	 * Set the position and rotation values directly without any clamping.
	 */
	@SideOnly(Side.CLIENT)
	public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch,
			int posRotationIncrements, boolean teleport) {
		this.newPosRotationIncrements = 0;
	}

	/**
	 * Called when the entity is attacked.
	 */
	public boolean attackEntityFrom(DamageSource source, float amount) {
		if (this.isClosed()) {
			Entity entity = source.getSourceOfDamage();

			if (entity instanceof EntityArrow) {
				return false;
			}
		}

		if (super.attackEntityFrom(source, amount)) {
			if ((double) this.getHealth() < (double) this.getMaxHealth() * 0.5D && this.rand.nextInt(4) == 0) {
				this.tryTeleportToNewPosition();
			}

			return true;
		} else {
			return false;
		}
	}

	private boolean isClosed() {
		return this.getPeekTick() == 0;
	}

	/**
	 * Returns the collision bounding box for this entity
	 */
	@Nullable
	public AxisAlignedBB getCollisionBoundingBox() {
		return this.isEntityAlive() ? this.getEntityBoundingBox() : null;
	}

	public EnumFacing getAttachmentFacing() {
		return (EnumFacing) this.dataManager.get(ATTACHED_FACE);
	}

	@Nullable
	public BlockPos getAttachmentPos() {
		return (BlockPos) ((Optional) this.dataManager.get(ATTACHED_BLOCK_POS)).orNull();
	}

	public void setAttachmentPos(@Nullable BlockPos pos) {
		this.dataManager.set(ATTACHED_BLOCK_POS, Optional.fromNullable(pos));
	}

	public int getPeekTick() {
		return ((Byte) this.dataManager.get(PEEK_TICK)).byteValue();
	}

	/**
	 * Applies or removes armor modifier
	 */
	public void updateArmorModifier(int p_184691_1_) {
		if (!this.worldObj.isRemote) {
			this.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(COVERED_ARMOR_BONUS_MODIFIER);

			if (p_184691_1_ == 0) {
				this.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier(COVERED_ARMOR_BONUS_MODIFIER);
				this.playSound(SoundEvents.ENTITY_SHULKER_CLOSE, 1.0F, 1.0F);
			} else {
				this.playSound(SoundEvents.ENTITY_SHULKER_OPEN, 1.0F, 1.0F);
			}
		}

		this.dataManager.set(PEEK_TICK, Byte.valueOf((byte) p_184691_1_));
	}

	@SideOnly(Side.CLIENT)
	public float getClientPeekAmount(float p_184688_1_) {
		return this.prevPeekAmount + (this.peekAmount - this.prevPeekAmount) * p_184688_1_;
	}

	@SideOnly(Side.CLIENT)
	public int getClientTeleportInterp() {
		return this.clientSideTeleportInterpolation;
	}

	@SideOnly(Side.CLIENT)
	public BlockPos getOldAttachPos() {
		return this.currentAttachmentPosition;
	}

	public float getEyeHeight() {
		return 0.5F;
	}

	/**
	 * The speed it takes to move the entityliving's rotationPitch through the
	 * faceEntity method. This is only currently use in wolves.
	 */
	public int getVerticalFaceSpeed() {
		return 180;
	}

	public int getHorizontalFaceSpeed() {
		return 180;
	}

	/**
	 * Applies a velocity to the entities, to push them away from eachother.
	 */
	public void applyEntityCollision(Entity entityIn) {
	}

	public float getCollisionBorderSize() {
		return 0.0F;
	}

	@SideOnly(Side.CLIENT)
	public boolean isAttachedToBlock() {
		return this.currentAttachmentPosition != null && this.getAttachmentPos() != null;
	}

	@Nullable
	protected ResourceLocation getLootTable() {
		return LootTableList.ENTITIES_SHULKER;
	}

	class AIAttack extends EntityAIBase {
		private int attackTime;

		public AIAttack() {
			this.setMutexBits(3);
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		public boolean shouldExecute() {
			EntityLivingBase entitylivingbase = TameableShulker.this.getAttackTarget();
			return entitylivingbase != null && entitylivingbase.isEntityAlive()
					? TameableShulker.this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL : false;
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		public void startExecuting() {
			this.attackTime = 20;
			TameableShulker.this.updateArmorModifier(100);
		}

		/**
		 * Resets the task
		 */
		public void resetTask() {
			TameableShulker.this.updateArmorModifier(0);
		}

		/**
		 * Updates the task
		 */
		public void updateTask() {
			if (TameableShulker.this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL) {
				--this.attackTime;
				EntityLivingBase entitylivingbase = TameableShulker.this.getAttackTarget();
				TameableShulker.this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 180.0F, 180.0F);
				double d0 = TameableShulker.this.getDistanceSqToEntity(entitylivingbase);

				if (d0 < 400.0D) {
					if (this.attackTime <= 0) {
						this.attackTime = 20 + TameableShulker.this.rand.nextInt(10) * 20 / 2;
						EntityShulkerBullet EntityShulkerBullet = new EntityShulkerBullet(
								TameableShulker.this.worldObj, TameableShulker.this, entitylivingbase,
								TameableShulker.this.getAttachmentFacing().getAxis());
						TameableShulker.this.worldObj.spawnEntityInWorld(EntityShulkerBullet);
						TameableShulker.this.playSound(SoundEvents.ENTITY_SHULKER_SHOOT, 2.0F,
								(TameableShulker.this.rand.nextFloat() - TameableShulker.this.rand.nextFloat()) * 0.2F
										+ 1.0F);
					}
				} else {
					TameableShulker.this.setAttackTarget((EntityLivingBase) null);
				}

				super.updateTask();
			}
		}
	}

	class AIAttackNearest extends EntityAINearestAttackableTarget<EntityPlayer> {
		public AIAttackNearest(TameableShulker shulker) {
			super(shulker, EntityPlayer.class, true);
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		public boolean shouldExecute() {
			return TameableShulker.this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL ? false
					: super.shouldExecute();
		}

		protected AxisAlignedBB getTargetableArea(double targetDistance) {
			EnumFacing enumfacing = ((TameableShulker) this.taskOwner).getAttachmentFacing();
			return enumfacing.getAxis() == EnumFacing.Axis.X
					? this.taskOwner.getEntityBoundingBox().expand(4.0D, targetDistance, targetDistance)
					: (enumfacing.getAxis() == EnumFacing.Axis.Z
							? this.taskOwner.getEntityBoundingBox().expand(targetDistance, targetDistance, 4.0D)
							: this.taskOwner.getEntityBoundingBox().expand(targetDistance, 4.0D, targetDistance));
		}
	}

	static class AIDefenseAttack extends EntityAINearestAttackableTarget<EntityLivingBase> {
		public AIDefenseAttack(TameableShulker shulker) {
			super(shulker, EntityLivingBase.class, 10, true, false, new Predicate<EntityLivingBase>() {
				public boolean apply(@Nullable EntityLivingBase p_apply_1_) {
					return p_apply_1_ instanceof IMob;
				}
			});
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		public boolean shouldExecute() {
			return this.taskOwner.getTeam() == null ? false : super.shouldExecute();
		}

		protected AxisAlignedBB getTargetableArea(double targetDistance) {
			EnumFacing enumfacing = ((TameableShulker) this.taskOwner).getAttachmentFacing();
			return enumfacing.getAxis() == EnumFacing.Axis.X
					? this.taskOwner.getEntityBoundingBox().expand(4.0D, targetDistance, targetDistance)
					: (enumfacing.getAxis() == EnumFacing.Axis.Z
							? this.taskOwner.getEntityBoundingBox().expand(targetDistance, targetDistance, 4.0D)
							: this.taskOwner.getEntityBoundingBox().expand(targetDistance, 4.0D, targetDistance));
		}
	}

	class AIPeek extends EntityAIBase {
		private int peekTime;

		private AIPeek() {
		}

		/**
		 * Returns whether the EntityAIBase should begin execution.
		 */
		public boolean shouldExecute() {
			return TameableShulker.this.getAttackTarget() == null && TameableShulker.this.rand.nextInt(40) == 0;
		}

		/**
		 * Returns whether an in-progress EntityAIBase should continue executing
		 */
		public boolean continueExecuting() {
			return TameableShulker.this.getAttackTarget() == null && this.peekTime > 0;
		}

		/**
		 * Execute a one shot task or start executing a continuous task
		 */
		public void startExecuting() {
			this.peekTime = 20 * (1 + TameableShulker.this.rand.nextInt(3));
			TameableShulker.this.updateArmorModifier(30);
		}

		/**
		 * Resets the task
		 */
		public void resetTask() {
			if (TameableShulker.this.getAttackTarget() == null) {
				TameableShulker.this.updateArmorModifier(0);
			}
		}

		/**
		 * Updates the task
		 */
		public void updateTask() {
			--this.peekTime;
		}
	}

	class BodyHelper extends EntityBodyHelper {
		public BodyHelper(EntityLivingBase p_i47062_2_) {
			super(p_i47062_2_);
		}

		/**
		 * Update the Head and Body rendenring angles
		 */
		public void updateRenderAngles() {
		}
	}

	 public void fall(float distance, float damageMultiplier)
	    {
	    }

	    /**
	     * Get number of ticks, at least during which the living entity will be silent.
	     */
	    public int getTalkInterval()
	    {
	        return 120;
	    }

	    /**
	     * Determines if an entity can be despawned, used on idle far away entities
	     */
	    protected boolean canDespawn()
	    {
	        return false;
	    }
	    protected boolean isValidLightLevel()
	    {
	        BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);

	        if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
	        {
	            return false;
	        }
	        else
	        {
	            int i = this.worldObj.getLightFromNeighbors(blockpos);

	            if (this.worldObj.isThundering())
	            {
	                int j = this.worldObj.getSkylightSubtracted();
	                this.worldObj.setSkylightSubtracted(10);
	                i = this.worldObj.getLightFromNeighbors(blockpos);
	                this.worldObj.setSkylightSubtracted(j);
	            }

	            return i <= this.rand.nextInt(8);
	        }
	    }
	    /**
	     * Checks if the entity's current position is a valid location to spawn this entity.
	     */
	    @Override
	    public boolean getCanSpawnHere()
	    {
	        return this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !isValidLightLevel() && super.getCanSpawnHere();
	    }

	 @Override
	    protected void despawnEntity() {
	        if (!isTamed()) {
	            super.despawnEntity();
	        }
	    }
}


text:
"""
SyncData
========

Django command similar to 'loaddata' but also deletes.
After 'syncdata' has run, the database will have the same data as the fixture - anything
missing will of been added, anything different will of been updated,
and anything extra will of been deleted.
"""

import os
import sys
import six
from django.core.management.base import BaseCommand
from django.core.management.color import no_style

class Command(BaseCommand):
    """ syncdata command """

    help = 'Makes the current database have the same data as the fixture(s), no more, no less.'
    args = "fixture [fixture ...]"

    def remove_objects_not_in(self, objects_to_keep, verbosity):
        """
        Deletes all the objects in the database that are not in objects_to_keep.
        - objects_to_keep: A map where the keys are classes, and the values are a
         set of the objects of that class we should keep.
        """
        for class_ in objects_to_keep.keys():
            current = class_.objects.all()
            current_ids = set([x.pk for x in current])
            keep_ids = set([x.pk for x in objects_to_keep[class_]])

            remove_these_ones = current_ids.difference(keep_ids)
            if remove_these_ones:
                for obj in current:
                    if obj.pk in remove_these_ones:
                        obj.delete()
                        if verbosity >= 2:
                            print("Deleted object: %s" % six.u(obj))

            if verbosity > 0 and remove_these_ones:
                num_deleted = len(remove_these_ones)
                if num_deleted > 1:
                    type_deleted = six.u(class_._meta.verbose_name_plural)
                else:
                    type_deleted = six.u(class_._meta.verbose_name)

                print("Deleted %s %s" % (str(num_deleted), type_deleted))

    def handle(self, *fixture_labels, **options):
        """ Main method of a Django command """
        from django.db.models import get_apps
        from django.core import serializers
        from django.db import connection, transaction
        from django.conf import settings

        self.style = no_style()

        verbosity = int(options.get('verbosity', 1))
        show_traceback = options.get('traceback', False)

        # Keep a count of the installed objects and fixtures
        fixture_count = 0
        object_count = 0
        objects_per_fixture = []
        models = set()

        humanize = lambda dirname: dirname and "'%s'" % dirname or 'absolute path'

        # Get a cursor (even though we don't need one yet). This has
        # the side effect of initializing the test database (if
        # it isn't already initialized).
        cursor = connection.cursor()

        # Start transaction management. All fixtures are installed in a
        # single transaction to ensure that all references are resolved.
        transaction.commit_unless_managed()
        transaction.enter_transaction_management()
        transaction.managed(True)

        app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
        for fixture_label in fixture_labels:
            parts = fixture_label.split('.')
            if len(parts) == 1:
                fixture_name = fixture_label
                formats = serializers.get_public_serializer_formats()
            else:
                fixture_name, format = '.'.join(parts[:-1]), parts[-1]
                if format in serializers.get_public_serializer_formats():
                    formats = [format]
                else:
                    formats = []

            if formats:
                if verbosity > 1:
                    print("Loading '%s' fixtures..." % fixture_name)
            else:
                sys.stderr.write(self.style.ERROR("Problem installing fixture '%s': %s is not a known serialization format." % (fixture_name, format)))
                transaction.rollback()
                transaction.leave_transaction_management()
                return

            if os.path.isabs(fixture_name):
                fixture_dirs = [fixture_name]
            else:
                fixture_dirs = app_fixtures + list(settings.FIXTURE_DIRS) + ['']

            for fixture_dir in fixture_dirs:
                if verbosity > 1:
                    print("Checking %s for fixtures..." % humanize(fixture_dir))

                label_found = False
                for format in formats:
                    #serializer = serializers.get_serializer(format)
                    if verbosity > 1:
                        print("Trying %s for %s fixture '%s'..." % (humanize(fixture_dir), format, fixture_name))
                    try:
                        full_path = os.path.join(fixture_dir, '.'.join([fixture_name, format]))
                        fixture = open(full_path, 'r')
                        if label_found:
                            fixture.close()
                            print(self.style.ERROR("Multiple fixtures named '%s' in %s. Aborting." % (fixture_name, humanize(fixture_dir))))
                            transaction.rollback()
                            transaction.leave_transaction_management()
                            return
                        else:
                            fixture_count += 1
                            objects_per_fixture.append(0)
                            if verbosity > 0:
                                print("Installing %s fixture '%s' from %s." % (format, fixture_name, humanize(fixture_dir)))
                            try:
                                objects_to_keep = {}
                                objects = serializers.deserialize(format, fixture)
                                for obj in objects:
                                    object_count += 1
                                    objects_per_fixture[-1] += 1

                                    class_ = obj.object.__class__
                                    if class_ not in objects_to_keep:
                                        objects_to_keep[class_] = set()
                                    objects_to_keep[class_].add(obj.object)

                                    models.add(class_)
                                    obj.save()

                                self.remove_objects_not_in(objects_to_keep, verbosity)

                                label_found = True
                            except (SystemExit, KeyboardInterrupt):
                                raise
                            except Exception:
                                import traceback
                                fixture.close()
                                transaction.rollback()
                                transaction.leave_transaction_management()
                                if show_traceback:
                                    traceback.print_exc()
                                else:
                                    sys.stderr.write(self.style.ERROR("Problem installing fixture '%s': %s\n" % (full_path, traceback.format_exc())))
                                return
                            fixture.close()
                    except:
                        if verbosity > 1:
                            print("No %s fixture '%s' in %s." % (format, fixture_name, humanize(fixture_dir)))

        # If any of the fixtures we loaded contain 0 objects, assume that an
        # error was encountered during fixture loading.
        if 0 in objects_per_fixture:
            sys.stderr.write(
                self.style.ERROR("No fixture data found for '%s'. (File format may be invalid.)" % (fixture_name)))
            transaction.rollback()
            transaction.leave_transaction_management()
            return

        # If we found even one object in a fixture, we need to reset the
        # database sequences.
        if object_count > 0:
            sequence_sql = connection.ops.sequence_reset_sql(self.style, models)
            if sequence_sql:
                if verbosity > 1:
                    print("Resetting sequences")
                for line in sequence_sql:
                    cursor.execute(line)

        transaction.commit()
        transaction.leave_transaction_management()

        if object_count == 0:
            if verbosity > 1:
                print("No fixtures found.")
        else:
            if verbosity > 0:
                print("Installed %d object(s) from %d fixture(s)" % (object_count, fixture_count))

        # Close the DB connection. This is required as a workaround for an
        # edge case in MySQL: if the same connection is used to
        # create tables, load data, and query, the query can return
        # incorrect results. See Django #7572, MySQL #37735.
        connection.close()


text:
function Services() {
  var gSobject = gs.inherit(gs.baseClass,'Services');
  gSobject.clazz = { name: 'Services', simpleName: 'Services'};
  gSobject.clazz.superclass = { name: 'java.lang.Object', simpleName: 'Object'};
  gSobject.clazz.interfaces = [{ name: 'AngularModule', simpleName: 'AngularModule'}];
  if (AngularModule['setProperty']) {
    gSobject.setProperty = function(x1) { return AngularModule.setProperty(gSobject,x1); }
  }
  if (AngularModule['getProperty']) {
    gSobject.getProperty = function() { return AngularModule.getProperty(gSobject); }
  }
  gSobject.getAngular = function() { return AngularModule.getAngular(gSobject); }
  AngularModule.$init$(gSobject);
  gSobject['init'] = function(it) {
    var dependents = gs.list([]);
    gs.mc(dependents,'leftShift', gs.list(["ngNotify"]));
    var services = gs.mc(gs.fs('angular', this),"module",["appServices", dependents]);
    gs.mc(services,"factory",["wydFocusService", function($rootScope, $timeout) {
      return function(name) {
        return gs.execCall($timeout, this, [function(it) {
          return gs.mc($rootScope,"$broadcast",["wydFocusOn", name]);
        }]);
      };
    }]);
    gs.mc(services,"factory",["generalHttpInterceptor", function($log) {
      return gs.map().add("request",function(config) {
        return config;
      }).add("requestError",function(rejection) {
        gs.mc($log,"error",[rejection]);
        return rejection;
      }).add("response",function(response) {
        return response;
      }).add("responseError",function(rejection) {
        gs.mc($log,"error",[rejection]);
        return rejection;
      });
    }]);
    return gs.mc(services,"factory",["wydNotifyService", function($log, ngNotify) {
      gs.mc(ngNotify,"config",[gs.map().add("theme","pastel").add("position","top").add("duration",3000).add("type","info").add("sticky",false)]);
      var service = gs.map().add("native",ngNotify);
      gs.sp(service,"addInfo",function(message, clear) {
        if (gs.bool(clear)) {
          gs.mc(ngNotify,"dismiss",[]);
        };
        return gs.mc(ngNotify,"set",[message, gs.map().add("type","info").add("duration",5000)]);
      });
      gs.sp(service,"addSuccess",function(message, clear) {
        if (gs.bool(clear)) {
          gs.mc(ngNotify,"dismiss",[]);
        };
        return gs.mc(ngNotify,"set",[message, gs.map().add("type","success").add("duration",4000)]);
      });
      gs.sp(service,"addWarning",function(message, clear) {
        if (gs.bool(clear)) {
          gs.mc(ngNotify,"dismiss",[]);
        };
        return gs.mc(ngNotify,"set",[message, gs.map().add("type","warn").add("duration",3000)]);
      });
      gs.sp(service,"addError",function(message, clear) {
        if (gs.bool(clear)) {
          gs.mc(ngNotify,"dismiss",[]);
        };
        return gs.mc(ngNotify,"set",[message, gs.map().add("sticky",true).add("type","error").add("duration",6000)]);
      });
      gs.sp(service,"remove",function(it) {
        return gs.mc(ngNotify,"dismiss",[]);
      });
      gs.sp(service,"removeAll",function(it) {
        return gs.mc(ngNotify,"dismiss",[]);
      });
      return service;
    }]);
  }
  if (arguments.length == 1) {gs.passMapToObject(arguments[0],gSobject);};

  return gSobject;
};


text:
dojo.provide("plugins.workflow.SharedApps");

// ALLOW THE USER TO SELECT APPLICATIONS BELONGING TO OTHER USERS AND DRAG THEM INTO WORKFLOWS

// NB: USERS CAN MANAGE THEIR APPS IN THE 'ADMIN' TAB

// INTERNAL MODULES
dojo.require("plugins.workflow.Apps");

dojo.declare("plugins.workflow.SharedApps",
	[ plugins.workflow.Apps ],
{

//Path to the template of this widget.
templatePath: dojo.moduleUrl("plugins", "workflow/templates/sharedapps.html"),

/////}

startup : function() {
	console.log("SharedApps.startup    workflow.SharedApps.startup()");

	this.inherited(arguments);
},

setRefreshButton : function () {
	dojo.connect(this.refreshButton, "onclick", this, "refresh");
},

refresh : function () {
	////console.log("SharedApps.refresh     plugins.workflow.SharedApps.refresh()");

	this.updateApps();
},

updateApps : function (args) {
	////console.log("SharedApps.refresh     plugins.workflow.SharedApps.refresh()");
	console.log("SharedApps.updateApps    Doing Agua.getTable(sharedapps)");
	this.closePanes();

	// ALLOW TIME FOR PANES TO CLOSE THEN GET TABLE DATA
	setTimeout(function(thisObj) {
		Data.getTable("sharedApps,sharedParameters");
		//Agua.warning("Completed reloading shared applications");
		thisObj.loadAppSources();
	}, 500, this);
},

getApps : function () {
	return Agua.getSharedApps();
}

}); // plugins.workflow.SharedApps

/*

loadAppSources : function () {
	console.log("SharedApps.loadAppSources     plugins.workflow.SharedApps.loadAppSources()");
	console.log("SharedApps.loadAppSources     caller: " + this.loadAppSources.caller.nom);

	// DELETE EXISTING CONTENT
	//while ( this.dragSource.firstChild )
	//	this.dragSource.removeChild(this.dragSource.firstChild);
	this.clearDragSource();

	var apps = this.getApps();
	console.log("SharedApps.loadAppSources     apps: " + dojo.toJson(apps));
	var types = Agua.getAppTypes(apps);
	console.log("SharedApps.loadAppSources     types: " + dojo.toJson(types));

	//for ( var i = 0; i < types.length; i++ )
	for ( var i = 0; i < 1; i++ )
	{
		var type = types[i];
		console.log("SharedApps.loadAppSources     Doing type: " + dojo.toJson(type));
		var itemArray = Agua.getAppsByType(type, apps);
		console.log("SharedApps.loadAppSources     itemArray: " + dojo.toJson(itemArray));
		if ( itemArray == null || itemArray.length == 0 )	continue;
		console.log("SharedApps.loadAppSources     type '" + type + "' itemArray: " + dojo.toJson(itemArray));

		// CREATE TITLE PANE
		var appSource = new plugins.workflow.AppSource(
		{
			title		: 	type,
			itemArray 	:	itemArray,
			contextMenu	:	this.contextMenu
		});
		this.appSourcesContainer.appendChild(appSource.domNode);
	}
}
*/


text:
#ifndef YAVE_DEVICE_DEVICERESOURCES_H
#define YAVE_DEVICE_DEVICERESOURCES_H

#include <yave/yave.h>

#include <yave/assets/AssetPtr.h>

#include <yave/graphics/images/Image.h>
#include <yave/graphics/images/ImageView.h>

namespace yave {

class SpirVData;
class ComputeProgram;
class MaterialTemplate;
class Material;
class StaticMesh;
class IBLProbe;

class DeviceResources final : NonMovable {
    public:
        enum SpirV {
            EquirecConvolutionComp,
            CubemapConvolutionComp,
            BRDFIntegratorComp,
            DeferredLocalsComp,
            LinearizeDepthComp,
            SSAOComp,
            SSAOUpsampleComp,
            SSAOUpsampleMergeComp,
            CopyComp,
            HistogramClearComp,
            HistogramComp,
            ExposureParamsComp,
            DepthBoundComp,

            DeferredPointFrag,
            DeferredSpotFrag,
            DeferredAmbientFrag,
            AtmosphereFrag,
            AtmosphereIntegrationFrag,
            ToneMapFrag,
            TexturedFrag,
            TexturedAlphaFrag,
            PassthroughFrag,
            DownsampleFrag,
            BloomUpscaleFrag,
            BloomDownscaleFrag,
            HBlurFrag,
            VBlurFrag,
            WireFrameFrag,

            DeferredPointVert,
            DeferredSpotVert,
            BasicVert,
            SkinnedVert,
            ScreenVert,
            WireFrameVert,

            MaxSpirV
        };

        enum ComputePrograms {
            EquirecConvolutionProgram,
            CubemapConvolutionProgram,
            BRDFIntegratorProgram,
            DeferredLocalsProgram,
            LinearizeDepthProgram,
            SSAOProgram,
            SSAOUpsampleProgram,
            SSAOUpsampleMergeProgram,
            CopyProgram,
            HistogramClearProgram,
            HistogramProgram,
            ExposureParamsProgram,
            DepthBoundProgram,

            MaxComputePrograms
        };

        enum MaterialTemplates {
            TexturedMaterialTemplate,
            TexturedAlphaMaterialTemplate,
            TexturedSkinnedMaterialTemplate,

            DeferredPointLightMaterialTemplate,
            DeferredSpotLightMaterialTemplate,
            DeferredAmbientMaterialTemplate,
            AtmosphereMaterialTemplate,
            AtmosphereIntegrationMaterialTemplate,
            ToneMappingMaterialTemplate,

            ScreenPassthroughMaterialTemplate,
            ScreenBlendPassthroughMaterialTemplate,

            DownsampleMaterialTemplate,

            BloomUpscaleMaterialTemplate,
            BloomDownscaleMaterialTemplate,

            HBlurMaterialTemplate,
            VBlurMaterialTemplate,

            WireFrameMaterialTemplate,

            MaxMaterialTemplates
        };

        enum Materials {
            EmptyMaterial,

            MaxMaterials
        };

        enum Textures {
            BlackTexture,
            WhiteTexture,
            GreyTexture,
            RedTexture,

            FlatNormalTexture,

            SkyIBLTexture,

            MaxTextures
        };

        enum Meshes {
            CubeMesh,
            SphereMesh,
            SimpleSphereMesh,
            ConeMesh,

            MaxMeshes
        };

        DeviceResources();

        // can't default for inclusion reasons
        ~DeviceResources();

        TextureView brdf_lut() const;
        TextureView white_noise() const;

        const AssetPtr<IBLProbe>& ibl_probe() const;
        const AssetPtr<IBLProbe>& empty_probe() const;

        const SpirVData& operator[](SpirV i) const;
        const ComputeProgram& operator[](ComputePrograms i) const;
        const MaterialTemplate* operator[](MaterialTemplates i) const;

        const AssetPtr<Texture>& operator[](Textures i) const;
        const AssetPtr<Material>& operator[](Materials i) const;
        const AssetPtr<StaticMesh>& operator[](Meshes i) const;

    private:
        std::unique_ptr<SpirVData[]> _spirv;
        std::unique_ptr<ComputeProgram[]> _computes;
        std::unique_ptr<MaterialTemplate[]> _material_templates;

        std::unique_ptr<AssetPtr<Texture>[]> _textures;
        std::unique_ptr<AssetPtr<Material>[]> _materials;
        std::unique_ptr<AssetPtr<StaticMesh>[]> _meshes;

        AssetPtr<IBLProbe> _probe;
        AssetPtr<IBLProbe> _empty_probe;

        Texture _brdf_lut;
        Texture _white_noise;
};
}

#endif // YAVE_DEVICE_DEVICERESOURCES_H


text:
		@if ($_user)

Start a Discussion

		@endif

Choose a Filter

			@icon('icon-list') All Discussions

			@if ($_user)
				@icon('icon-new') Unread Discussions
				url() }}?by={{ $_user->username }}" class="list-group-item{{ ($_query->has('by')) ? ' active' : '' }}">@icon('icon-user') My Discussions
				@icon('icon-heart') My Favorites
				url() }}?subscribed=1" class="list-group-item{{ ($_query->has('subscribed')) ? ' active' : '' }}">@icon('icon-star') Subscribed
			@endif

			url() }}?trending=1" class="list-group-item{{ ($_query->has('trending')) ? ' active' : '' }}">@icon('icon-flash') Popular This Week
			url() }}?popular=1" class="list-group-item{{ ($_query->has('popular')) ? ' active' : '' }}">@icon('icon-rocket') Popular All Time
			url() }}?answered=1" class="list-group-item{{ ($_query->has('answered')) ? ' active' : '' }}">@icon('icon-check') Answered
			url() }}?started=1" class="list-group-item{{ ($_query->has('started')) ? ' active' : '' }}">@icon('icon-clock') Recently Started

Or Pick a Topic

				All

			@foreach ($topics as $topic)

					{{ $topic->name }}
					color }}">

				@if ($topic->children->count() > 0)
					@foreach ($topic->children as $child)

								{{ $child->name }}

{{ $topic->name }}

							color }}">

					@endforeach
				@endif
			@endforeach

		@if ($_user)

						@icon('icon-new-message')
						Start Discussion

						@icon('icon-funnel')
						Filter

		@endif

Filter Discussions

				<button type="button" class="close" data-dismiss="modal">×Close</button>

Choose a Filter

					@icon('icon-list') All Discussions

					@if ($_user)
						@icon('icon-new') Unread Discussions
						url() }}?by={{ $_user->username }}" class="list-group-item">@icon('icon-user') My Discussions
						@icon('icon-heart') My Favorites
						url() }}?subscribed=1" class="list-group-item">@icon('icon-star') Subscribed
					@endif

					url() }}?trending=1" class="list-group-item">@icon('icon-flash') Popular This Week
					url() }}?popular=1" class="list-group-item">@icon('icon-rocket') Popular All Time
					url() }}?answered=1" class="list-group-item">@icon('icon-check') Answered Questions
					url() }}?started=1" class="list-group-item">@icon('icon-clock') Recently Started

Or Pick a Topic

						All

					@foreach ($topics as $topic)

							{{ $topic->name }}
							color }}">

						@if ($topic->children->count() > 0)
							@foreach ($topic->children as $child)

										{{ $child->name }}

{{ $topic->name }}

									color }}">

							@endforeach
						@endif
					@endforeach

				Close


text:
import { Injectable } from '@angular/core';

@Injectable()
export class DataService {

  data:any;

  constructor() { }

}


text:
/*
 * This file is generated by jOOQ.
*/
package top.zbeboy.isy.domain.tables.records;

import javax.annotation.Generated;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record4;
import org.jooq.Row4;
import org.jooq.impl.UpdatableRecordImpl;

import top.zbeboy.isy.domain.tables.Schoolroom;

/**
 * This class is generated by jOOQ.
 */
@Generated(
    value = {
        "http://www.jooq.org",
        "jOOQ version:3.10.7"
    },
    comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class SchoolroomRecord extends UpdatableRecordImpl<SchoolroomRecord> implements Record4<Integer, Integer, String, Byte> {

    private static final long serialVersionUID = 1870363390;

    /**
     * Setter for isy.schoolroom.schoolroom_id.
     */
    public void setSchoolroomId(Integer value) {
        set(0, value);
    }

    /**
     * Getter for isy.schoolroom.schoolroom_id.
     */
    public Integer getSchoolroomId() {
        return (Integer) get(0);
    }

    /**
     * Setter for isy.schoolroom.building_id.
     */
    public void setBuildingId(Integer value) {
        set(1, value);
    }

    /**
     * Getter for isy.schoolroom.building_id.
     */
    @NotNull
    public Integer getBuildingId() {
        return (Integer) get(1);
    }

    /**
     * Setter for isy.schoolroom.building_code.
     */
    public void setBuildingCode(String value) {
        set(2, value);
    }

    /**
     * Getter for isy.schoolroom.building_code.
     */
    @NotNull
    @Size(max = 10)
    public String getBuildingCode() {
        return (String) get(2);
    }

    /**
     * Setter for isy.schoolroom.schoolroom_is_del.
     */
    public void setSchoolroomIsDel(Byte value) {
        set(3, value);
    }

    /**
     * Getter for isy.schoolroom.schoolroom_is_del.
     */
    public Byte getSchoolroomIsDel() {
        return (Byte) get(3);
    }

    // -------------------------------------------------------------------------
    // Primary key information
    // -------------------------------------------------------------------------

    /**
     * {@inheritDoc}
     */
    @Override
    public Record1<Integer> key() {
        return (Record1) super.key();
    }

    // -------------------------------------------------------------------------
    // Record4 type implementation
    // -------------------------------------------------------------------------

    /**
     * {@inheritDoc}
     */
    @Override
    public Row4<Integer, Integer, String, Byte> fieldsRow() {
        return (Row4) super.fieldsRow();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Row4<Integer, Integer, String, Byte> valuesRow() {
        return (Row4) super.valuesRow();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Integer> field1() {
        return Schoolroom.SCHOOLROOM.SCHOOLROOM_ID;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Integer> field2() {
        return Schoolroom.SCHOOLROOM.BUILDING_ID;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<String> field3() {
        return Schoolroom.SCHOOLROOM.BUILDING_CODE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Byte> field4() {
        return Schoolroom.SCHOOLROOM.SCHOOLROOM_IS_DEL;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer component1() {
        return getSchoolroomId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer component2() {
        return getBuildingId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String component3() {
        return getBuildingCode();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Byte component4() {
        return getSchoolroomIsDel();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer value1() {
        return getSchoolroomId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer value2() {
        return getBuildingId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String value3() {
        return getBuildingCode();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Byte value4() {
        return getSchoolroomIsDel();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SchoolroomRecord value1(Integer value) {
        setSchoolroomId(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SchoolroomRecord value2(Integer value) {
        setBuildingId(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SchoolroomRecord value3(String value) {
        setBuildingCode(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SchoolroomRecord value4(Byte value) {
        setSchoolroomIsDel(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SchoolroomRecord values(Integer value1, Integer value2, String value3, Byte value4) {
        value1(value1);
        value2(value2);
        value3(value3);
        value4(value4);
        return this;
    }

    // -------------------------------------------------------------------------
    // Constructors
    // -------------------------------------------------------------------------

    /**
     * Create a detached SchoolroomRecord
     */
    public SchoolroomRecord() {
        super(Schoolroom.SCHOOLROOM);
    }

    /**
     * Create a detached, initialised SchoolroomRecord
     */
    public SchoolroomRecord(Integer schoolroomId, Integer buildingId, String buildingCode, Byte schoolroomIsDel) {
        super(Schoolroom.SCHOOLROOM);

        set(0, schoolroomId);
        set(1, buildingId);
        set(2, buildingCode);
        set(3, schoolroomIsDel);
    }
}


text:
@interface Texture2DContent : TextureContent {

}

@property (nonatomic, retain) MipmapChain *mipmaps;

- (void) validateWithGraphicsProfile:(GraphicsProfile)targetProfile;

@end


text:
"""An abstract for Worker class"""
import abc

class Worker(metaclass=abc.ABCMeta):
    """Widget abstract"""
    @abc.abstractmethod
    def execute(self):
        """call a worker"""
        pass

    @abc.abstractmethod
    def start(self):
        """call a worker"""
        pass

    @abc.abstractmethod
    def shutdown(self):
        """stops worker and all services"""
        pass


text:
package blog.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import blog.bn.BasicVar;
import blog.bn.DerivedVar;
import blog.bn.RandFuncAppVar;
import blog.world.PartialWorld;

/**
 * Represents a symbol evidence statement, which is of the form {type_name
 * var_name : cond_formula} = { symbol_list }.
 */
public class SymbolEvidenceStatement {

  /**
   * Creates a new SymbolEvidenceStatement saying that the objects satisfying
   * the given implicit set specification are referred to by the given constant
   * symbols.
   *
   * @param setSpec
   *          an implicit set specification
   * @param symbols
   *          a List of Strings representing Skolem constant names
   */
  public SymbolEvidenceStatement(ImplicitSetSpec setSpec, List symbols) {
    this.setSpec = setSpec;

    List predecessors = new ArrayList();
    for (Iterator iter = symbols.iterator(); iter.hasNext();) {
      String name = (String) iter.next();
      SkolemConstant s = new SkolemConstant(name, setSpec, predecessors);
      skolemConstants.add(s);
      predecessors.add(s);
    }
  }

  /**
   * Returns the implicit set specification that defines the set of objects
   * labeled by the symbols.
   */
  public ImplicitSetSpec getSetSpec() {
    return setSpec;
  }

  /**
   * Returns a List of SkolemConstant objects representing the symbols
   * introduced in this symbol evidence statement.
   *
   * @return unmodifiable List of SkolemConstant objects
   */
  public List<SkolemConstant> getSkolemConstants() {

    return Collections.unmodifiableList(skolemConstants);

  }

  /**
   * Returns the cardinality variable whose value is observed in this evidence
   * statement.
   *
   * @throws IllegalStateException
   *           if compile has not yet been called.
   */
  public DerivedVar getObservedVar() {
    if (observedVar == null) {
      throw new IllegalStateException("Evidence statement has not "
          + "been compiled yet.");
    }
    return observedVar;
  }

  /**
   * Returns the observed value of the cardinality variable associated with this
   * symbol evidence statement.
   *
   * @throws IllegalStateException
   *           if compile has not yet been called.
   */
  public Integer getObservedValue() {
    if (observedValue == null) {
      throw new IllegalStateException("Evidence statement has not "
          + "been compiled yet.");
    }
    return observedValue;
  }

  /**
   * Returns true if this statement satisfies type and scope constraints. If
   * there is a type or scope error, prints a message to standard error and
   * returns false.
   */
  public boolean checkTypesAndScope(Model model) {
    return setSpec.checkTypesAndScope(model, Collections.EMPTY_MAP, null);
  }

  /**
   * Initializes the observed variable and value, and compiles the cardinality
   * spec for the observed variable. Also compiles the dependency models for
   * this statement's skolem constants.
   */
  public int compile(LinkedHashSet callStack) {
    compiled = true;

    int errors = 0;

    CardinalitySpec cardSpec = new CardinalitySpec(setSpec);
    errors += cardSpec.compile(callStack);
    observedVar = new DerivedVar(cardSpec);
    observedValue = new Integer(skolemConstants.size());

    for (SkolemConstant c : skolemConstants) {
      errors += ((SkolemConstant) c).getDepModel().compile(callStack);
    }

    return errors;
  }

  /**
   * Returns true if the given partial world is complete enough to determine
   * whether this symbol evidence statement is true: that is, it determines what
   * objects satisfy this statement's set specification, and it instantiates all
   * the symbols.
   */
  public boolean isDetermined(PartialWorld w) {
    if (!setSpec.isDetermined(w)) {
      return false;
    }

    for (Iterator iter = skolemConstants.iterator(); iter.hasNext();) {
      SkolemConstant sym = (SkolemConstant) iter.next();
      BasicVar symVar = new RandFuncAppVar(sym, Collections.EMPTY_LIST);
      if (w.getValue(symVar) == null) {
        return false;
      }
    }

    return true;
  }

  /**
   * Returns true if this symbol evidence statement is true in the given world:
   * that is, its satisfying set has the right number of elements, and all of
   * its symbols (if they are instantiated) refer to distinct elements of that
   * set.
   */
  public boolean isTrue(PartialWorld w) {
    Set satisfiers = setSpec.getSatisfyingSet(w);
    if (satisfiers.size() != skolemConstants.size()) {
      // System.out.println("Symbol evidence statement should be "
      // + "satisfied by " + skolemConstants.size()
      // + " objects; actually satisfied by " + satisfiers.size() + ".");
      return false;
    }

    Set referents = new HashSet();
    for (Iterator iter = skolemConstants.iterator(); iter.hasNext();) {
      SkolemConstant sym = (SkolemConstant) iter.next();
      BasicVar symVar = new RandFuncAppVar(sym, Collections.EMPTY_LIST);
      Object referent = w.getValue(symVar);
      if (referent != null) {
        if (referents.contains(referent)) {
          // System.out.println("Skolem constant " + sym
          // + " corefers with earlier constant.");
          return false;
        }
        if (!satisfiers.contains(referent)) {
          System.out.println("Skolem constant " + sym + " refers to "
              + referent + " which doesn't satisfy set spec.");
          return false;
        }
        referents.add(referent);
      }
    }

    return true;
  }

  /**
   * Returns an object whose toString method yields a description of the
   * location where this statement occurred in an input file.
   */
  public Object getLocation() {
    return setSpec.getLocation();
  }

  public String toString() {
    StringBuffer buf = new StringBuffer();
    buf.append(setSpec);
    buf.append(" = {");
    for (int i = 0; i < skolemConstants.size(); ++i) {
      buf.append(skolemConstants.get(i));
      if (i + 1 < skolemConstants.size()) {
        buf.append(", ");
      }
    }
    buf.append("}");
    return buf.toString();
  }

  /**
   * Replaces a term by another, returning a new SymbolEvidenceStatement if
   * there is a replacement, or same if not. The Skolem constants are not
   * considered for replacement. The new SymbolEvidenceStatement is compiled if
   * this is compiled.
   */
  public SymbolEvidenceStatement replace(Term t, ArgSpec another) {
    ImplicitSetSpec newSetSpec = (ImplicitSetSpec) setSpec.replace(t, another);
    if (newSetSpec != setSpec) {
      SymbolEvidenceStatement result = new SymbolEvidenceStatement(newSetSpec,
          skolemConstants);
      if (compiled)
        result.compile(new LinkedHashSet());
      return result;
    }
    return this;
  }

  private ImplicitSetSpec setSpec;
  private List<SkolemConstant> skolemConstants = new ArrayList<SkolemConstant>(); // of
                                                                                // //
                                                                                // SkolemConstant

  private boolean compiled = false;
  private DerivedVar observedVar;
  private Integer observedValue;
}


text:
package org.apache.hyracks.control.cc.web;

import org.json.JSONObject;

import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.control.cc.ClusterControllerService;
import org.apache.hyracks.control.cc.web.util.IJSONOutputFunction;
import org.apache.hyracks.control.cc.work.GetActivityClusterGraphJSONWork;
import org.apache.hyracks.control.cc.work.GetJobRunJSONWork;
import org.apache.hyracks.control.cc.work.GetJobSummariesJSONWork;

public class JobsRESTAPIFunction implements IJSONOutputFunction {
    private ClusterControllerService ccs;

    public JobsRESTAPIFunction(ClusterControllerService ccs) {
        this.ccs = ccs;
    }

    @Override
    public JSONObject invoke(String[] arguments) throws Exception {
        JSONObject result = new JSONObject();
        switch (arguments.length) {
            case 1:
                if (!"".equals(arguments[0])) {
                    break;
                }
            case 0: {
                GetJobSummariesJSONWork gjse = new GetJobSummariesJSONWork(ccs);
                ccs.getWorkQueue().scheduleAndSync(gjse);
                result.put("result", gjse.getSummaries());
                break;
            }

            case 2: {
                JobId jobId = JobId.parse(arguments[0]);

                if ("job-activity-graph".equalsIgnoreCase(arguments[1])) {
                    GetActivityClusterGraphJSONWork gjage = new GetActivityClusterGraphJSONWork(ccs, jobId);
                    ccs.getWorkQueue().scheduleAndSync(gjage);
                    result.put("result", gjage.getJSON());
                } else if ("job-run".equalsIgnoreCase(arguments[1])) {
                    GetJobRunJSONWork gjre = new GetJobRunJSONWork(ccs, jobId);
                    ccs.getWorkQueue().scheduleAndSync(gjre);
                    result.put("result", gjre.getJSON());
                }

                break;
            }
        }
        return result;
    }
}