text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class engine.core.entity.Entity</title>
<meta name="date" content="2015-07-06">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
engine.core.entity.Entity

Packages that use Entity

Package
Description

engine.components

Provides various components that are useful in virtually any application.

engine.core

Classes defining the core functionality of the game engine.

engine.core.entity

Classes for defining the objects in the game and their functionality.

Uses of Entity in engine.components

Constructors in engine.components with parameters of type Entity

Constructor and Description

AudioComponent(Entity entity,
              java.lang.String[] soundNames,
              Sound[] soundsIn)

Creates a new AudioComponent

ColliderComponent(Entity entity)

Creates a new ColliderComponent

CollisionComponent(Entity entity)

Creates a new CollisionComponent

FadeRemove(Entity entity,
          double duration,
          int animationFrame,
          double solidityDuration)

Creates a new FadeRemove

LightComponent(Entity entity,
              LightMap light,
              double width,
              double height,
              double offsetX,
              double offsetY)

Creates a new LightComponent

LinkComponent(Entity entity,
             Entity toLink)

Creates a new LinkComponent.

RemoveComponent(Entity entity)

Creates a new RemoveComponent

SpriteComponent(Entity entity,
               double width,
               double height,
               SpriteSheet[] sheets,
               int[] indices,
               double[] frameTimes,
               int[] nextFrames,
               Color color)

Creates a new SpriteComponent

SpriteComponent(Entity entity,
               double width,
               double height,
               SpriteSheet[] sheets,
               int[] indices,
               double frameTime,
               Color color)

Creates a new SpriteComponent

SpriteComponent(Entity entity,
               double width,
               double height,
               SpriteSheet sheet,
               double frameTime,
               Color color)

Creates a new SpriteComponent

SpriteComponent(Entity entity,
               double width,
               double height,
               SpriteSheet sheet,
               int[] indices,
               double frameTime,
               Color color)

Creates a new SpriteComponent

SpriteComponent(Entity entity,
               double width,
               double height,
               SpriteSheet sheet,
               int spriteIndex,
               Color color)

Creates a new SpriteComponent

Uses of Entity in engine.core

Constructor parameters in engine.core with type arguments of type Entity

Constructor and Description

Scene(ISpatialStructure<Entity> structure)

Creates a new Scene.

Uses of Entity in engine.core.entity

Methods in engine.core.entity that return Entity

Modifier and Type
Method and Description

Entity
EntityComponent.getEntity()

Gets the entity this is attached to.

Methods in engine.core.entity with parameters of type Entity

Modifier and Type
Method and Description

int
Entity.compareTo(Entity o)

void
IEntityVisitor.visit(Entity entity,
     EntityComponent component)

A function that will be called every time an entity is visited.

Constructors in engine.core.entity with parameters of type Entity

Constructor and Description

EntityComponent(Entity entity,
               int id)

Creates a component attached to a specific entity.

Constructor parameters in engine.core.entity with type arguments of type Entity

Constructor and Description

Entity(ISpatialStructure<Entity> structure,
      double posX,
      double posY,
      double posZ)

Creates a new Entity with minimum necessary construction.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
package org.apache.ambari.logsearch.converter;

import org.apache.ambari.logsearch.common.LogType;
import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest;
import org.springframework.data.solr.core.query.FacetOptions;

import javax.inject.Named;

import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;

@Named
public class ServiceLogComponentRequestFacetQueryConverter extends AbstractServiceLogRequestFacetQueryConverter<ServiceLogComponentHostRequest> {

  @Override
  public FacetOptions.FacetSort getFacetSort() {
    return FacetOptions.FacetSort.INDEX;
  }

  @Override
  public String getDateTimeField() {
    return LOGTIME;
  }

  @Override
  public LogType getLogType() {
    return LogType.SERVICE;
  }

  @Override
  public void appendFacetOptions(FacetOptions facetOptions, ServiceLogComponentHostRequest request) {
    facetOptions.addFacetOnPivot(COMPONENT, HOST, LEVEL);
    facetOptions.addFacetOnPivot(COMPONENT, LEVEL);
  }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Mgc {

class MAGICFM Minimize1D
{
public:
    typedef Real (*Function)(Real,void*);

    Minimize1D (Function oF, int iMaxLevel, int iMaxBracket,
        void* pvUserData = 0);

    int& MaxLevel ();
    int& MaxBracket ();
    void*& UserData ();

    void GetMinimum (Real fT0, Real fT1, Real fTInitial,
        Real& rfTMin, Real& rfFMin);

protected:
    Function m_oF;
    int m_iMaxLevel, m_iMaxBracket;
    Real m_fTMin, m_fFMin;
    void* m_pvUserData;

    void GetMinimum (Real fT0, Real fF0, Real fT1, Real fF1, int iLevel);

    void GetMinimum (Real fT0, Real fF0, Real fTm, Real fFm, Real fT1,
        Real fF1, int iLevel);

    void GetBracketedMinimum (Real fT0, Real fF0, Real fTm,
        Real fFm, Real fT1, Real fF1, int iLevel);
};

#include "MgcMinimize1D.inl"

} // namespace Mgc

#endif


text:
body {
	padding-top: 60px;
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}

.stretch {
	width: 100%;
}

#selection-size, #collection-name {
	font-weight: bold;
}

#create-col-form {
	margin-bottom: 0px;
}

.jsoneditor .menu button.collapse-editor {
    background-position: -144px -48px;
}


text:
class SessionsController < ApplicationController
  def new
  end

  def create
    user = User.find_by(email: params[:session][:email].downcase)
    if user && user.authenticate(params[:session][:password])
      log_in(user)
      redirect_to root_path
    else
      flash[:danger] = 'Invalid email/password combination'
      render 'new'
    end
  end

  def destroy
    log_out
    redirect_to root_path
  end
end


text:
package net.authorize.sample.CustomerProfiles;

import java.util.ArrayList;
import java.util.List;
import net.authorize.Environment;
import net.authorize.api.contract.v1.*;
import net.authorize.api.controller.base.ApiOperationBase;
import net.authorize.api.controller.*;

public class GetCustomerPaymentProfileList {
    public static ANetApiResponse run(String apiLoginId,String transactionKey) {

        // Set the request to operate in either the sandbox or production environment
        ApiOperationBase.setEnvironment(Environment.SANDBOX);

        // Create object with merchant authentication details
        MerchantAuthenticationType merchantAuthenticationType  = new MerchantAuthenticationType() ;
        merchantAuthenticationType.setName(apiLoginId);
        merchantAuthenticationType.setTransactionKey(transactionKey);

        // Setting the paging
        Paging paging = new Paging();
        paging.setLimit(100);
        paging.setOffset(1);

        // Setting the sorting order
        CustomerPaymentProfileSorting sorting = new CustomerPaymentProfileSorting();
        CustomerPaymentProfileOrderFieldEnum orderByEnum = CustomerPaymentProfileOrderFieldEnum.ID;
        sorting.setOrderBy(orderByEnum);
        sorting.setOrderDescending(false);

        // Setting the searchType
        CustomerPaymentProfileSearchTypeEnum searchType = CustomerPaymentProfileSearchTypeEnum.CARDS_EXPIRING_IN_MONTH;

        // Create the API request and set the parameters for this specific request
        GetCustomerPaymentProfileListRequest apiRequest = new GetCustomerPaymentProfileListRequest();
        apiRequest.setMerchantAuthentication(merchantAuthenticationType);
        apiRequest.setPaging(paging);
        apiRequest.setSearchType(searchType);
        apiRequest.setSorting(sorting);
        apiRequest.setMonth("2020-12");

        // Call the controller
        GetCustomerPaymentProfileListController controller = new GetCustomerPaymentProfileListController(apiRequest);
        controller.execute();

        // Get the response
        GetCustomerPaymentProfileListResponse response = new GetCustomerPaymentProfileListResponse();
        response = controller.getApiResponse();

        // Parse the response to determine results
        if (response != null) {
            // If API Response is OK, go ahead and check the transaction response
            if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
                System.out.println("Successfully got customer payment profile list");
                System.out.println("Message Code:" + response.getMessages().getMessage().get(0).getCode());
                System.out.println("Message Text:" + response.getMessages().getMessage().get(0).getText());
                System.out.println("Total Number of Results in the Results Set:" + response.getTotalNumInResultSet());
                List <CustomerPaymentProfileListItemType> arr = response.getPaymentProfiles().getPaymentProfile();

                for (CustomerPaymentProfileListItemType element : arr) {
                    System.out.println();
                    if (element.getBillTo()!=null) {
                        System.out.println("Customer name : "+element.getBillTo().getFirstName()+" "+element.getBillTo().getLastName());
                    }
                    System.out.println("Credit card number: "+element.getPayment().getCreditCard().getCardNumber());
                    System.out.println("Customer Profile ID : "+element.getCustomerProfileId());
                    System.out.println("Customer Payment Profile ID : "+element.getCustomerPaymentProfileId());
                }
            } else {
                // Displaying the error code and message when error occurs
                System.out.println("Failed to get customer payment profile list");
                if (!response.getMessages().getMessage().isEmpty()) {
                    System.out.println("Error: "+response.getMessages().getMessage().get(0).getCode()+" "+ response.getMessages().getMessage().get(0).getText());
                }
            }
        } else {
            // Display the error code and message when response is null
            ANetApiResponse errorResponse = controller.getErrorResponse();
            System.out.println("Failed to get response");
            if (!errorResponse.getMessages().getMessage().isEmpty()) {
                System.out.println("Error: "+errorResponse.getMessages().getMessage().get(0).getCode()+" \n"+ errorResponse.getMessages().getMessage().get(0).getText());
            }
        }

