Results 1 to 6 of 6

Thread: Compare two methods for equality

  1. #1
    Join Date
    Dec 2009
    Posts
    178

    Compare two methods for equality

    Hello,
    I have a class named Sequence. In my program I would use a list of Sequence. One of the fields in this class and a list of objects of type Match. At one point in this program I have to compare all objects of type game with another list, which will allow me to complete their attribute. (The game attribute possess a position that is their position on the sequence by comparing this position with a list of known positions I just deduct it are the attributes of the match in question.) My question then is, who should have the method of comparison between the game and the other list? If you have solution for this problem, then please help me with this. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    446

    Re: Compare two methods for equality

    Hello,
    What do you comparing exactly? If the game is, simply redefine the class in the game equals method common to all objects. Otherwise I think you can also make a method in which Sequence compares two lists of matches, using the equals method of game that you've redefined. If you need more information on this, then you can visit the sun's official site and then you can see more detailed information on the same.

  3. #3
    Join Date
    Nov 2009
    Posts
    356

    Re: Compare two methods for equality

    Hello,
    I am a little restricted by the choice of the JDK, to provide a method equals to each object. For me, it's always something external that can compare. So the answer to the question Who should have the method of comparison between the game and the other list? To be smarter, I noted that there is in the class Arrays methods for comparing lists.

  4. #4
    Join Date
    Nov 2009
    Posts
    343

    Re: Compare two methods for equality

    Hello,
    There may be something somewhere that specifies the organization of these things, then it is he who will hold this as equals. Or do these rules come from constraints of your lists, or lists of objects, these bizarre rules do not fall from heaven. If they come from specific properties to these lists, then there must be method to the list. It is a difficulty responding to problems with compression algorithms that can explain compression algorithms, the objects themselves become algorithmic ideas, and we eventually get lost.

  5. #5
    Join Date
    Nov 2009
    Posts
    359

    Re: Compare two methods for equality

    Hello,
    If I understand a game is a range of characters. By comparison "you mean that you are looking at whether a range of characters (game object) is included in another range of characters. Looking therefore to know whether an object matches "is included" in another object game. Who has the information necessary to answer this question? A prior, the game objects. Therefore, this responsibility must be assigned to objects game. I therefore see such a method "public boolean contains (Match m)" in the class matches.

  6. #6
    Join Date
    Nov 2009
    Posts
    446

    Re: Compare two methods for equality

    Hello,
    But still the question of "who" will call contains and manage the assignment of attributes to the Games ... to me, it would rather blow to an external service (so in my opinion nor in the list or in game), but it's true it's a little too vague "functionally" to meet. I think this is the only solution for you, I can not think of an alternative right now, but if I come to knew about the same then I will post back.

Similar Threads

  1. Replies: 1
    Last Post: 22-08-2011, 04:40 AM
  2. Dead Space 2 PC Equality Petition
    By Botan in forum Video Games
    Replies: 2
    Last Post: 31-01-2011, 03:26 PM
  3. How to check object equality in .net?
    By MAHAH in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 07:52 PM
  4. What are the different methods used by a Firewall
    By Abhibhava in forum Networking & Security
    Replies: 5
    Last Post: 23-12-2009, 12:30 AM
  5. Get and Set methods
    By garfield1 in forum Software Development
    Replies: 3
    Last Post: 24-11-2009, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •