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

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