        return response;
    }
}


text:
<!DOCTYPE html>

<meta content="text/html;charset=utf-8" http-equiv="content-type"/>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>pymel.core.windows.promptDialog — PyMEL 1.0.7 documentation</title>
<link href="../../../_static/nature.css" rel="stylesheet" type="text/css"/>
<link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../index-2.html" rel="top" title="PyMEL 1.0.7 documentation"/>
<link href="../../pymel.core.windows.html" rel="up" title="pymel.core.windows"/>
<link href="pymel.core.windows.promptForFolder.html" rel="next" title="pymel.core.windows.promptForFolder"/>
<link href="pymel.core.windows.promptBoxGenerator.html" rel="prev" title="pymel.core.windows.promptBoxGenerator"/>
<link href="../../../../style/adsk.cpm.css" rel="stylesheet" type="text/css"/><meta content="expert" name="experiencelevel"/><meta content="programmer" name="audience"/><meta content="enable" name="user-comments"/><meta content="ENU" name="language"/><meta content="MAYAUL" name="product"/><meta content="2016" name="release"/><meta content="Customization" name="book"/><meta content="Maya-Tech-Docs" name="component"/><meta content="/view/MAYAUL/2016/ENU/" name="helpsystempath"/><meta content="04/03/2015" name="created"/><meta content="04/03/2015" name="modified"/><meta content="Navigation

 index

 modules |

 next |

 previous |
 PyMEL 1.0.7 documentation »
 pymel.core.windows »

 pymel.core.windows.promptDialog ¶

 promptDialog ( *args , **kwargs ) ¶
 The promptDialog command creates a modal dialog with a message to the user, a text field in which the user may enter a
response, and a variable number of buttons to dismiss the dialog. The dialog is dismissed when the user presses any
button or chooses the close item..." name="description"/><meta content="__PyMel_generated_functions_pymel_core_windows_pymel_core_windows_promptDialog_html" name="topicid"/>

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.windows »

pymel.core.windows.promptDialog¶

<tt class="descname">promptDialog</tt><big>(</big>*args, **kwargs<big>)</big>¶

The promptDialog command creates a modal dialog with a message to the user, a text field in which the user may enter a
response, and a variable number of buttons to dismiss the dialog.  The dialog is dismissed when the user presses any
button or chooses the close item from the window menu.  In the case where a button is pressed then the name of the
button selected is returned.  If the dialog is dismissed via the close item then the string returned is specified by the
-ds/dismissStringflag. The default behaviour when no arguments are specified is to create an empty single button dialog.
To obtain the text entered by the user simply query the -tx/textflag.

Flags:

<colgroup>
<col width="1%"></col>
<col width="61%"></col>
<col width="19%"></col>
<col width="19%"></col>
</colgroup>

Long Name / Short Name
Argument Types
Properties

<tt class="docutils literal">backgroundColor</tt> / <tt class="docutils literal">bgc</tt>
float, float, float

The background color of the dialog. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0.
(Windows only flag)                    Flag can have multiple arguments, passed either as a tuple or a list.

<tt class="docutils literal">button</tt> / <tt class="docutils literal">b</tt>
unicode

Create a button with the given string as it's text.

<tt class="docutils literal">cancelButton</tt> / <tt class="docutils literal">cb</tt>
unicode

The cancel button is activated by pressing the escape key. Note that this flag does not create a button, it simply indicates which button created via the
-b/buttonflag shall respond to the escape key.

<tt class="docutils literal">defaultButton</tt> / <tt class="docutils literal">db</tt>
unicode

The default button is activated by pressing the enter key. Note that this flag does not create a button, it simply indicates which button created via the
-b/buttonflag shall respond to the enter key.

<tt class="docutils literal">dismissString</tt> / <tt class="docutils literal">ds</tt>
unicode

The string returned when the user selects the 'Close' item from the Window Manager menu.  If this flag is not set then the string dismissis returned.

<tt class="docutils literal">message</tt> / <tt class="docutils literal">m</tt>
unicode

The message text appearing in the dialog.

<tt class="docutils literal">messageAlign</tt> / <tt class="docutils literal">ma</tt>
unicode

Align the message left, center, or right.

<tt class="docutils literal">parent</tt> / <tt class="docutils literal">p</tt>
unicode

Specify the parent window for the dialog.  The dialog will be centered on this window and raise and lower with it's parent. By default, the dialog is not parented
to a particular window and is simply centered on the screen.

<tt class="docutils literal">scrollableField</tt> / <tt class="docutils literal">sf</tt>
bool

By default a single line text field is used in the dialog. Specify true for a multi-line scroll field.

<tt class="docutils literal">style</tt> / <tt class="docutils literal">st</tt>
unicode

Specify the type of input expected in the input field. Vaid input types are integerfloattext. If this flag is not specified, we assume the input type is text.

<tt class="docutils literal">text</tt> / <tt class="docutils literal">tx</tt>
unicode

The field text.

<tt class="docutils literal">title</tt> / <tt class="docutils literal">t</tt>
unicode

The dialog title.

Derived from mel command <tt class="xref py py-obj docutils literal">maya.cmds.promptDialog</tt>

Example:

import pymel.core as pm

# Create an OK/Cancel prompt dialog.
#
# +-+---------------------+
# |-|    Rename Object    |
# +-----------------------+
# | Enter Name:           |
# | +-------------------+ |
# | |                   | |
# | |                   | |
# | +-------------------+ |
# +-----------------------+
# | +-------+  +--------+ |
# | |  OK   |  | Cancel | |
# | +-------+  +--------+ |
# +-----------------------+
#

result = pm.promptDialog(
                title='Rename Object',
                message='Enter Name:',
                button=['OK', 'Cancel'],
                defaultButton='OK',
                cancelButton='Cancel',
                dismissString='Cancel')

if result == 'OK':
        text = pm.promptDialog(query=True, text=True)

Previous topic

pymel.core.windows.promptBoxGenerator

Next topic

pymel.core.windows.promptForFolder

Core Modules

<tt class="xref">animation</tt>

<tt class="xref">effects</tt>

<tt class="xref">general</tt>

<tt class="xref">language</tt>

<tt class="xref">modeling</tt>

<tt class="xref">rendering</tt>

<tt class="xref">system</tt>

<tt class="xref">windows</tt>

Type Modules

<tt class="xref">datatypes</tt>

<tt class="xref">nodetypes</tt>

<tt class="xref">uitypes</tt>

Other Modules

<tt class="xref">plugins</tt>

<tt class="xref">mayautils</tt>

<tt class="xref">util</tt>

<tt class="xref">versions</tt>

<tt class="xref">tools</tt>

This Page

Show Source

Quick search

<form action="http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/search.html" class="search" method="get"></form>
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>

    Enter search terms or a module, class or function name.

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.windows »

        © Copyright 2009, Chad Dombrova.
      Created using Sphinx 1.2.3.


text:
@interface GTMUIView_UnitTestingTest : GTMTestCase <GTMUnitTestViewDrawer>
@end

@implementation GTMUIView_UnitTestingTest

- (void)testDrawing {
  GTMAssertDrawingEqualToFile(self,
                              CGSizeMake(200,200),
                              @"GTMUIViewUnitTestingTest",
                              [UIApplication sharedApplication],
                              nil);
}

- (void)testState {
  UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)] autorelease];
  UIView *subview = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)] autorelease];
  [view addSubview:subview];
  GTMAssertObjectStateEqualToStateNamed(view, @"GTMUIViewUnitTestingTest", nil);
}

