List of usage examples for java.util IdentityHashMap IdentityHashMap
public IdentityHashMap()
From source file:org.dresdenocl.model.base.AbstractModel.java
public boolean addAllMappings(final Map<EObject, EObject> mappings) { if (mappings == null) { m_allMappings = new IdentityHashMap<EObject, EObject>(); } else {/* w w w.j ava 2 s .com*/ m_allMappings = new IdentityHashMap<EObject, EObject>(mappings); } return true; }
From source file:com.parse.ParseTraverser.java
/** * Causes the traverser to traverse all objects pointed to by root, recursively. *///from w w w. ja va2s . com public void traverse(Object root) { IdentityHashMap<Object, Object> seen = new IdentityHashMap<Object, Object>(); traverseInternal(root, yieldRoot, seen); }
From source file:nz.co.senanque.validationengine.ValidationEngineImpl.java
public Map<ValidationObject, ProxyObject> addAll(final ListeningArray<ValidationObject> listeningArray, final List<ValidationObject> o, final ValidationSession validationSession) { final Map<ValidationObject, ProxyObject> bound = new IdentityHashMap<ValidationObject, ProxyObject>(); for (ValidationObject object : o) { bound.putAll(add(listeningArray, object, validationSession)); }//w w w. jav a 2 s . c o m return bound; }
From source file:org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.java
/** * Create a new resource resolver context. *///from w w w .j a v a2 s. c o m public ResourceResolverControl(final boolean isAdmin, final Map<String, Object> authenticationInfo, final ResourceProviderStorageProvider resourceProviderTracker) { this.authenticatedProviders = new IdentityHashMap<ResourceProviderHandler, Object>(); this.authenticationInfo = authenticationInfo; this.isAdmin = isAdmin; this.resourceProviderTracker = resourceProviderTracker; }
From source file:org.apache.hadoop.mapred.SimulatorJobInProgress.java
@SuppressWarnings("deprecation") public SimulatorJobInProgress(JobID jobid, JobTracker jobtracker, JobConf default_conf, JobStory jobStory) { super(jobid, jobStory.getJobConf(), jobtracker); // jobSetupCleanupNeeded set to false in parent cstr, though // default is true restartCount = 0;//from ww w . ja v a 2 s . c om jobSetupCleanupNeeded = false; this.memoryPerMap = conf.getMemoryForMapTask(); this.memoryPerReduce = conf.getMemoryForReduceTask(); this.maxTaskFailuresPerTracker = conf.getMaxTaskFailuresPerTracker(); this.jobId = jobid; String url = "http://" + jobtracker.getJobTrackerMachine() + ":" + jobtracker.getInfoPort() + "/jobdetails.jsp?jobid=" + jobid; this.jobtracker = jobtracker; this.conf = jobStory.getJobConf(); this.priority = conf.getJobPriority(); Path jobDir = jobtracker.getSystemDirectoryForJob(jobid); this.jobFile = new Path(jobDir, "job.xml"); this.status = new JobStatus(jobid, 0.0f, 0.0f, 0.0f, 0.0f, JobStatus.PREP, priority, conf.getUser()); this.profile = new JobProfile(jobStory.getUser(), jobid, this.jobFile.toString(), url, jobStory.getName(), conf.getQueueName()); this.startTime = JobTracker.getClock().getTime(); status.setStartTime(startTime); this.resourceEstimator = new ResourceEstimator(this); this.numMapTasks = jobStory.getNumberMaps(); this.numReduceTasks = jobStory.getNumberReduces(); this.taskCompletionEvents = new ArrayList<TaskCompletionEvent>(numMapTasks + numReduceTasks + 10); this.mapFailuresPercent = conf.getMaxMapTaskFailuresPercent(); this.reduceFailuresPercent = conf.getMaxReduceTaskFailuresPercent(); MetricsContext metricsContext = MetricsUtil.getContext("mapred"); this.jobMetrics = MetricsUtil.createRecord(metricsContext, "job"); this.jobMetrics.setTag("user", conf.getUser()); this.jobMetrics.setTag("sessionId", conf.getSessionId()); this.jobMetrics.setTag("jobName", conf.getJobName()); this.jobMetrics.setTag("jobId", jobid.toString()); this.maxLevel = jobtracker.getNumTaskCacheLevels(); this.anyCacheLevel = this.maxLevel + 1; this.nonLocalMaps = new LinkedList<TaskInProgress>(); this.nonLocalRunningMaps = new LinkedHashSet<TaskInProgress>(); this.runningMapCache = new IdentityHashMap<Node, Set<TaskInProgress>>(); this.nonRunningReduces = new LinkedList<TaskInProgress>(); this.runningReduces = new LinkedHashSet<TaskInProgress>(); this.slowTaskThreshold = Math.max(0.0f, conf.getFloat("mapred.speculative.execution.slowTaskThreshold", 1.0f)); this.speculativeCap = conf.getFloat("mapred.speculative.execution.speculativeCap", 0.1f); this.slowNodeThreshold = conf.getFloat("mapred.speculative.execution.slowNodeThreshold", 1.0f); this.jobStory = jobStory; // this.jobHistory = this.jobtracker.getJobHistory(); }
From source file:org.apache.openjpa.util.AbstractChangeTracker.java
/** * Create a new set for storing adds/removes/changes. Takes into account * whether we need to use an identity set or standard set. *///from w ww .jav a2 s . c om protected Set newSet() { if (_identity == Boolean.TRUE) return MapBackedSet.decorate(new IdentityHashMap()); return new HashSet(); }
From source file:org.apache.openjpa.util.AbstractChangeTracker.java
/** * Switch from an identity structure to a standard one, or vice versa. *///w w w. java2 s .c o m private static Collection switchStructure(Collection cur, boolean identity) { if (cur == null) return null; if (identity && cur instanceof HashSet) { if (cur.isEmpty()) return null; Set replace = MapBackedSet.decorate(new IdentityHashMap()); replace.addAll(cur); return replace; } if (!identity && !(cur instanceof HashSet) && cur instanceof Set) { if (cur.isEmpty()) return null; return new HashSet(cur); } return cur; }
From source file:org.openmrs.module.patientflags.PatientFlagsModuleActivator.java
/** * @see org.openmrs.module.Activator#shutdown() *///from ww w . jav a 2s . c o m public void shutdown() { // need to delete the configured extensions here to assure that they aren't double-loaded on next startup Module thisModule = ModuleFactory.getModuleByPackage("org.openmrs.module.patientflags"); thisModule.setExtensionNames(new IdentityHashMap<String, String>()); thisModule.setExtensions(new Vector<Extension>()); log.info("Shutting down Patient Flags Module"); }
From source file:org.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Inject public MultipleInputColumnsPropertyWidget(ComponentBuilder componentBuilder, ConfiguredPropertyDescriptor propertyDescriptor) { super(componentBuilder, propertyDescriptor); // setBorder(WidgetUtils.BORDER_LIST_ITEM); _checkBoxes = new LinkedHashMap<>(); _checkBoxDecorations = new IdentityHashMap<>(); _firstUpdate = true;//from w w w. jav a 2 s . c o m _dataType = propertyDescriptor.getTypeArgument(0); getAnalysisJobBuilder().addSourceColumnChangeListener(this); getAnalysisJobBuilder().addTransformerChangeListener(this); setLayout(new VerticalLayout(2)); _searchDatastoreTextField = WidgetFactory.createTextField("Search/filter columns"); _searchDatastoreTextField.setBorder( new CompoundBorder(WidgetUtils.BORDER_CHECKBOX_LIST_INDENTATION, WidgetUtils.BORDER_THIN)); _searchDatastoreTextField.getDocument().addDocumentListener(new DCDocumentListener() { @Override protected void onChange(DocumentEvent event) { String text = _searchDatastoreTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { // when there is no search query, set all datastores // visible for (JCheckBox cb : _checkBoxes.values()) { cb.setVisible(true); } } else { // do a case insensitive search text = text.trim().toLowerCase(); for (JCheckBox cb : _checkBoxes.values()) { String name = cb.getText().toLowerCase(); cb.setVisible(name.contains(text)); } } } }); if (_dataType == null || _dataType == Object.class) { _notAvailableCheckBox = new DCCheckBox<>( "<html><font color=\"gray\">- no columns available -</font></html>", false); } else { _notAvailableCheckBox = new DCCheckBox<>("<html><font color=\"gray\">- no <i>" + LabelUtils.getDataTypeLabel(_dataType) + "</i> columns available -</font></html>", false); } _notAvailableCheckBox.setEnabled(false); _buttonPanel = new DCPanel(); _buttonPanel.setLayout(new HorizontalLayout(2)); _buttonPanel.setBorder(WidgetUtils.BORDER_CHECKBOX_LIST_INDENTATION); JButton selectAllButton = WidgetFactory.createDefaultButton("Select all"); selectAllButton.setFont(WidgetUtils.FONT_SMALL); selectAllButton.addActionListener(selectAllActionListener); _buttonPanel.add(selectAllButton); JButton selectNoneButton = WidgetFactory.createDefaultButton("Select none"); selectNoneButton.setFont(WidgetUtils.FONT_SMALL); selectNoneButton.addActionListener(selectNoneActionListener); _buttonPanel.add(selectNoneButton); if (propertyDescriptor.isArray()) { if (_dataType == String.class || _dataType == Object.class) { final JButton expressionColumnButton = WidgetFactory .createSmallButton(IconUtils.MODEL_COLUMN_EXPRESSION); expressionColumnButton.setToolTipText("Create expression/value based column"); expressionColumnButton .addActionListener(AddExpressionBasedColumnActionListener.forMultipleColumns(this)); _buttonPanel.add(expressionColumnButton); } final JButton reorderColumnsButton = WidgetFactory.createSmallButton(IconUtils.ACTION_REORDER_COLUMNS); reorderColumnsButton.setToolTipText("Reorder columns"); reorderColumnsButton.addActionListener(new ReorderColumnsActionListener(this)); _buttonPanel.add(reorderColumnsButton); } add(_buttonPanel); add(_searchDatastoreTextField); }
From source file:org.eobjects.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Inject public MultipleInputColumnsPropertyWidget(AbstractBeanJobBuilder<?, ?, ?> beanJobBuilder, ConfiguredPropertyDescriptor propertyDescriptor) { super(beanJobBuilder, propertyDescriptor); setBorder(new EtchedBorder(EtchedBorder.LOWERED)); _checkBoxes = new LinkedHashMap<InputColumn<?>, DCCheckBox<InputColumn<?>>>(); _checkBoxDecorations = new IdentityHashMap<DCCheckBox<InputColumn<?>>, JComponent>(); _firstUpdate = true;/*from w w w. ja v a 2 s.c o m*/ _dataType = propertyDescriptor.getTypeArgument(0); getAnalysisJobBuilder().getSourceColumnListeners().add(this); getAnalysisJobBuilder().getTransformerChangeListeners().add(this); setLayout(new VerticalLayout(2)); _searchDatastoreTextField = WidgetFactory.createTextField("Search/filter columns"); _searchDatastoreTextField.setBorder(new CompoundBorder(_indentBorder, WidgetUtils.BORDER_THIN)); _searchDatastoreTextField.getDocument().addDocumentListener(new DCDocumentListener() { @Override protected void onChange(DocumentEvent event) { String text = _searchDatastoreTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { // when there is no search query, set all datastores // visible for (JCheckBox cb : _checkBoxes.values()) { cb.setVisible(true); } } else { // do a case insensitive search text = text.trim().toLowerCase(); for (JCheckBox cb : _checkBoxes.values()) { String name = cb.getText().toLowerCase(); cb.setVisible(name.indexOf(text) != -1); } } } }); _notAvailableCheckBox = new DCCheckBox<InputColumn<?>>("<html><font color=\"gray\">- no <i>" + LabelUtils.getDataTypeLabel(_dataType) + "</i> columns available -</font></html>", false); _notAvailableCheckBox.setEnabled(false); _buttonPanel = new DCPanel(); _buttonPanel.setLayout(new HorizontalLayout(2)); _buttonPanel.setBorder(_indentBorder); JButton selectAllButton = new JButton("Select all"); selectAllButton.setFont(WidgetUtils.FONT_SMALL); selectAllButton.addActionListener(selectAllActionListener); _buttonPanel.add(selectAllButton); JButton selectNoneButton = new JButton("Select none"); selectNoneButton.setFont(WidgetUtils.FONT_SMALL); selectNoneButton.addActionListener(selectNoneActionListener); _buttonPanel.add(selectNoneButton); if (propertyDescriptor.isArray()) { if (_dataType == String.class || _dataType == Object.class) { final JButton expressionColumnButton = WidgetFactory .createSmallButton(IconUtils.BUTTON_EXPRESSION_COLUMN_IMAGEPATH); expressionColumnButton.setToolTipText("Create expression/value based column"); expressionColumnButton .addActionListener(AddExpressionBasedColumnActionListener.forMultipleColumns(this)); _buttonPanel.add(expressionColumnButton); } final JButton reorderColumnsButton = WidgetFactory .createSmallButton(IconUtils.BUTTON_REORDER_COLUMN_IMAGEPATH); reorderColumnsButton.setToolTipText("Reorder columns"); reorderColumnsButton.addActionListener(new ReorderColumnsActionListener(this)); _buttonPanel.add(reorderColumnsButton); } add(_buttonPanel); add(_searchDatastoreTextField); }