Code Duplication    Length = 34-34 lines in 2 locations

src/main/java/it/cnr/istc/pst/platinum/ai/framework/domain/component/pdb/PlanDataBaseComponent.java 2 locations

@@ 345-378 (lines=34) @@
342
	/**
343
	 * 
344
	 */
345
	@Override
346
	public synchronized double[] getBehaviorDuration() 
347
	{
348
		// set the initial minimal and maximal values
349
		double[] duration = new double[] {
350
				0,
351
				0
352
			};
353
		
354
		
355
		// get the list of primitive components
356
		Set<DomainComponent> primset = new HashSet<>();
357
		// compute "local" makespan for each component
358
		for (DomainComponent comp : this.components.values()) 
359
		{
360
			// check type 
361
			if (comp.getType().equals(DomainComponentType.SV_PRIMITIVE)) 
362
			{
363
				// get local makespan
364
				double[] local = comp.getBehaviorDuration();
365
				// update "global" minimum makespan
366
				duration[0] += local[0];
367
				// update "global" maximum makespan
368
				duration[1] += local[1];
369
				// add component to primset
370
				primset.add(comp);
371
			}
372
		}
373
		
374
		// compute average values
375
		duration[0] = duration[0] / primset.size();
376
		duration[1] = duration[1] / primset.size();
377
		// get the duration
378
		return duration;
379
	}
380
	
381
	/**
@@ 306-339 (lines=34) @@
303
	 * Compute the duration of a plan as the minimum and maximal average duration of the activities
304
	 * of its components 
305
	 */
306
	@Override
307
	public synchronized double[] getMakespan() 
308
	{
309
		// set the initial minimal and maximal values
310
		double[] makespan = new double[] {
311
				0,
312
				0
313
			};
314
		
315
		
316
		// get the list of primitive components
317
		Set<DomainComponent> primset = new HashSet<>();
318
		// compute "local" makespan for each component
319
		for (DomainComponent comp : this.components.values()) 
320
		{
321
			// check type 
322
			if (comp.getType().equals(DomainComponentType.SV_PRIMITIVE)) 
323
			{
324
				// get local makespan
325
				double[] local = comp.getMakespan();
326
				// update "global" minimum makespan
327
				makespan[0] += local[0];
328
				// update "global" maximum makespan
329
				makespan[1] += local[1];
330
				// add component to primset
331
				primset.add(comp);
332
			}
333
		}
334
		
335
		// compute average values
336
		makespan[0] = makespan[0] / primset.size();
337
		makespan[1] = makespan[1] / primset.size();
338
		// get the makespan
339
		return makespan;
340
	}
341
	
342
	/**