- (void)testUIImage {
  NSString* name = @"GTMUIViewUnitTestingTest";
  NSBundle *bundle = [NSBundle bundleForClass:[self class]];
  NSString *imagePath = [bundle pathForResource:name ofType:@"png"];
  STAssertNotNil(imagePath, nil);
  UIImage* image = [UIImage imageWithContentsOfFile:imagePath];
  GTMAssertObjectImageEqualToImageNamed(image, name, nil);
}

- (void)gtm_unitTestViewDrawRect:(CGRect)rect contextInfo:(void*)contextInfo {
  UIApplication *app = [UIApplication sharedApplication];
  STAssertEqualObjects(app,
                       contextInfo,
                       @"Should be a UIApplication");
  CGPoint center = CGPointMake(CGRectGetMidX(rect),
                               CGRectGetMidY(rect));
  rect = CGRectMake(center.x - 50, center.y - 50, 100, 100);
  CGContextRef context = UIGraphicsGetCurrentContext();
  CGContextAddEllipseInRect(context, rect);
  CGContextSetLineWidth(context, 5);
  [[UIColor redColor] set];
  CGContextStrokePath(context);
}

@end


text:
#ifndef _NAND_H_
#define _NAND_H_

#include <linux/mtd/compat.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>

typedef struct mtd_info nand_info_t;

extern int nand_curr_device;
extern nand_info_t nand_info[];

static inline int nand_read(nand_info_t *info, ulong ofs, ulong *len, u_char *buf)
{
	return info->read(info, ofs, *len, (size_t *)len, buf);
}

static inline int nand_write(nand_info_t *info, ulong ofs, ulong *len, u_char *buf)
{
	return info->write(info, ofs, *len, (size_t *)len, buf);
}

static inline int nand_block_isbad(nand_info_t *info, ulong ofs)
{
	return info->block_isbad(info, ofs);
}

static inline int nand_erase(nand_info_t *info, ulong off, ulong size)
{
	struct erase_info instr;

	instr.mtd = info;
	instr.addr = off;
	instr.len = size;
	instr.callback = 0;

	return info->erase(info, &instr);
}

/*****************************************************************************
 * declarations from nand_util.c
 ****************************************************************************/

struct nand_write_options {
	u_char *buffer;		/* memory block containing image to write */
	ulong length;		/* number of bytes to write */
	ulong offset;		/* start address in NAND */
	int quiet;		/* don't display progress messages */
	int autoplace;		/* if true use auto oob layout */
	int forcejffs2;		/* force jffs2 oob layout */
	int forceyaffs;		/* force yaffs oob layout */
	int noecc;		/* write without ecc */
	int writeoob;		/* image contains oob data */
	int pad;		/* pad to page size */
	int blockalign;		/* 1|2|4 set multiple of eraseblocks
				 * to align to */
    int skipfirstblk;   /* if true, skip the first good block,
                         * set true when write the yaffs image,
                         * add by www.embedsky.net
                         */
    int nocheckbadblk;  /* if true, don't check bad blockes,
                         * use them as good blockes
                         * add by www.embedsky.net
                         */
};

typedef struct nand_write_options nand_write_options_t;

struct nand_read_options {
	u_char *buffer;		/* memory block in which read image is written*/
	ulong length;		/* number of bytes to read */
	ulong offset;		/* start address in NAND */
	int quiet;		/* don't display progress messages */
	int readoob;		/* put oob data in image */
	int noecc;		/* read without ecc */
    int nocheckbadblk;  /* if true, don't check bad blockes,
                         * use them as good blockes
                         * add by www.embedsky.net
                         */
};

typedef struct nand_read_options nand_read_options_t;

struct nand_erase_options {
	ulong length;		/* number of bytes to erase */
	ulong offset;		/* first address in NAND to erase */
	int quiet;		/* don't display progress messages */
	int jffs2;		/* if true: format for jffs2 usage
				 * (write appropriate cleanmarker blocks) */
	int scrub;		/* if true, really clean NAND by erasing
				 * bad blocks (UNSAFE) */
};

typedef struct nand_erase_options nand_erase_options_t;

int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts);

int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts);
int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts);

#define NAND_LOCK_STATUS_TIGHT	0x01
#define NAND_LOCK_STATUS_LOCK	0x02
#define NAND_LOCK_STATUS_UNLOCK 0x04

int nand_lock( nand_info_t *meminfo, int tight );
int nand_unlock( nand_info_t *meminfo, ulong start, ulong length );
int nand_get_lock_status(nand_info_t *meminfo, ulong offset);

#ifdef CFG_NAND_SELECT_DEVICE
void board_nand_select_device(struct nand_chip *nand, int chip);
#endif

#endif


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('api', '0002_auto_20160113_2131'),
    ]

    operations = [
        migrations.AddField(
            model_name='texture',
            name='type',
            field=models.CharField(default=b'', max_length=255, choices=[(b'CHARACTER COMPONENT', b'Character Component'), (b'ITEM', b'Item')]),
            preserve_default=True,
        ),
    ]


text:
/**
 * RelType
 *
 * @author Joel Kniaz
 */
package gov.va.isaac.gui.querybuilder.node;

import gov.va.isaac.util.OTFUtility;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;

/**
 * RefsetContainsConcept
 *
 * @author Joel Kniaz
 *
 * RelType(
 * 		Query enclosingQuery,
 * 		String refsetConceptSpecKey,
 * 		String queryTextKey,
 * 		String viewCoordinateKey)
 */
public class RefsetContainsString extends AssertionNode {
	private IntegerProperty refsetConceptNidIntegerProperty = new SimpleIntegerProperty();
	private StringProperty queryTextStringProperty = new SimpleStringProperty();

	/**
	 *
	 */
	public RefsetContainsString() {
		super();
		getDescriptionProperty().set(getDescription());

		setValidationChangeListeners();
		setDescriptionChangeListeners();
	}

	private boolean isNodeValid() {
		if (refsetConceptNidIntegerProperty == null || OTFUtility.getConceptVersion(refsetConceptNidIntegerProperty.get()) == null) {
			return false;
		} else if (queryTextStringProperty == null || queryTextStringProperty.get() == null || queryTextStringProperty.get().length() < 1) {
			return false;
		} else {
			return true;
		}
	}

	public IntegerProperty getRefsetConceptNidIntegerProperty() { return refsetConceptNidIntegerProperty; }
	public Integer getRefsetConceptNid() { return refsetConceptNidIntegerProperty != null ? refsetConceptNidIntegerProperty.get() : null; }
	public void setRefsetConceptNid(int nid) { refsetConceptNidIntegerProperty.set(nid); }

	public StringProperty getQueryTextStringProperty() { return queryTextStringProperty; }
	public String getQueryText() { return queryTextStringProperty != null ? queryTextStringProperty.get() : null; }
	public void setQueryText(String queryText) { queryTextStringProperty.set(queryText); }

	protected void setValidationChangeListeners() {
		refsetConceptNidIntegerProperty.addListener(new ChangeListener<Number>() {
			@Override
			public void changed(ObservableValue<? extends Number> observable,
					Number oldValue, Number newValue) {
				if (newValue != null && newValue.intValue() != 0 && OTFUtility.getConceptVersion(newValue.intValue()) != null) {
					isValidProperty.set(isNodeValid());
				} else {
					isValidProperty.set(false);
				}
			}
		});
		queryTextStringProperty.addListener(new ChangeListener<String>() {
			@Override
			public void changed(ObservableValue<? extends String> observable,
					String oldValue, String newValue) {
				if (newValue != null && newValue.length() > 0) {
					isValidProperty.set(isNodeValid());
				} else {
					isValidProperty.set(false);
				}
			}
		});
	}
	protected void setDescriptionChangeListeners() {
		super.setDescriptionChangeListeners();
		invertProperty.addListener(new ChangeListener<Boolean>() {
			@Override
			public void changed(ObservableValue<? extends Boolean> observable,
					Boolean oldValue, Boolean newValue) {
				if (oldValue != newValue) {
					getDescriptionProperty().set(getDescription());
				}
			}
		});
		refsetConceptNidIntegerProperty.addListener(new ChangeListener<Number>() {
			@Override
			public void changed(ObservableValue<? extends Number> observable,
					Number oldValue, Number newValue) {
				if (oldValue != newValue) {
					getDescriptionProperty().set(getDescription());
				}
			}
		});
		queryTextStringProperty.addListener(new ChangeListener<String>() {
			@Override
			public void changed(ObservableValue<? extends String> observable,
					String oldValue, String newValue) {
				if (oldValue != newValue) {
					getDescriptionProperty().set(getDescription());
				}
			}
		});
	}

