composition

Retrieve client id for facelets

纵然是瞬间 提交于 2019-12-25 01:35:53
问题 How do I retrieve clientId for a facelet included with ui:include? For a reusable component I use this syntax: cc.clientId . EDIT1 The question is in the context of Determine absolute id. To include the dynamic editors I use a custom include. The source code of DynamicInclude, DynamicIncludeComponent and DynamicIncludeHandler can be found at: http://pastebin.com/5e2dgR15. I had to remove the lines that tested the src for null in getSrc method of DynamicInclude and changed getFamily to return

Why does this Type Assertion on a direct implemented interface fail?

為{幸葍}努か 提交于 2019-12-25 00:53:09
问题 I am struggling with Go's Type Assertion mechanism. In the below example the Type Assertion for Qux.(Bar) fails. Why does a direct implementation of DoBar() at Qux not fullfill the Bar interface? package main import ( "fmt" ) type Nameable interface { Name() string } type Foo interface { Nameable DoFoo() string } type Bar interface { Nameable DoBar() string } type bar struct { name string } func (b bar) Name() string { return b.name } // Qux embeds bar and is expected to fullfill Nameable

Function to set properties of an object of a class composition

别等时光非礼了梦想. 提交于 2019-12-24 11:30:03
问题 I would like construct a class composition that includes a function set_props for setting the instance variables of components. The application for this is in defining new objects for drawing in matplotlib. One example is that I would like to have a function drawMyArrow that draws an arrow with possibly different colors (and other specifications) for its head, tail, and arc. I would like to be able to pass various specifications for the head, tail, and arc via keyword arguments in drawMyArrow

UML notation for 'ending' composition

我只是一个虾纸丫 提交于 2019-12-24 10:11:58
问题 Is there a UML notation for how many levels deep a recursion can be? In a simple composition model I have branches that can have branches or leaves. But a branch can only have a kid-branch and a grandkid branch, after that, It only can have leaves. Thanks! 回答1: Not in UML but there is suplement called OCL (Object Constraint Language). Here is specification http://www.lri.fr/~wolff/teach-material/2008-09/IFIPS-VnV/UML2.0OCL-specification.pdf 回答2: You can always add manually a constraints on

UML class diagram: Association or Composition?

三世轮回 提交于 2019-12-24 10:04:28
问题 I'm a little confused on what the relationship would be for the scenario below. When examples of composition are used they always tend to use simple ones such as rooms and a building. This scenario is that doctor patient visits are recorded. Would it be an association, composition or a mix of both? I've included a picture below of the two different relationships I am stuck between. I am thinking composition because the visit belongs to each party? Derived association 回答1: In general my rule

Is Double-buffering required with Desktop Composition enabled?

a 夏天 提交于 2019-12-24 06:24:29
问题 Is double-buffering still required when Desktop Composition is enabled? In Microsoft's Application Compatibility Guide: Graphical Device Interface (GDI) Prior to Windows Vista and Windows Server 2008, a window handle (HWND) was painted directly to the screen, which had certain benefits, but limited how Windows could display and manage top-level windows. In Windows Vista and Windows Server 2008, all top-level windows are rendered to an off-screen bitmap (similar to WS_EX_LAYERED), and the

How does composition work in Hibernate?

可紊 提交于 2019-12-24 03:47:09
问题 I'm trying to use composition in hibernate with annotations. I have: @Entity @Table(name = "Foo") public class Foo { private Bar bar; public void setBar(Bar bar){...} public Bar getBar() {...) } public class Bar { private double x; public void setX(double x) {...} public double getX() {...} } And when trying to save Foo, I'm getting Could not determine type for entity org.bla.Bar at table Foo for columns: [org.hibernate.mapping.Column(bar)] I tried putting an @Entity annotation on Bar, but

Composing Pipes into a loop or cycle in haskell

耗尽温柔 提交于 2019-12-24 03:47:06
问题 This question is about the Haskell library Pipes. This question is related to 2019 Advent of Code Day 11 (possible spoiler warning) I have two Pipe Int Int m r brain and robot that need to pass information too each other in a continuous loop. That is the output of brain need to go to the input of robot and the output of robot needs to go the the input of brain . When brain finished I need the result of the computation. How do I compose brain and robot into a loop? Ideally a loop with the type

Composable C++ Function Decorators

南笙酒味 提交于 2019-12-23 14:56:56
问题 Python has a very useful feature of function decorators, which, moreover, allows composition. For example, if write a function foo , then you can state that you would like foo to be memoized, but also retried more than a single time in case of a cache miss in which foo also raises an exception, by: @lru_cache @retry def foo(...): Decorator composability allows developing functions like foo and individual function decorators independently, and then mixing them as needed. It would be nice if we

Composable C++ Function Decorators

自作多情 提交于 2019-12-23 14:56:46
问题 Python has a very useful feature of function decorators, which, moreover, allows composition. For example, if write a function foo , then you can state that you would like foo to be memoized, but also retried more than a single time in case of a cache miss in which foo also raises an exception, by: @lru_cache @retry def foo(...): Decorator composability allows developing functions like foo and individual function decorators independently, and then mixing them as needed. It would be nice if we