תוכן עמיר - עמוד 10 - HWzone פורומים
עבור לתוכן
  • צור חשבון

עמיר

משתמש רשום
  • מספר הודעות

    3136
  • הצטרפות

  • ביקר לאחרונה

    אף פעם

הודעות שנפתחו על-ידי עמיר

  1. על פנוי זה נראה בסדר (אם כי בזבזני נוראה בכל פעם ליצור אובייקט חדש, במיוחד אם הפונקציה הזו נקראת הרבה פעמים), יכול להיות שהבעיה במקום אחר..

  2. את צריכה לממש את הפונקציה equal בכל מקום שאת לא רוצה שהיא תתנהג כמו == . הנה דוגמא שכתבתי ואולי תעזור להבין את ההבל בין השוואת מיקום אובייקט למצב אובייקט:


    public class atest
    {
    int an_field;

    public boolean equals(Object other)
    {
    if (this == other) return true;
    if (!(other instanceof atest)) return false;
    return (an_field == ((atest)other).an_field);
    }

    public static void main(String[] args)
    {
    atest a, b, c, d; // this are REFERENCES to objects, not objects themselves.
    // a REFERNCE is a kind of pointer to an object.

    a = new atest(); // a points to a new object in memory.
    b = a; // b points to the same object that a points to.
    c = new atest(); // c points to a new object in memory.
    d = new atest();

    a.an_field = 1;
    c.an_field = 1;
    d.an_field = 2;

    if (a==b) // this is true, since both refrences point to same object/place in memory.
    System.out.println("a==b");
    else
    System.out.println("a!=b");
    if (a==c) // this is false, since each reference points to another object in memory.
    System.out.println("a==c");
    else
    System.out.println("a!=c");
    if (a==d) // this is false, since each reference points to another object in memory.
    System.out.println("a==d");
    else
    System.out.println("a!=d");

    // what did we learn ? that altough that both A and C have the same state, they aren't
    // the same object in memory, and thus == returns false.
    // inorder to compare 2 objects state, we need to implmement our own equals that
    // modifies the default behaviour of equals is ==.

    if (a.equals(b)) // this is true, since both refrences point to same object/place in memory. (which has the same state as itself)
    System.out.println("a equals b");
    else
    System.out.println("a doesn't equal b");
    if (a.equals(c)) // this is true, since each reference points to another object in memory. (but the object have the same state)
    System.out.println("a equals c");
    else
    System.out.println("a doesn't equal c");
    if (a.equals(d)) // this is false, since each reference points to another object in memory. (and their state is diffrent, one has an_field with 1 and the other with 2)
    System.out.println("a equals d");
    else
    System.out.println("a doesn't equal d");
    }
    }

  3. התרגיל הזה זה במסגרת קורס ב JAVA בבית ספר ?

    בכל מקרה, לא ראיתי את כל השורות, תשני את:

    if (t.getTimeClock().equals(kivnclock.TimeToAlarm()))

    ל

    if (kivnclock.TimeToAlarm())

    ובקוד של TimeToAlarm תשני את

    if(timeClock==timeAlarm)

    ל

    if(timeClock.equals(timeAlarm))

  4. א. שימי breakpoint איפה שאת רוצה בקוד (כפתור ימני בקוד ו add breakpoint או משהו כזה). תריצי את הקוד במצב debug (החיפושית במקום החץ הירוק). כאשר הוא יגיע לנקודת ה breakpoint הוא יבקש להיכנס למבט דיבג, תסכימי. אז יהיה לך למעלה חצים של step into ו step out ו step over שמאפשרים לך לשלוט באיך להמשיך לרוץ. (במבט דיבאג יש גם כלים כמו לעקוב אחרי משתנים וכו').

    ב. הפונקציה הזו קשורה למיפוי של אובייקטים תחת מבנים ב Java מסוג Hash (ערבול, נושא שאולי את מכירה). זה קשור לקונבנציה שאובייקטים ב Java שמחזירים true תחת equals חייבים ש hashCode יתן ערך מיפוי (המספר שהו מחזיר) זהה. יש מצב שבקוד שלך (אם את לא משתמשת במבני ערבול) לא תהיה אף בעיה, אבל בגלל ששינינו את equals מומלץ לשנות גם את זה.

  5. http://www.tweaknews.net/reviews/samsung_971p/index5.php

    But, sadly, this is where the good things stop. Sure the picture quality is great, but that is only when you are standing still. Seeing this has an advertising refresh rate of 6ms I thought that gaming would be great....boy was I wrong. The monitor has a bad ghosting problem and doesn't live up to its' 6ms timing. I tried everything seeing I thought it was something to do with my videocard settings but I proved it was the monitor by swapping the monitor out for the 970P and the ghosting was gone. Do NOT buy this monitor for gaming. You will be VERY disappointed.

    לא נראה טוב, אפילו ל casual gamer... הבעיות שיש ב VP930 זהות או שזה סוג אחר ?

  6. המבנים / טכנולוגיות של NOD ממשחק אחד איתם נראות יותר מגניב. שימו לב גם שהברירת מחדל של יחידות היא defence stance ואפשר לשנות את זה למטה שיהיו יותר אגרסיבים. שימו לב גם לאופציות שיש למטה כמו planning mode ו reverse mode.

  7. לגבי ה ION, תעשה COMMAND TECH ואז יופיע לך תחת ה SUPPORT אפשרות ל ION CANNON CENTER או משהו כזה, אחרי שתיצור אותו (כל אחד מהביניינים עולה 5000$) יהיה לך כל איזה 10 דקות אפשרות להשתמש בו.

    ב EASY אין צורך להגן, ב MEDIUM אני עושה איזה 2-3 תותחים רגילים, 3 AA בכל בסיס (יש לי את הבסיס הראשי ובסיס משני באחד מאזורי הטיבריום הענקייים, ו 8 מסוקים (מ 2 הסוגים) בשביל FAST DESPATCH לאזורים שמתקיפים אותי.

×
  • צור חדש...