	@Override
	public String getDescription() {
		String refsetConceptDescription = null;
		if (getRefsetConceptNid() != null && getRefsetConceptNid() != 0) {
			refsetConceptDescription = OTFUtility.getDescriptionIfConceptExists(getRefsetConceptNid());
		}

		String queryText = getQueryText() != null ? "\"" + getQueryText() + "\"" : null;

		return (invertProperty.get() ? "NOT " : "") + getNodeTypeName() + " refset=" + refsetConceptDescription + ", query=" + queryText;
	}
}


text:
// the goal of this file is to define wxCrtSetDbgFlag() macro which may be
// used like this:
//      wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
// to turn on memory leak checks for programs compiled with Microsoft Visual
// C++ (5.0+). The macro will not be defined under other compilers or if it
// can't be used with MSVC for whatever reason.

#ifndef _MSW_MSVCRT_H_
#define _MSW_MSVCRT_H_

// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
// builds
#undef wxUSE_VC_CRTDBG
#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
    && !defined(UNDER_CE)
    // it doesn't combine well with wxWin own memory debugging methods
    #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
        #define wxUSE_VC_CRTDBG
    #endif
#endif

#ifdef wxUSE_VC_CRTDBG
    // Need to undef new if including crtdbg.h which may redefine new itself
    #ifdef new
        #undef new
    #endif

    #include <stdlib.h>

    // Defining _CRTBLD should never be necessary at all, but keep it for now
    // as there is no time to retest all the compilers before 3.0 release.
    // Definitely do not use it with MSVS 2013 as defining it results in errors
    // if the standard <assert.h> is included afterwards.
    #if !defined(_CRTBLD) && !wxCHECK_VISUALC_VERSION(12)
        // Needed when building with pure MS SDK
        #define _CRTBLD
    #endif

    #include <crtdbg.h>

    #undef WXDEBUG_NEW
    #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)

    // this define works around a bug with inline declarations of new, see
    //
    //      http://support.microsoft.com/kb/q140858/
    //
    // for the details
    #define new  WXDEBUG_NEW

    #define wxCrtSetDbgFlag(flag) \
        _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag))
#else // !using VC CRT
    #define wxCrtSetDbgFlag(flag)
#endif // wxUSE_VC_CRTDBG

#endif // _MSW_MSVCRT_H_


