001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.pattern.parser; 015 016import ch.qos.logback.core.pattern.FormatInfo; 017 018public class FormattingNode extends Node { 019 020 FormatInfo formatInfo; 021 022 FormattingNode(int type) { 023 super(type); 024 } 025 026 FormattingNode(int type, Object value) { 027 super(type, value); 028 } 029 030 public FormatInfo getFormatInfo() { 031 return formatInfo; 032 } 033 034 public void setFormatInfo(FormatInfo formatInfo) { 035 this.formatInfo = formatInfo; 036 } 037 038 public boolean equals(Object o) { 039 if (!super.equals(o)) { 040 return false; 041 } 042 043 if (!(o instanceof FormattingNode)) { 044 return false; 045 } 046 FormattingNode r = (FormattingNode) o; 047 048 return (formatInfo != null ? formatInfo.equals(r.formatInfo) : r.formatInfo == null); 049 } 050 051 @Override 052 public int hashCode() { 053 int result = super.hashCode(); 054 result = 31 * result + (formatInfo != null ? formatInfo.hashCode() : 0); 055 return result; 056 } 057}