public Entry(Kind kind, String info) { ExceptionHelper.checkNotNullArgument(kind, "kind"); ExceptionHelper.checkNotNullArgument(info, "info"); this.kind = kind; this.info = info; }
public QueryAndOutput( CancellationToken cancelToken, AsyncDataState firstState, AsyncDataQuery<? super DataType, ? extends SourceDataType> query, AsyncDataListener<? super SourceDataType> outputListener) { ExceptionHelper.checkNotNullArgument(cancelToken, "cancelToken"); ExceptionHelper.checkNotNullArgument(query, "query"); ExceptionHelper.checkNotNullArgument(outputListener, "outputListener"); this.cancelToken = cancelToken; this.query = query; this.outputListener = outputListener; this.mainLock = new ReentrantLock(); this.eventScheduler = TaskExecutors.inOrderSyncExecutor(); this.dataForwarderTask = new DataForwardTask(); this.currentSession = null; this.currentController = new InitLaterDataController(firstState); this.initializedController = false; this.unsentData = null; this.sessionReport = AsyncReport.SUCCESS; this.endReport = null; this.finished = false; }
public NbGradle18ModelLoader(OperationInitializer setup, GradleTarget gradleTarget) { ExceptionHelper.checkNotNullArgument(setup, "setup"); ExceptionHelper.checkNotNullArgument(gradleTarget, "gradleTarget"); this.gradleTarget = gradleTarget; this.setup = setup; }
public JavaSourceGroupID(String sourceSetName, JavaSourceGroupName groupName) { ExceptionHelper.checkNotNullArgument(sourceSetName, "sourceSetName"); ExceptionHelper.checkNotNullArgument(groupName, "groupName"); this.sourceSetName = sourceSetName; this.groupName = groupName; }
public DefaultLicenseKey(String name, Path srcPath) { ExceptionHelper.checkNotNullArgument(name, "name"); ExceptionHelper.checkNotNullArgument(srcPath, "srcPath"); this.name = name; this.srcPath = srcPath; }
public TaskDef(CancellationToken cancelToken, CancelableTask task, CleanupTask cleanupTask) { ExceptionHelper.checkNotNullArgument(cancelToken, "cancelToken"); ExceptionHelper.checkNotNullArgument(task, "task"); this.cancelToken = cancelToken; this.task = task; this.cleanupTask = cleanupTask; }
public GradleTemplateAttrProvider( NbGradleProject project, LicenseManager<? super NbGradleModel> licenseManager) { ExceptionHelper.checkNotNullArgument(project, "project"); ExceptionHelper.checkNotNullArgument(licenseManager, "licenseManager"); this.project = project; this.licenseManager = licenseManager; }
private void dispatchTasks(CancellationToken cancelToken) { if (isCurrentThreadDispatching()) { // Tasks will be dispatched there. return; } Thread currentThread = Thread.currentThread(); Throwable toThrow = null; while (!isQueueEmpty()) { if (dispatcherThread.compareAndSet(null, currentThread)) { try { TaskDef taskDef = pollFromQueue(); if (taskDef != null) { taskDef.doTask(cancelToken); } } catch (Throwable ex) { // Only in a case of a very serious error (like OutOfMemory) // will this block be executed because exceptions thrown // by the task (and the cleanup task) is caught and logged. if (toThrow == null) toThrow = ex; else toThrow.addSuppressed(ex); } finally { dispatcherThread.set(null); } } else { return; } } ExceptionHelper.rethrowIfNotNull(toThrow); }
public NbListenerRef addModelUpdateListener(final ProjectModelUpdatedListener listener) { ExceptionHelper.checkNotNullArgument(listener, "listener"); final PropertyChangeListener forwarder = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { listener.onUpdateProject((NbGradleModel) evt.getNewValue()); } }; updateListeners.addPropertyChangeListener(forwarder); return new NbListenerRef() { private volatile boolean registered = true; @Override public boolean isRegistered() { return registered; } @Override public void unregister() { updateListeners.removePropertyChangeListener(forwarder); registered = true; } }; }
public InOrderTaskExecutor(TaskExecutor executor) { ExceptionHelper.checkNotNullArgument(executor, "executor"); this.executor = executor; this.queueLock = new ReentrantLock(); this.dispatcherThread = new AtomicReference<>(null); this.taskQueue = new RefLinkedList<>(); }
public static <Source, Target> Aura<Source, Target> merge( Collection<Aura<? super Source, ? super Target>> auras) { List<Aura<? super Source, ? super Target>> aurasCopy = new ArrayList<>(auras); ExceptionHelper.checkNotNullElements(aurasCopy, "auras"); int count = aurasCopy.size(); if (count == 0) { return (world, source, target) -> UndoableUnregisterRef.UNREGISTERED_REF; } if (count == 1) { // Even if it is not, it shouldn't matter because the returned aura // will accept anything a "<Source, Target>" would. @SuppressWarnings("unchecked") Aura<Source, Target> result = (Aura<Source, Target>) aurasCopy.get(0); return result; } return (world, source, target) -> { UndoableUnregisterRefBuilder result = new UndoableUnregisterRefBuilder(aurasCopy.size()); for (Aura<? super Source, ? super Target> aura : aurasCopy) { result.addRef(aura.applyAura(world, source, target)); } return result; }; }
public ColumnDef( String caption, Comparator<ColumnData> dataComparer, ColumnFormatter<ColumnData> formatter, ColumnDataGetter<RowData, ColumnData> dataGetter) { this(caption, dataComparer, new StringFormat<>(formatter), dataGetter, false); ExceptionHelper.checkNotNullArgument(dataComparer, "dataComparer"); }
/** * Sets the event tracker from which this panel will be notified of changes in the "world" of * ExaltedCombat. The events fired by this event tracker must be consistent with the {@link * #setWorldModel(CombatEntityWorldModel) world model}. * * @param eventTracker the event tracker from which this panel will be notified of changes. This * argument cannot be {@code null}. * @throws NullPointerException thrown if the specified event tracker is {@code null} */ public void setEventTracker(EventTracker eventTracker) { ExceptionHelper.checkNotNullArgument(eventTracker, "eventTracker"); if (this.eventTracker != null) { this.eventTracker.removeAllListeners(); } this.eventTracker = new LocalEventTracker(eventTracker); registerEventTracker(); }
private ColumnDef( String caption, Comparator<ColumnData> dataComparer, ColumnDisplayFormat<?, ColumnData> formatter, ColumnDataGetter<RowData, ColumnData> dataGetter, boolean editable) { ExceptionHelper.checkNotNullArgument(caption, "caption"); ExceptionHelper.checkNotNullArgument(formatter, "formatter"); ExceptionHelper.checkNotNullArgument(dataGetter, "dataGetter"); this.displayDataClass = formatter.getDisplayDataClass(); ExceptionHelper.checkNotNullArgument(displayDataClass, "formatter.getDisplayDataClass()"); this.caption = caption; this.dataComparer = dataComparer; this.formatter = formatter; this.dataGetter = dataGetter; this.editable = editable; }
public static Path[] getFilesForProfile(Path rootDir, ProfileKey profileKey) { ExceptionHelper.checkNotNullArgument(rootDir, "rootDir"); Path mainFile = rootDir.resolve(DEFAULT_PROPERTIES_FILENAME); if (profileKey == null) { return new Path[] {mainFile}; } else { Path profileFile = getProfileFile(rootDir, profileKey); return new Path[] {profileFile, mainFile}; } }
private static CacheKey tryCreateKey(NbGradleModel model) { ExceptionHelper.checkNotNullArgument(model, "model"); File projectDir = model.getGenericInfo().getProjectDir(); FileObject settingsFileObj = model.getGenericInfo().tryGetSettingsFileObj(); File settingsFile = settingsFileObj != null ? FileUtil.toFile(settingsFileObj) : null; if (projectDir == null || (settingsFile == null && settingsFileObj != null)) { return null; } return new CacheKey(projectDir, settingsFile); }
public static Path getProfileFile(Path rootDir, ProfileKey profileKey) { ExceptionHelper.checkNotNullArgument(rootDir, "rootDir"); if (profileKey != null) { Path profileFileDir = getProfileDirectory(rootDir); String group = profileKey.getGroupName(); if (group != null) { profileFileDir = profileFileDir.resolve(group); } return profileFileDir.resolve(profileKey.getFileName()); } else { return rootDir.resolve(DEFAULT_PROPERTIES_FILENAME); } }
public static HearthStoneDb getTestDbUnsafe() throws IOException, ObjectParsingException { Throwable failure = LOAD_FAILURE.get(); if (failure != null) { throw ExceptionHelper.throwChecked(failure, ObjectParsingException.class); } HearthStoneDb result = DB_REF.get(); if (result == null) { try { result = HearthStoneDb.readDefault(); } catch (Throwable ex) { LOAD_FAILURE.set(ex); throw ex; } if (!DB_REF.compareAndSet(null, result)) { result = DB_REF.get(); } } return result; }
public static <Entity> EntityFilter<Entity> merge( Collection<? extends EntityFilter<Entity>> filters) { List<EntityFilter<Entity>> filtersCopy = new ArrayList<>(filters); ExceptionHelper.checkNotNullElements(filtersCopy, "filters"); int count = filtersCopy.size(); if (count == 0) { return EntityFilters.empty(); } if (count == 1) { return filtersCopy.get(0); } return (World world, Stream<? extends Entity> entities) -> { Stream<? extends Entity> currentTargets = entities; for (EntityFilter<Entity> filter : filtersCopy) { currentTargets = filter.select(world, currentTargets); } return currentTargets; }; }
public static <Self, T> AuraFilter<? super Self, ? super T> merge( Collection<? extends AuraFilter<? super Self, ? super T>> filters) { int filterCount = filters.size(); if (filterCount == 0) { return AuraFilter.ANY; } if (filterCount == 1) { return filters.iterator().next(); } List<AuraFilter<? super Self, ? super T>> filtersCopy = new ArrayList<>(filters); ExceptionHelper.checkNotNullElements(filtersCopy, "filters"); return (World world, Self owner, T eventSource) -> { for (AuraFilter<? super Self, ? super T> filter : filtersCopy) { if (!filter.isApplicable(world, owner, eventSource)) { return false; } } return true; }; }
public JavaProjectContextActions(JavaExtension javaExt) { ExceptionHelper.checkNotNullArgument(javaExt, "javaExt"); this.javaExt = javaExt; }
public StandardImageQueryTests(ImageIOLinkFactory imageQuery) { ExceptionHelper.checkNotNullArgument(imageQuery, "imageQuery"); this.imageQuery = imageQuery; }
public FailedVerifier(Class<? extends Throwable> expectedException) { ExceptionHelper.checkNotNullArgument(expectedException, "expectedException"); this.expectedException = expectedException; }
public CacheKey(File projectDir, File settingsFile) { ExceptionHelper.checkNotNullArgument(projectDir, "projectDir"); this.projectDir = projectDir; this.settingsFile = settingsFile; }
@Override public void onDoneReceive(AsyncReport report) { ExceptionHelper.checkNotNullArgument(report, "report"); submitEventTask(new SessionEndTask(session, report)); }
public GradleSharabilityQuery(NbGradleProject project) { ExceptionHelper.checkNotNullArgument(project, "project"); this.project = project; }
public UnstoppableExecutor(ExecutorService executor) { ExceptionHelper.checkNotNullArgument(executor, "executor"); this.executor = executor; }
public ProjectInfo(Collection<Entry> entries) { this.entries = Collections.unmodifiableList(new ArrayList<>(entries)); ExceptionHelper.checkNotNullElements(this.entries, "entries"); }
public static Path getSettingsDir(Path rootDir) { ExceptionHelper.checkNotNullArgument(rootDir, "rootDir"); return rootDir.resolve(SETTINGS_DIR_NAME); }
public StringFormat(ColumnFormatter<ColumnData> formatter) { ExceptionHelper.checkNotNullArgument(formatter, "formatter"); this.formatter = formatter; }