CartQuery
class CartQuery extends ModelCriteria
Base class that represents a query for the 'cart' table.
Methods
Initializes internal state of \Thelia\Model\Base\CartQuery object.
Returns a new ChildCartQuery object.
Find objects by primary key
$objs = $c->findPks(array(12, 56, 832), $con);
Filter the query by primary key
Filter the query by a list of primary keys
Filter the query on the id column
Filter the query on the token column
Filter the query on the customer_id column
Filter the query on the addressdeliveryid column
Filter the query on the addressinvoiceid column
Filter the query on the currency_id column
Filter the query on the discount column
Filter the query on the created_at column
Filter the query on the updated_at column
Filter the query by a related \Thelia\Model\Customer object
Adds a JOIN clause to the query using the Customer relation
Use the Customer relation Customer object
Filter the query by a related \Thelia\Model\Address object
Adds a JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
Use the AddressRelatedByAddressDeliveryId relation Address object
Filter the query by a related \Thelia\Model\Address object
Adds a JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
Use the AddressRelatedByAddressInvoiceId relation Address object
Filter the query by a related \Thelia\Model\Currency object
Adds a JOIN clause to the query using the Currency relation
Use the Currency relation Currency object
Filter the query by a related \Thelia\Model\CartItem object
Adds a JOIN clause to the query using the CartItem relation
Use the CartItem relation CartItem object
Deletes all rows from the cart table.
Performs a DELETE on the database, given a ChildCart or Criteria object OR a primary key value.
Filter by the latest updated
Filter by the latest created
Order by update date desc
Order by update date asc
Order by create date desc
Order by create date asc
Order by the id column
Order by the token column
Order by the customer_id column
Order by the addressdeliveryid column
Order by the addressinvoiceid column
Order by the currency_id column
Order by the discount column
Order by the created_at column
Order by the updated_at column
Group by the id column
Group by the token column
Group by the customer_id column
Group by the addressdeliveryid column
Group by the addressinvoiceid column
Group by the currency_id column
Group by the discount column
Group by the created_at column
Group by the updated_at column
Adds a LEFT JOIN clause to the query
Adds a RIGHT JOIN clause to the query
Adds a INNER JOIN clause to the query
Adds a LEFT JOIN clause to the query using the Customer relation
Adds a RIGHT JOIN clause to the query using the Customer relation
Adds a INNER JOIN clause to the query using the Customer relation
Adds a LEFT JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
Adds a RIGHT JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
Adds a INNER JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
Adds a LEFT JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
Adds a RIGHT JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
Adds a INNER JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
Adds a LEFT JOIN clause to the query using the Currency relation
Adds a RIGHT JOIN clause to the query using the Currency relation
Adds a INNER JOIN clause to the query using the Currency relation
Adds a LEFT JOIN clause to the query using the CartItem relation
Adds a RIGHT JOIN clause to the query using the CartItem relation
Adds a INNER JOIN clause to the query using the CartItem relation
Return the first ChildCart matching the query
Return the first ChildCart matching the query, or a new ChildCart object populated from the query conditions when no match is found
Return the first ChildCart filtered by the id column
Return the first ChildCart filtered by the token column
Return the first ChildCart filtered by the customer_id column
Return the first ChildCart filtered by the addressdeliveryid column
Return the first ChildCart filtered by the addressinvoiceid column
Return the first ChildCart filtered by the currency_id column
Return the first ChildCart filtered by the discount column
Return the first ChildCart filtered by the created_at column
Return the first ChildCart filtered by the updated_at column
Return ChildCart objects filtered by the id column
Return ChildCart objects filtered by the token column
Return ChildCart objects filtered by the customer_id column
Return ChildCart objects filtered by the addressdeliveryid column
Return ChildCart objects filtered by the addressinvoiceid column
Return ChildCart objects filtered by the currency_id column
Return ChildCart objects filtered by the discount column
Return ChildCart objects filtered by the created_at column
Return ChildCart objects filtered by the updated_at column
Details
at line 102
__construct(
string $dbName = 'thelia',
string $modelName = '\\Thelia\\Model\\Cart',
string $modelAlias = null)
Initializes internal state of \Thelia\Model\Base\CartQuery object.
at line 115
static
CartQuery
create(
string $modelAlias = null,
Criteria $criteria = null)
Returns a new ChildCartQuery object.
at line 145
Cart|array|mixed
findPk(
mixed $key,
ConnectionInterface $con = null)
Find object by primary key.
Propel uses the instance pool to skip the database if the object exists. Go fast if the query is untouched.
$obj = $c->findPk(12, $con);
at line 227
ObjectCollection|array|mixed
findPks(
array $keys,
ConnectionInterface $con = null)
Find objects by primary key
$objs = $c->findPks(array(12, 56, 832), $con);
at line 248
CartQuery
filterByPrimaryKey(
mixed $key)
Filter the query by primary key
at line 261
CartQuery
filterByPrimaryKeys(
array $keys)
Filter the query by a list of primary keys
at line 285
CartQuery
filterById(
mixed $id = null,
string $comparison = null)
Filter the query on the id column
Example usage:
$query->filterById(1234); // WHERE id = 1234
$query->filterById(array(12, 34)); // WHERE id IN (12, 34)
$query->filterById(array('min' => 12)); // WHERE id > 12
at line 323
CartQuery
filterByToken(
string $token = null,
string $comparison = null)
Filter the query on the token column
Example usage:
$query->filterByToken('fooValue'); // WHERE token = 'fooValue'
$query->filterByToken('%fooValue%'); // WHERE token LIKE '%fooValue%'
at line 357
CartQuery
filterByCustomerId(
mixed $customerId = null,
string $comparison = null)
Filter the query on the customer_id column
Example usage:
$query->filterByCustomerId(1234); // WHERE customerid = 1234
$query->filterByCustomerId(array(12, 34)); // WHERE customerid IN (12, 34)
$query->filterByCustomerId(array('min' => 12)); // WHERE customer_id > 12
at line 400
CartQuery
filterByAddressDeliveryId(
mixed $addressDeliveryId = null,
string $comparison = null)
Filter the query on the addressdeliveryid column
Example usage:
$query->filterByAddressDeliveryId(1234); // WHERE addressdeliveryid = 1234
$query->filterByAddressDeliveryId(array(12, 34)); // WHERE addressdeliveryid IN (12, 34)
$query->filterByAddressDeliveryId(array('min' => 12)); // WHERE addressdeliveryid > 12
at line 443
CartQuery
filterByAddressInvoiceId(
mixed $addressInvoiceId = null,
string $comparison = null)
Filter the query on the addressinvoiceid column
Example usage:
$query->filterByAddressInvoiceId(1234); // WHERE addressinvoiceid = 1234
$query->filterByAddressInvoiceId(array(12, 34)); // WHERE addressinvoiceid IN (12, 34)
$query->filterByAddressInvoiceId(array('min' => 12)); // WHERE addressinvoiceid > 12
at line 486
CartQuery
filterByCurrencyId(
mixed $currencyId = null,
string $comparison = null)
Filter the query on the currency_id column
Example usage:
$query->filterByCurrencyId(1234); // WHERE currencyid = 1234
$query->filterByCurrencyId(array(12, 34)); // WHERE currencyid IN (12, 34)
$query->filterByCurrencyId(array('min' => 12)); // WHERE currency_id > 12
at line 527
CartQuery
filterByDiscount(
mixed $discount = null,
string $comparison = null)
Filter the query on the discount column
Example usage:
$query->filterByDiscount(1234); // WHERE discount = 1234
$query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
$query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
at line 570
CartQuery
filterByCreatedAt(
mixed $createdAt = null,
string $comparison = null)
Filter the query on the created_at column
Example usage:
$query->filterByCreatedAt('2011-03-14'); // WHERE createdat = '2011-03-14'
$query->filterByCreatedAt('now'); // WHERE createdat = '2011-03-14'
$query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
at line 613
CartQuery
filterByUpdatedAt(
mixed $updatedAt = null,
string $comparison = null)
Filter the query on the updated_at column
Example usage:
$query->filterByUpdatedAt('2011-03-14'); // WHERE updatedat = '2011-03-14'
$query->filterByUpdatedAt('now'); // WHERE updatedat = '2011-03-14'
$query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
at line 644
CartQuery
filterByCustomer(
Customer|ObjectCollection $customer,
string $comparison = null)
Filter the query by a related \Thelia\Model\Customer object
at line 669
CartQuery
joinCustomer(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Adds a JOIN clause to the query using the Customer relation
at line 704
CustomerQuery
useCustomerQuery(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Use the Customer relation Customer object
at line 719
CartQuery
filterByAddressRelatedByAddressDeliveryId(
Address|ObjectCollection $address,
string $comparison = null)
Filter the query by a related \Thelia\Model\Address object
at line 744
CartQuery
joinAddressRelatedByAddressDeliveryId(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Adds a JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
at line 779
AddressQuery
useAddressRelatedByAddressDeliveryIdQuery(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Use the AddressRelatedByAddressDeliveryId relation Address object
at line 794
CartQuery
filterByAddressRelatedByAddressInvoiceId(
Address|ObjectCollection $address,
string $comparison = null)
Filter the query by a related \Thelia\Model\Address object
at line 819
CartQuery
joinAddressRelatedByAddressInvoiceId(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Adds a JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
at line 854
AddressQuery
useAddressRelatedByAddressInvoiceIdQuery(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Use the AddressRelatedByAddressInvoiceId relation Address object
at line 869
CartQuery
filterByCurrency(
Currency|ObjectCollection $currency,
string $comparison = null)
Filter the query by a related \Thelia\Model\Currency object
at line 894
CartQuery
joinCurrency(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Adds a JOIN clause to the query using the Currency relation
at line 929
CurrencyQuery
useCurrencyQuery(
string $relationAlias = null,
string $joinType = Criteria::LEFT_JOIN)
Use the Currency relation Currency object
at line 944
CartQuery
filterByCartItem(
CartItem|ObjectCollection $cartItem,
string $comparison = null)
Filter the query by a related \Thelia\Model\CartItem object
at line 967
CartQuery
joinCartItem(
string $relationAlias = null,
string $joinType = Criteria::INNER_JOIN)
Adds a JOIN clause to the query using the CartItem relation
at line 1002
CartItemQuery
useCartItemQuery(
string $relationAlias = null,
string $joinType = Criteria::INNER_JOIN)
Use the CartItem relation CartItem object
at line 1031
int
doDeleteAll(
ConnectionInterface $con = null)
Deletes all rows from the cart table.
at line 1068
int
delete(
ConnectionInterface $con = null)
Performs a DELETE on the database, given a ChildCart or Criteria object OR a primary key value.
at line 1109
CartQuery
recentlyUpdated(
int $nbDays = 7)
Filter by the latest updated
at line 1121
CartQuery
recentlyCreated(
int $nbDays = 7)
Filter by the latest created
at line 1131
CartQuery
lastUpdatedFirst()
Order by update date desc
at line 1141
CartQuery
firstUpdatedFirst()
Order by update date asc
at line 1151
CartQuery
lastCreatedFirst()
Order by create date desc
at line 1161
CartQuery
firstCreatedFirst()
Order by create date asc
at line 92
ChildCartQuery
orderById($order = Criteria::ASC)
Order by the id column
at line 92
ChildCartQuery
orderByToken($order = Criteria::ASC)
Order by the token column
at line 92
ChildCartQuery
orderByCustomerId($order = Criteria::ASC)
Order by the customer_id column
at line 92
ChildCartQuery
orderByAddressDeliveryId($order = Criteria::ASC)
Order by the addressdeliveryid column
at line 92
ChildCartQuery
orderByAddressInvoiceId($order = Criteria::ASC)
Order by the addressinvoiceid column
at line 92
ChildCartQuery
orderByCurrencyId($order = Criteria::ASC)
Order by the currency_id column
at line 92
ChildCartQuery
orderByDiscount($order = Criteria::ASC)
Order by the discount column
at line 92
ChildCartQuery
orderByCreatedAt($order = Criteria::ASC)
Order by the created_at column
at line 92
ChildCartQuery
orderByUpdatedAt($order = Criteria::ASC)
Order by the updated_at column
at line 92
ChildCartQuery
groupById()
Group by the id column
at line 92
ChildCartQuery
groupByToken()
Group by the token column
at line 92
ChildCartQuery
groupByCustomerId()
Group by the customer_id column
at line 92
ChildCartQuery
groupByAddressDeliveryId()
Group by the addressdeliveryid column
at line 92
ChildCartQuery
groupByAddressInvoiceId()
Group by the addressinvoiceid column
at line 92
ChildCartQuery
groupByCurrencyId()
Group by the currency_id column
at line 92
ChildCartQuery
groupByDiscount()
Group by the discount column
at line 92
ChildCartQuery
groupByCreatedAt()
Group by the created_at column
at line 92
ChildCartQuery
groupByUpdatedAt()
Group by the updated_at column
at line 92
ChildCartQuery
leftJoin($relation)
Adds a LEFT JOIN clause to the query
at line 92
ChildCartQuery
rightJoin($relation)
Adds a RIGHT JOIN clause to the query
at line 92
ChildCartQuery
innerJoin($relation)
Adds a INNER JOIN clause to the query
at line 92
ChildCartQuery
leftJoinCustomer($relationAlias = null)
Adds a LEFT JOIN clause to the query using the Customer relation
at line 92
ChildCartQuery
rightJoinCustomer($relationAlias = null)
Adds a RIGHT JOIN clause to the query using the Customer relation
at line 92
ChildCartQuery
innerJoinCustomer($relationAlias = null)
Adds a INNER JOIN clause to the query using the Customer relation
at line 92
ChildCartQuery
leftJoinAddressRelatedByAddressDeliveryId($relationAlias = null)
Adds a LEFT JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
at line 92
ChildCartQuery
rightJoinAddressRelatedByAddressDeliveryId($relationAlias = null)
Adds a RIGHT JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
at line 92
ChildCartQuery
innerJoinAddressRelatedByAddressDeliveryId($relationAlias = null)
Adds a INNER JOIN clause to the query using the AddressRelatedByAddressDeliveryId relation
at line 92
ChildCartQuery
leftJoinAddressRelatedByAddressInvoiceId($relationAlias = null)
Adds a LEFT JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
at line 92
ChildCartQuery
rightJoinAddressRelatedByAddressInvoiceId($relationAlias = null)
Adds a RIGHT JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
at line 92
ChildCartQuery
innerJoinAddressRelatedByAddressInvoiceId($relationAlias = null)
Adds a INNER JOIN clause to the query using the AddressRelatedByAddressInvoiceId relation
at line 92
ChildCartQuery
leftJoinCurrency($relationAlias = null)
Adds a LEFT JOIN clause to the query using the Currency relation
at line 92
ChildCartQuery
rightJoinCurrency($relationAlias = null)
Adds a RIGHT JOIN clause to the query using the Currency relation
at line 92
ChildCartQuery
innerJoinCurrency($relationAlias = null)
Adds a INNER JOIN clause to the query using the Currency relation
at line 92
ChildCartQuery
leftJoinCartItem($relationAlias = null)
Adds a LEFT JOIN clause to the query using the CartItem relation
at line 92
ChildCartQuery
rightJoinCartItem($relationAlias = null)
Adds a RIGHT JOIN clause to the query using the CartItem relation
at line 92
ChildCartQuery
innerJoinCartItem($relationAlias = null)
Adds a INNER JOIN clause to the query using the CartItem relation
at line 92
ChildCart
findOne(
ConnectionInterface $con = null)
Return the first ChildCart matching the query
at line 92
ChildCart
findOneOrCreate(
ConnectionInterface $con = null)
Return the first ChildCart matching the query, or a new ChildCart object populated from the query conditions when no match is found
at line 92
ChildCart
findOneById(
int $id)
Return the first ChildCart filtered by the id column
at line 92
ChildCart
findOneByToken(
string $token)
Return the first ChildCart filtered by the token column
at line 92
ChildCart
findOneByCustomerId(
int $customer_id)
Return the first ChildCart filtered by the customer_id column
at line 92
ChildCart
findOneByAddressDeliveryId(
int $address_delivery_id)
Return the first ChildCart filtered by the addressdeliveryid column
at line 92
ChildCart
findOneByAddressInvoiceId(
int $address_invoice_id)
Return the first ChildCart filtered by the addressinvoiceid column
at line 92
ChildCart
findOneByCurrencyId(
int $currency_id)
Return the first ChildCart filtered by the currency_id column
at line 92
ChildCart
findOneByDiscount(
string $discount)
Return the first ChildCart filtered by the discount column
at line 92
ChildCart
findOneByCreatedAt(
string $created_at)
Return the first ChildCart filtered by the created_at column
at line 92
ChildCart
findOneByUpdatedAt(
string $updated_at)
Return the first ChildCart filtered by the updated_at column
at line 92
array
findById(
int $id)
Return ChildCart objects filtered by the id column
at line 92
array
findByToken(
string $token)
Return ChildCart objects filtered by the token column
at line 92
array
findByCustomerId(
int $customer_id)
Return ChildCart objects filtered by the customer_id column
at line 92
array
findByAddressDeliveryId(
int $address_delivery_id)
Return ChildCart objects filtered by the addressdeliveryid column
at line 92
array
findByAddressInvoiceId(
int $address_invoice_id)
Return ChildCart objects filtered by the addressinvoiceid column
at line 92
array
findByCurrencyId(
int $currency_id)
Return ChildCart objects filtered by the currency_id column
at line 92
array
findByDiscount(
string $discount)
Return ChildCart objects filtered by the discount column
at line 92
array
findByCreatedAt(
string $created_at)
Return ChildCart objects filtered by the created_at column
at line 92
array
findByUpdatedAt(
string $updated_at)
Return ChildCart objects filtered by the updated_at column


Work Day Scheduler
A simple calendar app for scheduling your work day
9:00am
10:00am
11:00am
12:00pm
1:00pm
2:00pm
3:00pm
4:00pm
5:00pm


Media Type:Video Length: 4:00 min Summary: At the conclusion of this video, viewers will understand how technology enables electronic care coordination using a fictitious patient's health privacy preferences and ultimately their health records between care providers.


| Path: | rcapture/module_doc.rb |
| Last Update: | 2010-02-20 15:27:03 +0100 |
The module RCapture is your single entry point when it comes to method capturing/hooking.
To hook/capture methods you need to
Here is a set of examples that should help you getting started. Those examples are part of the RCapture distribution
The following example illustrates basic class and instance level hooking and makes use of the passed CapturedInfo instance to query details.
require 'rcapture' # Enrich Array class. class Array include RCapture::Interceptable end # Install a hook at insertion methods of Array. # Calling capture methods at class level will capture # insertions from all instances of Array. Array.capture_pre :methods => [:<<, :push] do |cs| puts "'#{cs.method}' will be called with #{cs.args.first}" end [] << 1 << 2 [].push :hello # Installing a hook on instance level will # affect only that single instance a = [] a.capture_post :methods => :length do |cs| puts "Length of 'a' is #{cs.return}" end a << 1 a.length # Any other array will not be affected [].length #=> '<<' was called with 1! #=> '<<' was called with 2! #=> 'push' was called with hello! #=> '<<' was called with 1! #=> Length of 'a' is 1
In this example quickly shows how to hook class methods.
require 'rcapture' # Enrich Math module module Math include RCapture::Interceptable end Math.capture_pre :class_methods => [:cos, :acos, :sin, :asin] do puts "Hello Trigonometry!" end Math.cos(0) #=> Hello Trigonometry!#
The following example illustrates capturing methods in order to modify input and return arguments. Further, it illustrates how capture methods of a single instance only.
require 'rcapture' # Enrich single instance x = [] x.extend(RCapture::Interceptable) # Define procs that will modify the input arguments inc = Proc.new { |ci| ci.args[0] += 1 } dec = Proc.new { |ci| ci.args[0] -= 1 } mul = Proc.new { |ci| ci.args[0] *= 2 } # Capture ':<<' multiple times. x.capture_pre :methods => :<<, &inc x.capture_pre :methods => :<<, &mul x.capture_pre :methods => :<<, &inc x.capture_pre :methods => :<<, &dec x.capture_pre :methods => :<<, &dec x << 2 << 4 p x #=> [3,7] # Similarily, you can modify return values y = [] y.extend(RCapture::Interceptable) inc = Proc.new { |ci| ci.return += 1 } dec = Proc.new { |ci| ci.return -= 1 } mul = Proc.new { |ci| ci.return *= 2 } y.capture_post :methods => :[], &inc y.capture_post :methods => :[], &mul y.capture_post :methods => :[], &inc y.capture_post :methods => :[], &dec y.capture_post :methods => :[], &dec y << 1 << 4 p y[0] #=> 3 p y[1] #=> 9#
Additionally to modifying arguments you can prevent captured method from being called using a Interceptable#capture_pre hook.
require 'rcapture' # This array will only accept even numbers x = [] x.extend(RCapture::Interceptable) even_filter = Proc.new do |ci| # Define the predicate that must evaluate to true # in order to call the captured method ci.predicate = (ci.args.first % 2 == 0) # In case the predicate evaluates to false you # can use the return property to control # what is returned from the captured method instead # Insertion to array returns the array itself: ci.return = ci.sender end x.capture_pre :methods => [:<<, :push], &even_filter x << 2 << 3 << 4 << 5 << 6 x.push(7).push(8) p x #=> [2,4,6,8]#
During processing of a callback, capturing is disabled. Otherwise, this could lead to infinite recursion as the following examples demonstrates.
require 'rcapture' class Fixnum include RCapture::Interceptable end op_count = 0 Fixnum.capture :methods => :+ do |cs| # Here we use Fixnum#+ inside the callback. # RCapture takes special care that anything that # happens inside a callback remains capture-free. op_count = op_count + 1 end x = 1 + 1 + 2 + 3 p op_count #=> 3#
Captured methods propagate through derivates as long as they are not overridden by a class.
require 'rcapture' include RCapture # Closed polygon class Polygon include Interceptable def vertices; self.edges; end end # Triangle class Triangle < Polygon def edges; 3; end end # Degenerate polygon class Digon < Polygon def edges; 1; end def vertices; 2; end end # Four sided polygon class Quadliteral < Polygon def edges; 4; end def vertices; super; end end called = 0 Polygon.capture :methods => :vertices do called += 1 end Triangle.new.vertices # +1 Digon.new.vertices # - Quadliteral.new.vertices # +1 p called #=> 2#
RCapture is a lock-free implementation that supports multithreading. There is no restriction on the number of threads that call a shared callback. Captures, however, should be called only from a single thread or guaranteed to be synchronized by the user. Since callbacks can be invoked from multiple threads in parallel, shared resources from within the callbacks need to be synchronized by the user. The passed CapturedInfo is a thread-local variable and needs not to be synchronized. The following example illustrates this.
require 'rcapture' require 'thread' # Will keep track of Enumberable#inject results inject_results = [] m = Mutex.new module Enumerable include RCapture::Interceptable end Enumerable.capture :methods => :inject do |cs| # Callbacks can be invoked from multiple threads. # So we need to synchronize access to shared resources. m.synchronize do inject_results << cs.return end end array = [] 10000.times {array << rand(100)} threads = [] 5.times do t = Thread.new do sum = array.inject(0) {|memo, e| memo + e} end threads << t end threads.each {|t| t.join } p inject_results #=> [493311, 493311, 493311, 493311, 493311] or similar#
Here is one final example that stimulate your imagination of what can be done with RCapture: given any class, it is often desireable to work with newly created instance by passing a block to new. If that class does not support this you can use RCapture to enable this behaviour.
require 'rcapture' include RCapture class X include Interceptable def initialize(name); @name = name; end def say_hello; puts "Hello, #{@name}!"; end end class Y < X def initialize; super("Y"); end end X.capture :class_methods => :new do |ci| ci.block.call(ci.return) if ci.block end # Now you can use X and Y as if it supports # blocks x = X.new("Christoph") do |x| x.say_hello #=> "Hello, Christoph!" end y = Y.new do |y| y.say_hello #=> "Hello, Y!" end # Or leaf the block argument away x = X.new("Christoph") y = Y.new#
RCapture works on Ruby 1.8.x and 1.9.x. Due to API changes between 1.8 and 1.9, RCapture selects an appropriate implementation of its core methods. Here is a benchmark that illustrates the overhead on 1.8 and 1.9 when a captured method is called.
require 'test/unit' require 'test/unit/testee' require 'benchmark' require 'rcapture' class Fixnum include RCapture::Interceptable end class BenchmarkCapture < Test::Unit::TestCase def test_benchmark_native n = 100000 puts "Benchmarking addition" Benchmark.bm do |x| x.report { n.times do; 1+1; end } Fixnum.capture :methods => :+ do end x.report { n.times do; 1+1; end } end # On my machine Intel Q6600, 2.4GHz # # Ruby 1.8.6 # user system total real # 0.015000 0.000000 0.015000 ( 0.027000) # 1.610000 0.000000 1.610000 ( 1.629000) # overhead is roughly 0,00001602 secs per invocation # # Ruby 1.9.1 # user system total real # 0.000000 0.000000 0.000000 ( 0.009765) # 0.359000 0.000000 0.359000 ( 0.356446) # overhead is roughly 0,0000034 secs per invocation end def test_benchmark_construct n = 100000 puts "Benchmarking construction of new objects" Benchmark.bm do |x| x.report { n.times do; Testee.new; end } Testee.capture :class_methods => :new do end x.report { n.times do; Testee.new; end } end # On my machine Intel Q6600, 2.4GHz # # user system total real # 0.188000 0.000000 0.188000 ( 0.208000) # 1.812000 0.000000 1.812000 ( 1.836000) # overhead is roughly 0,00001628 secs per invocation # # Ruby 1.9.1 # user system total real # 0.047000 0.000000 0.047000 ( 0.051757) # 0.422000 0.000000 0.422000 ( 0.408203) # overhead is roughly 0,00000357 secs per invocation end end


There are growing concerns on flow data in diverse fields including trade, migration, knowledge diffusion, disease spread, and transportation. The package is an effective visual support to learn the pattern of flow which is called halfcircle diagram. The flow between two nodes placed on the center line of a circle is represented using a half circle drawn from the origin to the destination in a clockwise direction. Through changing the order of nodes, the halfcircle diagram enables users to examine the complex relationship between bidirectional flow and each potential determinants. Furthermore, the halfmeancenter function, which calculates (un) weighted mean center of half circles, makes the comparison easier.
| Version: | 0.1.0 |
| Depends: | R (≥ 2.10) |
| Imports: | scales, graphics |
| Suggests: | knitr, rmarkdown |
| Published: | 2018-11-02 |
| Author: | Sohyun Park, Ningchuan Xiao |
| Maintainer: | Sohyun Park <park.2627 at osu.edu> |
| License: | MIT + file LICENSE |
| NeedsCompilation: | no |
| CRAN checks: | halfcircle results |
| Reference manual: | halfcircle.pdf |
| Package source: | halfcircle_0.1.0.tar.gz |
| Windows binaries: | r-devel: halfcircle_0.1.0.zip, r-release: halfcircle_0.1.0.zip, r-oldrel: halfcircle_0.1.0.zip |
| OS X binaries: | r-release: halfcircle_0.1.0.tgz, r-oldrel: halfcircle_0.1.0.tgz |
Please use the canonical form https://CRAN.R-project.org/package=halfcircle to link to this page.


The
Form Builder
allows you to build a
Form
Wizard
PDF
as JSON Schema
which
Renders as a Form
in your Application
which creates a Submission JSON


|
hcash
2.0.0
hcash
|
#include <lstate.h>
Public Attributes | |
| lua_Alloc | frealloc |
| void * | ud |
| l_mem | totalbytes |
| l_mem | GCdebt |
| lu_mem | GCmemtrav |
| lu_mem | GCestimate |
| stringtable | strt |
| TValue | l_registry |
| unsigned int | seed |
| lu_byte | currentwhite |
| lu_byte | gcstate |
| lu_byte | gckind |
| lu_byte | gcrunning |
| GCObject * | allgc |
| GCObject ** | sweepgc |
| GCObject * | finobj |
| GCObject * | gray |
| GCObject * | grayagain |
| GCObject * | weak |
| GCObject * | ephemeron |
| GCObject * | allweak |
| GCObject * | tobefnz |
| GCObject * | fixedgc |
| struct lua_State * | twups |
| unsigned int | gcfinnum |
| int | gcpause |
| int | gcstepmul |
| lua_CFunction | panic |
| struct lua_State * | mainthread |
| const lua_Number * | version |
| TString * | memerrmsg |
| TString * | tmname [TM_N] |
| struct Table * | mt [LUA_NUMTAGS] |
| TString * | strcache [STRCACHE_N][STRCACHE_M] |
| GCObject* global_State::allgc |
| GCObject* global_State::allweak |
| lu_byte global_State::currentwhite |
| GCObject* global_State::ephemeron |
| GCObject* global_State::finobj |
| GCObject* global_State::fixedgc |
| lua_Alloc global_State::frealloc |
| l_mem global_State::GCdebt |
| lu_mem global_State::GCestimate |
| unsigned int global_State::gcfinnum |
| lu_byte global_State::gckind |
| lu_mem global_State::GCmemtrav |
| int global_State::gcpause |
| lu_byte global_State::gcrunning |
| lu_byte global_State::gcstate |
| int global_State::gcstepmul |
| GCObject* global_State::gray |
| GCObject* global_State::grayagain |
| TValue global_State::l_registry |
| struct lua_State* global_State::mainthread |
| TString* global_State::memerrmsg |
| struct Table* global_State::mt[LUA_NUMTAGS] |
| lua_CFunction global_State::panic |
| unsigned int global_State::seed |
| TString* global_State::strcache[STRCACHE_N][STRCACHE_M] |
| stringtable global_State::strt |
| GCObject** global_State::sweepgc |
| GCObject* global_State::tobefnz |
| l_mem global_State::totalbytes |
| struct lua_State* global_State::twups |
| void* global_State::ud |
| const lua_Number* global_State::version |
| GCObject* global_State::weak |


TExpander implements a neighborhood operation similar to morphological dilation. However, unlike ordinary dilation, where the structuring element is added to the color samples, the expand operation will multiply the weights. We define this operator as
where f is a sampler and b is a structuring element. The structuring element is defined by the Kernel property of the class. See topic about Sampling and Rasterization for more info.


[1]
inside staff were busying themselves like robots avoiding eye contact.
[2]
however a cathedral view has meant a view of pastries there is €24.


This page provides pointers to the materials (datasets, software and notebooks) used in a paper currently under review
Summary: Application developers today have three choices for exploiting the knowledge present in Wikidata [1] : they can download the Wikidata dumps in JSON or RDF format, they can use the Wikidata API to get data about individual entities, or they can use the Wikidata SPARQL endpoint. None of these methods can support complex, yet common, query use cases, such as retrieval of large amounts of data or aggregations over large fractions of Wikidata. This paper introduces KGTK Kypher, a query language and processor that allows users creating personalized variants of Wikidata on a laptop. We present several use cases that illustrate the types of analyses that Kypher enables users to run on the full Wikidata KG on a laptop, combining data from external resources such as DBpedia. The Kypher queries for these use cases run much faster on a laptop than the equivalent SPARQL queries on a Wikidata clone running on a powerful server with 24h time-out limits.
This page and the materials described on it (excluding external references) is available at a permanent URL: https://w3id.org/kgtk_kypher.
A preprint of the paper will soon be available here.
The cache (sqlite) used to store the queries is available in the following DOI: https://doi.org/10.5281/zenodo.5146407
The results of the analyis are the times comparing KGTK and SPARQL, as reported in the paper.
Research Lead
Research Lead at the Information Sciences Institute, University of Southern California.
Research Director
Research Director at the center on Knowledge Graphs, Information Sciences Institute, University of Southern California.
Research Scientist
Researcher at the Information Sciences Institute, University of Southern California.
Student worker
Master student at the University of Southern California.
Designed deived from w3.css


{% extends 'main.html' %} {% block content %} {% include "header.html" %}
Are you sure you want to delete {{ item }}?


#Import Library library(highcharter) #Read from File Data = read.csv("Literate Rate of States.csv") #Stroe Name of States states=Data[,2] #Declare Array literacyRate <- as.matrix(Data[,3]) maleLiteracyRate <- as.matrix(Data[,4]) femaleLiteracyRate <- as.matrix(Data[,5]) #Draw Graph hc <- highchart() %>% hc_xAxis(categories = states) %>% hc_add_series(name = "Literacy Rate", data = as.double(literacyRate)) %>% hc_add_series(name = "Male Literacy Rate", data = as.double(maleLiteracyRate)) %>% hc_add_series(name = "Female Literacy Rate", data = as.double(femaleLiteracyRate)) %>% hc_title(text="Comparision of Male and Female Literacy rate of Each States") %>% hc_add_theme(hc_theme_darkunica()) #Convert into 3D hc <- hc %>% hc_chart(type = "column", options3d = list(enabled = TRUE, beta =10, alpha = 10)) print(hc)


I was scared as hell at first. I didn't know what to expect, I guess. I never felt this hesitation in all my psychonaut experiences until the day my friend Brad showed up at my doorstep at three in the afternoon with a gram of uncut meth. A day before I had mentioned wanting to try some, but just a little, because I loved the hyped-up feeling of Acid but had had bad experiences with ephedrine and ephedra in the past. Now, here, in my apartment sat Brad, some other friends, myself and a gram of pure crystal.
He gave me a pretty big bump, I thought. Well, it looked big, at least. I snorted it after about three minutes of talking myself into it. I had heard a lot of bad stuff about meth, but I just had to try it for myself.
Time passed and everyone left my house about twenty minutes after I had snorted the line. It didn't burn my sinuses like I thought it would, but it didn't numb everything like coke does either. The drainage down the back of my throat was kind of pleasant, but it didn't have that 'coke' taste to it.
When it began to kick in, I realized why they call it 'speed' real damn quick. I was a little impressed, however I was getting bored. The drainage down my throat was making me nauseated so I decided to smoke some weed. Problem solved. The one thing that caught my attention is that I'd lose the buzz if I didn't stay busy. I had to keep moving.
Well.... My apartment was messy (but not too messy, mind you), and so I decided to clean it.  There is only one word to describe my place after I came down: Spotless.
I'd do it again, I think. It's at least one hell of a way to have fun while cleaning and doing other dirty work.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Portfolio
About Me
I'm a Business Analyst, currently pursuing a Full stack Web Development Bootcamp from University of New Hampshire, to better my skills on my new found passion for technology. I'm a finance graduate with a couple of years of international experience in a Credit Analyst role. After moving to US, I gathered my first experiences in the IT industry working as a Business Analyst in a fintech Company in Boston, that instantly grabbed my interest to work in this domain.
I'm easy to work with, and strongly believe in teamwork. My dedication to work, willingness to learn more and firm determination has helped me produce outstanding results within defined timelines. I've consistently demonstrated success in guiding my projects to completion. I am looking to further my knowledge, improve my skills, and continue to learn.
Outside of work, I enjoy travelling, playing indoor games, solving riddles and spending time with friends and family.
Contact Me
Let's connect!
For inquiries or collaborations please contact me by phone/email or fill out the form alongside.


A Java developer embarking on a Groovy adventure will always have Java in mind, and will progressively learn Groovy, one feature at a time, becoming more productive and writing more idiomatic Groovy code. This document’s purpose is to guide such a developer along the way, teaching some common Groovy syntax style, new operators, and new features like closures, etc. This guide is not complete and only serves as a quick intro and a base for further guideline sections should you feel like contributing to the document and enhancing it.
1. No semicolons
When coming from a C / C++ / C# / Java background, we’re so used to semicolons, that we put them everywhere. Even worse, Groovy supports 99% of Java’s syntax, and sometimes, it’s so easy to paste some Java code into your Groovy programs, that you end up with tons of semicolons everywhere. But… semicolons are optional in Groovy, you can omit them, and it’s more idiomatic to remove them.
2. Return keyword optional
In Groovy, the last expression evaluated in the body of a method can be returned without necessitating the return
keyword.
Especially for short methods and for closures, it’s nicer to omit it for brevity:
String toString() { return "a server" }
String toString() { "a server" }
But sometimes, this doesn’t look too good when you’re using a variable, and see it visually twice on two rows:
def props() {
def m1 = [a: 1, b: 2]
m2 = m1.findAll { k, v -> v % 2 == 0 }
m2.c = 3
m2
}
In such case, either putting a newline before the last expression, or explicitly using return
may yield better readability.
I, for myself, sometimes use the return
keyword, sometimes not, it’s often a matter of taste.
But often, inside of closure, we omit it more often than not, for example. So even if the keyword is optional,
this is by no means mandatory to not use it if you think it halters the readability of your code.
A word of caution, however. When using methods which are defined with the def
keyword instead of a specific concrete type,
you may be surprised to see the last expression being returned sometimes. So usually prefer using a specific return type like void or a type.
In our example above, imagine we forgot to put m2 as last statement to be returned,
the last expression would be m2.c = 3
, which would return… 3
, and not the map you expect.
Statements like if
/else
, try
/catch
can thus return a value as well, as there’s a "last expression" evaluated in those statements:
def foo(n) {
if(n == 1) {
"Roshan"
} else {
"Dawrani"
}
}
assert foo(1) == "Roshan"
assert foo(2) == "Dawrani"
3. Def and type
As we’re talking about def
and types, I often see developers using both def
and a type. But def
is redundant here.
So make a choice, either use def
or a type.
So don’t write:
def String name = "Guillaume"
But:
String name = "Guillaume"
When using def
in Groovy, the actual type holder is Object
(so you can assign any object to variables defined with def
,
and return any kind of object if a method is declared returning def
).
When defining a method with untyped parameters, you can use def
but it’s not needed, so we tend to omit them.
So instead of:
void doSomething(def param1, def param2) { }
Prefer:
void doSomething(param1, param2) { }
But as we mention in the last section of the document, it’s usually better to type your method parameters, so as to help with documenting your code, and also help IDEs for code-completion, or for leveraging the static type checking or static compilation capabilities of Groovy.
Another place where def
is redundant and should be avoided is when defining constructors:
class MyClass {
def MyClass() {}
}
Instead, just remove the def
:
class MyClass {
MyClass() {}
}
4. Public by default
By default, Groovy considers classes and methods public
.
So you don’t have to use the public
modifier everywhere something is public.
Only if it’s not public, you should put a visibility modifier.
So instead of:
public class Server {
public String toString() { return "a server" }
}
Prefer the more concise:
class Server {
String toString() { "a server" }
}
You may wonder about the 'package-scope' visibility, and the fact Groovy allows one to omit 'public' means that this scope is not supported by default, but there’s actually a special Groovy annotation which allows you to use that visibility:
class Server {
@PackageScope Cluster cluster
}
5. Omitting parentheses
Groovy allows you to omit the parentheses for top-level expressions, like with the println
command:
println "Hello"
method a, b
vs:
println("Hello")
method(a, b)
When a closure is the last parameter of a method call, like when using Groovy’s each{}
iteration mechanism,
you can put the closure outside the closing parentheses, and even omit the parentheses:
list.each( { println it } )
list.each(){ println it }
list.each { println it }
Always prefer the third form, which is more natural, as an empty pair of parentheses is just useless syntactical noise!
There are some cases where Groovy doesn’t allow you to remove parentheses. As I said, top-level expressions can omit them, but for nested method calls or on the right-hand side of an assignment, you can’t omit them there.
def foo(n) { n }
println foo 1 // won't work
def m = foo 1
6. Classes as first-class citizens
The .class
suffix is not needed in Groovy, a bit like in Java’s instanceof
.
For example:
connection.doPost(BASE_URI + "/modify.hqu", params, ResourcesResponse.class)
Using GStrings we’re going to cover below, and using first class citizens:
connection.doPost("${BASE_URI}/modify.hqu", params, ResourcesResponse)
7. Getters and Setters
In Groovy, a getters and setters form what we call a "property", and offers a shortcut notation for accessing and setting such properties. So instead of the Java-way of calling getters / setters, you can use a field-like access notation:
resourceGroup.getResourcePrototype().getName() == SERVER_TYPE_NAME
resourceGroup.resourcePrototype.name == SERVER_TYPE_NAME
resourcePrototype.setName("something")
resourcePrototype.name = "something"
When writing your beans in Groovy, often called POGOs (Plain Old Groovy Objects), you don’t have to create the field and getter / setter yourself, but let the Groovy compiler do it for you.
So instead of:
class Person {
private String name
String getName() { return name }
void setName(String name) { this.name = name }
}
You can simply write:
class Person {
String name
}
As you can see, a free standing 'field' without modifier visibility actually makes the Groovy compiler to generate a private field and a getter and setter for you.
When using such POGOs from Java, the getter and setter are indeed there, and can be used as usual, of course.
Although the compiler creates the usual getter/setter logic, if you wish to do anything additional or different in those getters/setters, you’re free to still provide them, and the compiler will use your logic, instead of the default generated one.
8. Initializing beans with named parameters and the default constructor
With a bean like:
class Server {
String name
Cluster cluster
}
Instead of setting each setter in subsequent statements as follows:
def server = new Server()
server.name = "Obelix"
server.cluster = aCluster
You can use named parameters with the default constructor (first the constructor is called, then the setters are called in the sequence in which they are specified in the map):
def server = new Server(name: "Obelix", cluster: aCluster)
9. Using with() for repeated operations on the same bean
Named-parameters with the default constructor is interesting when creating new instances, but what if you are updating an instance that was given to you, do you have to repeat the 'server' prefix again and again? No, thanks to the with() method that Groovy adds on all objects of any kind:
server.name = application.name
server.status = status
server.sessionCount = 3
server.start()
server.stop()
vs:
server.with {
name = application.name
status = status
sessionCount = 3
start()
stop()
}
10. Equals and ==
Java’s ==
is actually Groovy’s is()
method, and Groovy’s ==
is a clever equals()
!
To compare the references of objects, instead of ==
, you should use a.is(b)
.
But to do the usual equals()
comparison, you should prefer Groovy’s ==
,
as it also takes care of avoiding NullPointerException
, independently of whether the left or right is null
or not.
Instead of:
status != null && status.equals(ControlConstants.STATUS_COMPLETED)
Do:
status == ControlConstants.STATUS_COMPLETED
11. GStrings (interpolation, multiline)
We often use string and variable concatenation in Java, with many opening /
closing of double quotes, plus signs,
and \n
characters for newlines.
With interpolated strings (called GStrings), such strings look better and are less painful to type:
throw new Exception("Unable to convert resource: " + resource)
vs:
throw new Exception("Unable to convert resource: ${resource}")
Inside the curly braces, you can put any kind of expression, not just variables.
For simple variables, or variable.property
, you can even drop the curly braces:
throw new Exception("Unable to convert resource: $resource")
You can even lazily evaluate those expressions using a closure notation with ${→ resource }
.
When the GString will be coerced to a String, it’ll evaluate the closure and get the toString()
representation of the return value.
Example:
int i = 3
def s1 = "i's value is: ${i}"
def s2 = "i's value is: ${-> i}"
i++
assert s1 == "i's value is: 3" // eagerly evaluated, takes the value on creation
assert s2 == "i's value is: 4" // lazily evaluated, takes the new value into account
When strings and their concatenated expression are long in Java:
throw new PluginException("Failed to execute command list-applications:" +
" The group with name " +
parameterMap.groupname[0] +
" is not compatible group of type " +
SERVER_TYPE_NAME)
You can use the \
continuation character (this is not a multiline string):
throw new PluginException("Failed to execute command list-applications: \
The group with name ${parameterMap.groupname[0]} \
is not compatible group of type ${SERVER_TYPE_NAME}")
Or using multiline strings with triple quotes:
throw new PluginException("""Failed to execute command list-applications:
The group with name ${parameterMap.groupname[0]}
is not compatible group of type ${SERVER_TYPE_NAME)}""")
You can also strip the indentation appearing on the left side of the multiline strings by calling .stripIndent()
on that string.
Also note the difference between single quotes and double quotes in Groovy: single quotes always create Java Strings, without interpolation of variables, whereas double quotes either create Java Strings or GStrings when interpolated variables are present.
For multiline strings, you can triple the quotes: i.e. triple double quotes for GStrings and triple single quotes for mere Strings.
If you need to write regular expression patterns, you should use the "slashy" string notation:
assert "foooo/baaaaar" ==~ /fo+\/ba+r/
The advantage of the "slashy" notation is that you don’t need to double escape backslashes, making working with regex a bit simpler.
Last but not least, prefer using single quoted strings when you need string constants, and use double quoted strings when you are explicitly relying on string interpolation.
12. Native syntax for data structures
Groovy provides native syntax constructs for data structures like lists, maps, regex, or ranges of values. Make sure to leverage them in your Groovy programs.
Here are some examples of those native constructs:
def list = [1, 4, 6, 9]
// by default, keys are Strings, no need to quote them
// you can wrap keys with () like [(variableStateAcronym): stateName] to insert a variable or object as a key.
def map = [CA: 'California', MI: 'Michigan']
def range = 10..20
def pattern = ~/fo*/
// equivalent to add()
list << 5
// call contains()
assert 4 in list
assert 5 in list
assert 15 in range
// subscript notation
assert list[1] == 4
// add a new key value pair
map << [WA: 'Washington']
// subscript notation
assert map['CA'] == 'California'
// property notation
assert map.WA == 'Washington'
// matches() strings against patterns
assert 'foo' =~ pattern
13. The Groovy Development Kit
Continuing on the data structures, when you need to iterate over collections,
Groovy provides various additional methods, decorating Java’s core data structures,
like each{}
, find{}
, findAll{}
, every{}
, collect{}
, inject{}
.
These methods add a functional flavor to the programming language and help working with complex algorithms more easily.
Lots of new methods are applied to various types, through decoration, thanks to the dynamic nature of the language.
You can find lots of very useful methods on String, Files, Streams, Collections, and much more:
14. The power of switch
Groovy’s switch
is much more powerful than in C-ish languages which usually only accept primitives and assimilated.
Groovy’s switch
accepts pretty much any kind of type.
def x = 1.23
def result = ""
switch (x) {
case "foo": result = "found foo"
// lets fall through
case "bar": result += "bar"
case [4, 5, 6, 'inList']:
result = "list"
break
case 12..30:
result = "range"
break
case Integer:
result = "integer"
break
case Number:
result = "number"
break
case { it > 3 }:
result = "number > 3"
break
default: result = "default"
}
assert result == "number"
And more generally, types with an isCase()
method can also decide whether a value corresponds with a case
15. Import aliasing
In Java, when using two classes of the same name but from different packages, like java.util.List
and java.awt.List
,
you can import one class, but have to use a fully-qualified name for the other.
Also sometimes, in your code, when using often a long class name, and the code becomes a bit more verbose.
To improve such situations, Groovy features import aliasing:
import java.util.List as juList
import java.awt.List as aList
import java.awt.WindowConstants as WC
You can also import methods statically:
import static pkg.SomeClass.foo
foo()
16. Groovy Truth
All objects can be 'coerced' to a boolean value: everything that’s null
, void
, equal to zero,
or empty evaluates to false
, and if not, evaluates to true
.
So instead of writing:
if (name != null && name.length > 0) {}
You can just do:
if (name) {}
Same thing for collections, etc.
Thus, you can use some shortcuts in things like while()
, if()
, the ternary operator, the Elvis operator (see below), etc.
It’s even possible to customize the Groovy Truth, by adding an boolean asBoolean()
method to your classes!
17. Safe graph navigation
Groovy supports a variant of the .
operator to safely navigate an object graph.
In Java, when you’re interested in a node deep in the graph and need to check for null
,
you often end up writing complex if
, or nested if
statements like this:
if (order != null) {
if (order.getCustomer() != null) {
if (order.getCustomer().getAddress() != null) {
System.out.println(order.getCustomer().getAddress());
}
}
}
With ?.
safe dereference operator, you can simplify such code with:
println order?.customer?.address
Nulls are checked throughout the call chain and no NullPointerException
will be thrown if any element is null
,
and the resulting value will be null if something’s null
.
18. Assert
To check your parameters, your return values, and more, you can use the assert
statement.
Contrary to Java’s assert
, `assert`s don’t need to be activated to be working, so `assert`s are always checked.
def check(String name) {
// name non-null and non-empty according to Groovy Truth
assert name
// safe navigation + Groovy Truth to check
assert name?.size() > 3
}
You’ll also notice the nice output that Groovy’s "Power Assert" statement provides, with a graph view of the various values of each sub-expressions being asserted.
19. Elvis operator for default values
The Elvis operator is a special ternary operator shortcut which is handy to use for default values.
We often have to write code like:
def result = name != null ? name : "Unknown"
Thanks to Groovy Truth, the null
check can be simplified to just 'name'.
And to go even further, since you return 'name' anyway, instead of repeating name twice in this ternary expression, we can somehow remove what’s in between the question mark and colon, by using the Elvis operator, so that the above becomes:
def result = name ?: "Unknown"
20. Catch any exception
If you don’t really care about the type of the exception which is thrown inside your try
block,
you can simply catch any of them and simply omit the type of the caught exception.
So instead of catching the exceptions like in:
try {
// ...
} catch (Exception t) {
// something bad happens
}
Then catch anything ('any' or 'all', or whatever makes you think it’s anything):
try {
// ...
} catch (any) {
// something bad happens
}
| Note that it’s catching all Exceptions, not `Throwable`s. If you need to really catch "everything", you’ll have to be explicit and say you want to catch `Throwable`s. |
21. Optional typing advice
I’ll finish on some words on when and how to use optional typing.
Groovy lets you decide whether you use explicit strong typing, or when you use def
.
I’ve got a rather simple rule of thumb: whenever the code you’re writing is going to be used by others as a public API, you should always favor the use of strong typing, it helps making the contract stronger, avoids possible passed arguments type mistakes, gives better documentation, and also helps the IDE with code completion. Whenever the code is for your use only, like private methods, or when the IDE can easily infer the type, then you’re more free to decide when to type or not.


Class Map
Base class for a map that consists of one or more objects of base type IGameObject. It implements basic functionality to manage and access these objects, as well as commonly needed functinonality like tile exploration, FOV, and pathfinding. It also provides methods to easily access these objects as instances of some derived type, that can be used to access functionality you've implemented in a subclass.
Inheritance
Implements
Inherited Members
Namespace: GoRogue.GameFramework
Assembly: GoRogue.dll
Syntax
public class Map : IMapView<IEnumerable<IGameObject>>
Remarks
A Map consists of IGameObjects on one or more layers. These layers are numbered, from the lowest layer of 0 upward. Each Map contains at minimum a "terrain" layer. This is considered to be layer 0. All objects added to this layer must have their IsStatic flag set to true, and must reside on layer 0.
A map will typically also have some other layers, for non terrain objects like monsters, items, etc. The number of these layers present on the map, along with which of all the layers participate in collision detection, etc., can be specified in the constructor.
While this class has some flexibility, it does, unlike the rest of the library, tend to impose itself on your architecture. In cases where this is undesireable, each component of this map class exists as a separate component (layer masking, the SpatialMap(s) storing the entity layers, FOV, and pathfinding all exist as their own (more flexible) components). This class is not intended to cover every possible use case, but instead may act as an example or starting point in the case where you would like to use the components in a different way or within a different architecture.
Constructors
| Improve this Doc View SourceMap(ISettableMapView<IGameObject>, Int32, Distance, UInt32, UInt32, UInt32)
Constructor. Constructs map with the given terrain layer, determining width/height based on the width/height of that terrain layer.
Declaration
public Map(ISettableMapView<IGameObject> terrainLayer, int numberOfEntityLayers, Distance distanceMeasurement, uint layersBlockingWalkability =<PHONE_NUMBER>U, uint layersBlockingTransparency =<PHONE_NUMBER>U, uint entityLayersSupportingMultipleItems = 0U)
Parameters
| Type | Name | Description |
|---|---|---|
| ISettableMapView<IGameObject> | terrainLayer | The ISettableMapView that represents the terrain layer for this map. It is intended that this be modified ONLY via the SetTerrain function -- if it is modified outside of that, the ItemAdded/Removed events are NOT guaranteed to be called! |
| System.Int32 | numberOfEntityLayers | Number of non-terrain layers for the map. |
| Distance | distanceMeasurement | Distance measurement to use for pathing/measuring distance on the map. |
| System.UInt32 | layersBlockingWalkability | Layer mask containing those layers that should be allowed to have items that block walkability. Defaults to all layers. |
| System.UInt32 | layersBlockingTransparency | Layer mask containing those layers that should be allowed to have items that block FOV. Defaults to all layers. |
| System.UInt32 | entityLayersSupportingMultipleItems | Layer mask containing those layers that should be allowed to have multiple objects at the same location on the same layer. Defaults to no layers. |
Map(Int32, Int32, Int32, Distance, UInt32, UInt32, UInt32)
Constructor. Constructs terrain map as ArrayMap<BaseObject> with the given width/height.
Declaration
public Map(int width, int height, int numberOfEntityLayers, Distance distanceMeasurement, uint layersBlockingWalkability =<PHONE_NUMBER>U, uint layersBlockingTransparency =<PHONE_NUMBER>U, uint entityLayersSupportingMultipleItems = 0U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | width | Width of the map. |
| System.Int32 | height | Height of the map. |
| System.Int32 | numberOfEntityLayers | Number of non-terrain layers for the map. |
| Distance | distanceMeasurement | Distance measurement to use for pathing/measuring distance on the map. |
| System.UInt32 | layersBlockingWalkability | Layer mask containing those layers that should be allowed to have items that block walkability. Defaults to all layers. |
| System.UInt32 | layersBlockingTransparency | Layer mask containing those layers that should be allowed to have items that block FOV. Defaults to all layers. |
| System.UInt32 | entityLayersSupportingMultipleItems | Layer mask containing those layers that should be allowed to have multiple objects at the same location on the same layer. Defaults to no layers. |
Fields
| Improve this Doc View SourceExplored
Whether or not each tile is considered explored. Tiles start off unexplored, and become explored as soon as they are within a calculated FOV. This ArrayMap may also have values set to it, to easily allow for serialization or wizard-mode like functionality.
Declaration
public ArrayMap<bool> Explored
Field Value
| Type | Description |
|---|---|
| ArrayMap<System.Boolean> |
Properties
| Improve this Doc View SourceAStar
AStar pathfinder for the map. By default, uses WalkabilityView to determine which locations can be reached.
Declaration
public AStar AStar { get; set; }
Property Value
| Type | Description |
|---|---|
| AStar |
DistanceMeasurement
Distance measurement used for pathing and measuring distance on the map.
Declaration
public Distance DistanceMeasurement { get; }
Property Value
| Type | Description |
|---|---|
| Distance |
Entities
IReadOnlyLayeredSpatialMap of all entities (non-terrain objects) on the map.
Declaration
public IReadOnlyLayeredSpatialMap<IGameObject> Entities { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyLayeredSpatialMap<IGameObject> |
FOV
Current FOV results for the map. Calculate FOV via the Map's CalculateFOV functions.
Declaration
public IReadOnlyFOV FOV { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyFOV |
Height
Height of the map, in grid spaces.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Item[Coord]
Gets all objects at the given location, from the highest layer (layer with the highest number) down.
Declaration
public IEnumerable<IGameObject> this[Coord pos] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | pos | The position to retrieve objects for. |
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IGameObject> | All objects at the given location, in order from highest layer to lowest layer. |
Item[Int32]
Declaration
public IEnumerable<IGameObject> this[int index1D] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index1D |
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IGameObject> |
Item[Int32, Int32]
Gets all objects at the given location, from the highest layer (layer with the highest number) down.
Declaration
public IEnumerable<IGameObject> this[int x, int y] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to retrieve objects for. |
| System.Int32 | y | Y-value of the position to retrieve objects for. |
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IGameObject> | All objects at the given location, in order from highest layer to lowest layer. |
LayerMasker
LayerMasker that should be used to create layer masks for this Map.
Declaration
public LayerMasker LayerMasker { get; }
Property Value
| Type | Description |
|---|---|
| LayerMasker |
LayersBlockingTransparency
Layer mask that contains only layers that block transparency. A non-transparent BaseObject can only be added to this map if the layer it is on is contained within this layer mask.
Declaration
public uint LayersBlockingTransparency { get; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
LayersBlockingWalkability
Layer mask that contains only layers that block walkability. A non-walkable BaseObject can only be added to this map if the layer it is on is contained within this layer mask.
Declaration
public uint LayersBlockingWalkability { get; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
Terrain
Terrain of the map. Terrain at each location may be set via the SetTerrain function.
Declaration
public IMapView<IGameObject> Terrain { get; }
Property Value
| Type | Description |
|---|---|
| IMapView<IGameObject> |
TransparencyView
IMapView representing transparency values for each tile. Each location is true if the location is transparent (there are no non-transparent objects at that location), false otherwise.
Declaration
public IMapView<bool> TransparencyView { get; }
Property Value
| Type | Description |
|---|---|
| IMapView<System.Boolean> |
WalkabilityView
IMapView representing walkability values for each tile. Each location is true if the location is walkable (there are no non-walkable objects at that location), false otherwise.
Declaration
public IMapView<bool> WalkabilityView { get; }
Property Value
| Type | Description |
|---|---|
| IMapView<System.Boolean> |
Width
Width of the map, in grid spaces.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceAddEntity(IGameObject)
Adds the given entity (non-terrain object) to its recorded location, removing it from the map it is currently a part of. Returns true if the entity was added, false otherwise (eg., collision detection would not allow it, etc.)
Declaration
public bool AddEntity(IGameObject entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameObject | entity | Entity to add. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the entity was successfully added to the map, false otherwise. |
CalculateFOV(Coord, Double)
Calculates FOV with the given center point and radius (of shape circle), and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public void CalculateFOV(Coord position, double radius = 1.7976931348623157E+308)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | The center point of the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
CalculateFOV(Coord, Double, Distance)
Calculates FOV with the given center point and radius, and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public void CalculateFOV(Coord position, double radius, Distance radiusShape)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | The center point of the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
| Distance | radiusShape | The shape of the FOV to calculate. Can be specified as either Distance or Radius types (they are implicitly convertible). |
CalculateFOV(Coord, Double, Distance, Double, Double)
Calculates FOV with the given center point and radius, restricted to the given angle and span, and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public void CalculateFOV(Coord position, double radius, Distance radiusShape, double angle, double span)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | The center point of the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
| Distance | radiusShape | The shape of the FOV to calculate. Can be specified as either Distance or Radius types (they are implicitly convertible). |
| System.Double | angle | The angle in degrees the FOV cone faces. 0 degrees points right. |
| System.Double | span | The angle in degrees specifying the full arc of the FOV cone. span/2 degrees on either side of the given angle are included in the cone. |
CalculateFOV(Int32, Int32, Double)
Calculates FOV with the given center point and radius (of shape circle), and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public virtual void CalculateFOV(int x, int y, double radius = 1.7976931348623157E+308)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the center point for the new FOV to calculate. |
| System.Int32 | y | Y-value of the center point for the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
CalculateFOV(Int32, Int32, Double, Distance)
Calculates FOV with the given center point and radius, and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public virtual void CalculateFOV(int x, int y, double radius, Distance radiusShape)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the center point for the new FOV to calculate. |
| System.Int32 | y | Y-value of the center point for the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
| Distance | radiusShape | The shape of the FOV to calculate. Can be specified as either Distance or Radius types (they are implicitly convertible). |
CalculateFOV(Int32, Int32, Double, Distance, Double, Double)
Calculates FOV with the given center point and radius, restricted to the given angle and span, and stores the result in the FOV property. All tiles that are in the resulting FOV are marked as explored.
Declaration
public virtual void CalculateFOV(int x, int y, double radius, Distance radiusShape, double angle, double span)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the center point for the new FOV to calculate. |
| System.Int32 | y | Y-value of the center point for the new FOV to calculate. |
| System.Double | radius | The radius of the FOV. Defaults to infinite. |
| Distance | radiusShape | The shape of the FOV to calculate. Can be specified as either Distance or Radius types (they are implicitly convertible). |
| System.Double | angle | The angle in degrees the FOV cone faces. 0 degrees points right. |
| System.Double | span | The angle in degrees specifying the full arc of the FOV cone. span/2 degrees on either side of the given angle are included in the cone. |
CreateMap<T>(ISettableMapView<T>, Int32, Distance, UInt32, UInt32, UInt32)
Effectively a helper-constructor. Constructs a map using an ISettableView<T> for the terrain map that can have its type T be of any type that implements IGameObject. Note that a Map that is constructed using this function will throw an InvalidCastException if any IGameObject is given to SetTerrain that cannot be casted to type T.
Declaration
public static Map CreateMap<T>(ISettableMapView<T> terrainLayer, int numberOfEntityLayers, Distance distanceMeasurement, uint layersBlockingWalkability =<PHONE_NUMBER>U, uint layersBlockingTransparency =<PHONE_NUMBER>U, uint entityLayersSupportingMultipleItems = 0U)
where T : IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| ISettableMapView<T> | terrainLayer | The ISettableMapView that represents the terrain layer for this map. It is intended that this be modified ONLY via the SetTerrain function -- if it is modified outside of that, the ItemAdded/Removed events are NOT guaranteed to be called! |
| System.Int32 | numberOfEntityLayers | Number of non-terrain layers for the map. |
| Distance | distanceMeasurement | Distance measurement to use for pathing/measuring distance on the map. |
| System.UInt32 | layersBlockingWalkability | Layer mask containing those layers that should be allowed to have items that block walkability. Defaults to all layers. |
| System.UInt32 | layersBlockingTransparency | Layer mask containing those layers that should be allowed to have items that block FOV. Defaults to all layers. |
| System.UInt32 | entityLayersSupportingMultipleItems | Layer mask containing those layers that should be allowed to have multiple objects at the same location on the same layer. Defaults to no layers. |
Returns
| Type | Description |
|---|---|
| Map | A new Map whose terrain is created using the given terrainLayer, and with the given parameters. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of terrain that will be stored in the created Map. Can be any type that implements IGameObject. |
Remarks
Say you have a class MyTerrain that inherits from BaseClass and implements IGameObject. This construction function allows things like constructing your map from an ISettableView<MyTerrain>, which you cannot do with the regular constructor since ISettableMapView<MyTerrain> does not satisfy its type requirement of ISettableMapView<IGameObject>.
Since this function under the hood creates a SettableTranslationMap that translates to/from IGameObject, any change made either via the SetTerrain function or by modifying the original ISettableMapView passed in will be reflected both in the map and in the original ISettableMapView.
GetEntities<EntityType>(Coord, UInt32)
Gets all (non-terrain) entities encountered at the given position that are castable to type EntityType, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<EntityType> GetEntities<EntityType>(Coord position, uint layerMask =<PHONE_NUMBER>U)
where EntityType : IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to get entities for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<EntityType> | All entities encountered at the given position that are castable to the given type, in order from the highest existing layer in the mask downward. |
Type Parameters
| Name | Description |
|---|---|
| EntityType | Type of entities to return. |
GetEntities<EntityType>(Int32, Int32, UInt32)
Gets all (non-terrain) entities encountered at the given position that are castable to type EntityType, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<EntityType> GetEntities<EntityType>(int x, int y, uint layerMask =<PHONE_NUMBER>U)
where EntityType : IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get entities for. |
| System.Int32 | y | Y-value of the position to get entities for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<EntityType> | All entities encountered at the given position that are castable to the given type, in order from the highest existing layer in the mask downward. |
Type Parameters
| Name | Description |
|---|---|
| EntityType | Type of entities to return. |
GetEntity<EntityType>(Coord, UInt32)
Gets the first (non-terrain) entity encountered at the given position that can be casted to the specified type, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers. Null is returned if no entities of the specified type are found, or if there are no entities at the location.
Declaration
public EntityType GetEntity<EntityType>(Coord position, uint layerMask =<PHONE_NUMBER>U)
where EntityType : IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to check get entity for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an entity. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| EntityType | The first entity encountered, moving from the highest existing layer in the layer mask downward, or null if there are no entities of the specified type are found. |
Type Parameters
| Name | Description |
|---|---|
| EntityType | Type of entities to return. |
GetEntity<EntityType>(Int32, Int32, UInt32)
Gets the first (non-terrain) entity encountered at the given position that can be casted to the specified type, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers. Null is returned if no entities of the specified type are found, or if there are no entities at the location.
Declaration
public EntityType GetEntity<EntityType>(int x, int y, uint layerMask =<PHONE_NUMBER>U)
where EntityType : IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get entity for. |
| System.Int32 | y | Y-value of the position to get entity for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an entity. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| EntityType | The first entity encountered, moving from the highest existing layer in the layer mask downward, or null if there are no entities of the specified type are found. |
Type Parameters
| Name | Description |
|---|---|
| EntityType | Type of entities to return. |
GetObject(Coord, UInt32)
Gets the first object encountered at the given position, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IGameObject GetObject(Coord position, uint layerMask =<PHONE_NUMBER>U)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to get object for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| IGameObject | The first object encountered, moving from the highest existing layer in the layer mask downward. |
GetObject(Int32, Int32, UInt32)
Gets the first object encountered at the given position that can be casted to the specified type, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers. Null is returned if no objects of the specified type are found, or if there are no objects at the location.
Declaration
public IGameObject GetObject(int x, int y, uint layerMask =<PHONE_NUMBER>U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get object for. |
| System.Int32 | y | Y-value of the position to get object for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| IGameObject | The first object encountered, moving from the highest existing layer in the layer mask downward. |
GetObject<ObjectType>(Coord, UInt32)
Gets the first object encountered at the given position that can be casted to the type specified, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers. Null is returned if no objects of the specified type are found, or if there are no objects at the location.
Declaration
public ObjectType GetObject<ObjectType>(Coord position, uint layerMask =<PHONE_NUMBER>U)
where ObjectType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to get object for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| ObjectType | The first object encountered, moving from the highest existing layer in the layer mask downward, or null if there are no objects of the specified type are found. |
Type Parameters
| Name | Description |
|---|---|
| ObjectType | Type of objects to return. |
GetObject<ObjectType>(Int32, Int32, UInt32)
Gets the first object encountered at the given position that can be casted to the specified type, moving from the highest existing layer in the layer mask downward. Layer mask defaults to all layers. Null is returned if no objects of the specified type are found, or if there are no objects at the location.
Declaration
public ObjectType GetObject<ObjectType>(int x, int y, uint layerMask =<PHONE_NUMBER>U)
where ObjectType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get object for. |
| System.Int32 | y | Y-value of the position to get object for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| ObjectType | The first object encountered, moving from the highest existing layer in the layer mask downward, or null if there are no objects of the specified type are found. |
Type Parameters
| Name | Description |
|---|---|
| ObjectType | Type of objects to return. |
GetObjects(Coord, UInt32)
Gets all objects encountered at the given position, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<IGameObject> GetObjects(Coord position, uint layerMask =<PHONE_NUMBER>U)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to get objects for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IGameObject> | All objects encountered at the given position, in order from the highest existing layer in the mask downward. |
GetObjects(Int32, Int32, UInt32)
Gets all objects encountered at the given position, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<IGameObject> GetObjects(int x, int y, uint layerMask =<PHONE_NUMBER>U)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get objects for. |
| System.Int32 | y | Y-value of the position to get objects for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IGameObject> | All objects encountered at the given position, in order from the highest existing layer in the mask downward. |
GetObjects<ObjectType>(Coord, UInt32)
Gets all objects encountered at the given position that are castable to type ObjectType, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<ObjectType> GetObjects<ObjectType>(Coord position, uint layerMask =<PHONE_NUMBER>U)
where ObjectType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | Position to get objects for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ObjectType> | All objects encountered at the given position that are castable to the given type, in order from the highest existing layer in the mask downward. |
Type Parameters
| Name | Description |
|---|---|
| ObjectType | Type of objects to return. |
GetObjects<ObjectType>(Int32, Int32, UInt32)
Gets all objects encountered at the given position that are castable to type ObjectType, in order from the highest existing layer in the layer mask downward. Layer mask defaults to all layers.
Declaration
public IEnumerable<ObjectType> GetObjects<ObjectType>(int x, int y, uint layerMask =<PHONE_NUMBER>U)
where ObjectType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get objects for. |
| System.Int32 | y | Y-value of the position to get objects for. |
| System.UInt32 | layerMask | Layer mask for which layers can return an object. Defaults to all layers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ObjectType> | All objects encountered at the given position that are castable to the given type, in order from the highest existing layer in the mask downward. |
Type Parameters
| Name | Description |
|---|---|
| ObjectType | Type of objects to return. |
GetTerrain(Coord)
Gets the terrain object at the given location, or null if no terrain is set to that location.
Declaration
public IGameObject GetTerrain(Coord position)
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | The position to get the terrain for. |
Returns
| Type | Description |
|---|---|
| IGameObject | The terrain at the given postion, or null if no terrain exists at that location. |
GetTerrain(Int32, Int32)
Gets the terrain object at the given location, or null if no terrain is set to that location.
Declaration
public IGameObject GetTerrain(int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get the terrain for. |
| System.Int32 | y | Y-value of the position to get the terrain for. |
Returns
| Type | Description |
|---|---|
| IGameObject | The terrain at the given postion, or null if no terrain exists at that location. |
GetTerrain<TerrainType>(Coord)
Gets the terrain object at the given location, as a value of type TerrainType. Returns null if no terrain is set, or the terrain cannot be casted to the type specified.
Declaration
public TerrainType GetTerrain<TerrainType>(Coord position)
where TerrainType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| Coord | position | The position to get the terrain for. |
Returns
| Type | Description |
|---|---|
| TerrainType | The terrain at the given postion, or null if either no terrain exists at that location or the terrain was not castable to type TerrainType. |
Type Parameters
| Name | Description |
|---|---|
| TerrainType | Type to return the terrain as. |
GetTerrain<TerrainType>(Int32, Int32)
Gets the terrain object at the given location, as a value of type TerrainType. Returns null if no terrain is set, or the terrain cannot be casted to the type specified.
Declaration
public TerrainType GetTerrain<TerrainType>(int x, int y)
where TerrainType : class, IGameObject
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | X-value of the position to get the terrain for. |
| System.Int32 | y | Y-value of the position to get the terrain for. |
Returns
| Type | Description |
|---|---|
| TerrainType | The terrain at the given postion, or null if either no terrain exists at that location or the terrain was not castable to type TerrainType. |
Type Parameters
| Name | Description |
|---|---|
| TerrainType | Type to return the terrain as. |
RemoveEntity(IGameObject)
Removes the given entity (non-terrain object) from the map, returning true if it was successfully removed, false otherwise.
Declaration
public bool RemoveEntity(IGameObject entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameObject | entity | The entity to remove from the map. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the entity was removed successfully, false otherwise (eg, the entity was not part of this map). |
SetTerrain(IGameObject)
Sets the terrain at the given objects location to the given object, overwriting any terrain already present there.
Declaration
public void SetTerrain(IGameObject terrain)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameObject | terrain | Terrain to replace the current terrain with. |
Events
| Improve this Doc View SourceObjectAdded
Event that is fired whenever some object is added to the map.
Declaration
public event EventHandler<ItemEventArgs<IGameObject>> ObjectAdded
Event Type
| Type | Description |
|---|---|
| System.EventHandler<ItemEventArgs<IGameObject>> |
ObjectMoved
Event that is fired whenever some object that is part of the map is successfully moved.
Declaration
public event EventHandler<ItemMovedEventArgs<IGameObject>> ObjectMoved
Event Type
| Type | Description |
|---|---|
| System.EventHandler<ItemMovedEventArgs<IGameObject>> |
ObjectRemoved
Event that is fired whenever some object is removed from the map.
Declaration
public event EventHandler<ItemEventArgs<IGameObject>> ObjectRemoved
Event Type
| Type | Description |
|---|---|
| System.EventHandler<ItemEventArgs<IGameObject>> |


Recording date: April 17, 2021
Download at Apple Podcasts, Google Podcasts, Spotify, iHeartRadio, Spreaker or wherever you get your podcasts.
This is a common question, and Chris and Nick discovered that they do it differently.
Chris describes how he views tech debt from the perspective of his continuous integration and continuous delivery pipeline: “How quickly can I release, and what’s getting in my way?” He discussed that recently, Charity Majors has been discussing the importance of a quick feedback cycle for developers:
people really do leave their jobs over build times. i am not making this up.
— Charity Majors (@mipsytipsy) April 15, 2021
the impact your deploy pipeline has on developer productivity and happiness is HARDCORE. https://t.co/z49xUxXWsk
Basically, this comes down to, ‘you’ve got 15 minutes to build’ in order to be good at this, and this brings us to the Theory of Constraints thing: what things are blocking me from getting to that 15-minute build time, and how do I get rid of them?
Nick says he comes at this from a more traditional infosec approach, basically, how do I get in, how do I move around? Chris points out that this reveals two prevalent schools of thought in the industry when it comes to building software: “How do I make this work?” and, “How do I break this?”
How do we make it work leads to “How do I make this resilient”
Both of these approaches seem to meet up at resilience, which brings us to the broader conversion about software dependencies and dependencies management, which itself is based on the fact that today,
As we go about that process, we need to get open source, and buy tools, and many are pretty janky - and the janky tool is the one that gets you.
Chris thinks there is better tooling coming, and Nick is far more skeptical of that.
This gets into the fact that libraries get poorly maintained or abandoned and can in fact be taken over by malevolent actors, and now a trusted source is pushing malware.
Everyone understands that but to what extent do you have proper insight to what you’re assembling?
Supply chain breaches are top of the pops. But what are supply chain breaches?
Supply chain attacks happen when people get into these dependencies, which are then incorporated, or they get into the build chain to insert software that shouldn’t be there.
They can also be broader than just development operations, attacking necessary business tools that the company uses as a whole.
Probably the earliest great example of this that we remember is the RSA SecureID breach of 2011. Chris remembers that the term Advanced Persistent Threat was particularly bogus, because it isn’t the threat, it’s the attacker that is sophisticated and advanced (Nick throws in a plug for an article he and Scott Crawford wrote in January, 2010 called, ‘It’s The Adversaries That Are Advanced and Persistent')
But there’s been a change in dynamics in the past few years - where it felt like the entire SecureID breach targeted Lockheed Martin, now it feels like “stage the attack first and then choose your targets" rather than choose your target and then stage your attack.
If we are a contemporary software company or even a business, and we’ve done the right thing by outsourcing the stuff that isn’t our core competency, we find that there’s lots of stuff that isn’t everyone’s core competency - email servers, ticketing systems, remote helpdesk.
So even though we all use a much more diverse set of universal tools, each tool in its category is just as much a single point-of-failure as was SecureID - we all use the same instant messenger, the same ticketing system, the same what-have-you, so targeting can be conducted on an industry vertical-level by attacking a tool that horizontally attacks the whole industry.
How do we protect ourselves against these third party risks?
Spreadsheets.
Chris talks about the Hyperscalers like cloud and the starting point of the Shared Responsibility Model in which security and compliance are the shared responsibility between the hyperscaler and the customer.
We’re now at a point where we rely on the Hyperscalers like AWS for security.
Nick points out, though, that AWS has a different idea about what “secure” means from its customers - them being secure is just not the same as us being secure, and Chris rightly points out that this is the other side of the shares security model. But the point of handover is sometimes unclear to the customer.
Many things that should be done are best practices are not enabled by Amazon by default, and this is a huge issue, which Chris points out is completely right and behind the idea that we read the dunderheaded thing of the week every week in Corey Quinn’s Last Week In AWS newsletter.
But if you want the audit trail, you need to flip the bit that starts the taxi meter to fill your other S3 bucket with logs.
In looking at attacks, it’s important to realize that attackers will always seek the path of least resistance as they target you - and often these days the path of least resistance is the tool. Chris mentions another Economics of Information Security Paper, Where Do All The Attacks Go? in which the question is asked, ‘If security is so awful, why isn’t everyone attacked every day?’ and the answer of course is that even attacker groups have bosses to please and budgets to live up to. Targeting is hard.
So the idea to use supply chain attacks being in the news is to use them to justify the time it takes to consider something: given a supply chain attack against our CI/CD tool, what permissions would it have, and how can you follow those permissions throughout your CI/CD pipeline.
All too often we bring in these external tools to cover up what we’re not good at, which would be fine if they were better than they actually are. Threat modeling through a theoretical supply chain breach can help you identify new forms of tech debt.
Chris is a frequent speaker on topics such as serverless, DevOps, cloud, containers, security, networking and the Internet of Things. He’s also a cloud editor for InfoQ and a contributor to open source projects such as Docker, CoreOS and DXC’s Online DevOps Dojo.
Nick is Chief Security Officer at a financial technology firm, and was formerly an NYPD Intelligence Bureau apparatchik. He is co-author of many books, including Cyber Attack Survival Manual; In Context: Understanding Police Killings of Unarmed Civilians and Blackhatonomics: An Inside Look at the Economics of Cybercrime.


This model is configured with four-stage reverse osmosis filtration. This process removes water contaminants and chlorine to improve water taste and odor.
An in-tank ultraviolet light reduces bacterial growth to guarantee fresh clean water.
Plastic surfaces surrounding the dispensing area are infused with BioCote® to prevent the spread of bacteria. See the BioCote® Case Study Results.
Office H2O coolers have been shown to reduce carbon footprint by up to 55% compared to bottled water coolers. Bottleless water coolers reduce plastic bottle contribution to landfills. This Office H2O Cooler is ENERGY STAR certified.


Replace explicit boiler plate code with Lombok annotations. For example: it replaces the explicit method accessors with @Getter and @Setter
Currently supported only @Getter and @Setter annotations.


This class implement a cumulative moving median (rolling median or running median) filter.
More...
|
| | moving_median (size_type N) |
| | Creates a moving_median with a window of length N. More...
|
| |
| size_type | size () const |
| | Returns the size of the moving window. More...
|
| |
| void | resize (size_type N) |
| | Resizes the moving window to the specified number of elements. More...
|
| |
| void | reset () |
| | Reset the moving window to the original state. More...
|
| |
| template<typename InputIt , typename OutputIt > |
| void | filter (InputIt first, InputIt last, OutputIt d_first) |
| | Applies a moving median filter to the elements in the range [first, last) and stores the result in another range, beginning at d_first. More...
|
| |
template<typename T, typename Allocator = std::allocator<T>>
class edsp::filter::moving_median< T, Allocator >
This class implement a cumulative moving median (rolling median or running median) filter.
Given a series of numbers and a fixed subset size, the first element of the moving median is obtained by taking the median of the initial fixed subset of the number series. Then the subset is modified by "shifting forward"; that is, excluding the first number of the series and including the next value in the subset.
- Template Parameters
-
| T | Type of element. |
| Allocator | Allocator type, defaults to std::allocator<T>. |
template<typename T , typename Allocator >
template<typename InputIt , typename OutputIt >
Applies a moving median filter to the elements in the range [first, last) and stores the result in another range, beginning at d_first.
- Parameters
-
| first | Input iterator defining the beginning of the input range. |
| last | Input iterator defining the ending of the input range. |
| d_first | Output iterator defining the beginning of the destination range. |


Sorry, Requested page not found!
Probably the tables of processed data is not loaded properly.
Please select the device category again using the link below, then continue annotating by entering
the index of the page you were.
Select Category
if you continue seeing this error, probably the produced table is empty or broken.
Delete the table of your selected category and method in /src/web_app/static/tables,
and try to build or download the table again.


Reports unnecessary parentheses in expressions, types, and patterns.
Parentheses are considered unnecessary if the semantics of the program remains unchanged when the parentheses are removed.
Use the checkboxes below to customize the behaviour of the inspection.
Parentheses are considered clarifying if they separate an infix expression, type element, or pattern as a part of a larger infix element.
Example:
val x = (3)
After the quick-fix is applied:
val x = 3