/** * Construct an interval. * * @param interval the Element containing the interval * @throws Exception if there is a problem constructing the interval */ protected Interval(Element interval) throws Exception { String leftM = interval.getAttribute("leftMargin"); try { m_leftMargin = Double.parseDouble(leftM); } catch (IllegalArgumentException ex) { throw new Exception("[Interval] Can't parse left margin as a number"); } String rightM = interval.getAttribute("rightMargin"); try { m_rightMargin = Double.parseDouble(rightM); } catch (IllegalArgumentException ex) { throw new Exception("[Interval] Can't parse right margin as a number"); } String closure = interval.getAttribute("closure"); if (closure == null || closure.length() == 0) { throw new Exception("[Interval] No closure specified!"); } for (Closure c : Closure.values()) { if (c.toString().equals(closure)) { m_closure = c; break; } } }
/** * Construct an interval. * * @param interval the Element containing the interval * @throws Exception if there is a problem constructing the interval */ protected Interval(Element interval) throws Exception { String leftM = interval.getAttribute("leftMargin"); try { m_leftMargin = Double.parseDouble(leftM); } catch (IllegalArgumentException ex) { throw new Exception("[Interval] Can't parse left margin as a number"); } String rightM = interval.getAttribute("rightMargin"); try { m_rightMargin = Double.parseDouble(rightM); } catch (IllegalArgumentException ex) { throw new Exception("[Interval] Can't parse right margin as a number"); } String closure = interval.getAttribute("closure"); if (closure == null || closure.length() == 0) { throw new Exception("[Interval] No closure specified!"); } for (Closure c : Closure.values()) { if (c.toString().equals(closure)) { m_closure = c; break; } } }
@Override public String toString() { return m_closure.toString(m_leftMargin, m_rightMargin); } }
@Override public String toString() { return m_closure.toString(m_leftMargin, m_rightMargin); } }