Example of single node with multiple elements, Data Structure & Algorithms

The class Element represents a single node that can be part of multiple elements on a hotplate and runs in its own thread. The constructor accepts the initial temperature and a heat constant that should be between 0.0 (exclusive) and 1.0. The start method should start running the thread. While running the element compares the average temperatures of its neighbours with its own temperature and adjusts its current temperature using this formula:

currentTemp += (averageTemps - currentTemp) _ heatConstant

The elements own temperature can be increased or decreased by calling the method applyTempToElement using this formula:

currentTemp += (appliedTemp - currentTemp) _ heatConstant.

Because neighbour elements are running in their own threads and accessing each others temperature, careful synchronization will be needed whenever the temperature field is accessed or changed. Using the UML diagram below as a guide.

2411_elements.png

Posted Date: 3/1/2013 4:09:35 AM | Location : United States







Related Discussions:- Example of single node with multiple elements, Assignment Help, Ask Question on Example of single node with multiple elements, Get Answer, Expert's Help, Example of single node with multiple elements Discussions

Write discussion on Example of single node with multiple elements
Your posts are moderated
Related Questions
Write the algorithm for compound interest

write an algorithm to sort given numbers in ascending order using bubble sort

Write an algorithm by using pseudocode which: Inputs top speeds of 5000 cars Outputs fastest speed and the slowest speed Outputs average speed of all the 5000 cars

Consider the following 5-city traveling salesman problem. The distance between each city (in miles) is shown in the following table: (a) Formulate an IP whose solution will

how to define the size of array

Board coloring , C/C++ Programming

Q. Suggest a method of implementing two stacks in one array such that as long as space is there in an array, you should be capable to add an element in either stack. Using proposed

extra key inserted at end of array is called

Chaining In this method, instead of hashing function value as location we use it as an index into an array of pointers. Every pointer access a chain that holds the element havi

In this unit, we learned the data structure arrays from the application point of view and representation point of view. Two applications that are representation of a sparse matrix