/** FlagInfo class is redefine now, inherited from multi_super class: ObjectInfo and Parameter. */ class FlagInfo extends ObjectInfo implements Parameter { char m_area; // 'p' - penalty area flag char m_horiz; // [l|c|r] [l|r|t|b] [l|r] [t|b] char m_vert; // [t|b] 0 [t|c|b] [l|r] int m_no; // 10|20|30|40|50 double x, y; // x_position, y_position public FlagInfo() { super("flag"); } public FlagInfo(char type, char posH, char posV, int number) { super("flag"); m_area = type; m_horiz = posH; m_vert = posV; m_no = number; if (m_area == 'p'){ if(m_horiz == 'l') x = -0.5 * FieldLength + PenaltyAreaLength; else x = 0.5 * FieldLength - PenaltyAreaLength; switch (m_vert) { case 't': y = - 0.5 * PenaltyAreaWidth; break; case 'c': y = 0; break; case 'b': y = 0.5 * PenaltyAreaWidth; break; default : err_print(); break;} } else if ( m_area == 'g'){ if(m_horiz == 'l') x = -0.5 * FieldLength; else x = 0.5 * FieldLength; switch (m_vert) { case 't': y = - 0.5 * GoalWidth; break; case 'b': y = 0.5 * GoalWidth; break; default : err_print(); break;} } else { switch (m_horiz) { case 'l': case 'r': if(m_horiz == 'l') x = -0.5 * FieldLength - 5; else x = 0.5 * FieldLength + 5; if(m_vert == 't') { if (m_no > 0 ) y = -m_no; else { y = -0.5 * FieldWidth; if(m_horiz == 'l') x = -0.5 * FieldLength ; else x = 0.5 * FieldLength ;} } else if(m_vert == 'b') { if (m_no > 0 ) y = m_no; else { y = 0.5 * FieldWidth; if(m_horiz == 'l') x = -0.5 * FieldLength ; else x = 0.5 * FieldLength ;} } else if(m_vert == '0') y = 0; else err_print(); break; case 'c': x = 0; if (m_vert == 't') y = -0.5 * FieldWidth; else if (m_vert == 'b') y = 0.5 * FieldWidth; else y = 0; break; case 't': case 'b': if(m_horiz == 't') y = -0.5 * FieldWidth - 5; else y = 0.5 * FieldWidth + 5; if(m_vert == 'l') x = -m_no; else if(m_vert == 'r') x = m_no; else if(m_vert == '0') x = 0; else err_print(); break; } } } void err_print() { System.err.print("-- FlagInfo. value SET error. --"); System.err.print(m_area + "\t" + m_horiz + "\t" + m_vert + "\t" + m_no); } public void print() { super.print(); System.out.println(" {area, hori, vert, no}=\t" + m_area + "\t" + m_horiz + "\t" + m_vert + "\t" + m_no); System.out.println(" {position_x, y}=\t" + x + "\t" + y); } }