1 8 package org.jivesoftware.util.log.output.io.rotate; 9 10 import java.io.File ; 11 12 21 public class OrRotateStrategy 22 implements RotateStrategy { 23 private RotateStrategy[] m_strategies; 24 25 29 private int m_usedRotation = -1; 30 31 34 public OrRotateStrategy(final RotateStrategy[] strategies) { 35 this.m_strategies = strategies; 36 } 37 38 41 public void reset() { 42 if (-1 != m_usedRotation) { 43 m_strategies[m_usedRotation].reset(); 44 m_usedRotation = -1; 45 } 46 } 47 48 58 public boolean isRotationNeeded(final String data, final File file) { 59 m_usedRotation = -1; 60 61 if (null != m_strategies) { 62 final int length = m_strategies.length; 63 for (int i = 0; i < length; i++) { 64 if (true == m_strategies[i].isRotationNeeded(data, file)) { 65 m_usedRotation = i; 66 return true; 67 } 68 } 69 } 70 71 return false; 72 } 73 } 74 75 | Popular Tags |