List of usage examples for org.apache.commons.collections4.map ReferenceMap ReferenceMap
public ReferenceMap()
ReferenceMap
that will use hard references to keys and soft references to values. From source file:com.epitrack.guardioes.view.base.BaseActivity.java
@Override public int add(final Class<? extends Fragment> fragmentClass, final String tag, final Bundle bundle, final boolean addToBackStack) { if (fragmentClass == null) { throw new IllegalArgumentException("The fragmentClass cannot be null."); }/*from w ww. ja va 2 s. c om*/ if (tag == null) { throw new IllegalArgumentException("The tag cannot be null."); } if (fragmentMap == null) { fragmentMap = new ReferenceMap<>(); } Fragment fragment = fragmentMap.get(tag); if (fragment == null) { fragment = Fragment.instantiate(this, fragmentClass.getName(), bundle); fragmentMap.put(tag, fragment); } if (addToBackStack) { return getFragmentManager().beginTransaction().add(getLayout(), fragment, tag).addToBackStack(tag) .commit(); } return getFragmentManager().beginTransaction().add(getLayout(), fragment, tag).commit(); }
From source file:com.epitrack.guardioes.view.base.BaseAppCompatActivity.java
@Override public int add(final Class<? extends Fragment> fragmentClass, final String tag, final Bundle bundle, final boolean addToBackStack) { if (fragmentClass == null) { throw new IllegalArgumentException("The fragmentClass cannot be null."); }/*from w w w .j av a 2 s . c o m*/ if (tag == null) { throw new IllegalArgumentException("The tag cannot be null."); } if (fragmentMap == null) { fragmentMap = new ReferenceMap<>(); } Fragment fragment = fragmentMap.get(tag); if (fragment == null) { fragment = Fragment.instantiate(this, fragmentClass.getName()); fragmentMap.put(tag, fragment); } fragment.setArguments(bundle); if (addToBackStack) { return getFragmentManager().beginTransaction().add(getLayout(), fragment, tag).addToBackStack(tag) .commit(); } return getFragmentManager().beginTransaction().add(getLayout(), fragment, tag).commit(); }
From source file:net.sf.jasperreports.engine.util.JRSingletonCache.java
protected Map<String, T> getContextInstanceCache() { Object contextKey = getContextKey(); Map<String, T> contextCache = cache.get(contextKey); if (contextCache == null) { contextCache = new ReferenceMap<String, T>(); cache.put(contextKey, contextCache); }/*from w w w .j a va2s . co m*/ return contextCache; }
From source file:net.sf.jasperreports.engine.fill.JRFillCellContents.java
public JRFillCellContents(JRBaseFiller filler, JRCellContents cell, String cellType, JRFillCrosstabObjectFactory factory) { super(filler, cell, factory); defaultStyleProvider = factory.getDefaultStyleProvider(); parentCell = cell;// w w w . ja v a 2 s . co m this.cellType = cellType; int elementId = filler.getFillContext().generateFillElementId(); printElementOriginator = new DefaultPrintElementOriginator(elementId); lineBox = cell.getLineBox().clone(this); width = cell.getWidth(); height = cell.getHeight(); factory.registerDelayedStyleSetter(this, parentCell); initElements(); initConditionalStyles(); initTemplatesMap(); this.originProvider = factory.getParentOriginProvider(); setElementOriginProvider(this.originProvider); transformedContentsCache = new ReferenceMap<StretchedContents, JRFillCellContents>(); boxContentsCache = new HashMap<BoxContents, JRFillCellContents>(); clonePool = new JRClonePool(this, true, true); }
From source file:com.epitrack.guardioes.view.base.BaseActivity.java
@Override public int replace(final Class<? extends Fragment> fragmentClass, final String tag, final Bundle bundle, final boolean addToBackStack) { if (fragmentClass == null) { throw new IllegalArgumentException("The fragmentClass cannot be null."); }// w ww.j a va2s . co m if (tag == null) { throw new IllegalArgumentException("The tag cannot be null."); } if (fragmentMap == null) { fragmentMap = new ReferenceMap<>(); } Fragment fragment = fragmentMap.get(tag); if (fragment == null) { fragment = Fragment.instantiate(this, fragmentClass.getName(), bundle); fragmentMap.put(tag, fragment); } if (addToBackStack) { return getFragmentManager().beginTransaction().replace(getLayout(), fragment, tag).addToBackStack(tag) .commit(); } return getFragmentManager().beginTransaction().replace(getLayout(), fragment, tag).commit(); }
From source file:com.epitrack.guardioes.view.base.BaseAppCompatActivity.java
@Override public int replace(final Class<? extends Fragment> fragmentClass, final String tag, final Bundle bundle, final boolean addToBackStack) { if (fragmentClass == null) { throw new IllegalArgumentException("The fragmentClass cannot be null."); }/*from w w w . j av a2s . co m*/ if (tag == null) { throw new IllegalArgumentException("The tag cannot be null."); } if (fragmentMap == null) { fragmentMap = new ReferenceMap<>(); } Fragment fragment = fragmentMap.get(tag); if (fragment == null) { fragment = Fragment.instantiate(this, fragmentClass.getName()); fragmentMap.put(tag, fragment); } fragment.setArguments(bundle); if (addToBackStack) { return getFragmentManager().beginTransaction().replace(getLayout(), fragment, tag).addToBackStack(tag) .commit(); } return getFragmentManager().beginTransaction().replace(getLayout(), fragment, tag).commit(); }
From source file:net.sf.jasperreports.engine.fill.JRFillCellContents.java
protected JRFillCellContents(JRFillCellContents cellContents, JRFillCloneFactory factory) { super(cellContents, factory); defaultStyleProvider = cellContents.defaultStyleProvider; parentCell = cellContents.parentCell; cellType = cellContents.cellType;/*from w w w . j ava2s. co m*/ printElementOriginator = cellContents.printElementOriginator; lineBox = cellContents.getLineBox().clone(this); width = cellContents.width; height = cellContents.height; initStyle = cellContents.initStyle; initElements(); initConditionalStyles(); this.templateFrames = cellContents.templateFrames; this.originProvider = cellContents.originProvider; transformedContentsCache = new ReferenceMap<StretchedContents, JRFillCellContents>(); boxContentsCache = new HashMap<BoxContents, JRFillCellContents>(); clonePool = new JRClonePool(this, true, true); verticalPositionType = cellContents.verticalPositionType; }
From source file:org.openvpms.component.system.common.cache.SoftRefIMObjectCache.java
/** * Constructs a {@link SoftRefIMObjectCache}. *///from w ww. j av a 2 s. c o m public SoftRefIMObjectCache(IArchetypeService service) { super(new ReferenceMap<IMObjectReference, IMObject>(), service); }
From source file:org.protempa.CollectSubtreeGetterSlowStrategy.java
CollectSubtreeGetterSlowStrategy(Map<String, PropositionDefinition> propositionDefinitionMap, boolean narrower) { assert propositionDefinitionMap != null : "propositionDefinitionMap cannot be null"; this.propIdInDataSourceCache = new ReferenceMap<>(); this.propIdPropInDataSourceCache = new ReferenceMap<>(); this.propositionDefinitionMap = propositionDefinitionMap; this.narrower = narrower; this.propDefWalker = new PropositionDefinitionWalker(); this.propIdWalker = new PropIdWalker(); }
From source file:org.protempa.KnowledgeSourceImpl.java
public KnowledgeSourceImpl(KnowledgeSourceBackend... backends) { super(backends); this.inverseIsACache = new ReferenceMap<>(); this.abstractedFromCache = new ReferenceMap<>(); this.subContextsCache = new ReferenceMap<>(); this.inducedByCache = new ReferenceMap<>(); this.notFoundAbstractionDefinitionRequests = new WeakHashMap<>(); this.notFoundValueSetRequests = new WeakHashMap<>(); this.notFoundPropositionDefinitionRequests = new WeakHashMap<>(); this.notFoundContextDefinitionRequests = new WeakHashMap<>(); this.notFoundTemporalPropositionDefinitionRequests = new HashMap<>(); this.propDefReader = new PropositionDefinitionReader(); this.abstractionDefReader = new AbstractionDefinitionReader(); this.contextDefReader = new ContextDefinitionReader(); this.tempPropDefReader = new TemporalPropositionDefinitionReader(); }