text:
"""Tests for XLA op wrappers."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import functools

from absl.testing import parameterized
import numpy as np

from tensorflow.compiler.tests import xla_test
from tensorflow.compiler.tf2xla.python import xla
from tensorflow.compiler.xla import xla_data_pb2
from tensorflow.python.eager import def_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors
from tensorflow.python.framework import function
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.platform import googletest

class XlaOpsNumericalTest(xla_test.XLATestCase, parameterized.TestCase):

  def _assertOpOutputMatchesExpected(self, op, args, expected,
                                     equality_fn=None):
    with self.session() as session:
      with self.test_scope():
        placeholders = [
            array_ops.placeholder(dtypes.as_dtype(arg.dtype), arg.shape)
            for arg in args
        ]
        feeds = {placeholders[i]: args[i] for i in range(0, len(args))}
        output = op(*placeholders)
      result = session.run(output, feeds)
      if not equality_fn:
        equality_fn = self.assertAllClose
      equality_fn(result, expected, rtol=1e-3)

  def testAdd(self):
    for dtype in self.numeric_types:
      self._assertOpOutputMatchesExpected(
          xla.add,
          args=(np.array([1, 2, 3], dtype=dtype),
                np.array([4, 5, 6], dtype=dtype)),
          expected=np.array([5, 7, 9], dtype=dtype))

      self._assertOpOutputMatchesExpected(
          lambda x, y: xla.add(x, y, broadcast_dims=(0,)),
          args=(np.array([[1, 2], [3, 4]], dtype=dtype),
                np.array([7, 11], dtype=dtype)),
          expected=np.array([[8, 9], [14, 15]], dtype=dtype))

      self._assertOpOutputMatchesExpected(
          lambda x, y: xla.add(x, y, broadcast_dims=(1,)),
          args=(np.array([[1, 2], [3, 4]], dtype=dtype),
                np.array([7, 11], dtype=dtype)),
          expected=np.array([[8, 13], [10, 15]], dtype=dtype))

  def testBroadcast(self):
    for dtype in self.numeric_types:
      v = np.arange(4, dtype=np.int32).astype(dtype).reshape([2, 2])
      self._assertOpOutputMatchesExpected(
          lambda x: xla.broadcast(x, (7, 42)),
          args=(v,),
          expected=np.tile(v, (7, 42, 1, 1)))

  @test_util.disable_mlir_bridge('Not supported yet')
  def testGather(self):
    operand = np.arange(10, dtype=np.int32).reshape([2, 5])
    start_indices = np.array([2], np.int32)
    slice_sizes = np.array([1, 3], np.int32)

    def gather(operand, start_indices):
      dimension_numbers = xla_data_pb2.GatherDimensionNumbers()
      dimension_numbers.offset_dims.extend([1])
      dimension_numbers.collapsed_slice_dims.extend([0])
      dimension_numbers.start_index_map.extend([0])
      dimension_numbers.index_vector_dim = 1
      return xla.gather(operand, start_indices, dimension_numbers, slice_sizes)

    self._assertOpOutputMatchesExpected(
        gather,
        args=(operand, start_indices),
        expected=np.array([[5, 6, 7]]))

  @test_util.disable_mlir_bridge('Dynamic result types not supported')
  def testShiftRightLogical(self):
    self._assertOpOutputMatchesExpected(
        xla.shift_right_logical,
        args=(np.array([-1, 16], dtype=np.int32), np.int32(4)),
        expected=np.array([0x0FFFFFFF, 1], dtype=np.int32))

    self._assertOpOutputMatchesExpected(
        xla.shift_right_logical,
        args=(np.array([0xFFFFFFFF, 16], dtype=np.uint32), np.uint32(4)),
        expected=np.array([0x0FFFFFFF, 1], dtype=np.uint32))

  @test_util.disable_mlir_bridge('Dynamic result types not supported')
  def testShiftRightArithmetic(self):
    self._assertOpOutputMatchesExpected(
        xla.shift_right_arithmetic,
        args=(np.array([-1, 16], dtype=np.int32), np.int32(4)),
        expected=np.array([-1, 1], dtype=np.int32))

    self._assertOpOutputMatchesExpected(
        xla.shift_right_arithmetic,
        args=(np.array([0xFFFFFFFF, 16], dtype=np.uint32), np.uint32(4)),
        expected=np.array([0xFFFFFFFF, 1], dtype=np.uint32))

  PRECISION_VALUES = (None, xla_data_pb2.PrecisionConfig.DEFAULT,
                      xla_data_pb2.PrecisionConfig.HIGH,
                      xla_data_pb2.PrecisionConfig.HIGHEST)

  @parameterized.parameters(*PRECISION_VALUES)
  def testConv(self, precision):
    for dtype in set(self.float_types).intersection(
        set([dtypes.bfloat16.as_numpy_dtype, np.float32])):

      def conv_1d_fn(lhs, rhs):
        dnums = xla_data_pb2.ConvolutionDimensionNumbers()
        num_spatial_dims = 1
        dnums.input_batch_dimension = 0
        dnums.input_feature_dimension = 1
        dnums.output_batch_dimension = 0
        dnums.output_feature_dimension = 1
        dnums.kernel_output_feature_dimension = 0
        dnums.kernel_input_feature_dimension = 1
        dnums.input_spatial_dimensions.extend(range(2, 2 + num_spatial_dims))
        dnums.kernel_spatial_dimensions.extend(range(2, 2 + num_spatial_dims))
        dnums.output_spatial_dimensions.extend(range(2, 2 + num_spatial_dims))
        precision_config = None
        if precision:
          precision_config = xla_data_pb2.PrecisionConfig()
          precision_config.operand_precision.extend([precision, precision])
        return xla.conv(
            lhs,
            rhs,
            window_strides=(1,),
            padding=((2, 1),),
            lhs_dilation=(1,),
            rhs_dilation=(2,),
            dimension_numbers=dnums)

      self._assertOpOutputMatchesExpected(
          conv_1d_fn,
          args=(
              np.array([[[3, 4, 5, 6]]], dtype=dtype),
              np.array([[[-2, -3]]], dtype=dtype),
          ),
          expected=np.array([[[-9, -12, -21, -26, -10]]], dtype=dtype))

  @parameterized.parameters(*PRECISION_VALUES)
  def testDotGeneral(self, precision):
    for dtype in self.float_types:

      def dot_fn(lhs, rhs):
        dnums = xla_data_pb2.DotDimensionNumbers()
        dnums.lhs_contracting_dimensions.append(2)
        dnums.rhs_contracting_dimensions.append(1)
        dnums.lhs_batch_dimensions.append(0)
        dnums.rhs_batch_dimensions.append(0)
        precision_config = None
        if precision:
          precision_config = xla_data_pb2.PrecisionConfig()
          precision_config.operand_precision.extend([precision, precision])
        return xla.dot_general(
            lhs,
            rhs,
            dimension_numbers=dnums,
            precision_config=precision_config)

      lhs = np.array(
          [
              [[1, 2], [3, 4]],
              [[5, 6], [7, 8]],
          ], dtype=dtype)
      rhs = np.array(
          [
              [[1, 2, 3], [4, 5, 6]],
              [[7, 8, 9], [10, 11, 12]],
          ], dtype=dtype)
      self._assertOpOutputMatchesExpected(
          dot_fn,
          args=(lhs, rhs),
          expected=np.array(
              [
                  [[9, 12, 15], [19, 26, 33]],
                  [[95, 106, 117], [129, 144, 159]],
              ],
              dtype=dtype))

  def testNeg(self):
    for dtype in self.numeric_types - {np.uint8, np.int8}:
      self._assertOpOutputMatchesExpected(
          xla.neg,
          args=(np.array([1, 2, 3], dtype=dtype),),
          expected=np.array([-1, -2, -3], dtype=dtype))

  def testPad(self):
    for dtype in self.numeric_types:

      def pad_fn(x):
        return xla.pad(
            x,
            padding_value=7,
            padding_low=[2, 1],
            padding_high=[1, 2],
            padding_interior=[1, 0])

      self._assertOpOutputMatchesExpected(
          pad_fn,
          args=(np.arange(4, dtype=np.int32).astype(dtype).reshape([2, 2]),),
          expected=np.array(
              [[7, 7, 7, 7, 7], [7, 7, 7, 7, 7], [7, 0, 1, 7, 7],
               [7, 7, 7, 7, 7], [7, 2, 3, 7, 7], [7, 7, 7, 7, 7]],
              dtype=dtype))

  def testPadNegative(self):
    for dtype in self.numeric_types:

      def pad_fn(x):
        return xla.pad(
            x,
            padding_value=7,
            padding_low=[0, -1],
            padding_high=[1, -2],
            padding_interior=[1, 2])

      self._assertOpOutputMatchesExpected(
          pad_fn,
          args=(np.arange(6, dtype=np.int32).astype(dtype).reshape([2, 3]),),
          expected=np.array(
              [[7, 7, 1, 7], [7, 7, 7, 7], [7, 7, 4, 7], [7, 7, 7, 7]],
              dtype=dtype))

  @test_util.disable_mlir_bridge('Not supported yet')
  def testReduce(self):
    for dtype in set(self.numeric_types).intersection(
        set([dtypes.bfloat16.as_numpy_dtype, np.float32])):

      @function.Defun(dtype, dtype)
      def sum_reducer(x, y):
        return x + y

      def sum_reduction(dims):

        def fn(x):
          return xla.reduce(
              x, init_value=0, dimensions_to_reduce=dims, reducer=sum_reducer)

        return fn

      self._assertOpOutputMatchesExpected(
          sum_reduction(dims=[]),
          args=(np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]),),
          expected=np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]))
      self._assertOpOutputMatchesExpected(
          sum_reduction(dims=[0]),
          args=(np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]),),
          expected=np.array([12, 15, 18, 21], dtype=dtype))
      self._assertOpOutputMatchesExpected(
          sum_reduction(dims=[1]),
          args=(np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]),),
          expected=np.array([6, 22, 38], dtype=dtype))
      self._assertOpOutputMatchesExpected(
          sum_reduction(dims=[0, 1]),
          args=(np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]),),
          expected=dtype(66))

      @function.Defun(dtype, dtype)
      def mul_reducer(x, y):
        return x * y

      def mul_reduction(dims):

        def fn(x):
          return xla.reduce(
              x, init_value=1, dimensions_to_reduce=dims, reducer=mul_reducer)

        return fn

      self._assertOpOutputMatchesExpected(
          mul_reduction(dims=[0]),
          args=(np.arange(12, dtype=np.int32).astype(dtype).reshape([3, 4]),),
          expected=np.array([0, 45, 120, 231], dtype=dtype))

  @test_util.disable_mlir_bridge('Not supported yet')
  def testVariadicReduce(self):
    for dtype in set(self.numeric_types).intersection(
        set([np.float32, np.complex64])):

      @def_function.function
      def kahan_sum_reducer(t0, t1):
        (s0, c0), (s1, c1) = t0, t1
        s0minusc = s0 - (c0 + c1)
        t = s1 + s0minusc
        c = (t - s1) - s0minusc
        s = t
        return s, c

      def kahan_sum_reduction(dims, output_idx):

        def fn(x):
          arg = array_ops.zeros([], dtype)  # pylint: disable=cell-var-from-loop
          reducer = kahan_sum_reducer.get_concrete_function(
              (arg, arg), (arg, arg))

          return xla.variadic_reduce(
              (x, array_ops.zeros_like(x)),
              init_value=(arg, arg),
              dimensions_to_reduce=dims,
              reducer=reducer)[output_idx]

        return fn

      xs = np.array([1e5, np.pi, -1e5, np.exp(1.)])
      xs = np.array([xs, xs[::-1] / 3, xs / 7], dtype)
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[], output_idx=0),
          args=(xs,), expected=xs)
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[], output_idx=1),
          args=(xs,), expected=np.zeros_like(xs))
      shuffle_indices = np.argsort(np.random.randn(xs.shape[0]))
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[0], output_idx=0),
          args=(xs[shuffle_indices],),
          expected=np.array([np.exp(1) / 3 + 1e5 * 8 / 7,
                             np.pi * 8 / 7 - 1e5 / 3,
                             -1e5 * 8 / 7 + np.pi / 3,
                             np.exp(1) * 8 / 7 + 1e5 / 3], dtype=dtype))
      error_term_equality = functools.partial(self.assertAllClose, atol=.005)
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[0], output_idx=1),
          args=(xs[shuffle_indices],), expected=np.zeros_like(xs[0]),
          equality_fn=error_term_equality)
      shuffle_indices = np.argsort(np.random.randn(xs.shape[1]))
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[1], output_idx=0),
          args=(xs[:, shuffle_indices],),
          expected=np.array([np.pi + np.exp(1.),
                             (np.pi + np.exp(1.)) / 3,
                             (np.pi + np.exp(1.)) / 7], dtype=dtype))
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[1], output_idx=1),
          args=(xs[:, shuffle_indices],), expected=np.zeros_like(xs[:, 0]),
          equality_fn=error_term_equality)
      # Now, shuffle both dims.
      xs = xs[np.argsort(np.random.randn(xs.shape[0]))]
      xs = xs[:, np.argsort(np.random.randn(xs.shape[1]))]
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[0, 1], output_idx=0),
          args=(xs,), expected=dtype((np.pi + np.exp(1.)) * 31 / 21))
      self._assertOpOutputMatchesExpected(
          kahan_sum_reduction(dims=[0, 1], output_idx=1),
          args=(xs,), expected=dtype(0),
          equality_fn=error_term_equality)

  @test_util.disable_mlir_bridge('Not supported yet')
  def testSelectAndScatter(self):
    for dtype in set(self.numeric_types).intersection(
        set([dtypes.bfloat16.as_numpy_dtype, np.float32])):

      @function.Defun(dtype, dtype)
      def add_scatter(x, y):
        return x + y

      @function.Defun(dtype, dtype)
      def ge_select(x, y):
        return x >= y

      def test_fn(operand, source):
        return xla.select_and_scatter(
            operand,
            window_dimensions=[2, 3, 1, 1],
            window_strides=[2, 2, 1, 1],
            padding=[[0, 0]] * 4,
            source=source,
            init_value=0,
            select=ge_select,
            scatter=add_scatter)

      self._assertOpOutputMatchesExpected(
          test_fn,
          args=(np.array(
              [[7, 2, 5, 3, 8], [3, 8, 9, 3, 4], [1, 5, 7, 5, 6],
               [0, 6, 2, 10, 2]],
              dtype=dtype).reshape((4, 5, 1, 1)),
                np.array([[2, 6], [3, 1]], dtype=dtype).reshape((2, 2, 1, 1))),
          expected=np.array(
              [[0, 0, 0, 0, 0], [0, 0, 8, 0, 0], [0, 0, 3, 0, 0],
               [0, 0, 0, 1, 0]],
              dtype=dtype).reshape((4, 5, 1, 1)))

  def testTranspose(self):
    for dtype in self.numeric_types:
      v = np.arange(4, dtype=np.int32).astype(dtype).reshape([2, 2])
      self._assertOpOutputMatchesExpected(
          lambda x: xla.transpose(x, [1, 0]), args=(v,), expected=v.T)

  def testDynamicSlice(self):
    for dtype in self.numeric_types:
      self._assertOpOutputMatchesExpected(
          xla.dynamic_slice,
          args=(np.arange(1000,
                          dtype=np.int32).astype(dtype).reshape([10, 10, 10]),
                np.array([5, 7, 3]), np.array([2, 3, 2])),
          expected=np.array(
              np.array([[[573, 574], [583, 584], [593, 594]],
                        [[673, 674], [683, 684], [693, 694]]]),
              dtype=dtype))

  @test_util.disable_mlir_bridge('Error handling')
  def testDynamicSliceWithIncorrectStartIndicesShape(self):
    with self.session() as session:
      with self.test_scope():
        output = xla.dynamic_slice(
            np.arange(1000, dtype=np.int32).reshape([10, 10, 10]),
            np.array([5, 7]), np.array([2, 3, 4]))
      with self.assertRaises(errors.InvalidArgumentError) as invalid_arg_error:
        session.run(output)
      self.assertRegex(
          invalid_arg_error.exception.message,
          (r'start_indices must be a vector with length equal to input rank, '
           r'but input rank is 3 and start_indices has shape \[2\].*'))

  @test_util.disable_mlir_bridge('Error handling')
  def testDynamicSliceWithIncorrectSizeIndicesShape(self):
    with self.session() as session:
      with self.test_scope():
        output = xla.dynamic_slice(
            np.arange(1000, dtype=np.int32).reshape([10, 10, 10]),
            np.array([5, 7, 3]), np.array([2, 3]))
      with self.assertRaises(errors.InvalidArgumentError) as invalid_arg_error:
        session.run(output)
      self.assertRegex(
          invalid_arg_error.exception.message,
          (r'size_indices must be a vector with length equal to input rank, '
           r'but input rank is 3 and size_indices has shape \[2\].*'))

class XlaOpsShapeInferenceTest(xla_test.XLATestCase, parameterized.TestCase):

  def testDotDifferentNumberOfContractingDimensions(self):
    a = array_ops.placeholder(np.float32, shape=(4, 4, 4, 4))
    b = array_ops.placeholder(np.float32, shape=(4, 4, 4, 4))

    dim_nums = xla_data_pb2.DotDimensionNumbers()
    dim_nums.lhs_contracting_dimensions.append(2)
    dim_nums.rhs_contracting_dimensions.append(2)
    dim_nums.rhs_contracting_dimensions.append(3)

    with self.assertRaisesRegex(ValueError,
                                'Must specify the same number of contracting '
                                'dimensions for lhs and rhs. Got: 1 and 2'):
      xla.dot_general(a, b, dim_nums)

  def testDotDifferentContractingDimensionsSizes(self):
    a = array_ops.placeholder(np.float32, shape=(2, 2, 2, 2))
    b = array_ops.placeholder(np.float32, shape=(4, 4, 4, 4))

    dim_nums = xla_data_pb2.DotDimensionNumbers()
    dim_nums.lhs_contracting_dimensions.append(2)
    dim_nums.rhs_contracting_dimensions.append(3)

    with self.assertRaisesRegex(ValueError,
                                'Contracting dimension sizes do not match. '
                                'Got: 2 and 4'):
      xla.dot_general(a, b, dim_nums)

  def testDotDifferentNumberOfBatchDimensions(self):
    a = array_ops.placeholder(np.float32, shape=(4, 4, 4, 4))
    b = array_ops.placeholder(np.float32, shape=(4, 4, 4, 4))

    dim_nums = xla_data_pb2.DotDimensionNumbers()
    dim_nums.lhs_batch_dimensions.append(2)
    dim_nums.rhs_batch_dimensions.append(2)
    dim_nums.rhs_batch_dimensions.append(3)

    with self.assertRaisesRegex(ValueError,
                                'Must specify the same number of batch '
                                'dimensions for lhs and rhs. Got: 1 and 2'):
      xla.dot_general(a, b, dim_nums)

  def testDotDifferentBatchDimensionsSizes(self):
    a = array_ops.placeholder(np.float32, shape=(2, 2, 2, 2))
    b = array_ops.placeholder(np.float32, shape=(4, 4, 4, 2))

    dim_nums = xla_data_pb2.DotDimensionNumbers()
    dim_nums.lhs_contracting_dimensions.append(2)
    dim_nums.rhs_contracting_dimensions.append(3)
    dim_nums.lhs_batch_dimensions.append(0)
    dim_nums.rhs_batch_dimensions.append(0)

    with self.assertRaisesRegex(ValueError,
                                'Batch dimension sizes do not match. '
                                'Got: 2 and 4'):
      xla.dot_general(a, b, dim_nums)

  def testDotShapeInference(self):
    a = array_ops.placeholder(np.float32, shape=(1, 2, 3, 4))
    b = array_ops.placeholder(np.float32, shape=(4, 3, 2, 1))

    dim_nums = xla_data_pb2.DotDimensionNumbers()
    dim_nums.lhs_contracting_dimensions.append(1)
    dim_nums.rhs_contracting_dimensions.append(2)
    dim_nums.lhs_batch_dimensions.append(3)
    dim_nums.rhs_batch_dimensions.append(0)

    c = xla.dot_general(a, b, dim_nums)
    self.assertEqual(c.shape, tensor_shape.TensorShape([4, 1, 3, 3, 1]))

if __name__ == '__main__':
  # This test is using Tensorflow sessions which are not compatible with eager
  # mode.
  ops.disable_eager_execution()
  googletest.main()


text:
Limits = {
   MinRange = 0,
   MaxRange = 9999,
   MinAltitude = -500,
   MaxAltitude = 9999,
}
-- Optional weapon slot to fire. If non-nil then an LWC is not needed.
-- However, script-fired weapons aren't governed by failsafes, so keep
-- that in mind...
-- Missile controllers on turrets should be assigned the same weapon slot
-- as their turret block.
MissileWeaponSlot = nil

-- Target selection algorithm for newly-launched missiles.
-- 1 = Focus on highest priority target
-- 2 = Pseudo-random split against all targetable targets
MissileTargetSelector = 1

-- Configuration for FakeTDC guidance
Config = {
   -- Number of seconds before guidance is disabled. Should be sufficiently
   -- long enough to account for turning radius & terminal velocity.
   -- How long to set this depends on your missile characteristics. Too long
   -- and it basically becomes a guided missile...
   OneTurnTime = 3,
   -- Whether or not this missile system fires torpedoes. If true, then it
   -- will only perform 2D aiming (i.e. same plane)
   IsTorpedo = true,
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
CTColorMRU (POI API Documentation)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.sl.draw.binding

Class CTColorMRU

java.lang.Object
  org.apache.poi.sl.draw.binding.CTColorMRU

public class CTColorMRU
extends java.lang.Object

Java class for CT_ColorMRU complex type.

The following schema fragment specifies the expected content contained within this class.

 <complexType name="CT_ColorMRU">
   <complexContent>
     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       <sequence>
         <group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_ColorChoice" maxOccurs="10" minOccurs="0"/>
       </sequence>
     </restriction>
   </complexContent>
 </complexType>

Field Summary

protected  java.util.List<java.lang.Object>
egColorChoice

Constructor Summary

CTColorMRU()

Method Summary

 java.util.List<java.lang.Object>
getEGColorChoice()

          Gets the value of the egColorChoice property.

 boolean
isSetEGColorChoice()

 void
unsetEGColorChoice()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

egColorChoice

protected java.util.List<java.lang.Object> egColorChoice

Constructor Detail

CTColorMRU

public CTColorMRU()

Method Detail

getEGColorChoice

public java.util.List<java.lang.Object> getEGColorChoice()

Gets the value of the egColorChoice property.

 This accessor method returns a reference to the live list,
 not a snapshot. Therefore any modification you make to the
 returned list will be present inside the JAXB object.
 This is why there is not a set method for the egColorChoice property.

 For example, to add a new item, do as follows:

    getEGColorChoice().add(newItem);

 Objects of the following type(s) are allowed in the list
 CTPresetColor
 CTSystemColor
 CTHslColor
 CTSRgbColor
 CTScRgbColor
 CTSchemeColor

isSetEGColorChoice

public boolean isSetEGColorChoice()

unsetEGColorChoice

public void unsetEGColorChoice()

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2015 The Apache Software Foundation or
        its licensors, as applicable.


text:
package com.datatorrent.stram.plan.logical;

import java.io.Serializable;

/**
 *
LogicalOperatorStatus class.

 *
 * @since 0.9.5
 */
public class LogicalOperatorStatus implements Serializable
{
  private static final long serialVersionUID = 201404251445L;

  public LogicalOperatorStatus(String name)
  {
    this.name = name;
  }
  public final String name;
  public long totalTuplesProcessed = 0;
  public long totalTuplesEmitted = 0;
  public long failureCount = 0;
}


text:
namespace covering
{

// Result of an intersection between object and cell.
enum CellObjectIntersection
{
  // No intersection. It is important, that its value is 0, so one can do if (intersection) ... .
  CELL_OBJECT_NO_INTERSECTION = 0,
  CELL_OBJECT_INTERSECT = 1,
  CELL_INSIDE_OBJECT = 2,
  OBJECT_INSIDE_CELL = 3
};

template <class CellIdT>
inline CellObjectIntersection IntersectCellWithLine(CellIdT const cell,
                                                    m2::PointD const & a,
                                                    m2::PointD const & b)
{
  pair<uint32_t, uint32_t> const xy = cell.XY();
  uint32_t const r = cell.Radius();
  m2::PointD const cellCorners[4] =
  {
    m2::PointD(xy.first - r, xy.second - r),
    m2::PointD(xy.first - r, xy.second + r),
    m2::PointD(xy.first + r, xy.second + r),
    m2::PointD(xy.first + r, xy.second - r)
  };
  for (int i = 0; i < 4; ++i)
    if (m2::robust::SegmentsIntersect(a, b, cellCorners[i], cellCorners[i == 0 ? 3 : i - 1]))
      return CELL_OBJECT_INTERSECT;
  if (xy.first - r <= a.x && a.x <= xy.first + r && xy.second - r <= a.y && a.y <= xy.second + r)
    return OBJECT_INSIDE_CELL;
  return CELL_OBJECT_NO_INTERSECTION;
}

template <class CellIdT>
CellObjectIntersection IntersectCellWithTriangle(
    CellIdT const cell, m2::PointD const & a, m2::PointD const & b, m2::PointD const & c)
{
  CellObjectIntersection const i1 = IntersectCellWithLine(cell, a, b);
  if (i1 == CELL_OBJECT_INTERSECT)
    return CELL_OBJECT_INTERSECT;
  CellObjectIntersection const i2 = IntersectCellWithLine(cell, b, c);
  if (i2 == CELL_OBJECT_INTERSECT)
    return CELL_OBJECT_INTERSECT;
  CellObjectIntersection const i3 = IntersectCellWithLine(cell, c, a);
  if (i3 == CELL_OBJECT_INTERSECT)
    return CELL_OBJECT_INTERSECT;
  // At this point either:
  // 1. Triangle is inside cell.
  // 2. Cell is inside triangle.
  // 3. Cell and triangle do not intersect.
  ASSERT_EQUAL(i1, i2, (cell, a, b, c));
  ASSERT_EQUAL(i2, i3, (cell, a, b, c));
  ASSERT_EQUAL(i3, i1, (cell, a, b, c));
  if (i1 == OBJECT_INSIDE_CELL || i2 == OBJECT_INSIDE_CELL || i3 == OBJECT_INSIDE_CELL)
    return OBJECT_INSIDE_CELL;
  pair<uint32_t, uint32_t> const xy = cell.XY();
  if (m2::IsPointStrictlyInsideTriangle(m2::PointD(xy.first, xy.second), a, b, c))
    return CELL_INSIDE_OBJECT;
  return CELL_OBJECT_NO_INTERSECTION;
}

template <class CellIdT, class CellIdContainerT, typename IntersectF>
void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdContainerT & out,
                 int cellDepth, CellIdT cell)
{
  if (cell.Level() == cellDepth - 1)
  {
    out.push_back(cell);
    return;
  }

  uint64_t const cellArea = my::sq(uint64_t(1 << (cellDepth - 1 - cell.Level())));
  CellObjectIntersection const intersection = intersect(cell);

  if (intersection == CELL_OBJECT_NO_INTERSECTION)
    return;
  if (intersection == CELL_INSIDE_OBJECT || cellPenaltyArea >= cellArea)
  {
    out.push_back(cell);
    return;
  }

  buffer_vector<CellIdT, 32> subdiv;
  for (uint8_t i = 0; i < 4; ++i)
    CoverObject(intersect, cellPenaltyArea, subdiv, cellDepth, cell.Child(i));

  uint64_t subdivArea = 0;
  for (size_t i = 0; i < subdiv.size(); ++i)
    subdivArea += my::sq(uint64_t(1 << (cellDepth - 1 - subdiv[i].Level())));

  ASSERT(!subdiv.empty(), (cellPenaltyArea, out, cell));

  // This criteria is more clear for me. Let's divide if we can save more than cellPenaltyArea.
  if (subdiv.size() > 1 && cellPenaltyArea >= cellArea - subdivArea)
  {
    out.push_back(cell);
  }
  else
  {
    for (size_t i = 0; i < subdiv.size(); ++i)
      out.push_back(subdiv[i]);
  }
}

} // namespace covering


text:
package org.kaaproject.kaa.common.dto;

import java.io.Serializable;

public class ChangeNotificationDto implements Serializable {

    private static final long serialVersionUID = 5138324914078714719L;

    private String appId;
    private int appSeqNumber;
    private String groupId;
    private int groupSeqNumber;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public int getAppSeqNumber() {
        return appSeqNumber;
    }

    public void setAppSeqNumber(int appSeqNumber) {
        this.appSeqNumber = appSeqNumber;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public int getGroupSeqNumber() {
        return groupSeqNumber;
    }

    public void setGroupSeqNumber(int groupSeqNumber) {
        this.groupSeqNumber = groupSeqNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ChangeNotificationDto)) {
            return false;
        }

        ChangeNotificationDto that = (ChangeNotificationDto) o;

        if (appSeqNumber != that.appSeqNumber) {
            return false;
        }
        if (groupSeqNumber != that.groupSeqNumber) {
            return false;
        }
        if (appId != null ? !appId.equals(that.appId) : that.appId != null) {
            return false;
        }
        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = appId != null ? appId.hashCode() : 0;
        result = 31 * result + appSeqNumber;
        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
        result = 31 * result + groupSeqNumber;
        return result;
    }

    @Override
    public String toString() {
        return "ChangeNotificationDto{" +
                "appId='" + appId + '\'' +
                ", appSeqNumber=" + appSeqNumber +
                ", groupId='" + groupId + '\'' +
                ", groupSeqNumber=" + groupSeqNumber +
                '}';
    }
}


text:
/**
 * @fileoverview FileListView listing files and display states(like size, count).
 * @author NHN. FE Development Lab <dl_javascript@nhn.com>
 */

'use strict';

var $ = require('jquery');
var snippet = require('tui-code-snippet');

var utils = require('../utils');
var Item = require('./item');
var consts = require('../consts');

var classNames = consts.className;
var forEach = snippet.forEach;
var isUndefined = snippet.isUndefined;
var isArraySafe = snippet.isArraySafe;

/**
 * List view
 * @class List
 * @param {jQuery} $el - Container element to generate list view
 * @param {object} options - Options to set list view
 *     @param {object} options.listType - List type ('simple' or 'table')
 *     @param {string} [options.item] - To customize item contents when list type is 'simple'
 *     @param {array.<object>} [options.columnList] - To customize row contents when list type is 'table'
 * @ignore
 */
var List = snippet.defineClass(/** @lends List.prototype */{
    init: function($el, options) {
        /**
         * jQuery-element of list container
         * @type {jQuery}
         */
        this.$el = $el;

        /**
         * jQuery-element of list
         * @type {jQuery}
         */
        this.$list = null;

        /**
         * jQuery-element of checkbox in header
         * @type {jQuery}
         */
        this.$checkbox = null;

        /**
         * List type
         * @type {string}
         */
        this.listType = options.type;

        /**
         * Item template preset of simple list
         * @type {string}
         */
        this.item = options.item;

        /**
         * Item template preset of table
         * @type {Array.<Object>}
         */
        this.columnList = options.columnList;

        /**
         * Item's template in list
         * @type {string}
         */
        this.itemTemplate = null;

        /**
         * Items
         * @type {Array.<Item>}
         */
        this.items = [];

        this._render();
        this._addEvent();
    },

    /**
     * Render list view
     * @private
     */
    _render: function() {
        var isTableList = (this.listType === 'table');
        var $listContainer = this._getListContainer(isTableList);

        this.$el.append($listContainer);

        if (isTableList) {
            this._setTableWidth($listContainer);
            this._setColumnGroup();
            this._setTableHeader();
            this._setTableRowTemplate();
        } else {
            this._setListItemTemplate();
        }

        this.$list = this.$el.find('.' + classNames.LIST_ITEMS_CONTAINER);
        this.$checkbox = this.$el.find(':checkbox');
    },

    /**
     * Add event on checkbox
     * @private
     */
    _addEvent: function() {
        if (this.$checkbox) {
            this.$checkbox.on('change', $.proxy(this._onChange, this));
        }
    },

    /**
     * Change event handler
     * @private
     */
    _onChange: function() {
        var state = !!this.$checkbox.prop('checked');

        this._changeCheckboxInItem(state);
        this._changeCheckboxInHeader(state);

        this.fire('checkAll', {
            filelist: this.getCheckedItems()
        });
    },

    /**
     * Get container element of list
     * @param {boolean} isTableList - Whether list type is "table" or not
     * @returns {jQuery} List container
     * @private
     */
    _getListContainer: function(isTableList) {
        var template = isTableList ? consts.tableTemplate : consts.listTemplate;

        return $(utils.template({
            listItemsClassName: classNames.LIST_ITEMS_CONTAINER,
            checkbox: consts.html.CHECKBOX
        }, template.CONTAINER));
    },

    /**
     * Set width of table
     * @param {jQuery} $listContainer - List container element
     * @private
     */
    _setTableWidth: function($listContainer) {
        var columns = this.columnList;
        var totalWidth = parseInt($listContainer.width(), 10);
        var sumWidth = 0;
        var emptyCount = 0;

        forEach(columns, function(column) {
            if (column.width) {
                sumWidth += column.width;
            } else {
                emptyCount += 1;
            }
        });

        if (columns) {
            this._setEmptyWidth(totalWidth - sumWidth, emptyCount);
        }
    },

    /**
     * Set empty width value
     * @param {number} extraWidth - Extra width value
     * @param {number} emptyCount - Empty width count
     * @private
     */
    _setEmptyWidth: function(extraWidth, emptyCount) {
        var columns = this.columnList;
        var eachWidth = Math.floor(extraWidth / emptyCount);
        var lastWidth = eachWidth + (extraWidth % emptyCount);

        forEach(columns, function(column, index) {
            if (!column.width) {
                column.width = ((columns.length - 1) === index) ? lastWidth : eachWidth;
            }
        });
    },

    /**
     * Set column group in table
     * @private
     */
    _setColumnGroup: function() {
        var $colgroup = this.$el.find('colgroup');
        var columns = this.columnList;
        var html = '';

        forEach(columns, function(column) {
            html += '<col width="' + column.width + '">';
        });

        if (columns) {
            $colgroup.html(html);
        }
    },

    /**
     * Set table header
     * @private
     */
    _setTableHeader: function() {
        var columns = this.columnList;
        var html = '';
        var headerCount = 0;

        forEach(columns, function(column) {
            if (!isUndefined(column.header)) {
                html += '' + column.header + '	';
                headerCount += 1;
            }
        });

        if (columns) {
            this._setHeaderElement(html, (headerCount === columns.length));
        }
    },

    /**
     * Set header element
     * @param {string} html - Template of header
     * @param {boolean} hasHeader - Whether has header or not
     * @private
     */
    _setHeaderElement: function(html, hasHeader) {
        var $thead = this.$el.find('thead');

        if (hasHeader) {
            html = utils.template({
                checkbox: consts.html.CHECKBOX
            }, html);
            $thead.html('
' + html + '
');
            $thead.find('th').first().css('border-right', 0);
            $thead.find('th').last().css('border-right', 0);
        } else {
            $thead.hide();
        }
    },

    /**
     * Set row's template of table
     * @private
     */
    _setTableRowTemplate: function() {
        var columns = this.columnList;
        var html = '';

        forEach(columns, function(column) {
            html += '' + column.body + '	';
        });

        if (html) {
            html = '
' + html + '
';
        } else {
            html = consts.tableTemplate.LIST_ITEM;
        }

        this.itemTemplate = html;
    },

    /**
     * Set item's template of list
     * @private
     */
    _setListItemTemplate: function() {
        var item = this.item;
        var html;

        if (item) {
            html = '
' + item + '
';
        } else {
            html = consts.listTemplate.LIST_ITEM;
        }

        this.itemTemplate = html;
    },

    /**
     * Set class name to list
     * @private
     */
    _setHasItemsClassName: function() {
        var className = classNames.HAS_ITEMS;
        var hasItems = !!this.items.length;

        if (hasItems) {
            this.$el.addClass(className);
        } else {
            this.$el.removeClass(className);
        }
    },

    /**
     * Set last column's width value
     */
    _setLastColumnWidth: function() {
        var lastTheadWidth = this.$el.find('th').last()[0].width;
        var scrollWidth = this.$list.width() - this.$list[0].scrollWidth;
        var lastColumWidth = lastTheadWidth - scrollWidth;

        forEach(this.items, function(item) {
            item.$el.find('td').last().attr('width', lastColumWidth);
        });
    },

    /**
     * Add file items
     * @param {object} files - Added file list
     * @private
     */
    _addFileItems: function(files) {
        if (!isArraySafe(files)) { // for target from iframe, use "isArraySafe"
            files = [files];
        }
        forEach(files, function(file) {
            this.items.push(this._createItem(file));
        }, this);
    },

    /**
     * Remove file items
     * @param {object} data - Removed item's
     * @private
     */
    _removeFileItems: function(data) {
        var removedItem;

        this.items = snippet.filter(this.items, function(item) {
            removedItem = data[item.id];

            if (removedItem) {
                item.destroy();
            }

            return !removedItem;
        }, this);
    },

    /**
     * Create item By Data
     * @param {object} data - Data for list items
     * @returns {Item} Item
     * @private
     */
    _createItem: function(data) {
        var item = new Item(this.$list, data, this.itemTemplate);
        item.on('remove', this._onRemove, this);
        item.on('check', this._onCheck, this);

        return item;
    },

    /**
     * Remove event handler on each item
     * @param {Item} data - Remove item's data
     * @private
     */
    _onRemove: function(data) {
        this.fire('remove', data);
    },

    /**
     * Check event handler fired on each list item
     * @param {string} data - Current selected item's data
     * @private
     */
    _onCheck: function(data) {
        this._setCheckedAll();

        this.fire('check', data);
    },

    /**
     * Set checked all state
     * @private
     */
    _setCheckedAll: function() {
        var checkedItems = this.getCheckedItems();
        var isCheckedAll = (checkedItems.length === this.items.length) &&
                            !!(this.items.length);

        this.$checkbox.prop('checked', isCheckedAll);
        this._changeCheckboxInHeader(isCheckedAll);
    },

    /**
     * Change checkbox in table header
     * @param {boolean} state - Checked state
     * @private
     */
    _changeCheckboxInHeader: function(state) {
        var $checkbox = this.$checkbox;
        var $label = utils.getLabelElement($checkbox);
        var $target = $label ? $label : $checkbox;
        var className = classNames.IS_CHECKED;

        if (state) {
            $target.addClass(className);
        } else {
            $target.removeClass(className);
        }
    },

    /**
     * Change checkbox in list item
     * @param {boolean} state - Checked state
     * @private
     */
    _changeCheckboxInItem: function(state) {
        forEach(this.items, function(item) {
            item.changeCheckboxState(state);
        });
    },

    /**
     * Get checked items
     * @returns {Array.<object>} Checked item data
     */
    getCheckedItems: function() {
        var checkedItems = [];

        snippet.forEach(this.items, function(item) {
            if (item.getCheckedState()) {
                checkedItems.push({
                    id: item.id,
                    name: item.name,
                    size: item.size
                });
            }
        });

        return checkedItems;
    },

    /**
     * Update item list
     * @param {object} data - File information(s) with type
     * @param {*} type - Update type
     */
    update: function(data, type) {
        if (type === 'remove') {
            this._removeFileItems(data);
        } else {
            this._addFileItems(data);
        }

        if (this.listType === 'table') {
            this._setHasItemsClassName();
            this._setCheckedAll();
            this._setLastColumnWidth();
        }
    },

    /**
     * Clear list
     */
    clear: function() {
        forEach(this.items, function(item) {
            item.destroy();
        });
        this.items.length = 0;
        this._setHasItemsClassName();
        this._setCheckedAll();
    }
});

snippet.CustomEvents.mixin(List);

module.exports = List;