Questions tagged [composite]

The Composite pattern is a design pattern that allows a group of objects to be treated in the same way as a single instance of an object. It is one of the Gang of Four's structural design patterns.

Overview

The Composite pattern is a design pattern that allows a group of objects to be treated in the same way as a single instance of an object.

It is one of the Gang of Four's structural , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

The Composite pattern may sometimes coincide with the use of composite data types and composite variables.

See also

979 questions
-1
votes
1 answer

Indexing getter composite pattern java

I have implemented this model with Composite pattern in Java: I would like to know how I can access to the leafs of these tree using an index getter. For example if I have a List of Element, get the second leaf. Thanks!
user3721503
-1
votes
1 answer

Using another class as vector in a composite class

I have 2 classes, they have a composite relationship. How do I include the class as a vector in another class? Can anyone tell me how to initialize the vector as well? class Student{ int id; string name; public: Student(int id = 0, string name =…
Coastie
  • 55
  • 7
-1
votes
1 answer

Finding the primary key table name in SQL server

I have an issue with composite primary keys. Having the name of a table, I need to know which columns are foreign keys and I need to know the names of the tables they relate to. Now this would be easy if it weren't for the fact that the related…
Mr W
  • 597
  • 1
  • 7
  • 22
-1
votes
2 answers

initialize a static const std::pair>

I have a class myclass { // ... static const vector>> var; // ... }; in the class definition, to use mappings of single strings to several others. I am using vector<> instead of arrays, in order to be able to…
npit
  • 2,219
  • 2
  • 19
  • 25
-1
votes
1 answer

Which design pattern can be used to fulfill this requirement?

I am working on an application which allows its users to apply different filters on an image that they upload. However, there is another requirement that needs to be fulfilled here. The application should allow the user to apply several filters on…
Fandango
  • 11
  • 1
-1
votes
1 answer

GeneralPath and the Composite pattern

A GeneralPath object contains Shapes and is itself a Shape. Would this be an example of a class that uses the Composite Pattern? I am confused by the Composite Pattern condition: "Clients treat a composite object as a primitive object." Is this use…
user3000731
  • 93
  • 2
  • 11
-1
votes
1 answer

Set value of composite classes using Reflection

I'm trying to create instance of an object that also have classes composed in to it: [DataContract(Name = "share", Namespace = "")] public class RequestShareDocument { [DataMember(Order = 0)] public string profile_name { get; set; } …
Salman
  • 1,266
  • 5
  • 21
  • 41
-1
votes
1 answer

Bi-directional OneToMany error: why does Hibernate think I am using a composite key?

I am getting this infamous error: Foreign key (FK69848D5097EB6FB4:DOCUMENT_HISTORY [VOTERDOC_ID])) must have same number of columns as the referenced primary key (VOTER_DOCUMENT [VOTER_ID,ID]) But I am not using a composite key. I've confirmed…
Robert Bowen
  • 487
  • 2
  • 13
  • 24
-1
votes
2 answers

How to batch combine two unique series of images into a single side-by-side image in Photoshop?

I need to combine two series of images (both the same resolution, saved as JPG files) into a single JPG file with the images side by side to each other. I have tried doing this with Photoshop CS6 actions but to no avail... I have searched the…
Dr. C
  • 9
  • 1
  • 1
-1
votes
1 answer

Draw in composite

I have a Composite called Workspace. In this composite I want to add some graphics object. Each object can be selected, dragged, moved and can have complicated shape (circle, ellipse, polygon,...). I can click at each object to see its properties.…
Hieu Nguyen
  • 382
  • 2
  • 15
-1
votes
2 answers

how to add panel/jpanel or any panel of any package to composite in java?? (using RAP, SWT)

I am creating an RAP application in JAVA. i want to have a GUI like master detail. in which left side has panel that has a tree (like in windows 7) and on the right side there will be text fields which will be changing when different TreeItem is…
Asad Ullah
  • 117
  • 1
  • 3
  • 11
-2
votes
1 answer

Example Composite Design Pattern - Genealogical Tree

I would like to model a genealogical tree with the composite pattern. For simplicity I am only interested: to the marriage relationship between two people to the paternity relationship between a parent and all her children. For simplicity, it is not…
Mariox
  • 15
  • 2
-2
votes
1 answer

How to fix: Syntax error on token(s), misplaced construct(s) Error

working my way through an online java video tutorial and running into some trouble. tutorial deals with the composite design pattern to which i have little experience. first two tutorials went well and the third is giving me issues. i've asked…
tgrim90
  • 339
  • 1
  • 2
  • 13
-2
votes
1 answer

How to keep Wooccommerce Composite Product extension from multiplying the quantity of composite items by the base product quantity?

The Wooccommerce Composite Product extension allows you to create one product which is the combination of a base product and one or more component products. It's like having one or more small boxes inside one big box and the one big box inside an…
-3
votes
1 answer

i want to create composite foreign key but it gives my sql error 1005

Table complaint_record with composite primary key CREATE TABLE `complaint_record` ( `complaint_id` int(11) NOT NULL AUTO_INCREMENT, `cat_id` int(10) unsigned NOT NULL, `store_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned DEFAULT…
dhyanandra singh
  • 1,071
  • 2
  • 18
  • 38
1 2 3
65
66