@Override public boolean equals (final Object o) { if (o == this) return true; if (!super.equals (o)) return false; final JSBlock rhs = (JSBlock) o; return m_bBracesRequired == rhs.m_bBracesRequired && m_bIndentRequired == rhs.m_bIndentRequired && m_bNewLineAtEnd == rhs.m_bNewLineAtEnd; }
@Override public boolean equals (final Object o) { if (o == this) return true; if (!super.equals (o)) return false; final JSAtomBoolean rhs = (JSAtomBoolean) o; return m_bValue == rhs.m_bValue; }
@Override @Nonnull public AbstractJSAtomNumeric numericPlus (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue + aRhs.doubleValue ()); return new JSAtomInt (m_nValue + (long) aRhs.doubleValue ()); }
@Nonnull public final JSAssignment assignPlus (final float fValue) { return assignPlus (JSExpr.lit (fValue)); }
@Nonnull public static JSInvocation jsonStringify (@Nonnull final IJSExpression aExpr) { return jsonStringify ().arg (aExpr); } }
@Nonnull public static AbstractJSExpression plus (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { // Some optimizations if (aLeft instanceof JSStringLiteral && aRight instanceof JSStringLiteral) return new JSStringLiteral (((JSStringLiteral) aLeft).getContainedString () + ((JSStringLiteral) aRight).getContainedString ()); if (aLeft instanceof AbstractJSAtomNumeric && aRight instanceof AbstractJSAtomNumeric) return ((AbstractJSAtomNumeric) aLeft).numericPlus ((AbstractJSAtomNumeric) aRight); return new JSOpBinary (aLeft, "+", aRight); }
@Nonnull public static AbstractJSExpression div (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { // Some optimizations if (aLeft instanceof AbstractJSAtomNumeric && aRight instanceof AbstractJSAtomNumeric) return ((AbstractJSAtomNumeric) aLeft).numericDiv ((AbstractJSAtomNumeric) aRight); return new JSOpBinary (aLeft, "/", aRight); }
@Override @Nonnull public AbstractJSAtomNumeric numericMinus (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue - aRhs.doubleValue ()); return new JSAtomInt (m_nValue - (long) aRhs.doubleValue ()); }
@Override @Nonnull public AbstractJSAtomNumeric numericMul (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue * aRhs.doubleValue ()); return new JSAtomInt (m_nValue * (long) aRhs.doubleValue ()); }
@Override @Nonnull public AbstractJSAtomNumeric numericMod (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue % aRhs.doubleValue ()); return new JSAtomInt (m_nValue % (long) aRhs.doubleValue ()); }
@Override @Nonnull public AbstractJSAtomNumeric numericMul (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue * aRhs.doubleValue ()); return new JSAtomInt (m_nValue * (long) aRhs.doubleValue ()); }
@Override @Nonnull public AbstractJSAtomNumeric numericPlus (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue + aRhs.doubleValue ()); return new JSAtomInt (m_nValue + (long) aRhs.doubleValue ()); }
@Override @Nonnull public AbstractJSAtomNumeric numericMod (@Nonnull final AbstractJSAtomNumeric aRhs) { if (aRhs.isDecimalValue ()) return new JSAtomDecimal (m_nValue % aRhs.doubleValue ()); return new JSAtomInt (m_nValue % (long) aRhs.doubleValue ()); }