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
what are the charaterstics to determine weather an algorithm is good or not? explain in detail

SPARSE MATRICES Matrices along with good number of zero entries are called sparse matrices. Refer the following matrices of Figure (a)

Define data model?  A data model is a collection of conceptual tools for explaning data, data relationships, data semantics and consistency constraints.

how we can convert a graph into tree

Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.

Game trees An interesting application of trees is the playing of games such as tie-tac-toe, chess, nim, kalam, chess, go etc. We can picture the sequence of possible moves by m

Taking a suitable example explains how a general tree can be shown as a Binary Tree. Conversion of general trees to binary trees: A general tree can be changed into an equiv

Decision Tree A decision tree is a diagram that shows conditions and actions sequentially and therefore shows which condition is to be considered first, second and so on. It is

Prim's algorithm employs the concept of sets. Rather than processing the graph by sorted order of edges, this algorithm processes the edges within the graph randomly by building up

Q. Which are the two standard ways of traversing a graph?  Explain them with an example of each.  Ans:   T he two ways of traversing a graph are written below