Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I made a Java application where each class performs a processing and at the end it creates an instance of another class. It also calls a method of this class and passes results to it in the parameters of the method like this:

public class Matrix{
     public double CalculerMinimum()
     {
        ....
           if ((result < min)) {
                        min = result;
               }
       

            Liste lis  = new Liste();
            lis.getFile(min);
         return min;
     }
 }
public class Liste{
     public string getFile(double min)
     {
        ....
           
         return lien;
     }
}

What is the relationship between classes? how I can represent that with a class diagram?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
253 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your Matrix class creates and uses the Liste class. This is called a dependency. You can represent it in a class-diagram with a dotted arrow and ?use? and/or ?create?.

Your code shows no kind of association nor generalization. The fact that a Liste is used in the implementation of an operation is not sufficient to make an association: this Liste is local and encapsulated in the operation; there is no conceptual association between the two classes themselves (and you could imagine an implementation of CalculerMinimum() that doesn't use any Liste).

What you cannot represent in the class-diagram is the dynamic of the behavior. If you're interested in the dynamics you'd need to use a behavior diagram.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...