repo_name
stringlengths 5
108
| path
stringlengths 6
333
| size
stringlengths 1
6
| content
stringlengths 4
977k
| license
stringclasses 15
values |
---|---|---|---|---|
lhillah/pnmlframework | pnmlFw-CoreModel/src/fr/lip6/move/pnml/pnmlcoremodel/hlapi/FontDecorationHLAPI.java | 2005 | /**
* Copyright 2009-2016 Université Paris Ouest and Sorbonne Universités,
Univ. Paris 06 - CNRS UMR 7606 (LIP6)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Project leader / Initial Contributor:
* Lom Messan Hillah - <lom-messan.hillah@lip6.fr>
*
* Contributors:
* ${ocontributors} - <$oemails}>
*
* Mailing list:
* lom-messan.hillah@lip6.fr
*/
/**
* (C) Sorbonne Universités, UPMC Univ Paris 06, UMR CNRS 7606 (LIP6/MoVe)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Lom HILLAH (LIP6) - Initial models and implementation
* Rachid Alahyane (UPMC) - Infrastructure and continuous integration
* Bastien Bouzerau (UPMC) - Architecture
* Guillaume Giffo (UPMC) - Code generation refactoring, High-level API
*
* $Id ggiffo, Wed Feb 10 14:59:10 CET 2016$
*/
package fr.lip6.move.pnml.pnmlcoremodel.hlapi;
import fr.lip6.move.pnml.pnmlcoremodel.*;
public enum FontDecorationHLAPI{
UNDERLINE("underline"),
OVERLINE("overline"),
LINETHROUGH("linethrough");
private final FontDecoration item;
private FontDecorationHLAPI(String name) {
this.item = FontDecoration.get(name);
}
/**
* Return one HLAPI enum (used for tests).
* @return one of the enum, null if the int is "out of bounds"
*/
public static FontDecorationHLAPI get(int num) {
if(num == 0){
return UNDERLINE;
}
if(num == 1){
return OVERLINE;
}
if(num == 2){
return LINETHROUGH;
}
return null;
}
public FontDecoration getContainedItem() {
return item;
}
} | epl-1.0 |
schemeway/SchemeScript | plugin/src/org/schemeway/plugins/schemescript/editor/autoedits/DoubleQuoteInserter.java | 1148 | /*
* Copyright (c) 2004 Nu Echo Inc.
*
* This is free software. For terms and warranty disclaimer, see ./COPYING
*/
package org.schemeway.plugins.schemescript.editor.autoedits;
import org.eclipse.jface.text.*;
public class DoubleQuoteInserter implements IAutoEditStrategy {
public DoubleQuoteInserter() {
}
public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
try {
if (command.text.equals("\\")) {
if (document.getChar(command.offset) == '"') {
command.text = "\\\\";
command.doit = true;
command.length = 0;
command.shiftsCaret = true;
command.caretOffset = command.offset;
}
}
else if (command.text.equals("\"")) {
if (document.getChar(command.offset) == '"') {
command.doit = true;
command.text = "";
command.length = 0;
command.shiftsCaret = true;
command.caretOffset = command.offset + 1;
}
else {
command.text = "\\\"";
command.doit = true;
command.length = 0;
command.shiftsCaret = true;
command.caretOffset = command.offset;
}
}
} catch (BadLocationException exception) {
}
}
} | epl-1.0 |
oxmcvusd/eclipse-integration-gradle | org.springsource.ide.eclipse.gradle.core/src/org/springsource/ide/eclipse/gradle/core/wizards/GradleImportOperation.java | 28545 | /*******************************************************************************
* Copyright (c) 2012, 2014 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.gradle.core.wizards;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.FileInfoMatcherDescription;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceFilterDescription;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo;
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.internal.ui.workingsets.IWorkingSetIDs;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.gradle.tooling.model.DomainObjectSet;
import org.gradle.tooling.model.eclipse.EclipseProjectDependency;
import org.gradle.tooling.model.eclipse.HierarchicalEclipseProject;
import org.springsource.ide.eclipse.gradle.core.GradleCore;
import org.springsource.ide.eclipse.gradle.core.GradleNature;
import org.springsource.ide.eclipse.gradle.core.GradleProject;
import org.springsource.ide.eclipse.gradle.core.ProjectConfigurationManager;
import org.springsource.ide.eclipse.gradle.core.ProjectConfigurationRequest;
import org.springsource.ide.eclipse.gradle.core.TaskUtil;
import org.springsource.ide.eclipse.gradle.core.TaskUtil.ITaskProvider;
import org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences;
import org.springsource.ide.eclipse.gradle.core.classpathcontainer.FastOperationFailedException;
import org.springsource.ide.eclipse.gradle.core.util.ErrorHandler;
import org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil;
import org.springsource.ide.eclipse.gradle.core.util.GradleProjectSorter;
import org.springsource.ide.eclipse.gradle.core.util.GradleProjectUtil;
import org.springsource.ide.eclipse.gradle.core.util.JobUtil;
import org.springsource.ide.eclipse.gradle.core.util.NatureUtils;
import org.springsource.ide.eclipse.gradle.core.util.ResourceFilterFactory;
import org.springsource.ide.eclipse.gradle.core.wizards.PrecomputedProjectMapper.NameClashException;
/**
* This is the 'core' counter part of GradleImportWizard. An instance of this class specifies
* an import operation that can be executed to import gradle projects into the workspace.
* <p>
* Essentially it contains just the information needed to execute the operation, extracted from
* the wizard UI when the user presses the finish button.
*
* @author Kris De Volder
* @author Alex Boyko
*/
@SuppressWarnings("restriction")
public class GradleImportOperation {
//TODO: check that root folder project doesn't have parents... (that situation isn't really considered in this code, not sure
// what behavior may ensue if user points "root folder" to a nested project.
public static final boolean DEFAULT_ADD_RESOURCE_FILTERS = true;
public static final boolean DEFAULT_QUICK_WORKINGSET_ENABLED = true;
public static final boolean DEFAULT_USE_HIERARCHICAL_NAMES = false;
public static final boolean DEFAULT_DO_AFTER_TASKS = true; //Is not affected by GRADLE-1792 so can be on by default
public static final boolean DEFAULT_ENABLE_DEPENDENCY_MANAGEMENT = true; //Default setting preserves 'old' behavior.
/**
* Tasks to run before doing actual import (if option is enabled)
*/
public static String[] DEFAULT_BEFORE_TASKS = {"cleanEclipse", "eclipse"};
/**
* Names of tasks to run after doing import (if option is enabled)
*/
public static String[] DEFAULT_AFTER_TASKS = {"afterEclipseImport"};
// private File rootFolder;
private List<HierarchicalEclipseProject> projectsToImport;
private boolean addResourceFilters = DEFAULT_ADD_RESOURCE_FILTERS;
// options related to executing additional tasks
private boolean doBeforeTasks;
private String[] beforeTasks = DEFAULT_BEFORE_TASKS;
private boolean doAfterTasks = DEFAULT_DO_AFTER_TASKS;
private String[] afterTasks = DEFAULT_AFTER_TASKS;
private PrecomputedProjectMapper projectMapper;
private IWorkingSet[] workingSets = new IWorkingSet[0];
private String quickWorkingSetName;
private boolean enableDependencyManagement = DEFAULT_ENABLE_DEPENDENCY_MANAGEMENT;
private boolean isReimport = false;
public GradleImportOperation(/*File rootFolder,*/ List<HierarchicalEclipseProject> projectsToImport, boolean addResourceFilters, PrecomputedProjectMapper projectMapping) {
// this.rootFolder = rootFolder;
this.projectsToImport = projectsToImport;
this.projectMapper = projectMapping;
this.addResourceFilters = addResourceFilters;
if (!projectsToImport.isEmpty()) {
this.doBeforeTasks = determineDefaultDoBefore(projectsToImport.get(0));
} else {
this.doBeforeTasks = false;
}
}
private boolean determineDefaultDoBefore(HierarchicalEclipseProject p) {
return determineDefaultDoBefore(GradleCore.create(p));
}
public void setUseHierachicalNames(boolean hierarchical) throws NameClashException, CoreException {
this.projectMapper = createProjectMapping(hierarchical, projectMapper.getAllProjects());
}
public void setReimport(boolean isReimport) {
this.isReimport = isReimport;
}
public static boolean determineDefaultDoBefore(GradleProject rootProject) {
if (rootProject!=null) { // null means unknown project (in wizard: before project is chosen)
try {
if (rootProject.isAtLeastM4()) {
return true;
}
} catch (FastOperationFailedException e) {
GradleCore.log(e);
} catch (CoreException e) {
GradleCore.log(e);
}
}
return false;
}
public void perform(ErrorHandler eh, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
int totalWork = projectsToImport.size();
int tasksWork = (totalWork+4)/5;
if (doBeforeTasks) {
totalWork += tasksWork;
}
if (doAfterTasks) {
totalWork += tasksWork;
}
int derivedMarkingWork = tasksWork+1/2;
totalWork += derivedMarkingWork;
monitor.beginTask("Importing Gradle Projects", totalWork);
boolean tasksExecuted;
try {
if (!projectsToImport.isEmpty()) {
List<HierarchicalEclipseProject> sorted = new GradleProjectSorter(projectsToImport).getSorted();
// Execute "before" tasks and only refresh preference if anything was executed
tasksExecuted = doBeforeTasks(sorted, eh, new SubProgressMonitor(monitor, tasksWork));
if (tasksExecuted) {
refreshProjectPreferences(sorted);
}
for (HierarchicalEclipseProject project : sorted) {
importProject(project, eh, new SubProgressMonitor(monitor, 1));
JobUtil.checkCanceled(monitor);
}
// Execute "after" tasks and refresh projects because they've been imported by now
tasksExecuted = doAfterTasks(sorted, eh, new SubProgressMonitor(monitor, tasksWork-tasksWork/3));
if (tasksExecuted) {
refreshProjects(sorted, new SubProgressMonitor(monitor, tasksWork/3));
}
markBuildFolderAsDerived(sorted, new SubProgressMonitor(monitor, derivedMarkingWork));
}
} finally {
monitor.done();
}
}
private void refreshProjectPreferences(List<HierarchicalEclipseProject> projects) {
for (HierarchicalEclipseProject p : projects) {
GradleProject gp = GradleCore.create(p);
gp.refreshProjectPreferences();
}
}
private void markBuildFolderAsDerived(List<HierarchicalEclipseProject> sorted, IProgressMonitor mon) {
mon.beginTask("Mark derived resources", sorted.size());
try {
for (HierarchicalEclipseProject hp : sorted) {
GradleProject gp = GradleCore.create(hp);
markBuildFolderAsDerived(gp, new SubProgressMonitor(mon, 1));
}
} finally {
mon.done();
}
}
/**
* Marks folders like 'build' where gradle typically puts stuff created by the build
* as 'derived'. This will stop these folders from being shared with CVS, git etc.
* and also stop validation.
*/
private void markBuildFolderAsDerived(GradleProject gp, IProgressMonitor mon) {
mon.beginTask("Mark build folder derived", 1);
try {
IFolder buildFolder = gp.getBuildFolder();
if (buildFolder!=null) {
if (!buildFolder.exists()) {
//Can't mark it when it doesn't exist. This could be problematic if
//it is created later by running a task/build. So we pro-actively create it
//now so we can mark it!
buildFolder.create(true, true, new NullProgressMonitor());
}
buildFolder.setDerived(true, new SubProgressMonitor(mon, 1));
}
} catch (CoreException e) {
GradleCore.log(e);
}
finally {
mon.done();
}
}
private void refreshProjects(List<HierarchicalEclipseProject> sorted, IProgressMonitor mon) {
mon.beginTask("Refreshing projects", sorted.size()*2);
try {
for (HierarchicalEclipseProject _p : sorted) {
IProject p = GradleCore.create(_p).getProject();
try {
p.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(mon, 1));
} catch (CoreException e) {
GradleCore.log(e);
}
}
} finally {
mon.done();
}
}
private boolean doBeforeTasks(List<HierarchicalEclipseProject> sorted, ErrorHandler eh, IProgressMonitor monitor) {
try {
ITaskProvider taskProvider = isReimport ? new ITaskProvider() {
@Override
public String[] getTaskNames(GradleProject project) {
GradleRefreshPreferences prefs = project.getRefreshPreferences();
return prefs.getDoBeforeTasks() ? prefs.getBeforeTasks() : new String[0];
}
} : new ITaskProvider() {
@Override
public String[] getTaskNames(GradleProject project) {
return getDoBeforeTasks() ? getBeforeTasks() : new String[0];
}
};
return TaskUtil.bulkRunTasks(sorted, taskProvider, monitor);
} catch (Exception e) {
eh.handleError(e);
return true; // conservatively assume that something was done before the error happened.
}
}
private boolean doAfterTasks(List<HierarchicalEclipseProject> sorted, ErrorHandler eh, IProgressMonitor monitor) {
try {
ITaskProvider taskProvider = isReimport ? new ITaskProvider() {
@Override
public String[] getTaskNames(GradleProject project) {
GradleRefreshPreferences prefs = project.getRefreshPreferences();
return prefs.getDoAfterTasks() ? prefs.getAfterTasks() : new String[0];
}
} : new ITaskProvider() {
@Override
public String[] getTaskNames(GradleProject project) {
return getDoAfterTasks() ? getAfterTasks() : new String[0];
}
};
return TaskUtil.bulkRunTasks(sorted, taskProvider, monitor);
} catch (Exception e) {
eh.handleError(e);
return true; // conservatively assume that something was done before the error happened.
}
}
/**
* Make sure that we get the real up-to-date raw classpath. If we don't call this function at certain
* points then JDT may give us stale information after the .classpath file has been changed on
* disk, for example by running a Gradle task.
*/
private static void forceClasspathUpToDate(IProject project) {
try {
JavaProject javaProject = (JavaProject)JavaCore.create(project);
PerProjectInfo info = javaProject.getPerProjectInfo();
if (info!=null) {
info.readAndCacheClasspath(javaProject);
}
} catch (Exception e) {
GradleCore.log(e);
}
}
private void importProject(HierarchicalEclipseProject projectModel, ErrorHandler eh, IProgressMonitor monitor) {
final boolean haveWorkingSets = workingSets.length>0 || quickWorkingSetName!=null;
//This provisional implementation just creates a linked project pointing to wherever the root folder
// is pointing to.
int totalWork = 8;
if (addResourceFilters) {
totalWork++; //9
}
if (haveWorkingSets) {
totalWork++; //10
}
monitor.beginTask("Import "+projectModel.getName(), totalWork);
try {
GradleProject gProj = GradleCore.create(projectModel);
//For reimport case we must preserve whether the project has dep managment enabled.
// We must check this early on before the .classpath is obliterated by the reimport.
boolean wasDependencyManaged = gProj.isDependencyManaged();
//1
IWorkspace ws = ResourcesPlugin.getWorkspace();
String projectName = getEclipseName(projectModel);
File projectDir = projectModel.getProjectDirectory().getCanonicalFile(); //TODO: is this right for subfolders (locations maybe better relative to ws somehow)
IProjectDescription projectDescription = ws.newProjectDescription(projectName);
Path projectLocation = new Path(projectDir.getAbsolutePath());
if (!isDefaultProjectLocation(projectName, projectDir)) {
projectDescription.setLocation(projectLocation);
}
//To improve error message... check validity of project location vs name
//note: in import wizard use, this error is impossible since wizard validates this constraint.
//Be careful that this constraint only needs to hold in a very specific case where the
//location is nested exactly one level below the workspace location on disk.
IPath wsLocation = ws.getRoot().getLocation();
if (wsLocation.isPrefixOf(projectLocation) && wsLocation.segmentCount()+1==projectLocation.segmentCount()) {
String expectedName = projectDir.getName();
if (!expectedName.equals(projectName)) {
eh.handleError(ExceptionUtil.coreException("Project-name ("+projectName+") should match last segment of location ("+projectDir+")"));
}
}
monitor.worked(1);
//2
IProject project = ws.getRoot().getProject(projectName);
if (isReimport) {
Assert.isLegal(project.exists());
} else {
project.create(projectDescription, new SubProgressMonitor(monitor, 1));
}
//3
GradleRefreshPreferences refreshPrefs = gProj.getRefreshPreferences();
if (!isReimport) {
refreshPrefs.copyFrom(this);
}
//4
if ((!isReimport && addResourceFilters) || (isReimport && refreshPrefs.getAddResourceFilters())) {
createResourceFilters(project, projectModel, new SubProgressMonitor(monitor, 1));
}
//5
if (isReimport) {
String comment = project.getDescription().getComment();
project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
// Keep the comment after refresh
IProjectDescription description = project.getDescription();
description.setComment(comment);
project.setDescription(description, new SubProgressMonitor(monitor, 1));
forceClasspathUpToDate(project);
} else {
project.open(new SubProgressMonitor(monitor, 1));
}
//6..7
if (project.hasNature(GradleNature.OLD_NATURE_ID)) {
// project needs migration (i.e. remove old nature and classpath container entries)
NatureUtils.remove(project, GradleNature.OLD_NATURE_ID, new SubProgressMonitor(monitor, 1));
IJavaProject javaproject = gProj.getJavaProject();
IClasspathEntry[] oldEntries = javaproject.getRawClasspath();
List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>(oldEntries.length);
for (IClasspathEntry e : oldEntries) {
boolean remove = e.getEntryKind()==IClasspathEntry.CPE_CONTAINER &&
e.getPath().toString().startsWith("com.springsource.sts.gradle");
if (!remove) {
newEntries.add(e);
}
}
javaproject.setRawClasspath(newEntries.toArray(new IClasspathEntry[newEntries.size()]), true, new SubProgressMonitor(monitor, 1));
} else {
monitor.worked(2);
}
//8..9
boolean generateOnly = isReimport ? !wasDependencyManaged : !getEnableDependencyManagement();
if (generateOnly) {
try {
NatureUtils.ensure(project, new SubProgressMonitor(monitor, 1),
GradleNature.NATURE_ID, //Must be first to make gradle project icon have gradle nature showing
JavaCore.NATURE_ID
);
} catch (CoreException e) {
eh.handleError(e);
}
} else {
gProj.convertToGradleProject(projectMapper, eh, new SubProgressMonitor(monitor, 2));
}
// Configure project. Delegated to clients.
ProjectConfigurationManager.getInstance().configure(
new ProjectConfigurationRequest(gProj.getGradleModel(),
gProj.getProject()), monitor);
//10
if (haveWorkingSets) {
addToWorkingSets(project, new SubProgressMonitor(monitor, 1));
}
} catch (Exception e) {
eh.handleError(e);
}
finally {
monitor.done();
}
}
private boolean isDefaultProjectLocation(String projectName, File projectDir) {
IPath workspaceLoc = Platform.getLocation();
if (workspaceLoc!=null) {
File defaultLoc = new File(workspaceLoc.toFile(), projectName);
return defaultLoc.equals(projectDir);
}
return false;
}
private void addToWorkingSets(IProject project, IProgressMonitor monitor) {
monitor.beginTask("Add '"+project.getName()+"' to working sets", 1);
try {
IWorkingSetManager wsm = PlatformUI.getWorkbench().getWorkingSetManager();
if (quickWorkingSetName!=null) {
IWorkingSet quickWorkingSet = wsm.getWorkingSet(quickWorkingSetName);
if (quickWorkingSet==null) {
quickWorkingSet = wsm.createWorkingSet(quickWorkingSetName, new IAdaptable[0]);
quickWorkingSet.setId(IWorkingSetIDs.JAVA);
wsm.addWorkingSet(quickWorkingSet);
}
wsm.addToWorkingSets(project, new IWorkingSet[] {quickWorkingSet});
}
wsm.addToWorkingSets(project, workingSets);
} finally {
monitor.done();
}
}
private String getEclipseName(HierarchicalEclipseProject projectModel) {
return projectMapper.get(projectModel).getName();
}
private void createResourceFilters(IProject project, HierarchicalEclipseProject projectModel, IProgressMonitor monitor) throws CoreException {
//TODO: we now delete all existing filters, perhaps it would be better to somehow mark filters that we "own" and not
// delete those that we don't own.
IResourceFilterDescription[] existing = project.getFilters();
monitor.beginTask("Create resource filters for "+project.getName(), existing.length*2);
try {
for (IResourceFilterDescription filter : existing) {
filter.delete(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
}
DomainObjectSet<? extends HierarchicalEclipseProject> children = projectModel.getChildren();
List<FileInfoMatcherDescription> childProjectFilters = new ArrayList<FileInfoMatcherDescription>(children.size());
IPath parent = new Path(projectModel.getProjectDirectory().getAbsolutePath());
for (HierarchicalEclipseProject childProject : children) {
IPath child = new Path(childProject.getProjectDirectory().getAbsolutePath());
if (parent.isPrefixOf(child)) {
//Ignore if child isn't nested inside parent (this shouldn't happen but you never know :-)
childProjectFilters.add(ResourceFilterFactory.projectRelativePath(child.makeRelativeTo(parent)));
}
}
if (!childProjectFilters.isEmpty()) {
project.createFilter(IResourceFilterDescription.EXCLUDE_ALL|IResourceFilterDescription.FOLDERS|IResourceFilterDescription.INHERITABLE,
ResourceFilterFactory.or(childProjectFilters), IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, existing.length));
}
} finally {
monitor.done();
}
}
/**
* Exception thrown when a project being imported already exists in the workspace.
*/
public static class ExistingProjectException extends CoreException {
private static final long serialVersionUID = 1L;
public ExistingProjectException(IProject existing, HierarchicalEclipseProject mapped, String conflictType) {
super(new Status(IStatus.ERROR, GradleCore.PLUGIN_ID,
GradleProject.getHierarchicalName(mapped)+" existing workspace project "+existing.getName()+" has the same "+conflictType));
}
}
/**
* Exception thrown when a project being imported has a project depedency that is not imported.
*/
public class MissingProjectDependencyException extends CoreException {
private static final long serialVersionUID = 1L;
public MissingProjectDependencyException(HierarchicalEclipseProject p, EclipseProjectDependency dep) {
super(new Status(IStatus.ERROR, GradleCore.PLUGIN_ID, "Project '"+projectMapper.get(p).getName()+"' has a dependency on non-imported project '"+
projectMapper.get(dep.getTargetProject()).getName()+"'"));
}
}
/**
* Gets a name for the project in the eclipse workspace. This name will be composed of the project's own name and
* those of the parent project, to reflect the gradle project hierarchy.
*/
public static String getDefaultEclipseName(HierarchicalEclipseProject target) {
return GradleProject.getHierarchicalName(target);
}
/**
* Verifies whether this operation can be performed without causing problems. Returns normally if no
* problems are detected. Otherwise, it raises an exception indicating the detected problem.
*
* @throws ExistingProjectException if any project involved in the import conflicts with one that
* already exists in the workspace.
*
* @throws MissingProjectDependencyException if an imported project has a dependency on a non-imported
* project
*/
public void verify() throws ExistingProjectException, MissingProjectDependencyException {
for (HierarchicalEclipseProject p : projectsToImport) {
verify(p);
}
}
private void verify(HierarchicalEclipseProject p) throws ExistingProjectException, MissingProjectDependencyException {
//Check the project is free of conflicts with existing project in the workspace
if (isReimport) {
//Skip this for 're-import' the conflicts are expected
} else {
IProject sameName = projectMapper.get(p);
if (sameName.exists()) {
throw new ExistingProjectException(sameName, p, "name");
}
IProject sameLocationProject = GradleCore.create(p).getProject();
if (sameLocationProject!=null) {
if (sameLocationProject.getName().equals(p.getName()))
throw new ExistingProjectException(sameLocationProject, p, "location");
}
}
//Check that project dependencies are also imported
for (EclipseProjectDependency dep : p.getProjectDependencies()) {
HierarchicalEclipseProject targetProject = dep.getTargetProject();
if (!projectsToImport.contains(targetProject) && !isAlreadyImported(targetProject)) {
throw new MissingProjectDependencyException(p, dep);
}
}
}
private boolean isAlreadyImported(HierarchicalEclipseProject targetProject) {
GradleProject gp = GradleCore.create(targetProject);
return gp.getProject()!=null;
}
/**
* Set optional "workingSets" parameter for the import operation. If set, the imported projects will be automatically
* added to the specified workingsets.
*/
public void setWorkingSets(IWorkingSet[] workingSets) {
this.workingSets = workingSets;
}
/**
* Set the 'quick' workingset parameter for the import operation. The quick workingset is given by name, and separately
* from setWorkingSets parameter because it may or may not yet exist. If it doesn't exist it will be created when the import
* operation is performed.
*/
public void setQuickWorkingSet(String name) {
this.quickWorkingSetName = name;
}
public boolean getDoBeforeTasks() {
return this.doBeforeTasks;
}
public boolean getDoAfterTasks() {
return this.doAfterTasks;
}
public void setDoBeforeTasks(boolean runEclipse) {
this.doBeforeTasks = runEclipse;
}
public static PrecomputedProjectMapper getDefaultProjectMapping(Collection<HierarchicalEclipseProject> projects) throws NameClashException, CoreException {
return DEFAULT_USE_HIERARCHICAL_NAMES ? new HierarchicalProjectMapper(projects) : new FlatPrecomputedProjectMapper(projects);
}
public void excludeProjects(String... name) {
Set<String> exclude = new HashSet<String>(Arrays.asList(name));
excludeProjects(exclude);
}
public void excludeProjects(Set<String> excludeNames) {
for (Iterator<HierarchicalEclipseProject> iterator = this.projectsToImport.iterator(); iterator.hasNext();) {
HierarchicalEclipseProject project = iterator.next();
if (excludeNames.contains(GradleProject.getName(project))) {
iterator.remove();
}
}
}
public void setDoAfterTasks(boolean b) {
this.doAfterTasks = b;
}
public void setBeforeTasks(String... tasks) {
this.beforeTasks = tasks;
}
public void setAfterTasks(String... tasks) {
this.afterTasks = tasks;
}
public String[] getBeforeTasks() {
return this.beforeTasks;
}
public String[] getAfterTasks() {
return this.afterTasks;
}
public boolean getEnableDependencyManagement() {
return this.enableDependencyManagement;
}
public void setEnableDependencyManagement(boolean enable) {
this.enableDependencyManagement = enable;
}
/**
* This is true if the 'eclipse' task will be run before the import.
*/
public boolean isDoingEclipseTask() {
if (getDoBeforeTasks()) {
String[] tasks = getBeforeTasks();
for (String t : tasks) {
if (t.equals("eclipse")) {
return true;
}
}
}
return false;
}
public static PrecomputedProjectMapper createProjectMapping(boolean hierarchical, Collection<HierarchicalEclipseProject> projects)
throws CoreException, NameClashException {
return hierarchical
? new HierarchicalProjectMapper(projects)
: new FlatPrecomputedProjectMapper(projects);
}
public boolean getAddResourceFilters() {
return addResourceFilters;
}
public boolean getUseHierarchicalNames() {
return projectMapper instanceof HierarchicalProjectMapper;
}
public void setAddResourceFilters(boolean enable) {
this.addResourceFilters = enable;
}
/**
* This method is deprecated. It only exist to avoid breakage at 'class linking' time when someone installs a newer
* version of Gradle tooling into an older version of STS. Calling this method always returns false as
* newer version of Gradle tooling don't provide DSLD support.
*/
@Deprecated
public boolean getEnableDSLD() {
//always false, feature no longer supported
return false;
}
/**
* This method is deprecated. It only exist to avoid breakage at 'class linking' time when someone installs a newer
* version of Gradle tooling into an older version of STS. Calling this method does nothing in newer
* version of Gradle tooling don't provide DSLD support.
*/
@Deprecated
public void setEnableDSLD(boolean enable) {
//do nothing. Feature no longer supported
}
public static List<HierarchicalEclipseProject> allProjects(File rootFolder) throws OperationCanceledException, CoreException {
GradleProject proj = GradleCore.create(rootFolder);
HierarchicalEclipseProject root = proj.getSkeletalGradleModel(new NullProgressMonitor());
return new ArrayList<HierarchicalEclipseProject>(GradleProjectUtil.getAllProjects(root));
}
public static GradleImportOperation importAll(File rootFolder) throws NameClashException, CoreException {
List<HierarchicalEclipseProject> projects = allProjects(rootFolder);
PrecomputedProjectMapper mapping = getDefaultProjectMapping(projects);
return new GradleImportOperation(projects, true, mapping);
}
public GradleProject[] getProjects() {
GradleProject[] projects = new GradleProject[projectsToImport.size()];
int i=0;
for (HierarchicalEclipseProject p : projectsToImport) {
projects[i++] = GradleCore.create(p);
}
return projects;
}
}
| epl-1.0 |
forge/javaee-descriptors | api/src/main/java/org/jboss/shrinkwrap/descriptor/api/javaee6/ResSharingScopeType.java | 778 | package org.jboss.shrinkwrap.descriptor.api.javaee6;
/**
* This class implements the <code> res-sharing-scopeType </code> xsd type
* @author <a href="mailto:ralf.battenfeld@bluewin.ch">Ralf Battenfeld</a>
* @author <a href="mailto:alr@jboss.org">Andrew Lee Rubinger</a>
*/
public enum ResSharingScopeType
{
_SHAREABLE("Shareable"),
_UNSHAREABLE("Unshareable");
private String value;
ResSharingScopeType (String value) { this.value = value; }
public String toString() {return value;}
public static ResSharingScopeType getFromStringValue(String value)
{
for(ResSharingScopeType type: ResSharingScopeType.values())
{
if(value != null && type.toString().equals(value))
{ return type;}
}
return null;
}
}
| epl-1.0 |
girba/jdt2famix | src/test/java/com/feenk/jdt2famix/samples/basic/ClassWithExceptions.java | 655 | package com.feenk.jdt2famix.samples.basic;
import java.io.BufferedReader;
public class ClassWithExceptions {
public void method() throws Exception {
try {}
catch(RuntimeException e) {
throw e;
}
}
public void methodWithTryWithResource() throws Exception {
try (BufferedReader br = new BufferedReader(null)) {}
catch(RuntimeException e) {
throw e;
}
}
public void methodThrowingInstantiatedException() throws Exception {
throw new RuntimeException();
}
public void methodThrowingExceptionReturnedFromAnotherMethod() throws Exception {
throw exception();
}
private RuntimeException exception() {
return null;
}
}
| epl-1.0 |
qqbbyq/controller | opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementationTest.java | 7490 | /*
* Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.controller.remote.rpc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.TimeUnit;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
/***
* Unit tests for RemoteRpcImplementation.
*
* @author Thomas Pantelis
*/
public class RemoteRpcImplementationTest extends AbstractRpcTest {
/**
* This test method invokes and executes the remote rpc
*/
@Test
public void testInvokeRpc() throws Exception {
final ContainerNode rpcOutput = makeRPCOutput("bar");
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
assertEquals(rpcOutput, result.getResult());
}
/**
* This test method invokes and executes the remote rpc
*/
@Test
public void testInvokeRpcWithNullInput() throws Exception {
final ContainerNode rpcOutput = makeRPCOutput("bar");
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
assertEquals(rpcOutput, result.getResult());
}
/**
* This test method invokes and executes the remote rpc
*/
@Test
public void testInvokeRpcWithNoOutput() throws Exception {
final ContainerNode rpcOutput = null;
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
assertNull(result.getResult());
}
/**
* This test method invokes and executes the remote rpc
*/
@Test(expected = DOMRpcException.class)
public void testInvokeRpcWithRemoteFailedFuture() throws Exception {
final ContainerNode rpcOutput = null;
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(new DOMRpcException(
"Test Exception") {}));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
}
/**
* This test method invokes and tests exceptions when akka timeout occured
*
* Currently ignored since this test with current config takes around 15 seconds
* to complete.
*
*/
@Ignore
@Test(expected = RemoteDOMRpcException.class)
public void testInvokeRpcWithAkkaTimeoutException() throws Exception {
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
frontEndFuture.checkedGet(20, TimeUnit.SECONDS);
}
/**
* This test method invokes remote rpc and lookup failed
* with runtime exception.
*/
@Test(expected = DOMRpcException.class)
public void testInvokeRpcWithLookupException() throws Exception {
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
doThrow(new RuntimeException("test")).when(domRpcService2).invokeRpc(any(SchemaPath.class),
any(NormalizedNode.class));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
}
private RemoteRpcProviderConfig getConfig() {
return new RemoteRpcProviderConfig.Builder("unit-test").build();
}
}
| epl-1.0 |
msche/oval | src/main/java/net/sf/oval/context/OValContext.java | 1246 | /*******************************************************************************
* Portions created by Sebastian Thomschke are copyright (c) 2005-2012 Sebastian
* Thomschke.
*
* All Rights Reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sebastian Thomschke - initial implementation.
*******************************************************************************/
package net.sf.oval.context;
import java.io.Serializable;
/**
* The root class of the validation context classes.
*
* @author Sebastian Thomschke
*/
public abstract class OValContext implements Serializable
{
private static final long serialVersionUID = -7514650057377148621L;
private final Class< ? > compileTimeType;
/**
* Default constructor
*/
OValContext() {
this(null);
}
/**
* Constructor Oval Context
*
* @param
*/
OValContext(Class<?> compileTimeType) {
this.compileTimeType = compileTimeType;
}
public Class< ? > getCompileTimeType()
{
return compileTimeType;
}
}
| epl-1.0 |
rmcilroy/HeraJVM | rvm/src/org/jikesrvm/compilers/opt/OPT_IndexPropagationSystem.java | 29737 | /*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
package org.jikesrvm.compilers.opt;
import java.util.Enumeration;
import org.jikesrvm.classloader.VM_TypeReference;
import org.jikesrvm.compilers.opt.OPT_IndexPropagation.ArrayCell;
import org.jikesrvm.compilers.opt.OPT_IndexPropagation.ObjectCell;
import org.jikesrvm.compilers.opt.ir.ALoad;
import org.jikesrvm.compilers.opt.ir.AStore;
import org.jikesrvm.compilers.opt.ir.Attempt;
import org.jikesrvm.compilers.opt.ir.CacheOp;
import org.jikesrvm.compilers.opt.ir.Call;
import org.jikesrvm.compilers.opt.ir.GetField;
import org.jikesrvm.compilers.opt.ir.GetStatic;
import org.jikesrvm.compilers.opt.ir.MonitorOp;
import org.jikesrvm.compilers.opt.ir.New;
import org.jikesrvm.compilers.opt.ir.NewArray;
import org.jikesrvm.compilers.opt.ir.OPT_BasicBlock;
import org.jikesrvm.compilers.opt.ir.OPT_BasicBlockEnumeration;
import org.jikesrvm.compilers.opt.ir.OPT_HeapOperand;
import org.jikesrvm.compilers.opt.ir.OPT_IR;
import org.jikesrvm.compilers.opt.ir.OPT_IRTools;
import org.jikesrvm.compilers.opt.ir.OPT_Instruction;
import org.jikesrvm.compilers.opt.ir.OPT_Operand;
import static org.jikesrvm.compilers.opt.ir.OPT_Operators.READ_CEILING;
import static org.jikesrvm.compilers.opt.ir.OPT_Operators.WRITE_FLOOR;
import org.jikesrvm.compilers.opt.ir.Phi;
import org.jikesrvm.compilers.opt.ir.Prepare;
import org.jikesrvm.compilers.opt.ir.PutField;
import org.jikesrvm.compilers.opt.ir.PutStatic;
/**
* Represents a set of dataflow equations used to solve the
* index propagation problem.
*/
class OPT_IndexPropagationSystem extends OPT_DF_System {
/**
* The governing IR.
*/
private final OPT_IR ir;
/**
* Heap Array SSA lookaside information for the IR.
*/
private final OPT_SSADictionary ssa;
/**
* Results of global value numbering
*/
private final OPT_GlobalValueNumberState valueNumbers;
/**
* object representing the MEET operator
*/
private static final MeetOperator MEET = new MeetOperator();
/**
* Set up the system of dataflow equations.
* @param _ir the IR
*/
public OPT_IndexPropagationSystem(OPT_IR _ir) {
ir = _ir;
ssa = ir.HIRInfo.SSADictionary;
valueNumbers = ir.HIRInfo.valueNumbers;
setupEquations();
}
/**
* Create an OPT_DF_LatticeCell corresponding to an OPT_HeapVariable
* @param o the heap variable
* @return a new lattice cell corresponding to this heap variable
*/
protected OPT_DF_LatticeCell makeCell(Object o) {
if (!(o instanceof OPT_HeapVariable)) {
throw new OPT_OptimizingCompilerException("OPT_IndexPropagation:makeCell");
}
OPT_DF_LatticeCell result = null;
Object heapType = ((OPT_HeapVariable<?>) o).getHeapType();
if (heapType instanceof VM_TypeReference) {
result = new ArrayCell((OPT_HeapVariable<?>) o);
} else {
result = new ObjectCell((OPT_HeapVariable<?>) o);
}
return result;
}
/**
* Initialize the lattice variables.
*/
protected void initializeLatticeCells() {
// initially all lattice cells are set to TOP
// set the lattice cells that are exposed on entry to BOTTOM
for (OPT_DF_LatticeCell c : cells.values()) {
if (c instanceof ObjectCell) {
ObjectCell c1 = (ObjectCell) c;
OPT_HeapVariable<?> key = c1.getKey();
if (key.isExposedOnEntry()) {
c1.setBOTTOM();
}
} else {
ArrayCell c1 = (ArrayCell) c;
OPT_HeapVariable<?> key = c1.getKey();
if (key.isExposedOnEntry()) {
c1.setBOTTOM();
}
}
}
}
/**
* Initialize the work list for the dataflow equation system.
*/
protected void initializeWorkList() {
// add all equations to the work list that contain a non-TOP
// variable
for (Enumeration<OPT_DF_Equation> e = getEquations(); e.hasMoreElements();) {
OPT_DF_Equation eq = e.nextElement();
for (OPT_DF_LatticeCell operand : eq.getOperands()) {
if (operand instanceof ObjectCell) {
if (!((ObjectCell) operand).isTOP()) {
addToWorkList(eq);
break;
}
} else {
if (!((ArrayCell) operand).isTOP()) {
addToWorkList(eq);
break;
}
}
}
}
}
/**
* Walk through the IR and add dataflow equations for each instruction
* that affects the values of Array SSA variables.
*/
void setupEquations() {
for (OPT_BasicBlockEnumeration e = ir.getBasicBlocks(); e.hasMoreElements();) {
OPT_BasicBlock bb = e.nextElement();
for (OPT_SSADictionary.AllInstructionEnumeration e2 = ssa.getAllInstructions(bb); e2.hasMoreElements();) {
OPT_Instruction s = e2.nextElement();
// only consider instructions which use/def Array SSA variables
if (!ssa.usesHeapVariable(s) && !ssa.defsHeapVariable(s)) {
continue;
}
if (s.isDynamicLinkingPoint()) {
processCall(s);
} else if (GetStatic.conforms(s)) {
processLoad(s);
} else if (GetField.conforms(s)) {
processLoad(s);
} else if (PutStatic.conforms(s)) {
processStore(s);
} else if (PutField.conforms(s)) {
processStore(s);
} else if (New.conforms(s)) {
processNew(s);
} else if (NewArray.conforms(s)) {
processNew(s);
} else if (ALoad.conforms(s)) {
processALoad(s);
} else if (AStore.conforms(s)) {
processAStore(s);
} else if (Call.conforms(s)) {
processCall(s);
} else if (MonitorOp.conforms(s)) {
processCall(s);
} else if (Prepare.conforms(s)) {
processCall(s);
} else if (Attempt.conforms(s)) {
processCall(s);
} else if (CacheOp.conforms(s)) {
processCall(s);
} else if (Phi.conforms(s)) {
processPhi(s);
} else if (s.operator == READ_CEILING) {
processCall(s);
} else if (s.operator == WRITE_FLOOR) {
processCall(s);
}
}
}
}
/**
* Update the set of dataflow equations to account for the actions
* of a Load instruction
*
* <p> The load is of the form x = A[k]. let A_1 be the array SSA
* variable before the load, and A_2 the array SSA variable after
* the store. Then we add the dataflow equation
* L(A_2) = updateUse(L(A_1), VALNUM(k))
*
* <p> Intuitively, this equation represents the fact that A[k] is available
* after the store
*
* @param s the Load instruction
*/
void processLoad(OPT_Instruction s) {
OPT_HeapOperand<?>[] A1 = ssa.getHeapUses(s);
OPT_HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
if ((A1.length != 1) || (A2.length != 1)) {
throw new OPT_OptimizingCompilerException(
"OPT_IndexPropagation.processLoad: load instruction defs or uses multiple heap variables?");
}
int valueNumber = -1;
if (GetField.conforms(s)) {
Object address = GetField.getRef(s);
valueNumber = valueNumbers.getValueNumber(address);
} else { // GetStatic.conforms(s)
valueNumber = 0;
}
if (OPT_IRTools.mayBeVolatileFieldLoad(s) || ir.options.READS_KILL) {
// to obey JMM strictly, we must treat every load as a
// DEF
addUpdateObjectDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), valueNumber);
} else {
// otherwise, don't have to treat every load as a DEF
addUpdateObjectUseEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), valueNumber);
}
}
/**
* Update the set of dataflow equations to account for the actions
* of a Store instruction.
*
* <p> The store is of the form A[k] = val. let A_1 be the array SSA
* variable before the store, and A_2 the array SSA variable after
* the store. Then we add the dataflow equation
* L(A_2) = updateDef(L(A_1), VALNUM(k))
*
* <p> Intuitively, this equation represents the fact that A[k] is available
* after the store
*
* @param s the Store instruction
*/
void processStore(OPT_Instruction s) {
OPT_HeapOperand<?>[] A1 = ssa.getHeapUses(s);
OPT_HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
if ((A1.length != 1) || (A2.length != 1)) {
throw new OPT_OptimizingCompilerException(
"OPT_IndexPropagation.processStore: store instruction defs or uses multiple heap variables?");
}
int valueNumber = -1;
if (PutField.conforms(s)) {
Object address = PutField.getRef(s);
valueNumber = valueNumbers.getValueNumber(address);
} else { // PutStatic.conforms(s)
valueNumber = 0;
}
addUpdateObjectDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), valueNumber);
}
/**
* Update the set of dataflow equations to account for the actions
* of ALoad instruction s
*
* <p> The load is of the form x = A[k]. let A_1 be the array SSA
* variable before the load, and A_2 the array SSA variable after
* the load. Then we add the dataflow equation
* L(A_2) = updateUse(L(A_1), VALNUM(k))
*
* <p> Intuitively, this equation represents the fact that A[k] is available
* after the store
*
* @param s the Aload instruction
*/
void processALoad(OPT_Instruction s) {
OPT_HeapOperand<?>[] A1 = ssa.getHeapUses(s);
OPT_HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
if ((A1.length != 1) || (A2.length != 1)) {
throw new OPT_OptimizingCompilerException(
"OPT_IndexPropagation.processALoad: aload instruction defs or uses multiple heap variables?");
}
OPT_Operand array = ALoad.getArray(s);
OPT_Operand index = ALoad.getIndex(s);
if (OPT_IRTools.mayBeVolatileFieldLoad(s) || ir.options.READS_KILL) {
// to obey JMM strictly, we must treat every load as a
// DEF
addUpdateArrayDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
} else {
// otherwise, don't have to treat every load as a DEF
addUpdateArrayUseEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
}
}
/**
* Update the set of dataflow equations to account for the actions
* of AStore instruction s
*
* <p> The store is of the form A[k] = val. let A_1 be the array SSA
* variable before the store, and A_2 the array SSA variable after
* the store. Then we add the dataflow equation
* L(A_2) = update(L(A_1), VALNUM(k))
*
* <p> Intuitively, this equation represents the fact that A[k] is available
* after the store
*
* @param s the Astore instruction
*/
void processAStore(OPT_Instruction s) {
OPT_HeapOperand<?>[] A1 = ssa.getHeapUses(s);
OPT_HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
if ((A1.length != 1) || (A2.length != 1)) {
throw new OPT_OptimizingCompilerException(
"OPT_IndexPropagation.processAStore: astore instruction defs or uses multiple heap variables?");
}
OPT_Operand array = AStore.getArray(s);
OPT_Operand index = AStore.getIndex(s);
addUpdateArrayDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
}
/**
* Update the set of dataflow equations to account for the actions
* of allocation instruction s
*
* @param s the New instruction
*/
void processNew(OPT_Instruction s) {
/** Assume nothing is a available after a new. So, set
* each lattice cell defined by the NEW as BOTTOM.
* TODO: add logic that understands that after a
* NEW, all fields have their default values.
*/
for (OPT_HeapOperand<?> def : ssa.getHeapDefs(s)) {
OPT_DF_LatticeCell c = findOrCreateCell(def.getHeapVariable());
if (c instanceof ObjectCell) {
((ObjectCell) c).setBOTTOM();
} else {
((ArrayCell) c).setBOTTOM();
}
}
}
/**
* Update the set of dataflow equations to account for the actions
* of CALL instruction.
*
* @param s the Call instruction
*/
void processCall(OPT_Instruction s) {
/** set all lattice cells def'ed by the call to bottom */
for (OPT_HeapOperand<?> operand : ssa.getHeapDefs(s)) {
OPT_DF_LatticeCell c = findOrCreateCell(operand.getHeapVariable());
if (c instanceof ObjectCell) {
((ObjectCell) c).setBOTTOM();
} else {
((ArrayCell) c).setBOTTOM();
}
}
}
/**
* Update the set of dataflow equations to account for the actions
* of Phi instruction.
*
* <p> The instruction has the form A1 = PHI (A2, A3, A4);
* We add the dataflow equation
* L(A1) = MEET(L(A2), L(A3), L(A4))
*
* @param s the Phi instruction
*/
void processPhi(OPT_Instruction s) {
OPT_Operand result = Phi.getResult(s);
if (!(result instanceof OPT_HeapOperand)) {
return;
}
OPT_HeapVariable<?> lhs = ((OPT_HeapOperand<?>) result).value;
OPT_DF_LatticeCell A1 = findOrCreateCell(lhs);
OPT_DF_LatticeCell[] rhs = new OPT_DF_LatticeCell[Phi.getNumberOfValues(s)];
for (int i = 0; i < rhs.length; i++) {
OPT_HeapOperand<?> op = (OPT_HeapOperand<?>) Phi.getValue(s, i);
rhs[i] = findOrCreateCell(op.value);
}
newEquation(A1, MEET, rhs);
}
/**
* Add an equation to the system of the form
* L(A1) = updateDef(L(A2), VALNUM(address))
*
* @param A1 variable in the equation
* @param A2 variable in the equation
* @param valueNumber value number of the address
*/
void addUpdateObjectDefEquation(OPT_HeapVariable<?> A1, OPT_HeapVariable<?> A2, int valueNumber) {
OPT_DF_LatticeCell cell1 = findOrCreateCell(A1);
OPT_DF_LatticeCell cell2 = findOrCreateCell(A2);
UpdateDefObjectOperator op = new UpdateDefObjectOperator(valueNumber);
newEquation(cell1, op, cell2);
}
/**
* Add an equation to the system of the form
* <pre>
* L(A1) = updateUse(L(A2), VALNUM(address))
* </pre>
*
* @param A1 variable in the equation
* @param A2 variable in the equation
* @param valueNumber value number of address
*/
void addUpdateObjectUseEquation(OPT_HeapVariable<?> A1, OPT_HeapVariable<?> A2, int valueNumber) {
OPT_DF_LatticeCell cell1 = findOrCreateCell(A1);
OPT_DF_LatticeCell cell2 = findOrCreateCell(A2);
UpdateUseObjectOperator op = new UpdateUseObjectOperator(valueNumber);
newEquation(cell1, op, cell2);
}
/**
* Add an equation to the system of the form
* <pre>
* L(A1) = updateDef(L(A2), <VALNUM(array),VALNUM(index)>)
* </pre>
*
* @param A1 variable in the equation
* @param A2 variable in the equation
* @param array variable in the equation
* @param index variable in the equation
*/
void addUpdateArrayDefEquation(OPT_HeapVariable<?> A1, OPT_HeapVariable<?> A2, Object array, Object index) {
OPT_DF_LatticeCell cell1 = findOrCreateCell(A1);
OPT_DF_LatticeCell cell2 = findOrCreateCell(A2);
int arrayNumber = valueNumbers.getValueNumber(array);
int indexNumber = valueNumbers.getValueNumber(index);
UpdateDefArrayOperator op = new UpdateDefArrayOperator(arrayNumber, indexNumber);
newEquation(cell1, op, cell2);
}
/**
* Add an equation to the system of the form
* <pre>
* L(A1) = updateUse(L(A2), <VALNUM(array),VALNUM(index)>)
* </pre>
*
* @param A1 variable in the equation
* @param A2 variable in the equation
* @param array variable in the equation
* @param index variable in the equation
*/
void addUpdateArrayUseEquation(OPT_HeapVariable<?> A1, OPT_HeapVariable<?> A2, Object array, Object index) {
OPT_DF_LatticeCell cell1 = findOrCreateCell(A1);
OPT_DF_LatticeCell cell2 = findOrCreateCell(A2);
int arrayNumber = valueNumbers.getValueNumber(array);
int indexNumber = valueNumbers.getValueNumber(index);
UpdateUseArrayOperator op = new UpdateUseArrayOperator(arrayNumber, indexNumber);
newEquation(cell1, op, cell2);
}
/**
* Represents a MEET function (intersection) over Cells.
*/
static class MeetOperator extends OPT_DF_Operator {
/**
* @return "MEET"
*/
public String toString() { return "MEET"; }
/**
* Evaluate a dataflow equation with the MEET operator
* @param operands the operands of the dataflow equation
* @return true iff the value of the lhs changes
*/
boolean evaluate(OPT_DF_LatticeCell[] operands) {
OPT_DF_LatticeCell lhs = operands[0];
if (lhs instanceof ObjectCell) {
return evaluateObjectMeet(operands);
} else {
return evaluateArrayMeet(operands);
}
}
/**
* Evaluate a dataflow equation with the MEET operator
* for lattice cells representing field heap variables.
* @param operands the operands of the dataflow equation
* @return true iff the value of the lhs changes
*/
boolean evaluateObjectMeet(OPT_DF_LatticeCell[] operands) {
ObjectCell lhs = (ObjectCell) operands[0];
// short-circuit if lhs is already bottom
if (lhs.isBOTTOM()) {
return false;
}
// short-circuit if any rhs is bottom
for (int j = 1; j < operands.length; j++) {
ObjectCell r = (ObjectCell) operands[j];
if (r.isBOTTOM()) {
// from the previous short-circuit, we know lhs was not already bottom, so ...
lhs.setBOTTOM();
return true;
}
}
boolean lhsWasTOP = lhs.isTOP();
int[] oldNumbers = null;
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
// perform the intersections
if (operands.length > 1) {
int firstNonTopRHS = -1;
// find the first RHS lattice cell that is not TOP
for (int j = 1; j < operands.length; j++) {
ObjectCell r = (ObjectCell) operands[j];
if (!r.isTOP()) {
firstNonTopRHS = j;
break;
}
}
// if we did not find ANY non-top cell, then simply set
// lhs to top and return
if (firstNonTopRHS == -1) {
lhs.setTOP(true);
return false;
}
// if we get here, we found a non-top cell. Start merging
// here
int[] rhsNumbers = ((ObjectCell) operands[firstNonTopRHS]).copyValueNumbers();
if (rhsNumbers != null) {
for (int v : rhsNumbers) {
lhs.add(v);
for (int j = firstNonTopRHS + 1; j < operands.length; j++) {
ObjectCell r = (ObjectCell) operands[j];
if (!r.contains(v)) {
lhs.remove(v);
break;
}
}
}
}
}
// check if anything has changed
if (lhsWasTOP) return true;
int[] newNumbers = lhs.copyValueNumbers();
return ObjectCell.setsDiffer(oldNumbers, newNumbers);
}
/**
* Evaluate a dataflow equation with the MEET operator
* for lattice cells representing array heap variables.
* @param operands the operands of the dataflow equation
* @return true iff the value of the lhs changes
*/
boolean evaluateArrayMeet(OPT_DF_LatticeCell[] operands) {
ArrayCell lhs = (ArrayCell) operands[0];
// short-circuit if lhs is already bottom
if (lhs.isBOTTOM()) {
return false;
}
// short-circuit if any rhs is bottom
for (int j = 1; j < operands.length; j++) {
ArrayCell r = (ArrayCell) operands[j];
if (r.isBOTTOM()) {
// from the previous short-circuit, we know lhs was not already bottom, so ...
lhs.setBOTTOM();
return true;
}
}
boolean lhsWasTOP = lhs.isTOP();
OPT_ValueNumberPair[] oldNumbers = null;
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
// perform the intersections
if (operands.length > 1) {
int firstNonTopRHS = -1;
// find the first RHS lattice cell that is not TOP
for (int j = 1; j < operands.length; j++) {
ArrayCell r = (ArrayCell) operands[j];
if (!r.isTOP()) {
firstNonTopRHS = j;
break;
}
}
// if we did not find ANY non-top cell, then simply set
// lhs to top and return
if (firstNonTopRHS == -1) {
lhs.setTOP(true);
return false;
}
// if we get here, we found a non-top cell. Start merging
// here
OPT_ValueNumberPair[] rhsNumbers = ((ArrayCell) operands[firstNonTopRHS]).copyValueNumbers();
if (rhsNumbers != null) {
for (OPT_ValueNumberPair pair : rhsNumbers) {
int v1 = pair.v1;
int v2 = pair.v2;
lhs.add(v1, v2);
for (int j = firstNonTopRHS + 1; j < operands.length; j++) {
ArrayCell r = (ArrayCell) operands[j];
if (!r.contains(v1, v2)) {
lhs.remove(v1, v2);
break;
}
}
}
}
}
// check if anything has changed
if (lhsWasTOP) return true;
OPT_ValueNumberPair[] newNumbers = lhs.copyValueNumbers();
return ArrayCell.setsDiffer(oldNumbers, newNumbers);
}
}
/**
* Represents an UPDATE_DEF function over two ObjectCells.
* <p> Given a value number v, this function updates a heap variable
* lattice cell to indicate that element at address v is
* available, but kills any available indices that are not DD from v
*/
class UpdateDefObjectOperator extends OPT_DF_Operator {
/**
* The value number used in the dataflow equation.
*/
private final int valueNumber;
/**
* @return a String representation
*/
public String toString() { return "UPDATE-DEF<" + valueNumber + ">"; }
/**
* Create an operator with a given value number
* @param valueNumber
*/
UpdateDefObjectOperator(int valueNumber) {
this.valueNumber = valueNumber;
}
/**
* Evaluate the dataflow equation with this operator.
* @param operands operands in the dataflow equation
* @return true iff the lhs changes from this evaluation
*/
boolean evaluate(OPT_DF_LatticeCell[] operands) {
ObjectCell lhs = (ObjectCell) operands[0];
if (lhs.isBOTTOM()) {
return false;
}
ObjectCell rhs = (ObjectCell) operands[1];
boolean lhsWasTOP = lhs.isTOP();
int[] oldNumbers = null;
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
if (rhs.isTOP()) {
throw new OPT_OptimizingCompilerException("Unexpected lattice operation");
}
int[] numbers = rhs.copyValueNumbers();
// add all rhs numbers that are DD from valueNumber
if (numbers != null) {
for (int number : numbers) {
if (valueNumbers.DD(number, valueNumber)) {
lhs.add(number);
}
}
}
// add value number generated by this update
lhs.add(valueNumber);
// check if anything has changed
if (lhsWasTOP) return true;
int[] newNumbers = lhs.copyValueNumbers();
return ObjectCell.setsDiffer(oldNumbers, newNumbers);
}
}
/**
* Represents an UPDATE_USE function over two ObjectCells.
*
* <p> Given a value number v, this function updates a heap variable
* lattice cell to indicate that element at address v is
* available, and doesn't kill any available indices
*/
static class UpdateUseObjectOperator extends OPT_DF_Operator {
/**
* The value number used in the dataflow equation.
*/
private final int valueNumber;
/**
* @return "UPDATE-USE"
*/
public String toString() { return "UPDATE-USE<" + valueNumber + ">"; }
/**
* Create an operator with a given value number
* @param valueNumber
*/
UpdateUseObjectOperator(int valueNumber) {
this.valueNumber = valueNumber;
}
/**
* Evaluate the dataflow equation with this operator.
* @param operands operands in the dataflow equation
* @return true iff the lhs changes from this evaluation
*/
boolean evaluate(OPT_DF_LatticeCell[] operands) {
ObjectCell lhs = (ObjectCell) operands[0];
if (lhs.isBOTTOM()) {
return false;
}
ObjectCell rhs = (ObjectCell) operands[1];
int[] oldNumbers = null;
boolean lhsWasTOP = lhs.isTOP();
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
if (rhs.isTOP()) {
throw new OPT_OptimizingCompilerException("Unexpected lattice operation");
}
int[] numbers = rhs.copyValueNumbers();
// add all rhs numbers
if (numbers != null) {
for (int number : numbers) {
lhs.add(number);
}
}
// add value number generated by this update
lhs.add(valueNumber);
// check if anything has changed
if (lhsWasTOP) return true;
int[] newNumbers = lhs.copyValueNumbers();
return ObjectCell.setsDiffer(oldNumbers, newNumbers);
}
}
/**
* Represents an UPDATE_DEF function over two ArrayCells.
* Given two value numbers v1, v2, this function updates a heap variable
* lattice cell to indicate that element for array v1 at address v2 is
* available, but kills any available indices that are not DD from <v1,v2>
*/
class UpdateDefArrayOperator extends OPT_DF_Operator {
/**
* The value number pair used in the dataflow equation.
*/
private final OPT_ValueNumberPair v;
/**
* @return "UPDATE-DEF"
*/
public String toString() { return "UPDATE-DEF<" + v + ">"; }
/**
* Create an operator with a given value number pair
* @param v1 first value number in the pari
* @param v2 first value number in the pari
*/
UpdateDefArrayOperator(int v1, int v2) {
v = new OPT_ValueNumberPair(v1, v2);
}
/**
* Evaluate the dataflow equation with this operator.
* @param operands operands in the dataflow equation
* @return true iff the lhs changes from this evaluation
*/
boolean evaluate(OPT_DF_LatticeCell[] operands) {
ArrayCell lhs = (ArrayCell) operands[0];
if (lhs.isBOTTOM()) {
return false;
}
ArrayCell rhs = (ArrayCell) operands[1];
OPT_ValueNumberPair[] oldNumbers = null;
boolean lhsWasTOP = lhs.isTOP();
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
if (rhs.isTOP()) {
throw new OPT_OptimizingCompilerException("Unexpected lattice operation");
}
OPT_ValueNumberPair[] numbers = rhs.copyValueNumbers();
// add all rhs pairs that are DD from either v.v1 or v.v2
if (numbers != null) {
for (OPT_ValueNumberPair number : numbers) {
if (valueNumbers.DD(number.v1, v.v1)) {
lhs.add(number.v1, number.v2);
} else if (valueNumbers.DD(number.v2, v.v2)) {
lhs.add(number.v1, number.v2);
}
}
}
// add the value number pair generated by this update
lhs.add(v.v1, v.v2);
// check if anything has changed
if (lhsWasTOP) {
return true;
}
OPT_ValueNumberPair[] newNumbers = lhs.copyValueNumbers();
return ArrayCell.setsDiffer(oldNumbers, newNumbers);
}
}
/**
* Represents an UPDATE_USE function over two ArrayCells.
*
* <p> Given two value numbers v1, v2, this function updates a heap variable
* lattice cell to indicate that element at array v1 index v2 is
* available, and doesn't kill any available indices
*/
static class UpdateUseArrayOperator extends OPT_DF_Operator {
/**
* The value number pair used in the dataflow equation.
*/
private final OPT_ValueNumberPair v;
/**
* @return "UPDATE-USE"
*/
public String toString() { return "UPDATE-USE<" + v + ">"; }
/**
* Create an operator with a given value number pair
* @param v1 first value number in the pair
* @param v2 second value number in the pair
*/
UpdateUseArrayOperator(int v1, int v2) {
v = new OPT_ValueNumberPair(v1, v2);
}
/**
* Evaluate the dataflow equation with this operator.
* @param operands operands in the dataflow equation
* @return true iff the lhs changes from this evaluation
*/
boolean evaluate(OPT_DF_LatticeCell[] operands) {
ArrayCell lhs = (ArrayCell) operands[0];
if (lhs.isBOTTOM()) {
return false;
}
ArrayCell rhs = (ArrayCell) operands[1];
OPT_ValueNumberPair[] oldNumbers = null;
boolean lhsWasTOP = lhs.isTOP();
if (!lhsWasTOP) oldNumbers = lhs.copyValueNumbers();
lhs.clear();
if (rhs.isTOP()) {
throw new OPT_OptimizingCompilerException("Unexpected lattice operation");
}
OPT_ValueNumberPair[] numbers = rhs.copyValueNumbers();
// add all rhs numbers
if (numbers != null) {
for (OPT_ValueNumberPair number : numbers) {
lhs.add(number.v1, number.v2);
}
}
// add value number generated by this update
lhs.add(v.v1, v.v2);
// check if anything has changed
if (lhsWasTOP) {
return true;
}
OPT_ValueNumberPair[] newNumbers = lhs.copyValueNumbers();
return ArrayCell.setsDiffer(oldNumbers, newNumbers);
}
}
}
| epl-1.0 |
xiaohanz/softcontroller | opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java | 11635 | /*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import org.opendaylight.controller.config.api.JmxAttributeValidationException;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.util.ConfigRegistryClient;
import org.opendaylight.controller.config.util.ConfigTransactionClient;
import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot;
import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.Config;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.InstanceConfig;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.InstanceConfigElementResolved;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ModuleConfig;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ModuleElementResolved;
import org.opendaylight.controller.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation;
import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfigXmlParser.EditConfigExecution;
import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.management.ObjectName;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class EditConfig extends AbstractConfigNetconfOperation {
private static final Logger logger = LoggerFactory.getLogger(EditConfig.class);
private final YangStoreSnapshot yangStoreSnapshot;
private final TransactionProvider transactionProvider;
private EditConfigXmlParser editConfigXmlParser;
public EditConfig(YangStoreSnapshot yangStoreSnapshot, TransactionProvider transactionProvider,
ConfigRegistryClient configRegistryClient, String netconfSessionIdForReporting) {
super(configRegistryClient, netconfSessionIdForReporting);
this.yangStoreSnapshot = yangStoreSnapshot;
this.transactionProvider = transactionProvider;
this.editConfigXmlParser = new EditConfigXmlParser();
}
@VisibleForTesting
Element getResponseInternal(final Document document,
final EditConfigXmlParser.EditConfigExecution editConfigExecution) throws NetconfDocumentedException {
if (editConfigExecution.shouldTest()) {
executeTests(configRegistryClient, editConfigExecution);
}
if (editConfigExecution.shouldSet()) {
executeSet(configRegistryClient, editConfigExecution);
}
logger.info("Operation {} successful", EditConfigXmlParser.EDIT_CONFIG);
return document.createElement(XmlNetconfConstants.OK);
}
private void executeSet(ConfigRegistryClient configRegistryClient,
EditConfigXmlParser.EditConfigExecution editConfigExecution) throws NetconfDocumentedException {
try {
set(configRegistryClient, editConfigExecution);
} catch (IllegalStateException | JmxAttributeValidationException | ValidationException e) {
logger.warn("Set phase for {} failed", EditConfigXmlParser.EDIT_CONFIG, e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(ErrorTag.operation_failed.name(), e.getMessage());
throw new NetconfDocumentedException("Test phase: " + e.getMessage(), e, ErrorType.application,
ErrorTag.operation_failed, ErrorSeverity.error, errorInfo);
}
logger.debug("Set phase for {} operation successful", EditConfigXmlParser.EDIT_CONFIG);
}
private void executeTests(ConfigRegistryClient configRegistryClient,
EditConfigExecution editConfigExecution) throws NetconfDocumentedException {
try {
test(configRegistryClient, editConfigExecution.getResolvedXmlElements(), editConfigExecution.getDefaultStrategy());
} catch (IllegalStateException | JmxAttributeValidationException | ValidationException e) {
logger.warn("Test phase for {} failed", EditConfigXmlParser.EDIT_CONFIG, e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(ErrorTag.operation_failed.name(), e.getMessage());
throw new NetconfDocumentedException("Test phase: " + e.getMessage(), e, ErrorType.application,
ErrorTag.operation_failed, ErrorSeverity.error, errorInfo);
}
logger.debug("Test phase for {} operation successful", EditConfigXmlParser.EDIT_CONFIG);
}
private void test(ConfigRegistryClient configRegistryClient,
Map<String, Multimap<String, ModuleElementResolved>> resolvedModules, EditStrategyType editStrategyType) {
ObjectName taON = transactionProvider.getTestTransaction();
try {
// default strategy = replace wipes config
if (editStrategyType == EditStrategyType.replace) {
transactionProvider.wipeTestTransaction(taON);
}
setOnTransaction(configRegistryClient, resolvedModules, taON);
transactionProvider.validateTestTransaction(taON);
} finally {
transactionProvider.abortTestTransaction(taON);
}
}
private void set(ConfigRegistryClient configRegistryClient,
EditConfigXmlParser.EditConfigExecution editConfigExecution) {
ObjectName taON = transactionProvider.getOrCreateTransaction();
// default strategy = replace wipes config
if (editConfigExecution.getDefaultStrategy() == EditStrategyType.replace) {
transactionProvider.wipeTransaction();
}
setOnTransaction(configRegistryClient, editConfigExecution.getResolvedXmlElements(), taON);
}
private void setOnTransaction(ConfigRegistryClient configRegistryClient,
Map<String, Multimap<String, ModuleElementResolved>> resolvedXmlElements, ObjectName taON) {
ConfigTransactionClient ta = configRegistryClient.getConfigTransactionClient(taON);
for (Multimap<String, ModuleElementResolved> modulesToResolved : resolvedXmlElements.values()) {
for (Entry<String, ModuleElementResolved> moduleToResolved : modulesToResolved.entries()) {
String moduleName = moduleToResolved.getKey();
ModuleElementResolved moduleElementResolved = moduleToResolved.getValue();
String instanceName = moduleElementResolved.getInstanceName();
InstanceConfigElementResolved ice = moduleElementResolved.getInstanceConfigElementResolved();
EditConfigStrategy strategy = ice.getEditStrategy();
strategy.executeConfiguration(moduleName, instanceName, ice.getConfiguration(), ta);
}
}
}
public static Config getConfigMapping(ConfigRegistryClient configRegistryClient,
Map<String/* Namespace from yang file */,
Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> mBeanEntries) {
Map<String, Map<String, ModuleConfig>> factories = transform(configRegistryClient, mBeanEntries);
return new Config(factories);
}
// TODO refactor
private static Map<String/* Namespace from yang file */,
Map<String /* Name of module entry from yang file */, ModuleConfig>> transform
(final ConfigRegistryClient configRegistryClient, Map<String/* Namespace from yang file */,
Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> mBeanEntries) {
return Maps.transformEntries(mBeanEntries,
new Maps.EntryTransformer<String, Map<String, ModuleMXBeanEntry>, Map<String, ModuleConfig>>() {
@Override
public Map<String, ModuleConfig> transformEntry(String arg0, Map<String, ModuleMXBeanEntry> arg1) {
return Maps.transformEntries(arg1,
new Maps.EntryTransformer<String, ModuleMXBeanEntry, ModuleConfig>() {
@Override
public ModuleConfig transformEntry(String key, ModuleMXBeanEntry moduleMXBeanEntry) {
return new ModuleConfig(key, new InstanceConfig(configRegistryClient, moduleMXBeanEntry
.getAttributes()), moduleMXBeanEntry.getProvidedServices().values());
}
});
}
});
}
@Override
protected String getOperationName() {
return EditConfigXmlParser.EDIT_CONFIG;
}
@Override
protected Element handle(Document document, XmlElement xml) throws NetconfDocumentedException {
EditConfigXmlParser.EditConfigExecution editConfigExecution;
Config cfg = getConfigMapping(configRegistryClient, yangStoreSnapshot.getModuleMXBeanEntryMap());
try {
editConfigExecution = editConfigXmlParser.fromXml(xml, cfg, transactionProvider, configRegistryClient);
} catch (IllegalStateException e) {
logger.warn("Error parsing xml", e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(ErrorTag.missing_attribute.name(), "Missing value for 'target' attribute");
throw new NetconfDocumentedException(e.getMessage(), ErrorType.rpc, ErrorTag.missing_attribute,
ErrorSeverity.error, errorInfo);
} catch (final IllegalArgumentException e) {
logger.warn("Error parsing xml", e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(ErrorTag.bad_attribute.name(), e.getMessage());
throw new NetconfDocumentedException(e.getMessage(), ErrorType.rpc, ErrorTag.bad_attribute,
ErrorSeverity.error, errorInfo);
} catch (final UnsupportedOperationException e) {
logger.warn("Unsupported", e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(ErrorTag.operation_not_supported.name(), "Unsupported option for 'edit-config'");
throw new NetconfDocumentedException(e.getMessage(), ErrorType.application,
ErrorTag.operation_not_supported, ErrorSeverity.error, errorInfo);
}
return getResponseInternal(document, editConfigExecution);
}
}
| epl-1.0 |
msbarry/Xtest | plugins/org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTestLexer.java | 122843 | package org.xtest.ui.contentassist.antlr.internal;
// Hack: Use our own Lexer superclass by means of import.
// Currently there is no other way to specify the superclass for the lexer.
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Lexer;
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalXTestLexer extends Lexer {
public static final int T__68=68;
public static final int T__69=69;
public static final int RULE_ID=4;
public static final int T__66=66;
public static final int T__67=67;
public static final int T__29=29;
public static final int T__64=64;
public static final int T__28=28;
public static final int T__65=65;
public static final int T__27=27;
public static final int T__62=62;
public static final int T__26=26;
public static final int T__63=63;
public static final int T__25=25;
public static final int T__24=24;
public static final int T__23=23;
public static final int T__22=22;
public static final int RULE_ANY_OTHER=12;
public static final int T__21=21;
public static final int T__20=20;
public static final int T__61=61;
public static final int EOF=-1;
public static final int T__60=60;
public static final int T__55=55;
public static final int T__56=56;
public static final int T__19=19;
public static final int T__57=57;
public static final int RULE_HEX=6;
public static final int T__58=58;
public static final int T__16=16;
public static final int T__51=51;
public static final int T__15=15;
public static final int T__52=52;
public static final int T__53=53;
public static final int T__18=18;
public static final int T__54=54;
public static final int T__17=17;
public static final int T__14=14;
public static final int T__13=13;
public static final int T__59=59;
public static final int RULE_INT=7;
public static final int RULE_DECIMAL=8;
public static final int T__50=50;
public static final int T__42=42;
public static final int T__43=43;
public static final int T__40=40;
public static final int T__41=41;
public static final int T__46=46;
public static final int T__80=80;
public static final int T__47=47;
public static final int T__81=81;
public static final int T__44=44;
public static final int T__82=82;
public static final int T__45=45;
public static final int T__83=83;
public static final int T__48=48;
public static final int T__49=49;
public static final int T__85=85;
public static final int T__84=84;
public static final int RULE_SL_COMMENT=10;
public static final int T__86=86;
public static final int RULE_ML_COMMENT=9;
public static final int T__30=30;
public static final int T__31=31;
public static final int T__32=32;
public static final int RULE_STRING=5;
public static final int T__33=33;
public static final int T__71=71;
public static final int T__34=34;
public static final int T__72=72;
public static final int T__35=35;
public static final int T__36=36;
public static final int T__70=70;
public static final int T__37=37;
public static final int T__38=38;
public static final int T__39=39;
public static final int T__76=76;
public static final int RULE_WS=11;
public static final int T__75=75;
public static final int T__74=74;
public static final int T__73=73;
public static final int T__79=79;
public static final int T__78=78;
public static final int T__77=77;
// delegates
// delegators
public InternalXTestLexer() {;}
public InternalXTestLexer(CharStream input) {
this(input, new RecognizerSharedState());
}
public InternalXTestLexer(CharStream input, RecognizerSharedState state) {
super(input,state);
}
public String getGrammarFileName() { return "../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g"; }
// $ANTLR start "T__13"
public final void mT__13() throws RecognitionException {
try {
int _type = T__13;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:11:7: ( ':=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:11:9: ':='
{
match(":=");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__13"
// $ANTLR start "T__14"
public final void mT__14() throws RecognitionException {
try {
int _type = T__14;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:12:7: ( '=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:12:9: '='
{
match('=');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__14"
// $ANTLR start "T__15"
public final void mT__15() throws RecognitionException {
try {
int _type = T__15;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:13:7: ( '+=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:13:9: '+='
{
match("+=");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__15"
// $ANTLR start "T__16"
public final void mT__16() throws RecognitionException {
try {
int _type = T__16;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:14:7: ( '||' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:14:9: '||'
{
match("||");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__16"
// $ANTLR start "T__17"
public final void mT__17() throws RecognitionException {
try {
int _type = T__17;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:15:7: ( '&&' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:15:9: '&&'
{
match("&&");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__17"
// $ANTLR start "T__18"
public final void mT__18() throws RecognitionException {
try {
int _type = T__18;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:16:7: ( 'xsuite' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:16:9: 'xsuite'
{
match("xsuite");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__18"
// $ANTLR start "T__19"
public final void mT__19() throws RecognitionException {
try {
int _type = T__19;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:17:7: ( 'xtest' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:17:9: 'xtest'
{
match("xtest");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__19"
// $ANTLR start "T__20"
public final void mT__20() throws RecognitionException {
try {
int _type = T__20;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18:7: ( 'class' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18:9: 'class'
{
match("class");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__20"
// $ANTLR start "T__21"
public final void mT__21() throws RecognitionException {
try {
int _type = T__21;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:19:7: ( '==' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:19:9: '=='
{
match("==");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__21"
// $ANTLR start "T__22"
public final void mT__22() throws RecognitionException {
try {
int _type = T__22;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:20:7: ( '!=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:20:9: '!='
{
match("!=");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__22"
// $ANTLR start "T__23"
public final void mT__23() throws RecognitionException {
try {
int _type = T__23;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:21:7: ( '>=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:21:9: '>='
{
match(">=");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__23"
// $ANTLR start "T__24"
public final void mT__24() throws RecognitionException {
try {
int _type = T__24;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:22:7: ( '<=' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:22:9: '<='
{
match("<=");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__24"
// $ANTLR start "T__25"
public final void mT__25() throws RecognitionException {
try {
int _type = T__25;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:23:7: ( '>' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:23:9: '>'
{
match('>');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__25"
// $ANTLR start "T__26"
public final void mT__26() throws RecognitionException {
try {
int _type = T__26;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:24:7: ( '<' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:24:9: '<'
{
match('<');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__26"
// $ANTLR start "T__27"
public final void mT__27() throws RecognitionException {
try {
int _type = T__27;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:25:7: ( '->' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:25:9: '->'
{
match("->");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__27"
// $ANTLR start "T__28"
public final void mT__28() throws RecognitionException {
try {
int _type = T__28;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:26:7: ( '..' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:26:9: '..'
{
match("..");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__28"
// $ANTLR start "T__29"
public final void mT__29() throws RecognitionException {
try {
int _type = T__29;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:27:7: ( '=>' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:27:9: '=>'
{
match("=>");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__29"
// $ANTLR start "T__30"
public final void mT__30() throws RecognitionException {
try {
int _type = T__30;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:28:7: ( '<>' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:28:9: '<>'
{
match("<>");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__30"
// $ANTLR start "T__31"
public final void mT__31() throws RecognitionException {
try {
int _type = T__31;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:29:7: ( '?:' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:29:9: '?:'
{
match("?:");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__31"
// $ANTLR start "T__32"
public final void mT__32() throws RecognitionException {
try {
int _type = T__32;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:30:7: ( '<=>' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:30:9: '<=>'
{
match("<=>");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__32"
// $ANTLR start "T__33"
public final void mT__33() throws RecognitionException {
try {
int _type = T__33;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:31:7: ( '+' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:31:9: '+'
{
match('+');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__33"
// $ANTLR start "T__34"
public final void mT__34() throws RecognitionException {
try {
int _type = T__34;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:32:7: ( '-' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:32:9: '-'
{
match('-');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__34"
// $ANTLR start "T__35"
public final void mT__35() throws RecognitionException {
try {
int _type = T__35;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:33:7: ( '*' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:33:9: '*'
{
match('*');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__35"
// $ANTLR start "T__36"
public final void mT__36() throws RecognitionException {
try {
int _type = T__36;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:34:7: ( '**' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:34:9: '**'
{
match("**");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__36"
// $ANTLR start "T__37"
public final void mT__37() throws RecognitionException {
try {
int _type = T__37;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:35:7: ( '/' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:35:9: '/'
{
match('/');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__37"
// $ANTLR start "T__38"
public final void mT__38() throws RecognitionException {
try {
int _type = T__38;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:36:7: ( '%' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:36:9: '%'
{
match('%');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__38"
// $ANTLR start "T__39"
public final void mT__39() throws RecognitionException {
try {
int _type = T__39;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:37:7: ( '!' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:37:9: '!'
{
match('!');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__39"
// $ANTLR start "T__40"
public final void mT__40() throws RecognitionException {
try {
int _type = T__40;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:38:7: ( '.' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:38:9: '.'
{
match('.');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__40"
// $ANTLR start "T__41"
public final void mT__41() throws RecognitionException {
try {
int _type = T__41;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:39:7: ( 'val' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:39:9: 'val'
{
match("val");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__41"
// $ANTLR start "T__42"
public final void mT__42() throws RecognitionException {
try {
int _type = T__42;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:40:7: ( 'super' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:40:9: 'super'
{
match("super");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__42"
// $ANTLR start "T__43"
public final void mT__43() throws RecognitionException {
try {
int _type = T__43;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:41:7: ( 'false' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:41:9: 'false'
{
match("false");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__43"
// $ANTLR start "T__44"
public final void mT__44() throws RecognitionException {
try {
int _type = T__44;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:42:7: ( ';' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:42:9: ';'
{
match(';');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__44"
// $ANTLR start "T__45"
public final void mT__45() throws RecognitionException {
try {
int _type = T__45;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:43:7: ( 'import' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:43:9: 'import'
{
match("import");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__45"
// $ANTLR start "T__46"
public final void mT__46() throws RecognitionException {
try {
int _type = T__46;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:44:7: ( ':' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:44:9: ':'
{
match(':');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__46"
// $ANTLR start "T__47"
public final void mT__47() throws RecognitionException {
try {
int _type = T__47;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:45:7: ( 'assert' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:45:9: 'assert'
{
match("assert");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__47"
// $ANTLR start "T__48"
public final void mT__48() throws RecognitionException {
try {
int _type = T__48;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:46:7: ( 'throws' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:46:9: 'throws'
{
match("throws");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__48"
// $ANTLR start "T__49"
public final void mT__49() throws RecognitionException {
try {
int _type = T__49;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:47:7: ( ',' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:47:9: ','
{
match(',');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__49"
// $ANTLR start "T__50"
public final void mT__50() throws RecognitionException {
try {
int _type = T__50;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:48:7: ( '(' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:48:9: '('
{
match('(');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__50"
// $ANTLR start "T__51"
public final void mT__51() throws RecognitionException {
try {
int _type = T__51;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:49:7: ( ')' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:49:9: ')'
{
match(')');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__51"
// $ANTLR start "T__52"
public final void mT__52() throws RecognitionException {
try {
int _type = T__52;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:50:7: ( 'instanceof' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:50:9: 'instanceof'
{
match("instanceof");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__52"
// $ANTLR start "T__53"
public final void mT__53() throws RecognitionException {
try {
int _type = T__53;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:51:7: ( 'as' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:51:9: 'as'
{
match("as");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__53"
// $ANTLR start "T__54"
public final void mT__54() throws RecognitionException {
try {
int _type = T__54;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:52:7: ( ']' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:52:9: ']'
{
match(']');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__54"
// $ANTLR start "T__55"
public final void mT__55() throws RecognitionException {
try {
int _type = T__55;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:53:7: ( '[' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:53:9: '['
{
match('[');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__55"
// $ANTLR start "T__56"
public final void mT__56() throws RecognitionException {
try {
int _type = T__56;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:54:7: ( 'if' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:54:9: 'if'
{
match("if");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__56"
// $ANTLR start "T__57"
public final void mT__57() throws RecognitionException {
try {
int _type = T__57;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:55:7: ( 'else' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:55:9: 'else'
{
match("else");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__57"
// $ANTLR start "T__58"
public final void mT__58() throws RecognitionException {
try {
int _type = T__58;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:56:7: ( 'switch' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:56:9: 'switch'
{
match("switch");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__58"
// $ANTLR start "T__59"
public final void mT__59() throws RecognitionException {
try {
int _type = T__59;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:57:7: ( '{' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:57:9: '{'
{
match('{');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__59"
// $ANTLR start "T__60"
public final void mT__60() throws RecognitionException {
try {
int _type = T__60;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:58:7: ( '}' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:58:9: '}'
{
match('}');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__60"
// $ANTLR start "T__61"
public final void mT__61() throws RecognitionException {
try {
int _type = T__61;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:59:7: ( 'default' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:59:9: 'default'
{
match("default");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__61"
// $ANTLR start "T__62"
public final void mT__62() throws RecognitionException {
try {
int _type = T__62;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:60:7: ( 'case' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:60:9: 'case'
{
match("case");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__62"
// $ANTLR start "T__63"
public final void mT__63() throws RecognitionException {
try {
int _type = T__63;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:61:7: ( 'for' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:61:9: 'for'
{
match("for");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__63"
// $ANTLR start "T__64"
public final void mT__64() throws RecognitionException {
try {
int _type = T__64;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:62:7: ( 'while' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:62:9: 'while'
{
match("while");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__64"
// $ANTLR start "T__65"
public final void mT__65() throws RecognitionException {
try {
int _type = T__65;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:63:7: ( 'do' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:63:9: 'do'
{
match("do");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__65"
// $ANTLR start "T__66"
public final void mT__66() throws RecognitionException {
try {
int _type = T__66;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:64:7: ( '::' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:64:9: '::'
{
match("::");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__66"
// $ANTLR start "T__67"
public final void mT__67() throws RecognitionException {
try {
int _type = T__67;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:65:7: ( 'new' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:65:9: 'new'
{
match("new");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__67"
// $ANTLR start "T__68"
public final void mT__68() throws RecognitionException {
try {
int _type = T__68;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:66:7: ( 'null' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:66:9: 'null'
{
match("null");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__68"
// $ANTLR start "T__69"
public final void mT__69() throws RecognitionException {
try {
int _type = T__69;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:67:7: ( 'typeof' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:67:9: 'typeof'
{
match("typeof");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__69"
// $ANTLR start "T__70"
public final void mT__70() throws RecognitionException {
try {
int _type = T__70;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:68:7: ( 'throw' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:68:9: 'throw'
{
match("throw");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__70"
// $ANTLR start "T__71"
public final void mT__71() throws RecognitionException {
try {
int _type = T__71;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:69:7: ( 'return' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:69:9: 'return'
{
match("return");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__71"
// $ANTLR start "T__72"
public final void mT__72() throws RecognitionException {
try {
int _type = T__72;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:70:7: ( 'try' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:70:9: 'try'
{
match("try");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__72"
// $ANTLR start "T__73"
public final void mT__73() throws RecognitionException {
try {
int _type = T__73;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:71:7: ( 'finally' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:71:9: 'finally'
{
match("finally");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__73"
// $ANTLR start "T__74"
public final void mT__74() throws RecognitionException {
try {
int _type = T__74;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:72:7: ( 'catch' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:72:9: 'catch'
{
match("catch");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__74"
// $ANTLR start "T__75"
public final void mT__75() throws RecognitionException {
try {
int _type = T__75;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:73:7: ( '?' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:73:9: '?'
{
match('?');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__75"
// $ANTLR start "T__76"
public final void mT__76() throws RecognitionException {
try {
int _type = T__76;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:74:7: ( 'extends' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:74:9: 'extends'
{
match("extends");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__76"
// $ANTLR start "T__77"
public final void mT__77() throws RecognitionException {
try {
int _type = T__77;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:75:7: ( '&' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:75:9: '&'
{
match('&');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__77"
// $ANTLR start "T__78"
public final void mT__78() throws RecognitionException {
try {
int _type = T__78;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:76:7: ( 'def' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:76:9: 'def'
{
match("def");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__78"
// $ANTLR start "T__79"
public final void mT__79() throws RecognitionException {
try {
int _type = T__79;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:77:7: ( 'static' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:77:9: 'static'
{
match("static");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__79"
// $ANTLR start "T__80"
public final void mT__80() throws RecognitionException {
try {
int _type = T__80;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:78:7: ( 'extension' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:78:9: 'extension'
{
match("extension");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__80"
// $ANTLR start "T__81"
public final void mT__81() throws RecognitionException {
try {
int _type = T__81;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:79:7: ( '...' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:79:9: '...'
{
match("...");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__81"
// $ANTLR start "T__82"
public final void mT__82() throws RecognitionException {
try {
int _type = T__82;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:80:7: ( '?.' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:80:9: '?.'
{
match("?.");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__82"
// $ANTLR start "T__83"
public final void mT__83() throws RecognitionException {
try {
int _type = T__83;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:81:7: ( '*.' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:81:9: '*.'
{
match("*.");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__83"
// $ANTLR start "T__84"
public final void mT__84() throws RecognitionException {
try {
int _type = T__84;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:82:7: ( '|' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:82:9: '|'
{
match('|');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__84"
// $ANTLR start "T__85"
public final void mT__85() throws RecognitionException {
try {
int _type = T__85;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:83:7: ( 'var' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:83:9: 'var'
{
match("var");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__85"
// $ANTLR start "T__86"
public final void mT__86() throws RecognitionException {
try {
int _type = T__86;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:84:7: ( 'true' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:84:9: 'true'
{
match("true");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__86"
// $ANTLR start "RULE_HEX"
public final void mRULE_HEX() throws RecognitionException {
try {
int _type = RULE_HEX;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:10: ( ( '0x' | '0X' ) ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+ ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )? )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:12: ( '0x' | '0X' ) ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+ ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )?
{
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:12: ( '0x' | '0X' )
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0=='0') ) {
int LA1_1 = input.LA(2);
if ( (LA1_1=='x') ) {
alt1=1;
}
else if ( (LA1_1=='X') ) {
alt1=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 1, 1, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:13: '0x'
{
match("0x");
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:18: '0X'
{
match("0X");
}
break;
}
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:24: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+
int cnt2=0;
loop2:
do {
int alt2=2;
int LA2_0 = input.LA(1);
if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='F')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='f')) ) {
alt2=1;
}
switch (alt2) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:
{
if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='f') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
if ( cnt2 >= 1 ) break loop2;
EarlyExitException eee =
new EarlyExitException(2, input);
throw eee;
}
cnt2++;
} while (true);
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:58: ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )?
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0=='#') ) {
alt4=1;
}
switch (alt4) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:59: '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) )
{
match('#');
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:63: ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) )
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0=='B'||LA3_0=='b') ) {
alt3=1;
}
else if ( (LA3_0=='L'||LA3_0=='l') ) {
alt3=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 3, 0, input);
throw nvae;
}
switch (alt3) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:64: ( 'b' | 'B' ) ( 'i' | 'I' )
{
if ( input.LA(1)=='B'||input.LA(1)=='b' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18434:84: ( 'l' | 'L' )
{
if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
}
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_HEX"
// $ANTLR start "RULE_INT"
public final void mRULE_INT() throws RecognitionException {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18436:10: ( '0' .. '9' ( '0' .. '9' | '_' )* )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18436:12: '0' .. '9' ( '0' .. '9' | '_' )*
{
matchRange('0','9');
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18436:21: ( '0' .. '9' | '_' )*
loop5:
do {
int alt5=2;
int LA5_0 = input.LA(1);
if ( ((LA5_0>='0' && LA5_0<='9')||LA5_0=='_') ) {
alt5=1;
}
switch (alt5) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:
{
if ( (input.LA(1)>='0' && input.LA(1)<='9')||input.LA(1)=='_' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop5;
}
} while (true);
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_INT"
// $ANTLR start "RULE_DECIMAL"
public final void mRULE_DECIMAL() throws RecognitionException {
try {
int _type = RULE_DECIMAL;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:14: ( RULE_INT ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )? ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )? )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:16: RULE_INT ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )? ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )?
{
mRULE_INT();
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:25: ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )?
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0=='E'||LA7_0=='e') ) {
alt7=1;
}
switch (alt7) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:26: ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT
{
if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:36: ( '+' | '-' )?
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0=='+'||LA6_0=='-') ) {
alt6=1;
}
switch (alt6) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:
{
if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
}
mRULE_INT();
}
break;
}
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:58: ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )?
int alt8=3;
int LA8_0 = input.LA(1);
if ( (LA8_0=='B'||LA8_0=='b') ) {
alt8=1;
}
else if ( (LA8_0=='D'||LA8_0=='F'||LA8_0=='L'||LA8_0=='d'||LA8_0=='f'||LA8_0=='l') ) {
alt8=2;
}
switch (alt8) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:59: ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' )
{
if ( input.LA(1)=='B'||input.LA(1)=='b' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
if ( input.LA(1)=='D'||input.LA(1)=='I'||input.LA(1)=='d'||input.LA(1)=='i' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18438:87: ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' )
{
if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='L'||input.LA(1)=='d'||input.LA(1)=='f'||input.LA(1)=='l' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_DECIMAL"
// $ANTLR start "RULE_ID"
public final void mRULE_ID() throws RecognitionException {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18440:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '$' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '$' | '_' | '0' .. '9' )* )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18440:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '$' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '$' | '_' | '0' .. '9' )*
{
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18440:11: ( '^' )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='^') ) {
alt9=1;
}
switch (alt9) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18440:11: '^'
{
match('^');
}
break;
}
if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18440:44: ( 'a' .. 'z' | 'A' .. 'Z' | '$' | '_' | '0' .. '9' )*
loop10:
do {
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0=='$'||(LA10_0>='0' && LA10_0<='9')||(LA10_0>='A' && LA10_0<='Z')||LA10_0=='_'||(LA10_0>='a' && LA10_0<='z')) ) {
alt10=1;
}
switch (alt10) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:
{
if ( input.LA(1)=='$'||(input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop10;
}
} while (true);
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_ID"
// $ANTLR start "RULE_STRING"
public final void mRULE_STRING() throws RecognitionException {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:13: ( ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt13=2;
int LA13_0 = input.LA(1);
if ( (LA13_0=='\"') ) {
alt13=1;
}
else if ( (LA13_0=='\'') ) {
alt13=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 13, 0, input);
throw nvae;
}
switch (alt13) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:16: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:20: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )*
loop11:
do {
int alt11=3;
int LA11_0 = input.LA(1);
if ( (LA11_0=='\\') ) {
alt11=1;
}
else if ( ((LA11_0>='\u0000' && LA11_0<='!')||(LA11_0>='#' && LA11_0<='[')||(LA11_0>=']' && LA11_0<='\uFFFF')) ) {
alt11=2;
}
switch (alt11) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:21: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
match('\\');
if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||(input.LA(1)>='t' && input.LA(1)<='u') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:66: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop11;
}
} while (true);
match('\"');
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:86: '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:91: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )*
loop12:
do {
int alt12=3;
int LA12_0 = input.LA(1);
if ( (LA12_0=='\\') ) {
alt12=1;
}
else if ( ((LA12_0>='\u0000' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='[')||(LA12_0>=']' && LA12_0<='\uFFFF')) ) {
alt12=2;
}
switch (alt12) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:92: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
match('\\');
if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||(input.LA(1)>='t' && input.LA(1)<='u') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18442:137: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop12;
}
} while (true);
match('\'');
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_STRING"
// $ANTLR start "RULE_ML_COMMENT"
public final void mRULE_ML_COMMENT() throws RecognitionException {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18444:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18444:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18444:24: ( options {greedy=false; } : . )*
loop14:
do {
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0=='*') ) {
int LA14_1 = input.LA(2);
if ( (LA14_1=='/') ) {
alt14=2;
}
else if ( ((LA14_1>='\u0000' && LA14_1<='.')||(LA14_1>='0' && LA14_1<='\uFFFF')) ) {
alt14=1;
}
}
else if ( ((LA14_0>='\u0000' && LA14_0<=')')||(LA14_0>='+' && LA14_0<='\uFFFF')) ) {
alt14=1;
}
switch (alt14) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18444:52: .
{
matchAny();
}
break;
default :
break loop14;
}
} while (true);
match("*/");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_ML_COMMENT"
// $ANTLR start "RULE_SL_COMMENT"
public final void mRULE_SL_COMMENT() throws RecognitionException {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop15:
do {
int alt15=2;
int LA15_0 = input.LA(1);
if ( ((LA15_0>='\u0000' && LA15_0<='\t')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\uFFFF')) ) {
alt15=1;
}
switch (alt15) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop15;
}
} while (true);
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:40: ( ( '\\r' )? '\\n' )?
int alt17=2;
int LA17_0 = input.LA(1);
if ( (LA17_0=='\n'||LA17_0=='\r') ) {
alt17=1;
}
switch (alt17) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:41: ( '\\r' )? '\\n'
{
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:41: ( '\\r' )?
int alt16=2;
int LA16_0 = input.LA(1);
if ( (LA16_0=='\r') ) {
alt16=1;
}
switch (alt16) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18446:41: '\\r'
{
match('\r');
}
break;
}
match('\n');
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_SL_COMMENT"
// $ANTLR start "RULE_WS"
public final void mRULE_WS() throws RecognitionException {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18448:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18448:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18448:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt18=0;
loop18:
do {
int alt18=2;
int LA18_0 = input.LA(1);
if ( ((LA18_0>='\t' && LA18_0<='\n')||LA18_0=='\r'||LA18_0==' ') ) {
alt18=1;
}
switch (alt18) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:
{
if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
if ( cnt18 >= 1 ) break loop18;
EarlyExitException eee =
new EarlyExitException(18, input);
throw eee;
}
cnt18++;
} while (true);
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_WS"
// $ANTLR start "RULE_ANY_OTHER"
public final void mRULE_ANY_OTHER() throws RecognitionException {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18450:16: ( . )
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:18450:18: .
{
matchAny();
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "RULE_ANY_OTHER"
public void mTokens() throws RecognitionException {
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:8: ( T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | RULE_HEX | RULE_INT | RULE_DECIMAL | RULE_ID | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt19=83;
alt19 = dfa19.predict(input);
switch (alt19) {
case 1 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:10: T__13
{
mT__13();
}
break;
case 2 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:16: T__14
{
mT__14();
}
break;
case 3 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:22: T__15
{
mT__15();
}
break;
case 4 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:28: T__16
{
mT__16();
}
break;
case 5 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:34: T__17
{
mT__17();
}
break;
case 6 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:40: T__18
{
mT__18();
}
break;
case 7 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:46: T__19
{
mT__19();
}
break;
case 8 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:52: T__20
{
mT__20();
}
break;
case 9 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:58: T__21
{
mT__21();
}
break;
case 10 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:64: T__22
{
mT__22();
}
break;
case 11 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:70: T__23
{
mT__23();
}
break;
case 12 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:76: T__24
{
mT__24();
}
break;
case 13 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:82: T__25
{
mT__25();
}
break;
case 14 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:88: T__26
{
mT__26();
}
break;
case 15 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:94: T__27
{
mT__27();
}
break;
case 16 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:100: T__28
{
mT__28();
}
break;
case 17 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:106: T__29
{
mT__29();
}
break;
case 18 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:112: T__30
{
mT__30();
}
break;
case 19 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:118: T__31
{
mT__31();
}
break;
case 20 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:124: T__32
{
mT__32();
}
break;
case 21 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:130: T__33
{
mT__33();
}
break;
case 22 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:136: T__34
{
mT__34();
}
break;
case 23 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:142: T__35
{
mT__35();
}
break;
case 24 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:148: T__36
{
mT__36();
}
break;
case 25 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:154: T__37
{
mT__37();
}
break;
case 26 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:160: T__38
{
mT__38();
}
break;
case 27 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:166: T__39
{
mT__39();
}
break;
case 28 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:172: T__40
{
mT__40();
}
break;
case 29 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:178: T__41
{
mT__41();
}
break;
case 30 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:184: T__42
{
mT__42();
}
break;
case 31 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:190: T__43
{
mT__43();
}
break;
case 32 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:196: T__44
{
mT__44();
}
break;
case 33 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:202: T__45
{
mT__45();
}
break;
case 34 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:208: T__46
{
mT__46();
}
break;
case 35 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:214: T__47
{
mT__47();
}
break;
case 36 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:220: T__48
{
mT__48();
}
break;
case 37 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:226: T__49
{
mT__49();
}
break;
case 38 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:232: T__50
{
mT__50();
}
break;
case 39 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:238: T__51
{
mT__51();
}
break;
case 40 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:244: T__52
{
mT__52();
}
break;
case 41 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:250: T__53
{
mT__53();
}
break;
case 42 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:256: T__54
{
mT__54();
}
break;
case 43 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:262: T__55
{
mT__55();
}
break;
case 44 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:268: T__56
{
mT__56();
}
break;
case 45 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:274: T__57
{
mT__57();
}
break;
case 46 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:280: T__58
{
mT__58();
}
break;
case 47 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:286: T__59
{
mT__59();
}
break;
case 48 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:292: T__60
{
mT__60();
}
break;
case 49 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:298: T__61
{
mT__61();
}
break;
case 50 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:304: T__62
{
mT__62();
}
break;
case 51 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:310: T__63
{
mT__63();
}
break;
case 52 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:316: T__64
{
mT__64();
}
break;
case 53 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:322: T__65
{
mT__65();
}
break;
case 54 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:328: T__66
{
mT__66();
}
break;
case 55 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:334: T__67
{
mT__67();
}
break;
case 56 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:340: T__68
{
mT__68();
}
break;
case 57 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:346: T__69
{
mT__69();
}
break;
case 58 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:352: T__70
{
mT__70();
}
break;
case 59 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:358: T__71
{
mT__71();
}
break;
case 60 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:364: T__72
{
mT__72();
}
break;
case 61 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:370: T__73
{
mT__73();
}
break;
case 62 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:376: T__74
{
mT__74();
}
break;
case 63 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:382: T__75
{
mT__75();
}
break;
case 64 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:388: T__76
{
mT__76();
}
break;
case 65 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:394: T__77
{
mT__77();
}
break;
case 66 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:400: T__78
{
mT__78();
}
break;
case 67 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:406: T__79
{
mT__79();
}
break;
case 68 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:412: T__80
{
mT__80();
}
break;
case 69 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:418: T__81
{
mT__81();
}
break;
case 70 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:424: T__82
{
mT__82();
}
break;
case 71 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:430: T__83
{
mT__83();
}
break;
case 72 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:436: T__84
{
mT__84();
}
break;
case 73 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:442: T__85
{
mT__85();
}
break;
case 74 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:448: T__86
{
mT__86();
}
break;
case 75 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:454: RULE_HEX
{
mRULE_HEX();
}
break;
case 76 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:463: RULE_INT
{
mRULE_INT();
}
break;
case 77 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:472: RULE_DECIMAL
{
mRULE_DECIMAL();
}
break;
case 78 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:485: RULE_ID
{
mRULE_ID();
}
break;
case 79 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:493: RULE_STRING
{
mRULE_STRING();
}
break;
case 80 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:505: RULE_ML_COMMENT
{
mRULE_ML_COMMENT();
}
break;
case 81 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:521: RULE_SL_COMMENT
{
mRULE_SL_COMMENT();
}
break;
case 82 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:537: RULE_WS
{
mRULE_WS();
}
break;
case 83 :
// ../org.xtest.ui/src-gen/org/xtest/ui/contentassist/antlr/internal/InternalXTest.g:1:545: RULE_ANY_OTHER
{
mRULE_ANY_OTHER();
}
break;
}
}
protected DFA19 dfa19 = new DFA19(this);
static final String DFA19_eotS =
"\1\uffff\1\56\1\61\1\63\1\65\1\67\2\72\1\76\1\100\1\103\1\105\1"+
"\107\1\112\1\115\1\120\1\uffff\3\72\1\uffff\3\72\5\uffff\1\72\2"+
"\uffff\4\72\2\162\1\53\1\uffff\2\53\16\uffff\2\72\1\uffff\2\72\4"+
"\uffff\1\174\4\uffff\1\176\13\uffff\7\72\1\uffff\2\72\1\u0089\1"+
"\u008b\3\72\5\uffff\2\72\2\uffff\1\72\1\u0093\4\72\1\uffff\1\162"+
"\4\uffff\5\72\4\uffff\1\u009d\1\u009e\4\72\1\u00a3\3\72\1\uffff"+
"\1\72\1\uffff\2\72\1\u00aa\3\72\1\u00af\1\uffff\1\72\1\u00b1\5\72"+
"\1\u00b7\1\72\2\uffff\4\72\1\uffff\6\72\1\uffff\1\u00c3\1\u00c4"+
"\2\72\1\uffff\1\72\1\uffff\1\u00c8\2\72\1\u00cb\1\u00cc\1\uffff"+
"\1\u00cd\1\u00ce\2\72\1\u00d1\4\72\1\u00d7\1\72\2\uffff\2\72\1\u00dc"+
"\1\uffff\1\72\1\u00de\4\uffff\1\u00df\1\u00e0\1\uffff\1\72\1\u00e2"+
"\1\72\1\u00e4\1\u00e5\1\uffff\1\u00e6\3\72\1\uffff\1\u00ea\3\uffff"+
"\1\u00eb\1\uffff\1\72\3\uffff\1\u00ed\1\72\1\u00ef\2\uffff\1\72"+
"\1\uffff\1\72\1\uffff\1\72\1\u00f3\1\u00f4\2\uffff";
static final String DFA19_eofS =
"\u00f5\uffff";
static final String DFA19_minS =
"\1\0\1\72\2\75\1\174\1\46\1\163\1\141\3\75\1\76\2\56\2\52\1\uffff"+
"\1\141\1\164\1\141\1\uffff\1\146\1\163\1\150\5\uffff\1\154\2\uffff"+
"\1\145\1\150\2\145\2\60\1\44\1\uffff\2\0\16\uffff\1\165\1\145\1"+
"\uffff\1\141\1\163\4\uffff\1\76\4\uffff\1\56\13\uffff\1\154\1\160"+
"\1\151\1\141\1\154\1\162\1\156\1\uffff\1\160\1\163\2\44\1\162\1"+
"\160\1\165\5\uffff\1\163\1\164\2\uffff\1\146\1\44\1\151\1\167\1"+
"\154\1\164\1\uffff\1\60\4\uffff\1\151\2\163\1\145\1\143\4\uffff"+
"\2\44\1\145\2\164\1\163\1\44\1\141\1\157\1\164\1\uffff\1\145\1\uffff"+
"\1\157\1\145\1\44\3\145\1\44\1\uffff\1\154\1\44\1\154\1\165\2\164"+
"\1\163\1\44\1\150\2\uffff\1\162\1\143\1\151\1\145\1\uffff\1\154"+
"\1\162\1\141\1\162\1\167\1\157\1\uffff\2\44\1\156\1\165\1\uffff"+
"\1\145\1\uffff\1\44\1\162\1\145\2\44\1\uffff\2\44\1\150\1\143\1"+
"\44\1\154\1\164\1\156\1\164\1\44\1\146\2\uffff\1\144\1\154\1\44"+
"\1\uffff\1\156\1\44\4\uffff\2\44\1\uffff\1\171\1\44\1\143\2\44\1"+
"\uffff\1\44\1\163\1\151\1\164\1\uffff\1\44\3\uffff\1\44\1\uffff"+
"\1\145\3\uffff\1\44\1\157\1\44\2\uffff\1\157\1\uffff\1\156\1\uffff"+
"\1\146\2\44\2\uffff";
static final String DFA19_maxS =
"\1\uffff\1\75\1\76\1\75\1\174\1\46\1\164\1\154\2\75\2\76\1\56\1"+
"\72\1\56\1\57\1\uffff\1\141\1\167\1\157\1\uffff\1\156\1\163\1\171"+
"\5\uffff\1\170\2\uffff\1\157\1\150\1\165\1\145\1\170\1\154\1\172"+
"\1\uffff\2\uffff\16\uffff\1\165\1\145\1\uffff\1\141\1\164\4\uffff"+
"\1\76\4\uffff\1\56\13\uffff\1\162\1\160\1\151\1\141\1\154\1\162"+
"\1\156\1\uffff\1\160\1\163\2\172\1\162\1\160\1\171\5\uffff\1\163"+
"\1\164\2\uffff\1\146\1\172\1\151\1\167\1\154\1\164\1\uffff\1\154"+
"\4\uffff\1\151\2\163\1\145\1\143\4\uffff\2\172\1\145\2\164\1\163"+
"\1\172\1\141\1\157\1\164\1\uffff\1\145\1\uffff\1\157\1\145\1\172"+
"\3\145\1\172\1\uffff\1\154\1\172\1\154\1\165\2\164\1\163\1\172\1"+
"\150\2\uffff\1\162\1\143\1\151\1\145\1\uffff\1\154\1\162\1\141\1"+
"\162\1\167\1\157\1\uffff\2\172\1\156\1\165\1\uffff\1\145\1\uffff"+
"\1\172\1\162\1\145\2\172\1\uffff\2\172\1\150\1\143\1\172\1\154\1"+
"\164\1\156\1\164\1\172\1\146\2\uffff\1\163\1\154\1\172\1\uffff\1"+
"\156\1\172\4\uffff\2\172\1\uffff\1\171\1\172\1\143\2\172\1\uffff"+
"\1\172\1\163\1\151\1\164\1\uffff\1\172\3\uffff\1\172\1\uffff\1\145"+
"\3\uffff\1\172\1\157\1\172\2\uffff\1\157\1\uffff\1\156\1\uffff\1"+
"\146\2\172\2\uffff";
static final String DFA19_acceptS =
"\20\uffff\1\32\3\uffff\1\40\3\uffff\1\45\1\46\1\47\1\52\1\53\1"+
"\uffff\1\57\1\60\7\uffff\1\116\2\uffff\1\122\1\123\1\1\1\66\1\42"+
"\1\11\1\21\1\2\1\3\1\25\1\4\1\110\1\5\1\101\2\uffff\1\116\2\uffff"+
"\1\12\1\33\1\13\1\15\1\uffff\1\22\1\16\1\17\1\26\1\uffff\1\34\1"+
"\23\1\106\1\77\1\30\1\107\1\27\1\120\1\121\1\31\1\32\7\uffff\1\40"+
"\7\uffff\1\45\1\46\1\47\1\52\1\53\2\uffff\1\57\1\60\6\uffff\1\113"+
"\1\uffff\1\114\1\115\1\117\1\122\5\uffff\1\24\1\14\1\105\1\20\12"+
"\uffff\1\54\1\uffff\1\51\7\uffff\1\65\11\uffff\1\35\1\111\4\uffff"+
"\1\63\6\uffff\1\74\4\uffff\1\102\1\uffff\1\67\5\uffff\1\62\13\uffff"+
"\1\112\1\55\3\uffff\1\70\2\uffff\1\7\1\10\1\76\1\36\2\uffff\1\37"+
"\5\uffff\1\72\4\uffff\1\64\1\uffff\1\6\1\56\1\103\1\uffff\1\41\1"+
"\uffff\1\43\1\44\1\71\3\uffff\1\73\1\75\1\uffff\1\100\1\uffff\1"+
"\61\3\uffff\1\104\1\50";
static final String DFA19_specialS =
"\1\0\47\uffff\1\1\1\2\u00cb\uffff}>";
static final String[] DFA19_transitionS = {
"\11\53\2\52\2\53\1\52\22\53\1\52\1\10\1\50\1\53\1\47\1\20\1"+
"\5\1\51\1\31\1\32\1\16\1\3\1\30\1\13\1\14\1\17\1\44\11\45\1"+
"\1\1\24\1\12\1\2\1\11\1\15\1\53\32\47\1\34\1\53\1\33\1\46\1"+
"\47\1\53\1\26\1\47\1\7\1\40\1\35\1\23\2\47\1\25\4\47\1\42\3"+
"\47\1\43\1\22\1\27\1\47\1\21\1\41\1\6\2\47\1\36\1\4\1\37\uff82"+
"\53",
"\1\55\2\uffff\1\54",
"\1\57\1\60",
"\1\62",
"\1\64",
"\1\66",
"\1\70\1\71",
"\1\74\12\uffff\1\73",
"\1\75",
"\1\77",
"\1\101\1\102",
"\1\104",
"\1\106",
"\1\111\13\uffff\1\110",
"\1\113\3\uffff\1\114",
"\1\116\4\uffff\1\117",
"",
"\1\122",
"\1\125\1\123\1\uffff\1\124",
"\1\126\7\uffff\1\130\5\uffff\1\127",
"",
"\1\134\6\uffff\1\132\1\133",
"\1\135",
"\1\136\11\uffff\1\140\6\uffff\1\137",
"",
"",
"",
"",
"",
"\1\146\13\uffff\1\147",
"",
"",
"\1\152\11\uffff\1\153",
"\1\154",
"\1\155\17\uffff\1\156",
"\1\157",
"\12\161\10\uffff\1\163\1\uffff\3\163\5\uffff\1\163\13\uffff"+
"\1\160\6\uffff\1\161\2\uffff\1\163\1\uffff\3\163\5\uffff\1\163"+
"\13\uffff\1\160",
"\12\161\10\uffff\1\163\1\uffff\3\163\5\uffff\1\163\22\uffff"+
"\1\161\2\uffff\1\163\1\uffff\3\163\5\uffff\1\163",
"\1\72\34\uffff\32\72\4\uffff\1\72\1\uffff\32\72",
"",
"\0\164",
"\0\164",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"\1\166",
"\1\167",
"",
"\1\170",
"\1\171\1\172",
"",
"",
"",
"",
"\1\173",
"",
"",
"",
"",
"\1\175",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"\1\177\5\uffff\1\u0080",
"\1\u0081",
"\1\u0082",
"\1\u0083",
"\1\u0084",
"\1\u0085",
"\1\u0086",
"",
"\1\u0087",
"\1\u0088",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\22"+
"\72\1\u008a\7\72",
"\1\u008c",
"\1\u008d",
"\1\u008f\3\uffff\1\u008e",
"",
"",
"",
"",
"",
"\1\u0090",
"\1\u0091",
"",
"",
"\1\u0092",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u0094",
"\1\u0095",
"\1\u0096",
"\1\u0097",
"",
"\12\161\10\uffff\1\163\1\uffff\3\163\5\uffff\1\163\22\uffff"+
"\1\161\2\uffff\1\163\1\uffff\3\163\5\uffff\1\163",
"",
"",
"",
"",
"\1\u0098",
"\1\u0099",
"\1\u009a",
"\1\u009b",
"\1\u009c",
"",
"",
"",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u009f",
"\1\u00a0",
"\1\u00a1",
"\1\u00a2",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00a4",
"\1\u00a5",
"\1\u00a6",
"",
"\1\u00a7",
"",
"\1\u00a8",
"\1\u00a9",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00ab",
"\1\u00ac",
"\1\u00ad",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\1"+
"\u00ae\31\72",
"",
"\1\u00b0",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00b2",
"\1\u00b3",
"\1\u00b4",
"\1\u00b5",
"\1\u00b6",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00b8",
"",
"",
"\1\u00b9",
"\1\u00ba",
"\1\u00bb",
"\1\u00bc",
"",
"\1\u00bd",
"\1\u00be",
"\1\u00bf",
"\1\u00c0",
"\1\u00c1",
"\1\u00c2",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00c5",
"\1\u00c6",
"",
"\1\u00c7",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00c9",
"\1\u00ca",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00cf",
"\1\u00d0",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00d2",
"\1\u00d3",
"\1\u00d4",
"\1\u00d5",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\22"+
"\72\1\u00d6\7\72",
"\1\u00d8",
"",
"",
"\1\u00d9\16\uffff\1\u00da",
"\1\u00db",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"\1\u00dd",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"",
"",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"\1\u00e1",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00e3",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00e7",
"\1\u00e8",
"\1\u00e9",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"\1\u00ec",
"",
"",
"",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\u00ee",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
"",
"\1\u00f0",
"",
"\1\u00f1",
"",
"\1\u00f2",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"\1\72\13\uffff\12\72\7\uffff\32\72\4\uffff\1\72\1\uffff\32"+
"\72",
"",
""
};
static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
static final short[][] DFA19_transition;
static {
int numStates = DFA19_transitionS.length;
DFA19_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
}
}
class DFA19 extends DFA {
public DFA19(BaseRecognizer recognizer) {
this.recognizer = recognizer;
this.decisionNumber = 19;
this.eot = DFA19_eot;
this.eof = DFA19_eof;
this.min = DFA19_min;
this.max = DFA19_max;
this.accept = DFA19_accept;
this.special = DFA19_special;
this.transition = DFA19_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | RULE_HEX | RULE_INT | RULE_DECIMAL | RULE_ID | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
}
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
IntStream input = _input;
int _s = s;
switch ( s ) {
case 0 :
int LA19_0 = input.LA(1);
s = -1;
if ( (LA19_0==':') ) {s = 1;}
else if ( (LA19_0=='=') ) {s = 2;}
else if ( (LA19_0=='+') ) {s = 3;}
else if ( (LA19_0=='|') ) {s = 4;}
else if ( (LA19_0=='&') ) {s = 5;}
else if ( (LA19_0=='x') ) {s = 6;}
else if ( (LA19_0=='c') ) {s = 7;}
else if ( (LA19_0=='!') ) {s = 8;}
else if ( (LA19_0=='>') ) {s = 9;}
else if ( (LA19_0=='<') ) {s = 10;}
else if ( (LA19_0=='-') ) {s = 11;}
else if ( (LA19_0=='.') ) {s = 12;}
else if ( (LA19_0=='?') ) {s = 13;}
else if ( (LA19_0=='*') ) {s = 14;}
else if ( (LA19_0=='/') ) {s = 15;}
else if ( (LA19_0=='%') ) {s = 16;}
else if ( (LA19_0=='v') ) {s = 17;}
else if ( (LA19_0=='s') ) {s = 18;}
else if ( (LA19_0=='f') ) {s = 19;}
else if ( (LA19_0==';') ) {s = 20;}
else if ( (LA19_0=='i') ) {s = 21;}
else if ( (LA19_0=='a') ) {s = 22;}
else if ( (LA19_0=='t') ) {s = 23;}
else if ( (LA19_0==',') ) {s = 24;}
else if ( (LA19_0=='(') ) {s = 25;}
else if ( (LA19_0==')') ) {s = 26;}
else if ( (LA19_0==']') ) {s = 27;}
else if ( (LA19_0=='[') ) {s = 28;}
else if ( (LA19_0=='e') ) {s = 29;}
else if ( (LA19_0=='{') ) {s = 30;}
else if ( (LA19_0=='}') ) {s = 31;}
else if ( (LA19_0=='d') ) {s = 32;}
else if ( (LA19_0=='w') ) {s = 33;}
else if ( (LA19_0=='n') ) {s = 34;}
else if ( (LA19_0=='r') ) {s = 35;}
else if ( (LA19_0=='0') ) {s = 36;}
else if ( ((LA19_0>='1' && LA19_0<='9')) ) {s = 37;}
else if ( (LA19_0=='^') ) {s = 38;}
else if ( (LA19_0=='$'||(LA19_0>='A' && LA19_0<='Z')||LA19_0=='_'||LA19_0=='b'||(LA19_0>='g' && LA19_0<='h')||(LA19_0>='j' && LA19_0<='m')||(LA19_0>='o' && LA19_0<='q')||LA19_0=='u'||(LA19_0>='y' && LA19_0<='z')) ) {s = 39;}
else if ( (LA19_0=='\"') ) {s = 40;}
else if ( (LA19_0=='\'') ) {s = 41;}
else if ( ((LA19_0>='\t' && LA19_0<='\n')||LA19_0=='\r'||LA19_0==' ') ) {s = 42;}
else if ( ((LA19_0>='\u0000' && LA19_0<='\b')||(LA19_0>='\u000B' && LA19_0<='\f')||(LA19_0>='\u000E' && LA19_0<='\u001F')||LA19_0=='#'||LA19_0=='@'||LA19_0=='\\'||LA19_0=='`'||(LA19_0>='~' && LA19_0<='\uFFFF')) ) {s = 43;}
if ( s>=0 ) return s;
break;
case 1 :
int LA19_40 = input.LA(1);
s = -1;
if ( ((LA19_40>='\u0000' && LA19_40<='\uFFFF')) ) {s = 116;}
else s = 43;
if ( s>=0 ) return s;
break;
case 2 :
int LA19_41 = input.LA(1);
s = -1;
if ( ((LA19_41>='\u0000' && LA19_41<='\uFFFF')) ) {s = 116;}
else s = 43;
if ( s>=0 ) return s;
break;
}
NoViableAltException nvae =
new NoViableAltException(getDescription(), 19, _s, input);
error(nvae);
throw nvae;
}
}
} | epl-1.0 |
parraman/micobs | mesp/ctools/es.uah.aut.srg.micobs.mesp.ctool.gnumake_3_81/src/es/uah/aut/srg/micobs/mesp/ctool/gnumake/generator/CreateMainFolders.java | 4506 | /*******************************************************************************
* Copyright (c) 2013-2015 UAH Space Research Group.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MICOBS SRG Team - Initial API and implementation
******************************************************************************/
package es.uah.aut.srg.micobs.mesp.ctool.gnumake.generator;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import es.uah.aut.srg.micobs.mesp.ctool.gnumake.generator.util.GNUMakeGeneratorUtil;
import es.uah.aut.srg.micobs.mesp.ctool.gnumake.plugin.GNUMakePlugin;
import es.uah.aut.srg.micobs.mesp.ctool.gnumake.util.GNUMakeStringHelper;
import es.uah.aut.srg.micobs.mesp.mespdep.MMESPDEPPackageFile;
import es.uah.aut.srg.micobs.mesp.mespdep.MMESPDeployment;
import es.uah.aut.srg.micobs.mesp.mespdep.MMESPDeploymentAlternative;
import es.uah.aut.srg.micobs.mesp.mespdep.MMESPDeploymentPlatform;
import es.uah.aut.srg.micobs.mesp.mespdep.mespdepPackage;
import es.uah.aut.srg.micobs.mesp.mespdep.provider.mespdepItemProviderAdapterFactory;
import es.uah.aut.srg.micobs.mesp.util.ui.MESPUtilUI;
import es.uah.aut.srg.micobs.ui.handlers.GenerateResourcesHandler;
/**
* Handler of the command that creates the folders for the main code
* of an application from its deployment model.
*
*/
public class CreateMainFolders extends GenerateResourcesHandler {
@Override
protected String getConfirmDialogMessage() {
return null;
}
@Override
protected List <IResource> getResourcesToErase(IContainer rootFolder,
EObject model) throws CoreException {
return new ArrayList<IResource>();
}
@Override
protected void generateResources(EObject model, IContainer rootFolder,
IProgressMonitor monitor) {
MMESPDeployment deployment = (MMESPDeployment) ((MMESPDEPPackageFile)model).getElement();
GNUMakeGeneratorUtil.createMainFolders(deployment, rootFolder);
if (deployment.getDeploymentAlternatives().isEmpty())
{
MMESPDeploymentPlatform deploymentPlatform =
MESPUtilUI.selectDeploymentPlatform(shell, deployment);
if (deploymentPlatform == null)
{
return;
}
try{
GNUMakeGeneratorUtil.generateMainTemplateFiles(
rootFolder.getFolder(
new Path(GNUMakeStringHelper.getMainFolder())).getLocation().toPortableString(),
deployment,
null,
deploymentPlatform,
new NullProgressMonitor());
} catch (Exception e)
{
GNUMakePlugin.INSTANCE.log(e);
}
}
else
{
MMESPDeploymentAlternative deploymentAlternative =
MESPUtilUI.selectLeafAlternative(shell, deployment);
if (deploymentAlternative == null)
{
return;
}
MMESPDeploymentPlatform deploymentPlatform =
MESPUtilUI.selectDeploymentPlatform(shell, deploymentAlternative);
if (deploymentPlatform == null)
{
return;
}
try {
GNUMakeGeneratorUtil.generateMainTemplateFiles(
rootFolder.getFolder(
new Path(GNUMakeStringHelper.getMainFolder())).getLocation().toPortableString(),
deployment,
deploymentAlternative,
deploymentPlatform,
new NullProgressMonitor());
} catch (Exception e)
{
GNUMakePlugin.INSTANCE.log(e);
}
}
try {
GNUMakeGeneratorUtil.generateMainConstructionFiles(
rootFolder.getFolder(
new Path(GNUMakeStringHelper.getMainFolder())).getLocation().toPortableString(),
deployment,
new NullProgressMonitor());
} catch (Exception e)
{
GNUMakePlugin.INSTANCE.log(e);
}
}
@Override
protected String getModelClassErrorMessage() {
return GNUMakePlugin.INSTANCE.getString("_UI_CreateMainFolders_ModelClassError_message");
}
@Override
protected EClass getModelEClass() {
return mespdepPackage.eINSTANCE.getMMESPDEPPackageFile();
}
@Override
protected AdapterFactory getItemProviderAdapterFactory() {
return new mespdepItemProviderAdapterFactory();
}
}
| epl-1.0 |
tectronics/cpp-parallel-builder | com.dv.eclipse.parbuilder/src/com/dv/eclipse/parbuilder/preferences/PreferenceConstants.java | 441 | package com.dv.eclipse.parbuilder.preferences;
/**
* Constant definitions for plug-in preferences
*/
public class PreferenceConstants {
/**
*
*/
public static final String P_PATH = "pathPreference";
/**
*
*/
public static final String P_BOOLEAN = "booleanPreference";
/**
*
*/
public static final String P_CHOICE = "choicePreference";
/**
*
*/
public static final String P_STRING = "stringPreference";
}
| epl-1.0 |
opendaylight/bgpcep | pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/AbstractPCEPSessionTest.java | 6357 | /*
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.protocol.pcep.impl;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.DefaultChannelPromise;
import io.netty.channel.EventLoop;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.ScheduledFuture;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.opendaylight.protocol.util.InetSocketAddressUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Close;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.CloseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Open;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.OpenBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Starttls;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.StarttlsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.close.message.CCloseMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.close.object.CCloseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.keepalive.message.KeepaliveMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.message.OpenMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.start.tls.message.StartTlsMessageBuilder;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.common.Uint8;
public class AbstractPCEPSessionTest {
protected static final Uint8 KEEP_ALIVE = Uint8.valueOf(15);
protected static final Uint8 DEADTIMER = Uint8.valueOf(40);
@Mock
protected Channel channel;
@Mock
private ChannelFuture channelFuture;
@Mock
private EventLoop eventLoop;
@Mock
private ScheduledFuture<?> future;
@Mock
private ChannelPipeline pipeline;
@Mock
private SocketAddress address;
protected final String ipAddress = InetSocketAddressUtil.getRandomLoopbackIpAddress();
protected final int port = InetSocketAddressUtil.getRandomPort();
protected final List<Notification> msgsSend = new ArrayList<>();
protected Open openMsg;
protected Close closeMsg;
protected Starttls startTlsMsg;
protected Keepalive kaMsg;
protected SimpleSessionListener listener;
@SuppressWarnings("unchecked")
@Before
public final void setUp() {
MockitoAnnotations.initMocks(this);
final ChannelFuture cfuture = new DefaultChannelPromise(this.channel);
doAnswer(invocation -> {
final Object[] args = invocation.getArguments();
AbstractPCEPSessionTest.this.msgsSend.add((Notification) args[0]);
return cfuture;
}).when(this.channel).writeAndFlush(any(Notification.class));
doReturn(this.channelFuture).when(this.channel).closeFuture();
doReturn(this.channelFuture).when(this.channelFuture).addListener(any(GenericFutureListener.class));
doReturn("TestingChannel").when(this.channel).toString();
doReturn(this.pipeline).when(this.channel).pipeline();
doReturn(this.address).when(this.channel).localAddress();
doReturn(this.address).when(this.channel).remoteAddress();
doReturn(this.eventLoop).when(this.channel).eventLoop();
doReturn(true).when(this.future).cancel(false);
doReturn(this.future).when(this.eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class),
any(ChannelHandler.class));
doReturn(this.pipeline).when(this.pipeline).addFirst(any(ChannelHandler.class));
doReturn(true).when(this.channel).isActive();
doReturn(mock(ChannelFuture.class)).when(this.channel).close();
doReturn(new InetSocketAddress(this.ipAddress, this.port)).when(this.channel).remoteAddress();
doReturn(new InetSocketAddress(this.ipAddress, this.port)).when(this.channel).localAddress();
this.openMsg = new OpenBuilder()
.setOpenMessage(new OpenMessageBuilder()
.setOpen(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
.open.object.OpenBuilder()
.setDeadTimer(DEADTIMER)
.setKeepalive(KEEP_ALIVE)
.setSessionId(Uint8.ZERO)
.build())
.build())
.build();
this.kaMsg = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
this.startTlsMsg = new StarttlsBuilder().setStartTlsMessage(new StartTlsMessageBuilder().build()).build();
this.closeMsg = new CloseBuilder().setCCloseMessage(new CCloseMessageBuilder()
.setCClose(new CCloseBuilder().setReason(Uint8.valueOf(6)).build()).build()).build();
this.listener = new SimpleSessionListener();
}
}
| epl-1.0 |
bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs | utils/eclipselink.utils.workbench/uitools/source/org/eclipse/persistence/tools/workbench/uitools/app/ValueCollectionPropertyValueModelAdapter.java | 4190 | /*******************************************************************************
* Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation from Oracle TopLink
******************************************************************************/
package org.eclipse.persistence.tools.workbench.uitools.app;
import java.util.Arrays;
import org.eclipse.persistence.tools.workbench.utility.Model;
import org.eclipse.persistence.tools.workbench.utility.events.CollectionChangeEvent;
import org.eclipse.persistence.tools.workbench.utility.events.CollectionChangeListener;
/**
* Extend ValueAspectPropertyValueModelAdapter to listen to one or more collection
* aspects of the value in the wrapped value model.
*/
public class ValueCollectionPropertyValueModelAdapter
extends ValueAspectPropertyValueModelAdapter
{
/** The names of the value's collections that we listen to. */
protected final String[] collectionNames;
/** Listener that listens to the value. */
protected CollectionChangeListener valueCollectionListener;
// ********** constructors **********
/**
* Construct an adapter for the specified value collection.
*/
public ValueCollectionPropertyValueModelAdapter(PropertyValueModel valueHolder, String collectionName) {
this(valueHolder, new String[] {collectionName});
}
/**
* Construct an adapter for the specified value collections.
*/
public ValueCollectionPropertyValueModelAdapter(PropertyValueModel valueHolder, String collectionName1, String collectionName2) {
this(valueHolder, new String[] {collectionName1, collectionName2});
}
/**
* Construct an adapter for the specified value collections.
*/
public ValueCollectionPropertyValueModelAdapter(PropertyValueModel valueHolder, String collectionName1, String collectionName2, String collectionName3) {
this(valueHolder, new String[] {collectionName1, collectionName2, collectionName3});
}
/**
* Construct an adapter for the specified value collections.
*/
public ValueCollectionPropertyValueModelAdapter(PropertyValueModel valueHolder, String[] collectionNames) {
super(valueHolder);
this.collectionNames = collectionNames;
}
// ********** initialization **********
protected void initialize() {
super.initialize();
this.valueCollectionListener = this.buildValueCollectionListener();
}
/**
* All we really care about is the fact that a Collection aspect has
* changed. Do the same thing no matter which event occurs.
*/
protected CollectionChangeListener buildValueCollectionListener() {
return new CollectionChangeListener() {
public void itemsAdded(CollectionChangeEvent e) {
ValueCollectionPropertyValueModelAdapter.this.valueAspectChanged();
}
public void itemsRemoved(CollectionChangeEvent e) {
ValueCollectionPropertyValueModelAdapter.this.valueAspectChanged();
}
public void collectionChanged(CollectionChangeEvent e) {
ValueCollectionPropertyValueModelAdapter.this.valueAspectChanged();
}
public String toString() {
return "value collection listener: " + Arrays.asList(ValueCollectionPropertyValueModelAdapter.this.collectionNames);
}
};
}
protected void startListeningToValue() {
Model v = (Model) this.value;
for (int i = this.collectionNames.length; i-- > 0; ) {
v.addCollectionChangeListener(this.collectionNames[i], this.valueCollectionListener);
}
}
protected void stopListeningToValue() {
Model v = (Model) this.value;
for (int i = this.collectionNames.length; i-- > 0; ) {
v.removeCollectionChangeListener(this.collectionNames[i], this.valueCollectionListener);
}
}
}
| epl-1.0 |
rticommunity/rtiperftest | srcJava/com/rti/perftest/ddsimpl/DynamicDataMembersId.java | 1006 | /*
* (c) 2005-2017 Copyright, Real-Time Innovations, Inc. All rights reserved.
* Subject to Eclipse Public License v1.0; see LICENSE.md for details.
*/
package com.rti.perftest.ddsimpl;
import java.util.HashMap;
import java.util.Map;
public class DynamicDataMembersId {
private static DynamicDataMembersId instance = null;
private Map<String, Integer> membersId;
private DynamicDataMembersId(){
membersId = new HashMap<String, Integer>();
membersId.put("key", 1);
membersId.put("entity_id", 2);
membersId.put("seq_num", 3);
membersId.put("timestamp_sec", 4);
membersId.put("timestamp_usec", 5);
membersId.put("latency_ping", 6);
membersId.put("bin_data", 7);
}
public static DynamicDataMembersId getInstance() {
if(instance == null) {
instance = new DynamicDataMembersId();
}
return instance;
}
public int at(String key) {
return (int)membersId.get(key);
}
} | epl-1.0 |
szarnyasg/mondo-hawk | org.hawk.modelio.exml.tests/src/org/hawk/modelio/exml/metamodel/ModelioMetaModelResourceTest.java | 1435 | /*******************************************************************************
* Copyright (c) 2015 The University of York.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Antonio Garcia-Dominguez - initial API and implementation
******************************************************************************/
package org.hawk.modelio.exml.metamodel;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.hawk.core.model.IHawkObject;
import org.hawk.core.model.IHawkPackage;
import org.junit.Before;
import org.junit.Test;
/**
* Tests for the {@link ModelioMetaModelResource} class.
*/
public class ModelioMetaModelResourceTest {
private ModelioMetaModelResource r;
@Before
public void setup() {
r = new ModelioMetaModelResource(new ModelioMetaModelResourceFactory());
}
@Test
public void countPackages() {
List<IHawkPackage> rootPackages = new ArrayList<>();
for (IHawkObject o : r.getAllContents()) {
if (o instanceof IHawkPackage && ((IHawkPackage)o).isRoot()) {
rootPackages.add((IHawkPackage)o);
}
}
assertEquals("There should be 1 IHawkPackage per root MPackage + 1 meta package", 6, rootPackages.size());
}
}
| epl-1.0 |
miklossy/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/serializer/sequencer/AbstractSemanticSequencer.java | 5089 | /*******************************************************************************
* Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.serializer.sequencer;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.serializer.ISerializationContext;
import org.eclipse.xtext.serializer.acceptor.ISemanticSequenceAcceptor;
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
import org.eclipse.xtext.serializer.analysis.SerializationContext;
import org.eclipse.xtext.serializer.diagnostic.ISemanticSequencerDiagnosticProvider;
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic;
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor;
import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider.INodesForEObjectProvider;
import com.google.inject.Inject;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
public abstract class AbstractSemanticSequencer implements ISemanticSequencer {
@Inject
protected ISemanticSequencerDiagnosticProvider diagnosticProvider;
protected ISerializationDiagnostic.Acceptor errorAcceptor;
@Inject
protected SequenceFeeder.Provider feederProvider;
protected ISemanticSequencer masterSequencer;
@Inject
protected ISemanticNodeProvider nodeProvider;
protected ISemanticSequenceAcceptor sequenceAcceptor;
@Inject
protected ITransientValueService transientValues;
private final boolean USES_EOBJECT_AS_CONTEXT = usesEObjectAsContext();
// TODO: deprecate this method
protected ISerializationContext createContext(EObject deprecatedContext, EObject semanticObject) {
return SerializationContext.fromEObject(deprecatedContext, semanticObject);
}
protected INodesForEObjectProvider createNodeProvider(EObject semanticObject) {
return nodeProvider.getNodesForSemanticObject(semanticObject, null);
}
@Override
@Deprecated
public void createSequence(EObject context, EObject semanticObject) {
throw new UnsupportedOperationException("Either overwrite, or, better, don't call this method.");
}
@Override
public void createSequence(ISerializationContext context, EObject semanticObject) {
if (USES_EOBJECT_AS_CONTEXT) {
createSequence(((SerializationContext) context).getActionOrRule(), semanticObject);
} else {
sequence(context, semanticObject);
}
}
// TODO: deprecate this method
@SuppressWarnings("deprecation")
protected SequenceFeeder createSequencerFeeder(EObject semanticObject) {
INodesForEObjectProvider nodeProvider = createNodeProvider(semanticObject);
return feederProvider.create(semanticObject, nodeProvider, masterSequencer, sequenceAcceptor, errorAcceptor);
}
// TODO: deprecate this method
@SuppressWarnings("deprecation")
protected SequenceFeeder createSequencerFeeder(EObject semanticObject, INodesForEObjectProvider nodeProvider) {
return feederProvider.create(semanticObject, nodeProvider, masterSequencer, sequenceAcceptor, errorAcceptor);
}
protected SequenceFeeder createSequencerFeeder(ISerializationContext context, EObject semanticObject) {
INodesForEObjectProvider nodeProvider = createNodeProvider(semanticObject);
return feederProvider.create(context, semanticObject, nodeProvider, masterSequencer, sequenceAcceptor, errorAcceptor);
}
protected SequenceFeeder createSequencerFeeder(ISerializationContext context, EObject semanticObject,
INodesForEObjectProvider nodeProvider) {
return feederProvider.create(context, semanticObject, nodeProvider, masterSequencer, sequenceAcceptor, errorAcceptor);
}
@Override
public void init(ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
init(this, sequenceAcceptor, errorAcceptor);
}
@Override
public void init(ISemanticSequencer sequencer, ISemanticSequenceAcceptor sequenceAcceptor,
ISerializationDiagnostic.Acceptor errorAcceptor) {
this.masterSequencer = sequencer;
this.sequenceAcceptor = sequenceAcceptor;
this.errorAcceptor = errorAcceptor;
}
public void sequence(ISerializationContext context, EObject semanticObject) {
}
public void setMasterSequencer(ISemanticSequencer sequencer) {
this.masterSequencer = sequencer;
}
private boolean usesEObjectAsContext() {
Class<?> eObj = null;
try {
eObj = getClass().getMethod("createSequence", EObject.class, EObject.class).getDeclaringClass();
} catch (NoSuchMethodException e) {
return false;
} catch (SecurityException e) {
return false;
}
Class<?> iContext = null;
try {
iContext = getClass().getMethod("sequence", ISerializationContext.class, EObject.class).getDeclaringClass();
} catch (NoSuchMethodException e) {
return true;
} catch (SecurityException e) {
return true;
}
return iContext.isAssignableFrom(eObj);
}
}
| epl-1.0 |
verhagen/java-table-api | src/test/java/com/github/verhagen/table/cell/CellGroupTest.java | 1815 | package com.github.verhagen.table.cell;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.testng.annotations.Test;
public class CellGroupTest {
@Test
public void createCellGroup() throws Exception {
Date date = new SimpleDateFormat("yyyy.MM.dd").parse("1934.06.09");
CellGroup cellGroup = new CellGroup.Builder(createPersonCellGroupDefinition())
.add("given-name", "Donald")
.add("surname", "Duck")
.add("birth-date", date)
.create();
assertNotNull(cellGroup);
assertEquals(cellGroup.get("given-name").getName(), "given-name");
assertEquals(cellGroup.get("given-name").getType(), String.class);
assertEquals(cellGroup.get("given-name").getValue(), "Donald");
assertEquals(cellGroup.get("birth-date").getName(), "birth-date");
assertEquals(cellGroup.get("birth-date").getType(), Date.class);
assertEquals(new SimpleDateFormat("d/MMM/yyyy").format(cellGroup.get("birth-date").getValue()), "9/Jun/1934");
}
private CellGroupDefinition createPersonCellGroupDefinition() {
CellDefinition givenNameCellDef = new CellDefinition.Builder().setName("given-name").setType(String.class).create();
CellDefinition preposCellDef = new CellDefinition.Builder().setName("prepositions").setType(String.class).create();
CellDefinition surnameCellDef = new CellDefinition.Builder().setName("surname").setType(String.class).create();
CellDefinition birthDateCellDef = new CellDefinition.Builder().setName("birth-date").setType(Date.class).create();
CellGroupDefinition cellGroupDef = new CellGroupDefinition.Builder()
.add(givenNameCellDef)
.add(preposCellDef)
.add(surnameCellDef)
.add(birthDateCellDef)
.create();
return cellGroupDef;
}
}
| epl-1.0 |
lincolnthree/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/reporting/rules/CreateCompatibleFileReportRuleProvider.java | 3968 | package org.jboss.windup.rules.apps.java.reporting.rules;
import org.jboss.windup.config.AbstractRuleProvider;
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.config.metadata.MetadataBuilder;
import org.jboss.windup.config.operation.iteration.AbstractIterationOperation;
import org.jboss.windup.config.phase.ReportGenerationPhase;
import org.jboss.windup.config.query.Query;
import org.jboss.windup.graph.GraphContext;
import org.jboss.windup.graph.model.ProjectModel;
import org.jboss.windup.graph.model.WindupConfigurationModel;
import org.jboss.windup.reporting.model.ApplicationReportModel;
import org.jboss.windup.reporting.model.TemplateType;
import org.jboss.windup.reporting.service.ApplicationReportService;
import org.jboss.windup.reporting.service.ReportService;
import org.jboss.windup.util.exception.WindupException;
import org.ocpsoft.rewrite.config.ConditionBuilder;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.context.EvaluationContext;
public class CreateCompatibleFileReportRuleProvider extends AbstractRuleProvider
{
private static final String TEMPLATE_APPLICATION_REPORT = "/reports/templates/compatible_files.ftl";
public CreateCompatibleFileReportRuleProvider()
{
super(MetadataBuilder.forProvider(CreateCompatibleFileReportRuleProvider.class)
.setPhase(ReportGenerationPhase.class));
}
// @formatter:off
@Override
public Configuration getConfiguration(GraphContext context)
{
ConditionBuilder applicationProjectModelsFound = Query
.fromType(WindupConfigurationModel.class);
AbstractIterationOperation<WindupConfigurationModel> addApplicationReport = new AbstractIterationOperation<WindupConfigurationModel>()
{
@Override
public void perform(GraphRewrite event, EvaluationContext context, WindupConfigurationModel payload)
{
ProjectModel projectModel = payload.getInputPath().getProjectModel();
if (projectModel == null)
{
throw new WindupException("Error, no project found in: " + payload.getInputPath().getFilePath());
}
createApplicationReport(event.getGraphContext(), projectModel);
}
@Override
public String toString()
{
return "CreateCompatibleFilesApplicationReport";
}
};
return ConfigurationBuilder.begin()
.addRule()
.when(applicationProjectModelsFound)
.perform(addApplicationReport);
}
// @formatter:on
private ApplicationReportModel createApplicationReport(GraphContext context, ProjectModel projectModel)
{
ApplicationReportService applicationReportService = new ApplicationReportService(context);
ApplicationReportModel applicationReportModel = applicationReportService.create();
applicationReportModel.setReportPriority(200);
applicationReportModel.setDisplayInApplicationReportIndex(true);
applicationReportModel.setReportName("Compatible Files");
applicationReportModel.setReportIconClass("glyphicon glyphicon-check");
applicationReportModel.setMainApplicationReport(false);
applicationReportModel.setProjectModel(projectModel);
applicationReportModel.setTemplatePath(TEMPLATE_APPLICATION_REPORT);
applicationReportModel.setTemplateType(TemplateType.FREEMARKER);
applicationReportModel.setDisplayInApplicationList(false);
// Set the filename for the report
ReportService reportService = new ReportService(context);
reportService.setUniqueFilename(applicationReportModel, "nonclassifiedfiles_" + projectModel.getName(), "html");
return applicationReportModel;
}
}
| epl-1.0 |
andiikaa/openhab2 | addons/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/RpcClient.java | 14923 | /**
* Copyright (c) 2010-2018 by the respective copyright holders.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.binding.homematic.internal.communicator.client;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.openhab.binding.homematic.internal.common.HomematicConfig;
import org.openhab.binding.homematic.internal.communicator.message.RpcRequest;
import org.openhab.binding.homematic.internal.communicator.parser.GetAllScriptsParser;
import org.openhab.binding.homematic.internal.communicator.parser.GetAllSystemVariablesParser;
import org.openhab.binding.homematic.internal.communicator.parser.GetDeviceDescriptionParser;
import org.openhab.binding.homematic.internal.communicator.parser.GetParamsetDescriptionParser;
import org.openhab.binding.homematic.internal.communicator.parser.GetParamsetParser;
import org.openhab.binding.homematic.internal.communicator.parser.GetValueParser;
import org.openhab.binding.homematic.internal.communicator.parser.HomegearLoadDeviceNamesParser;
import org.openhab.binding.homematic.internal.communicator.parser.ListBidcosInterfacesParser;
import org.openhab.binding.homematic.internal.communicator.parser.ListDevicesParser;
import org.openhab.binding.homematic.internal.communicator.parser.RssiInfoParser;
import org.openhab.binding.homematic.internal.model.HmChannel;
import org.openhab.binding.homematic.internal.model.HmDatapoint;
import org.openhab.binding.homematic.internal.model.HmDevice;
import org.openhab.binding.homematic.internal.model.HmGatewayInfo;
import org.openhab.binding.homematic.internal.model.HmInterface;
import org.openhab.binding.homematic.internal.model.HmParamsetType;
import org.openhab.binding.homematic.internal.model.HmRssiInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Client implementation for sending messages via BIN-RPC to a Homematic gateway.
*
* @author Gerhard Riegler - Initial contribution
*/
public abstract class RpcClient<T> {
private final Logger logger = LoggerFactory.getLogger(RpcClient.class);
protected static final int MAX_RPC_RETRY = 1;
protected HomematicConfig config;
public RpcClient(HomematicConfig config) {
this.config = config;
}
/**
* Disposes the client.
*/
public abstract void dispose();
/**
* Returns a RpcRequest for this client.
*/
protected abstract RpcRequest<T> createRpcRequest(String methodName);
/**
* Returns the callback url for this client.
*/
protected abstract String getRpcCallbackUrl();
/**
* Sends the RPC message to the gateway.
*/
protected abstract Object[] sendMessage(int port, RpcRequest<T> request) throws IOException;
/**
* Register a callback for the specified interface where the Homematic gateway can send its events.
*/
public void init(HmInterface hmInterface, String clientId) throws IOException {
RpcRequest<T> request = createRpcRequest("init");
request.addArg(getRpcCallbackUrl());
request.addArg(clientId);
if (config.getGatewayInfo().isHomegear()) {
request.addArg(new Integer(0x20));
}
sendMessage(config.getRpcPort(hmInterface), request);
}
/**
* Release a callback for the specified interface.
*/
public void release(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("init");
request.addArg(getRpcCallbackUrl());
sendMessage(config.getRpcPort(hmInterface), request);
}
/**
* Sends a ping to the specified interface.
*/
public void ping(HmInterface hmInterface, String callerId) throws IOException {
RpcRequest<T> request = createRpcRequest("ping");
request.addArg(callerId);
sendMessage(config.getRpcPort(hmInterface), request);
}
/**
* Returns the info of all BidCos interfaces available on the gateway.
*/
public ListBidcosInterfacesParser listBidcosInterfaces(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("listBidcosInterfaces");
return new ListBidcosInterfacesParser().parse(sendMessage(config.getRpcPort(hmInterface), request));
}
/**
* Returns some infos of the gateway.
*/
private GetDeviceDescriptionParser getDeviceDescription(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("getDeviceDescription");
request.addArg("BidCoS-RF");
return new GetDeviceDescriptionParser().parse(sendMessage(config.getRpcPort(hmInterface), request));
}
/**
* Returns all variable metadata and values from a Homegear gateway.
*/
public void getAllSystemVariables(HmChannel channel) throws IOException {
RpcRequest<T> request = createRpcRequest("getAllSystemVariables");
new GetAllSystemVariablesParser(channel).parse(sendMessage(config.getRpcPort(channel), request));
}
/**
* Loads all device names from a Homegear gateway.
*/
public void loadDeviceNames(HmInterface hmInterface, Collection<HmDevice> devices) throws IOException {
RpcRequest<T> request = createRpcRequest("getDeviceInfo");
new HomegearLoadDeviceNamesParser(devices).parse(sendMessage(config.getRpcPort(hmInterface), request));
}
/**
* Returns true, if the interface is available on the gateway.
*/
public void checkInterface(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("init");
request.addArg("http://openhab.validation:1000");
sendMessage(config.getRpcPort(hmInterface), request);
}
/**
* Returns all script metadata from a Homegear gateway.
*/
public void getAllScripts(HmChannel channel) throws IOException {
RpcRequest<T> request = createRpcRequest("getAllScripts");
new GetAllScriptsParser(channel).parse(sendMessage(config.getRpcPort(channel), request));
}
/**
* Returns all device and channel metadata.
*/
public Collection<HmDevice> listDevices(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("listDevices");
return new ListDevicesParser(hmInterface, config).parse(sendMessage(config.getRpcPort(hmInterface), request));
}
/**
* Loads all datapoint metadata into the given channel.
*/
public void addChannelDatapoints(HmChannel channel, HmParamsetType paramsetType) throws IOException {
RpcRequest<T> request = createRpcRequest("getParamsetDescription");
request.addArg(getRpcAddress(channel.getDevice().getAddress()) + ":" + channel.getNumber());
request.addArg(paramsetType.toString());
new GetParamsetDescriptionParser(channel, paramsetType).parse(sendMessage(config.getRpcPort(channel), request));
}
/**
* Sets all datapoint values for the given channel.
*/
public void setChannelDatapointValues(HmChannel channel, HmParamsetType paramsetType) throws IOException {
RpcRequest<T> request = createRpcRequest("getParamset");
request.addArg(getRpcAddress(channel.getDevice().getAddress()) + ":" + channel.getNumber());
request.addArg(paramsetType.toString());
if (channel.getDevice().getHmInterface() == HmInterface.CUXD && paramsetType == HmParamsetType.VALUES) {
setChannelDatapointValues(channel);
} else {
try {
new GetParamsetParser(channel, paramsetType).parse(sendMessage(config.getRpcPort(channel), request));
} catch (UnknownRpcFailureException ex) {
if (paramsetType == HmParamsetType.VALUES) {
logger.debug(
"RpcResponse unknown RPC failure (-1 Failure), fetching values with another API method for device: {}, channel: {}, paramset: {}",
channel.getDevice().getAddress(), channel.getNumber(), paramsetType);
setChannelDatapointValues(channel);
} else {
throw ex;
}
}
}
}
/**
* Reads all VALUES datapoints individually, fallback method if setChannelDatapointValues throws a -1 Failure
* exception.
*/
private void setChannelDatapointValues(HmChannel channel) throws IOException {
for (HmDatapoint dp : channel.getDatapoints()) {
if (dp.isReadable() && !dp.isVirtual() && dp.getParamsetType() == HmParamsetType.VALUES) {
RpcRequest<T> request = createRpcRequest("getValue");
request.addArg(getRpcAddress(channel.getDevice().getAddress()) + ":" + channel.getNumber());
request.addArg(dp.getName());
new GetValueParser(dp).parse(sendMessage(config.getRpcPort(channel), request));
}
}
}
/**
* Tries to identify the gateway and returns the GatewayInfo.
*/
public HmGatewayInfo getGatewayInfo(String id) throws IOException {
GetDeviceDescriptionParser ddParser = getDeviceDescription(HmInterface.RF);
boolean isHomegear = StringUtils.equalsIgnoreCase(ddParser.getType(), "Homegear");
ListBidcosInterfacesParser biParser = listBidcosInterfaces(HmInterface.RF);
HmGatewayInfo gatewayInfo = new HmGatewayInfo();
gatewayInfo.setAddress(biParser.getGatewayAddress());
if (isHomegear) {
gatewayInfo.setId(HmGatewayInfo.ID_HOMEGEAR);
gatewayInfo.setType(ddParser.getType());
gatewayInfo.setFirmware(ddParser.getFirmware());
} else if ((StringUtils.startsWithIgnoreCase(biParser.getType(), "CCU")
|| StringUtils.startsWithIgnoreCase(ddParser.getType(), "HM-RCV-50") || config.isCCUType())
&& !config.isNoCCUType()) {
gatewayInfo.setId(HmGatewayInfo.ID_CCU);
String type = StringUtils.isBlank(biParser.getType()) ? "CCU" : biParser.getType();
gatewayInfo.setType(type);
gatewayInfo.setFirmware(ddParser.getFirmware());
} else {
gatewayInfo.setId(HmGatewayInfo.ID_DEFAULT);
gatewayInfo.setType(biParser.getType());
gatewayInfo.setFirmware(biParser.getFirmware());
}
if (gatewayInfo.isCCU() || config.hasWiredPort()) {
gatewayInfo.setWiredInterface(hasInterface(HmInterface.WIRED, id));
}
if (gatewayInfo.isCCU() || config.hasHmIpPort()) {
gatewayInfo.setHmipInterface(hasInterface(HmInterface.HMIP, id));
}
if (gatewayInfo.isCCU() || config.hasCuxdPort()) {
gatewayInfo.setCuxdInterface(hasInterface(HmInterface.CUXD, id));
}
if (gatewayInfo.isCCU() || config.hasGroupPort()) {
gatewayInfo.setGroupInterface(hasInterface(HmInterface.GROUP, id));
}
return gatewayInfo;
}
/**
* Returns true, if a connection is possible with the given interface.
*/
private boolean hasInterface(HmInterface hmInterface, String id) throws IOException {
try {
checkInterface(hmInterface);
return true;
} catch (IOException ex) {
logger.info("Interface '{}' on gateway '{}' not available, disabling support", hmInterface, id);
return false;
}
}
/**
* Sets the value of the datapoint.
*/
public void setDatapointValue(HmDatapoint dp, Object value) throws IOException {
if (dp.isIntegerType() && value instanceof Double) {
value = ((Number) value).intValue();
}
RpcRequest<T> request;
if (HmParamsetType.VALUES == dp.getParamsetType()) {
request = createRpcRequest("setValue");
request.addArg(getRpcAddress(dp.getChannel().getDevice().getAddress()) + ":" + dp.getChannel().getNumber());
request.addArg(dp.getName());
request.addArg(value);
} else {
request = createRpcRequest("putParamset");
request.addArg(getRpcAddress(dp.getChannel().getDevice().getAddress()) + ":" + dp.getChannel().getNumber());
request.addArg(HmParamsetType.MASTER.toString());
Map<String, Object> paramSet = new HashMap<String, Object>();
paramSet.put(dp.getName(), value);
request.addArg(paramSet);
}
sendMessage(config.getRpcPort(dp.getChannel()), request);
}
/**
* Sets the value of a system variable on a Homegear gateway.
*/
public void setSystemVariable(HmDatapoint dp, Object value) throws IOException {
RpcRequest<T> request = createRpcRequest("setSystemVariable");
request.addArg(dp.getInfo());
request.addArg(value);
sendMessage(config.getRpcPort(dp.getChannel()), request);
}
/**
* Executes a script on the Homegear gateway.
*/
public void executeScript(HmDatapoint dp) throws IOException {
RpcRequest<T> request = createRpcRequest("runScript");
request.addArg(dp.getInfo());
sendMessage(config.getRpcPort(dp.getChannel()), request);
}
/**
* Enables/disables the install mode for given seconds.
*/
public void setInstallMode(HmInterface hmInterface, boolean enable, int seconds) throws IOException {
RpcRequest<T> request = createRpcRequest("setInstallMode");
request.addArg(enable);
request.addArg(seconds);
request.addArg(1);
sendMessage(config.getRpcPort(hmInterface), request);
}
/**
* Deletes the device from the gateway.
*/
public void deleteDevice(HmDevice device, int flags) throws IOException {
RpcRequest<T> request = createRpcRequest("deleteDevice");
request.addArg(device.getAddress());
request.addArg(flags);
sendMessage(config.getRpcPort(device.getHmInterface()), request);
}
/**
* Returns the rpc address from a device address, correctly handling groups.
*/
private String getRpcAddress(String address) {
if (address != null && address.startsWith("T-")) {
address = "*" + address.substring(2);
}
return address;
}
/**
* Returns the rssi values for all devices.
*/
public List<HmRssiInfo> loadRssiInfo(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("rssiInfo");
return new RssiInfoParser(config).parse(sendMessage(config.getRpcPort(hmInterface), request));
}
}
| epl-1.0 |
maxeler/eclipse | eclipse.jdt.ui/org.eclipse.jdt.ui.tests.refactoring/resources/InferTypeArguments/testCuCommonSuper/in/A.java | 180 | package p;
import java.util.ArrayList;
import java.util.List;
class A {
void foo() {
List list= new ArrayList();
list.add(new Double(1.7));
list.add(new Integer(1));
}
}
| epl-1.0 |
RodriguesJ/Atem | src/com/runescape/server/revised/content/achievement/karamja/elite/BoxingCleverAchievementTask.java | 11747 | /**
* Eclipse Public License - v 1.0
*
* THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
* OF THE
* PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
*
* 1. DEFINITIONS
*
* "Contribution" means:
*
* a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
* b) in the case of each subsequent Contributor:
* i) changes to the Program, and
* ii) additions to the Program;
* where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution
* 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf.
* Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program
* under their own license agreement, and (ii) are not derivative works of the Program.
* "Contributor" means any person or entity that distributes the Program.
*
* "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone
* or when combined with the Program.
*
* "Program" means the Contributions distributed in accordance with this Agreement.
*
* "Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
*
* 2. GRANT OF RIGHTS
*
* a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license
* to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor,
* if any, and such derivative works, in source code and object code form.
* b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license
* under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source
* code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the
* Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The
* patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
* c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided
* by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor
* disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise.
* As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other
* intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
* Program, it is Recipient's responsibility to acquire that license before distributing the Program.
* d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright
* license set forth in this Agreement.
* 3. REQUIREMENTS
*
* A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
*
* a) it complies with the terms and conditions of this Agreement; and
* b) its license agreement:
* i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions
* of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
* ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and
* consequential damages, such as lost profits;
* iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
* iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner
* on or through a medium customarily used for software exchange.
* When the Program is made available in source code form:
*
* a) it must be made available under this Agreement; and
* b) a copy of this Agreement must be included with each copy of the Program.
* Contributors may not remove or alter any copyright notices contained within the Program.
*
* Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients
* to identify the originator of the Contribution.
*
* 4. COMMERCIAL DISTRIBUTION
*
* Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this
* license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering
* should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in
* a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor
* ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
* brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in
* connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or
* Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly
* notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
* Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim
* at its own expense.
*
* For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial
* Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims
* and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend
* claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay
* any damages as a result, the Commercial Contributor must pay those damages.
*
* 5. NO WARRANTY
*
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
* FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and
* assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program
* errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
*
* 6. DISCLAIMER OF LIABILITY
*
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION
* OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* 7. GENERAL
*
* If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the
* remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum
* extent necessary to make such provision valid and enforceable.
*
* If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
* itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's
* rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
*
* All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this
* Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights
* under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However,
* Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
*
* Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may
* only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this
* Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the
* initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate
* entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
* distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is
* published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in
* Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement,
* whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
*
* This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to
* this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights
* to a jury trial in any resulting litigation.
*/
package com.runescape.server.revised.content.achievement.karamja.elite;
public class BoxingCleverAchievementTask {
} | epl-1.0 |
NABUCCO/org.nabucco.testautomation.config | org.nabucco.testautomation.config.ui.rcp/src/main/gen/org/nabucco/testautomation/config/ui/rcp/list/config/view/TestConfigListViewTableFilter.java | 1907 | /*
* Copyright 2012 PRODYNA AG
*
* Licensed under the Eclipse Public License (EPL), Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/eclipse-1.0.php or
* http://www.nabucco.org/License.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nabucco.testautomation.config.ui.rcp.list.config.view;
import org.eclipse.jface.viewers.Viewer;
import org.nabucco.framework.plugin.base.component.list.view.NabuccoTableFilter;
import org.nabucco.testautomation.config.facade.datatype.TestConfiguration;
/**
* TestConfigListViewTableFilter<p/>ListView for Test Configuration<p/>
*
* @author Stefan Huettenrauch, PRODYNA AG, 2010-05-25
*/
public class TestConfigListViewTableFilter extends NabuccoTableFilter {
/** Constructs a new TestConfigListViewTableFilter instance. */
public TestConfigListViewTableFilter() {
super();
}
@Override
public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
boolean result = false;
if (((null == searchFilter.getFilter()) || (0 == searchFilter.getFilter().length()))) {
result = true;
} else if ((element instanceof TestConfiguration)) {
TestConfiguration datatype = ((TestConfiguration) element);
result = (result || this.contains(datatype.getName(), searchFilter.getFilter()));
result = (result || this.contains(datatype.getDescription(), searchFilter.getFilter()));
}
return result;
}
}
| epl-1.0 |
lbeurerkellner/n4js | plugins/org.eclipse.n4js.flowgraphs/src/org/eclipse/n4js/flowgraphs/factories/JumpFactory.java | 4363 | /**
* Copyright (c) 2017 Marcus Mews.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marcus Mews - Initial API and implementation
*/
package org.eclipse.n4js.flowgraphs.factories;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.n4js.flowgraphs.ControlFlowType;
import org.eclipse.n4js.flowgraphs.model.ComplexNode;
import org.eclipse.n4js.flowgraphs.model.HelperNode;
import org.eclipse.n4js.flowgraphs.model.JumpToken;
import org.eclipse.n4js.flowgraphs.model.Node;
import org.eclipse.n4js.flowgraphs.model.RepresentingNode;
import org.eclipse.n4js.n4JS.BreakStatement;
import org.eclipse.n4js.n4JS.ContinueStatement;
import org.eclipse.n4js.n4JS.ControlFlowElement;
import org.eclipse.n4js.n4JS.Expression;
import org.eclipse.n4js.n4JS.ReturnStatement;
import org.eclipse.n4js.n4JS.Statement;
import org.eclipse.n4js.n4JS.ThrowStatement;
import org.eclipse.n4js.n4JS.WhileStatement;
/**
* Jumps are control flow edges that start at a {@link ControlFlowElement} and end at another
* {@link ControlFlowElement}. The loop control flow edge in loop statements, such as in {@link WhileStatement}s, is not
* considered as a jump.
* <p/>
* Jump edges start at and end at (start --> end):<br/>
* <ul>
* <li/>BreakStatement.exitNode --> (LoopStatement | SwitchStatement).exitNode
* <li/>ContinueStatement.exitNode --> LoopStatement.conditionNode or ForStatement.updateNode
* <li/>ReturnStatement.exitNode --> FunctionBlock.exitNode
* <li/>ThrowStatement.exitNode --> FunctionBlock.exitNode
* </ul>
* <p/>
* Jumps that happen due to Break- or ContinueStatements can refer to a label. This must be respected when computing the
* end node of a jump edge. See {@link ControlFlowGraphFactory} for more details.
* <p/>
* <b>Attention:</b> The order of {@link Node#astPosition}s is important, and thus the order of Node instantiation! In
* case this order is inconsistent to {@link OrderedEContentProvider}, the assertion with the message
* {@link ReentrantASTIterator#ASSERTION_MSG_AST_ORDER} is thrown.
*/
class JumpFactory {
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, BreakStatement stmt) {
JumpToken jumptoken = new JumpToken(ControlFlowType.Break, stmt.getLabel());
return buildComplexNode(astpp, stmt, null, jumptoken);
}
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, ContinueStatement stmt) {
JumpToken jumptoken = new JumpToken(ControlFlowType.Continue, stmt.getLabel());
return buildComplexNode(astpp, stmt, null, jumptoken);
}
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, ReturnStatement stmt) {
JumpToken jumptoken = new JumpToken(ControlFlowType.Return);
return buildComplexNode(astpp, stmt, stmt.getExpression(), jumptoken);
}
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, ThrowStatement stmt) {
JumpToken jumptoken = new JumpToken(ControlFlowType.Throw);
return buildComplexNode(astpp, stmt, stmt.getExpression(), jumptoken);
}
static ComplexNode buildComplexNode(ReentrantASTIterator astpp, Statement stmt, Expression expr,
JumpToken jumptoken) {
ComplexNode cNode = new ComplexNode(astpp.container(), stmt);
Node entryNode = new HelperNode(NodeNames.ENTRY, astpp.pos(), stmt);
cNode.addNode(entryNode);
Node expression = null;
if (expr != null) {
expression = DelegatingNodeFactory.create(astpp, NodeNames.EXPRESSION, stmt, expr);
cNode.addNode(expression);
}
Node jumpNode = new RepresentingNode(NodeNames.JUMP, astpp.pos(), stmt);
cNode.addNode(jumpNode);
Node exitNode = new HelperNode(NodeNames.EXIT, astpp.pos(), stmt);
cNode.addNode(exitNode);
List<Node> cfs = new LinkedList<>();
cfs.add(entryNode);
cfs.add(expression);
cNode.connectInternalSucc(entryNode, expression);
Node beforeDeadNode = ListUtils.filterNulls(entryNode, expression).getLast();
cNode.connectInternalSucc(beforeDeadNode, jumpNode);
cNode.connectInternalSucc(ControlFlowType.DeadCode, jumpNode, exitNode);
jumpNode.addJumpToken(jumptoken);
cNode.setEntryNode(entryNode);
cNode.setExitNode(exitNode);
cNode.setJumpNode(jumpNode);
return cNode;
}
}
| epl-1.0 |
boniatillo-com/PhaserEditor | source/phasereditor/phasereditor.ui/src/phasereditor/ui/ImageCache.java | 3669 | // The MIT License (MIT)
//
// Copyright (c) 2015, 2016 Arian Fornaris
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions: The above copyright notice and this permission
// notice shall be included in all copies or substantial portions of the
// Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
package phasereditor.ui;
import static java.lang.System.out;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import javafx.scene.image.Image;
/**
* @author arian
*
*/
public class ImageCache {
static class Container<T> {
public T value;
public long token;
}
private static Map<IFile, Container<Image>> _fxcache = new HashMap<>();
private static IResourceChangeListener _workspaceListener;
public static Image getFXImage(IFile file) {
return getFXImage(file, true);
}
public static Image getFXImage(IFile file, boolean backgroundLoading) {
if (_workspaceListener == null) {
_workspaceListener = createWorkspaceListener();
ResourcesPlugin.getWorkspace().addResourceChangeListener(_workspaceListener,
IResourceChangeEvent.POST_CHANGE);
}
synchronized (_fxcache) {
long t = file.getModificationStamp();
if (_fxcache.containsKey(file)) {
Container<Image> c = _fxcache.get(file);
if (t != c.token) {
c.token = t;
c.value = loadImage(file, backgroundLoading);
}
return c.value;
}
Container<Image> c = new Container<>();
c.token = t;
c.value = loadImage(file, backgroundLoading);
_fxcache.put(file, c);
return c.value;
}
}
private static Image loadImage(IFile file, boolean backgroundLoading) {
Image image = new Image("file:" + file.getLocation().makeAbsolute().toOSString(), backgroundLoading);
return image;
}
private static IResourceChangeListener createWorkspaceListener() {
return new IResourceChangeListener() {
@Override
public void resourceChanged(IResourceChangeEvent event) {
try {
event.getDelta().accept((delta) -> {
IResource res = delta.getResource();
if (delta.getKind() == IResourceDelta.REMOVED && res instanceof IFile) {
unloadFile((IFile) res);
}
return true;
});
} catch (CoreException e) {
e.printStackTrace();
}
}
};
}
static void unloadFile(IFile file) {
out.println("ImageCache: unload " + file);
synchronized (_fxcache) {
_fxcache.remove(file);
}
}
}
| epl-1.0 |
lbeurerkellner/n4js | tools/org.eclipse.n4js.hlc.base/src/org/eclipse/n4js/hlc/base/HeadlessExtensionRegistrationHelper.java | 7078 | /**
* Copyright (c) 2017 NumberFour AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* NumberFour AG - Initial API and implementation
*/
package org.eclipse.n4js.hlc.base;
import org.eclipse.core.runtime.Platform;
import org.eclipse.n4js.N4JSGlobals;
import org.eclipse.n4js.fileextensions.FileExtensionType;
import org.eclipse.n4js.fileextensions.FileExtensionsRegistry;
import org.eclipse.n4js.generator.SubGeneratorRegistry;
import org.eclipse.n4js.json.JSONGlobals;
import org.eclipse.n4js.json.JSONStandaloneSetup;
import org.eclipse.n4js.json.extension.JSONExtensionRegistry;
import org.eclipse.n4js.n4idl.N4IDLGlobals;
import org.eclipse.n4js.resource.packagejson.PackageJsonResourceDescriptionExtension;
import org.eclipse.n4js.runner.extension.RunnerRegistry;
import org.eclipse.n4js.runner.nodejs.NodeRunner.NodeRunnerDescriptorProvider;
import org.eclipse.n4js.tester.extension.TesterRegistry;
import org.eclipse.n4js.tester.nodejs.NodeTester.NodeTesterDescriptorProvider;
import org.eclipse.n4js.transpiler.es.EcmaScriptSubGenerator;
import org.eclipse.n4js.transpiler.es.n4idl.N4IDLSubGenerator;
import org.eclipse.n4js.validation.validators.packagejson.N4JSProjectSetupJsonValidatorExtension;
import org.eclipse.n4js.validation.validators.packagejson.PackageJsonValidatorExtension;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import com.google.inject.Inject;
/**
* This class provides helper methods for registering extensions in headless case. This should become obsolete when
* extension points fully works for headless case.
*/
public class HeadlessExtensionRegistrationHelper {
@Inject
private FileExtensionsRegistry n4jsFileExtensionsRegistry;
@Inject
private SubGeneratorRegistry subGeneratorRegistry;
@Inject
private EcmaScriptSubGenerator ecmaScriptSubGenerator;
@Inject
private N4IDLSubGenerator n4idlSubGenerator;
@Inject
private RunnerRegistry runnerRegistry;
@Inject
private TesterRegistry testerRegistry;
@Inject
private NodeRunnerDescriptorProvider nodeRunnerDescriptorProvider;
@Inject
private NodeTesterDescriptorProvider nodeTesterDescriptorProvider;
@Inject
private PackageJsonValidatorExtension packageJsonValidatorExtension;
@Inject
private N4JSProjectSetupJsonValidatorExtension projectSetupValidatorExtension;
@Inject
private PackageJsonResourceDescriptionExtension packageJsonResourceDescriptionExtension;
/**
* Register extensions manually. This method should become obsolete when extension point fully works in headless
* case.
*/
public void registerExtensions() {
// Wire registers related to the extension points
// in non-OSGI mode extension points are not automatically populated
if (!Platform.isRunning()) {
runnerRegistry.register(nodeRunnerDescriptorProvider.get());
testerRegistry.register(nodeTesterDescriptorProvider.get());
}
// Register file extensions
registerTestableFiles(N4JSGlobals.N4JS_FILE_EXTENSION, N4JSGlobals.N4JSX_FILE_EXTENSION);
registerRunnableFiles(N4JSGlobals.N4JS_FILE_EXTENSION, N4JSGlobals.JS_FILE_EXTENSION,
N4JSGlobals.N4JSX_FILE_EXTENSION, N4JSGlobals.JSX_FILE_EXTENSION);
registerTranspilableFiles(N4JSGlobals.N4JS_FILE_EXTENSION, N4JSGlobals.N4JSX_FILE_EXTENSION,
N4JSGlobals.JS_FILE_EXTENSION, N4JSGlobals.JSX_FILE_EXTENSION, N4IDLGlobals.N4IDL_FILE_EXTENSION);
registerTypableFiles(N4JSGlobals.N4JSD_FILE_EXTENSION, N4JSGlobals.N4JS_FILE_EXTENSION,
N4JSGlobals.N4JSX_FILE_EXTENSION, N4JSGlobals.JS_FILE_EXTENSION,
N4JSGlobals.JSX_FILE_EXTENSION, N4IDLGlobals.N4IDL_FILE_EXTENSION);
registerRawFiles(N4JSGlobals.JS_FILE_EXTENSION, N4JSGlobals.JSX_FILE_EXTENSION);
// Register ECMAScript subgenerator
subGeneratorRegistry.register(ecmaScriptSubGenerator, N4JSGlobals.N4JS_FILE_EXTENSION);
subGeneratorRegistry.register(ecmaScriptSubGenerator, N4JSGlobals.JS_FILE_EXTENSION);
subGeneratorRegistry.register(ecmaScriptSubGenerator, N4JSGlobals.N4JSX_FILE_EXTENSION);
subGeneratorRegistry.register(ecmaScriptSubGenerator, N4JSGlobals.JSX_FILE_EXTENSION);
subGeneratorRegistry.register(n4idlSubGenerator, N4IDLGlobals.N4IDL_FILE_EXTENSION);
// register N4JS-specific package.json behavior with JSONExtensionRegistry
registerJSONLanguageExtension();
}
/** Unregister all extensions */
public void unregisterExtensions() {
runnerRegistry.reset();
testerRegistry.reset();
n4jsFileExtensionsRegistry.reset();
subGeneratorRegistry.reset();
}
/**
* Registers files to {@link FileExtensionType#TESTABLE_FILE_EXTENSION}
*/
private void registerTestableFiles(String... extensions) {
for (String extension : extensions) {
n4jsFileExtensionsRegistry.register(extension, FileExtensionType.TESTABLE_FILE_EXTENSION);
}
}
/**
* Registers files to {@link FileExtensionType#RUNNABLE_FILE_EXTENSION}
*/
private void registerRunnableFiles(String... extensions) {
for (String extension : extensions) {
n4jsFileExtensionsRegistry.register(extension, FileExtensionType.RUNNABLE_FILE_EXTENSION);
}
}
/**
* Registers files to {@link FileExtensionType#TRANSPILABLE_FILE_EXTENSION}
*/
private void registerTranspilableFiles(String... extensions) {
for (String extension : extensions) {
n4jsFileExtensionsRegistry.register(extension, FileExtensionType.TRANSPILABLE_FILE_EXTENSION);
}
}
/**
* Registers files to {@link FileExtensionType#TYPABLE_FILE_EXTENSION}
*/
private void registerTypableFiles(String... extensions) {
for (String extension : extensions) {
n4jsFileExtensionsRegistry.register(extension, FileExtensionType.TYPABLE_FILE_EXTENSION);
}
}
/**
* Registers files to {@link FileExtensionType#RAW_FILE_EXTENSION}
*/
private void registerRawFiles(String... extensions) {
for (String extension : extensions) {
n4jsFileExtensionsRegistry.register(extension, FileExtensionType.TESTABLE_FILE_EXTENSION);
}
}
/**
* Register the N4JS-specific package.json language extension with the JSON extension registry.
*
* Assumes that the {@link JSONStandaloneSetup} has been performed beforehand.
*/
private void registerJSONLanguageExtension() {
final IResourceServiceProvider jsonServiceProvider = (IResourceServiceProvider) IResourceServiceProvider.Registry.INSTANCE
.getExtensionToFactoryMap().get(JSONGlobals.FILE_EXTENSION);
if (jsonServiceProvider == null) {
throw new IllegalStateException("Could not obtain the IResourceServiceProvider for the JSON language. "
+ " Has the standlone setup of the JSON language been performed.");
}
final JSONExtensionRegistry jsonExtensionRegistry = jsonServiceProvider
.get(JSONExtensionRegistry.class);
jsonExtensionRegistry.register(packageJsonValidatorExtension);
jsonExtensionRegistry.register(projectSetupValidatorExtension);
jsonExtensionRegistry.register(packageJsonResourceDescriptionExtension);
}
}
| epl-1.0 |
wugian/work_study | MyView/src/main/java/com/penley/myview/activities/AutoTypeActivity.java | 2873 | package com.penley.myview.activities;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.penley.myview.R;
import com.penley.myview.views.AutoTypeTextView;
import com.penley.myview.views.TypeTextView;
public class AutoTypeActivity extends ActionBarActivity {
String text = "公开报道显示,2010年《人民公安报》曾就“金盾工程”对时任公安部科技信息化局总工程师马晓东进行专访。作为“金盾工程”骨干成员之一,马晓东在本次对话中介绍了彼时“金盾工程”的进展情况以及亟待改善的问题。\n 2011年5月16日,《人民公安报》再次刊发有关马晓东的报道。在一篇名为《开创公安无线通信数字化新天地—访中国警用数字集群标准研发工作负责人马晓东总工程师》文章中,称马晓东是“倡导、引导、指导这一创新技术标准体制(警用数字集群 —Police Digital Trunking,简称PDT)的具体负责人,从最初的可行性研究,到制订各项标准,再到设计实用产品,始终就像妈妈照料婴儿一般,悉心呵护着PDT的每一步成长”。“实际上,PDT就相当于公安内部搞的3G标准。”该文援引工业和信息化部的一位专家的评价称。";
private AutoTypeTextView autoTypeTextView;
private TypeTextView typeTv;
private void assignViews() {
autoTypeTextView = (AutoTypeTextView) findViewById(R.id.autoTypeTextView);
typeTv = (TypeTextView) findViewById(R.id.typeTv);
autoTypeTextView.setTypeListener(new AutoTypeTextView.TypeListener() {
@Override
public void onStart() {
}
@Override
public void onFinish() {
// typeTv.start(text);
}
});
autoTypeTextView.setTextAndStart(text, 240);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auto_type);
assignViews();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_auto_type, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| epl-1.0 |
DavidGutknecht/elexis-3-base | bundles/ch.elexis.ebanking/src-gen/camt/GarnishmentType1.java | 2650 | //
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2017.06.14 um 06:06:29 PM CEST
//
package camt;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für GarnishmentType1 complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="GarnishmentType1">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CdOrPrtry" type="{urn:iso:std:iso:20022:tech:xsd:camt.054.001.06}GarnishmentType1Choice"/>
* <element name="Issr" type="{urn:iso:std:iso:20022:tech:xsd:camt.054.001.06}Max35Text" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GarnishmentType1", propOrder = {
"cdOrPrtry",
"issr"
})
public class GarnishmentType1 {
@XmlElement(name = "CdOrPrtry", required = true)
protected GarnishmentType1Choice cdOrPrtry;
@XmlElement(name = "Issr")
protected String issr;
/**
* Ruft den Wert der cdOrPrtry-Eigenschaft ab.
*
* @return
* possible object is
* {@link GarnishmentType1Choice }
*
*/
public GarnishmentType1Choice getCdOrPrtry() {
return cdOrPrtry;
}
/**
* Legt den Wert der cdOrPrtry-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link GarnishmentType1Choice }
*
*/
public void setCdOrPrtry(GarnishmentType1Choice value) {
this.cdOrPrtry = value;
}
/**
* Ruft den Wert der issr-Eigenschaft ab.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIssr() {
return issr;
}
/**
* Legt den Wert der issr-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIssr(String value) {
this.issr = value;
}
}
| epl-1.0 |
gomezabajo/Wodel | wodeledu.dsls.modeltext.ui/xtend-gen/wodeledu/dsls/ui/labeling/ModelTextDescriptionLabelProvider.java | 428 | /**
* generated by Xtext 2.13.0
*/
package wodeledu.dsls.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for IEObjectDescriptions and IResourceDescriptions.
*
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
*/
@SuppressWarnings("all")
public class ModelTextDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
}
| epl-1.0 |
bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs | utils/eclipselink.utils.workbench/mappingsmodel/source/org/eclipse/persistence/tools/workbench/mappingsmodel/spi/DefaultSPIManager.java | 6989 | /*******************************************************************************
* Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation from Oracle TopLink
******************************************************************************/
package org.eclipse.persistence.tools.workbench.mappingsmodel.spi;
import java.lang.reflect.Method;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import org.eclipse.persistence.tools.workbench.mappingsmodel.spi.db.ExternalDatabaseFactory;
import org.eclipse.persistence.tools.workbench.mappingsmodel.spi.db.jdbc.JDBCExternalDatabaseFactory;
import org.eclipse.persistence.tools.workbench.mappingsmodel.spi.meta.ExternalClassRepositoryFactory;
import org.eclipse.persistence.tools.workbench.mappingsmodel.spi.meta.classfile.CFExternalClassRepositoryFactory;
/**
*
*/
public class DefaultSPIManager implements SPIManager {
/**
* preferences allow the user to override the default SPI implementations
*/
private Preferences preferences;
public static final String SPI_PREFERENCES_NODE = "spi";
public static final String DEFAULTS_PREFERENCES_NODE = "defaults";
public static final String PROJECTS_PREFERENCES_NODE = "projects";
/**
* the project's name is used to look up any project-specific settings
* in the preferences
*/
private String projectName;
/**
* class repository
*/
private ExternalClassRepositoryFactory externalClassRepositoryFactory;
public static final String EXTERNAL_CLASS_REPOSITORY_FACTORY_CLASS_NAME_PREFERENCE = "external class repository factory class";
public static final String EXTERNAL_CLASS_REPOSITORY_FACTORY_CLASS_NAME_PREFERENCE_DEFAULT = CFExternalClassRepositoryFactory.class.getName();
public static final String EXTERNAL_CLASS_REPOSITORY_FACTORY_STATIC_METHOD_NAME_PREFERENCE = "external class repository factory static method";
public static final String EXTERNAL_CLASS_REPOSITORY_FACTORY_STATIC_METHOD_NAME_PREFERENCE_DEFAULT = "instance";
/**
* database
*/
private ExternalDatabaseFactory externalDatabaseFactory;
public static final String EXTERNAL_DATABASE_FACTORY_CLASS_NAME_PREFERENCE = "external database factory class";
public static final String EXTERNAL_DATABASE_FACTORY_CLASS_NAME_PREFERENCE_DEFAULT = JDBCExternalDatabaseFactory.class.getName();
public static final String EXTERNAL_DATABASE_FACTORY_STATIC_METHOD_NAME_PREFERENCE = "external database factory static method";
public static final String EXTERNAL_DATABASE_FACTORY_STATIC_METHOD_NAME_PREFERENCE_DEFAULT = "instance";
/**
* Construct an SPI manager for the specified project. The various
* factories can be configured via the specified preferences node.
*/
public DefaultSPIManager(Preferences preferences, String projectName) {
super();
this.preferences = preferences.node(SPI_PREFERENCES_NODE);
this.projectName = projectName;
}
// ********** class repository **********
/**
* @see SPIManager#getExternalClassRepositoryFactory()
*/
public ExternalClassRepositoryFactory getExternalClassRepositoryFactory() {
if (this.externalClassRepositoryFactory == null) {
this.externalClassRepositoryFactory = this.buildExternalClassRepositoryFactory();
}
return this.externalClassRepositoryFactory;
}
private ExternalClassRepositoryFactory buildExternalClassRepositoryFactory() {
return (ExternalClassRepositoryFactory) this.buildFactory(this.externalClassRepositoryFactoryClassName(), this.externalClassRepositoryFactoryStaticMethodName());
}
private String externalClassRepositoryFactoryClassName() {
return this.value(EXTERNAL_CLASS_REPOSITORY_FACTORY_CLASS_NAME_PREFERENCE, EXTERNAL_CLASS_REPOSITORY_FACTORY_CLASS_NAME_PREFERENCE_DEFAULT);
}
private String externalClassRepositoryFactoryStaticMethodName() {
return this.value(EXTERNAL_CLASS_REPOSITORY_FACTORY_STATIC_METHOD_NAME_PREFERENCE, EXTERNAL_CLASS_REPOSITORY_FACTORY_STATIC_METHOD_NAME_PREFERENCE_DEFAULT);
}
// ********** database **********
/**
* @see SPIManager#getExternalDatabaseFactory()
*/
public ExternalDatabaseFactory getExternalDatabaseFactory() {
if (this.externalDatabaseFactory == null) {
this.externalDatabaseFactory = this.buildExternalDatabaseFactory();
}
return this.externalDatabaseFactory;
}
private ExternalDatabaseFactory buildExternalDatabaseFactory() {
return (ExternalDatabaseFactory) this.buildFactory(this.externalDatabaseFactoryClassName(), this.externalDatabaseFactoryStaticMethodName());
}
private String externalDatabaseFactoryClassName() {
return this.value(EXTERNAL_DATABASE_FACTORY_CLASS_NAME_PREFERENCE, EXTERNAL_DATABASE_FACTORY_CLASS_NAME_PREFERENCE_DEFAULT);
}
private String externalDatabaseFactoryStaticMethodName() {
return this.value(EXTERNAL_DATABASE_FACTORY_STATIC_METHOD_NAME_PREFERENCE, EXTERNAL_DATABASE_FACTORY_STATIC_METHOD_NAME_PREFERENCE_DEFAULT);
}
// ********** common code **********
/**
* return the user-specified project-specific setting;
* absent that, return the user-specified default setting;
* absent that, return the system-specified default setting
*/
private String value(String key, String defaultValue) {
String value = defaultValue;
// spi/defaults/foo
value = this.preferences.node(DEFAULTS_PREFERENCES_NODE).get(key, value);
try {
// spi/projects/Project Name/foo
if (this.preferences.node(PROJECTS_PREFERENCES_NODE).nodeExists(this.projectName)) {
value = this.preferences.node(PROJECTS_PREFERENCES_NODE).node(this.projectName).get(key, value);
}
} catch (BackingStoreException ex) {
throw new RuntimeException(ex);
}
return value;
}
private Object buildFactory(String factoryClassName, String factoryStaticMethodName) {
try {
// first load the factory class
// (for now, the factory class must be loadable by this class's classloader;
// but we could configure a URLClassLoader with a classpath and use that...)
Class factoryClass = Class.forName(factoryClassName);
// then get the method
Method factoryStaticMethod = factoryClass.getMethod(factoryStaticMethodName, new Class[0]);
// then invoke the method and return the result
return factoryStaticMethod.invoke(null, new Object[0]);
} catch (Throwable t) {
// if any of the above code fails, throw a runtime exception
throw new RuntimeException(t);
}
}
}
| epl-1.0 |
boniatillo-com/PhaserEditor | source/v2/phasereditor/phasereditor.ui/src/phasereditor/ui/ScaledImage.java | 5185 | // The MIT License (MIT)
//
// Copyright (c) 2015, 2018 Arian Fornaris
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions: The above copyright notice and this permission
// notice shall be included in all copies or substantial portions of the
// Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
package phasereditor.ui;
import java.awt.image.BufferedImage;
import java.io.IOException;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
/**
* @author arian
*
*/
public class ScaledImage {
private float _scale;
private Image _image;
private int _viewWidth;
private int _viewHeight;
public static ScaledImage create(BufferedImage buffer, int maxSize) {
return create(buffer, FrameData.fromImage(buffer), maxSize);
}
public static ScaledImage create(BufferedImage src, FrameData fd, int maxSize) {
int viewWidth = fd.srcSize.x;
int viewHeight = fd.srcSize.y;
var resize = resizeInfo(viewWidth, viewHeight, maxSize);
var buffer = resize.createImage(src, fd);
try {
var img = PhaserEditorUI.image_Swing_To_SWT(buffer);
return new ScaledImage(img, viewWidth, viewHeight, resize.scale_view_to_proxy);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
public ScaledImage(Image image, int viewWidth, int viewHeight, float scale) {
super();
_image = image;
_viewWidth = viewWidth;
_viewHeight = viewHeight;
_scale = scale;
}
public static class ResizeInfo {
public int width;
public int height;
public boolean changed;
public float scale_view_to_proxy;
public BufferedImage createImage(BufferedImage src, FrameData fd) {
var buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
var g2 = buf.createGraphics();
g2.scale(scale_view_to_proxy, scale_view_to_proxy);
g2.drawImage(src,
fd.dst.x, fd.dst.y, fd.dst.x + fd.dst.width, fd.dst.y + fd.dst.height,
fd.src.x, fd.src.y, fd.src.x + fd.src.width, fd.src.y + fd.src.height,
null);
g2.dispose();
return buf;
}
}
public static ResizeInfo resizeInfo(int w, int h, int maxSize) {
var info = new ResizeInfo();
info.scale_view_to_proxy = 1;
info.width = w;
info.height = h;
info.changed = false;
if (w > maxSize || h > maxSize) {
if (w > h) {
var ratio = (float) h / w;
info.width = maxSize;
info.height = (int) (info.width * ratio);
info.scale_view_to_proxy = (float) info.width / w;
info.changed = true;
} else {
var ratio = (float) h / w;
info.height = maxSize;
info.width = (int) (info.height / ratio);
info.scale_view_to_proxy = (float) info.height / h;
info.changed = true;
}
}
return info;
}
public void paint(GC gc, int x, int y) {
var b = _image.getBounds();
gc.drawImage(_image, 0, 0, b.width, b.height, x, y, _viewWidth, _viewHeight);
}
public void paintScaledInArea(GC gc, Rectangle renderArea, boolean center) {
var image = getImage();
if (image == null) {
return;
}
var bounds = image.getBounds();
int renderHeight = renderArea.height;
int renderWidth = renderArea.width;
double imgW = bounds.width;
double imgH = bounds.height;
// compute the right width
imgW = imgW * (renderHeight / imgH);
imgH = renderHeight;
// fix width if it goes beyond the area
if (imgW > renderWidth) {
imgH = imgH * (renderWidth / imgW);
imgW = renderWidth;
}
double scale = imgW / bounds.width;
var imgX = renderArea.x + (center ? renderWidth / 2 - imgW / 2 : 0);
var imgY = renderArea.y + renderHeight / 2 - imgH / 2;
double imgDstW = bounds.width * scale;
double imgDstH = bounds.height * scale;
if (imgDstW > 0 && imgDstH > 0) {
gc.drawImage(image, 0, 0, bounds.width, bounds.height, (int) imgX, (int) imgY, (int) imgDstW, (int) imgDstH);
}
}
public Image getImage() {
return _image;
}
public void dispose() {
_image.dispose();
}
public Rectangle getBounds() {
return new Rectangle(0, 0, _viewWidth, _viewHeight);
}
public boolean hits(int x, int y) {
var alpha = 0;
Rectangle b = getBounds();
if (b.contains(x, y)) {
var img = getImage();
if (img != null) {
var data = img.getImageData();
alpha = data.getAlpha((int) (x * _scale), (int) (y * _scale));
}
}
return alpha != 0;
}
}
| epl-1.0 |
jeeeyul/eclipse.js | net.jeeeyul.eclipsejs/src/net/jeeeyul/eclipsejs/core/EJSContext.java | 1032 | package net.jeeeyul.eclipsejs.core;
import java.util.concurrent.CancellationException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.mozilla.javascript.Context;
/**
* Execution Context for eclipse.js scripts. It is basically same as rhino's
* default. However there is termination functionality by progress monitor was
* added. see {@link #observeInstructionCount(int)}
*
* @author Jeeeyul
* @since 0.1
*
*/
public class EJSContext extends Context {
private IProgressMonitor monitor;
/**
* sets a {@link IProgressMonitor} that can terminate script by cancel.
*
* @param monitor
*/
public void setMonitor(IProgressMonitor monitor) {
this.monitor = monitor;
setInstructionObserverThreshold(100);
}
protected EJSContext(EJSContextFactory factory) {
super(factory);
setErrorReporter(new EJSErrorReporter());
}
@Override
protected void observeInstructionCount(int instructionCount) {
if (monitor != null && monitor.isCanceled()) {
throw new CancellationException();
}
}
}
| epl-1.0 |
Jose-Badeau/boomslang-wireframesketcher | com.wireframesketcher.model/src/java/com/wireframesketcher/model/util/ModelSwitch.java | 116097 | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package com.wireframesketcher.model.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import com.wireframesketcher.model.*;
/**
* <!-- begin-user-doc -->
* The <b>Switch</b> for the model's inheritance hierarchy.
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
* to invoke the <code>caseXXX</code> method for each class of the model,
* starting with the actual class of the object
* and proceeding up the inheritance hierarchy
* until a non-null result is returned,
* which is the result of the switch.
* <!-- end-user-doc -->
* @see com.wireframesketcher.model.ModelPackage
* @generated
*/
public class ModelSwitch<T> extends Switch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static ModelPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelSwitch() {
if (modelPackage == null) {
modelPackage = ModelPackage.eINSTANCE;
}
}
/**
* Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param ePackage the package in question.
* @return whether this is a switch for the given package.
* @generated
*/
@Override
protected boolean isSwitchFor(EPackage ePackage) {
return ePackage == modelPackage;
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case ModelPackage.SCREEN: {
Screen screen = (Screen)theEObject;
T result = caseScreen(screen);
if (result == null) result = caseWidgetContainer(screen);
if (result == null) result = caseNoteSupport(screen);
if (result == null) result = caseNameSupport(screen);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SCREEN_RULER: {
ScreenRuler screenRuler = (ScreenRuler)theEObject;
T result = caseScreenRuler(screenRuler);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.RULER_GUIDE: {
RulerGuide rulerGuide = (RulerGuide)theEObject;
T result = caseRulerGuide(rulerGuide);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.WIDGET: {
Widget widget = (Widget)theEObject;
T result = caseWidget(widget);
if (result == null) result = caseNoteSupport(widget);
if (result == null) result = caseNameSupport(widget);
if (result == null) result = caseVisibleSupport(widget);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BUTTON: {
Button button = (Button)theEObject;
T result = caseButton(button);
if (result == null) result = caseWidget(button);
if (result == null) result = caseStateSupport(button);
if (result == null) result = caseColorBackgroundSupport(button);
if (result == null) result = caseFontSupport(button);
if (result == null) result = caseIconSupport(button);
if (result == null) result = caseLinkSupport(button);
if (result == null) result = caseTextAlignmentSupport(button);
if (result == null) result = caseSkinSupport(button);
if (result == null) result = caseClickSupport(button);
if (result == null) result = caseNoteSupport(button);
if (result == null) result = caseNameSupport(button);
if (result == null) result = caseVisibleSupport(button);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CHECKBOX: {
Checkbox checkbox = (Checkbox)theEObject;
T result = caseCheckbox(checkbox);
if (result == null) result = caseWidget(checkbox);
if (result == null) result = caseBooleanSelectionSupport(checkbox);
if (result == null) result = caseStateSupport(checkbox);
if (result == null) result = caseLinkSupport(checkbox);
if (result == null) result = caseFontSupport(checkbox);
if (result == null) result = caseSkinSupport(checkbox);
if (result == null) result = caseNoteSupport(checkbox);
if (result == null) result = caseNameSupport(checkbox);
if (result == null) result = caseVisibleSupport(checkbox);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COMBO: {
Combo combo = (Combo)theEObject;
T result = caseCombo(combo);
if (result == null) result = caseWidget(combo);
if (result == null) result = caseStateSupport(combo);
if (result == null) result = caseFontSupport(combo);
if (result == null) result = caseColorBorderSupport(combo);
if (result == null) result = caseColorBackgroundSupport(combo);
if (result == null) result = caseColorAlphaSupport(combo);
if (result == null) result = caseLinkSupport(combo);
if (result == null) result = caseSkinSupport(combo);
if (result == null) result = caseSelectionSupport(combo);
if (result == null) result = caseNoteSupport(combo);
if (result == null) result = caseNameSupport(combo);
if (result == null) result = caseVisibleSupport(combo);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LABEL: {
Label label = (Label)theEObject;
T result = caseLabel(label);
if (result == null) result = caseWidget(label);
if (result == null) result = caseFontSupport(label);
if (result == null) result = caseTextAlignmentSupport(label);
if (result == null) result = caseColorForegroundSupport(label);
if (result == null) result = caseStateSupport(label);
if (result == null) result = caseIconPositionSupport(label);
if (result == null) result = caseLinkSupport(label);
if (result == null) result = caseRotationSupport(label);
if (result == null) result = caseTextLinksSupport(label);
if (result == null) result = caseNoteSupport(label);
if (result == null) result = caseNameSupport(label);
if (result == null) result = caseVisibleSupport(label);
if (result == null) result = caseIconSupport(label);
if (result == null) result = caseItemSupport(label);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LINK: {
Link link = (Link)theEObject;
T result = caseLink(link);
if (result == null) result = caseWidget(link);
if (result == null) result = caseFontSupport(link);
if (result == null) result = caseStateSupport(link);
if (result == null) result = caseLinkSupport(link);
if (result == null) result = caseSkinSupport(link);
if (result == null) result = caseNoteSupport(link);
if (result == null) result = caseNameSupport(link);
if (result == null) result = caseVisibleSupport(link);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.PLACEHOLDER: {
Placeholder placeholder = (Placeholder)theEObject;
T result = casePlaceholder(placeholder);
if (result == null) result = caseWidget(placeholder);
if (result == null) result = caseLinkSupport(placeholder);
if (result == null) result = caseSkinSupport(placeholder);
if (result == null) result = caseNoteSupport(placeholder);
if (result == null) result = caseNameSupport(placeholder);
if (result == null) result = caseVisibleSupport(placeholder);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.RADIO_BUTTON: {
RadioButton radioButton = (RadioButton)theEObject;
T result = caseRadioButton(radioButton);
if (result == null) result = caseWidget(radioButton);
if (result == null) result = caseBooleanSelectionSupport(radioButton);
if (result == null) result = caseStateSupport(radioButton);
if (result == null) result = caseLinkSupport(radioButton);
if (result == null) result = caseFontSupport(radioButton);
if (result == null) result = caseSkinSupport(radioButton);
if (result == null) result = caseNoteSupport(radioButton);
if (result == null) result = caseNameSupport(radioButton);
if (result == null) result = caseVisibleSupport(radioButton);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT_FIELD: {
TextField textField = (TextField)theEObject;
T result = caseTextField(textField);
if (result == null) result = caseWidget(textField);
if (result == null) result = caseStateSupport(textField);
if (result == null) result = caseFontSupport(textField);
if (result == null) result = caseTextAlignmentSupport(textField);
if (result == null) result = caseColorBackgroundSupport(textField);
if (result == null) result = caseColorAlphaSupport(textField);
if (result == null) result = caseColorBorderSupport(textField);
if (result == null) result = caseSkinSupport(textField);
if (result == null) result = caseTextInputSupport(textField);
if (result == null) result = caseNoteSupport(textField);
if (result == null) result = caseNameSupport(textField);
if (result == null) result = caseVisibleSupport(textField);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SPINNER: {
Spinner spinner = (Spinner)theEObject;
T result = caseSpinner(spinner);
if (result == null) result = caseWidget(spinner);
if (result == null) result = caseStateSupport(spinner);
if (result == null) result = caseFontSupport(spinner);
if (result == null) result = caseColorBorderSupport(spinner);
if (result == null) result = caseColorBackgroundSupport(spinner);
if (result == null) result = caseColorAlphaSupport(spinner);
if (result == null) result = caseSkinSupport(spinner);
if (result == null) result = caseNoteSupport(spinner);
if (result == null) result = caseNameSupport(spinner);
if (result == null) result = caseVisibleSupport(spinner);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.WINDOW: {
Window window = (Window)theEObject;
T result = caseWindow(window);
if (result == null) result = caseWidget(window);
if (result == null) result = caseVerticalScrollbarSupport(window);
if (result == null) result = caseSkinSupport(window);
if (result == null) result = caseColorBackgroundSupport(window);
if (result == null) result = caseColorAlphaSupport(window);
if (result == null) result = caseNoteSupport(window);
if (result == null) result = caseNameSupport(window);
if (result == null) result = caseVisibleSupport(window);
if (result == null) result = caseValueSupport(window);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BROWSER: {
Browser browser = (Browser)theEObject;
T result = caseBrowser(browser);
if (result == null) result = caseWidget(browser);
if (result == null) result = caseVerticalScrollbarSupport(browser);
if (result == null) result = caseColorBackgroundSupport(browser);
if (result == null) result = caseSkinSupport(browser);
if (result == null) result = caseColorAlphaSupport(browser);
if (result == null) result = caseFontSupport(browser);
if (result == null) result = caseNoteSupport(browser);
if (result == null) result = caseNameSupport(browser);
if (result == null) result = caseVisibleSupport(browser);
if (result == null) result = caseValueSupport(browser);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT: {
Text text = (Text)theEObject;
T result = caseText(text);
if (result == null) result = caseWidget(text);
if (result == null) result = caseFontSupport(text);
if (result == null) result = caseTextAlignmentSupport(text);
if (result == null) result = caseColorForegroundSupport(text);
if (result == null) result = caseLinkSupport(text);
if (result == null) result = caseLineHeightSupport(text);
if (result == null) result = caseTextLinksSupport(text);
if (result == null) result = caseNoteSupport(text);
if (result == null) result = caseNameSupport(text);
if (result == null) result = caseVisibleSupport(text);
if (result == null) result = caseItemSupport(text);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.AREA: {
Area area = (Area)theEObject;
T result = caseArea(area);
if (result == null) result = caseWidget(area);
if (result == null) result = caseNoteSupport(area);
if (result == null) result = caseNameSupport(area);
if (result == null) result = caseVisibleSupport(area);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.PANEL: {
Panel panel = (Panel)theEObject;
T result = casePanel(panel);
if (result == null) result = caseWidget(panel);
if (result == null) result = caseColorBackgroundSupport(panel);
if (result == null) result = caseColorAlphaSupport(panel);
if (result == null) result = caseVerticalScrollbarSupport(panel);
if (result == null) result = caseColorForegroundSupport(panel);
if (result == null) result = caseBorderStyleSupport(panel);
if (result == null) result = caseLinkSupport(panel);
if (result == null) result = caseSkinSupport(panel);
if (result == null) result = caseNoteSupport(panel);
if (result == null) result = caseNameSupport(panel);
if (result == null) result = caseVisibleSupport(panel);
if (result == null) result = caseValueSupport(panel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.GROUP: {
Group group = (Group)theEObject;
T result = caseGroup(group);
if (result == null) result = caseWidget(group);
if (result == null) result = caseVerticalScrollbarSupport(group);
if (result == null) result = caseColorBackgroundSupport(group);
if (result == null) result = caseColorAlphaSupport(group);
if (result == null) result = caseFontSupport(group);
if (result == null) result = caseSkinSupport(group);
if (result == null) result = caseNoteSupport(group);
if (result == null) result = caseNameSupport(group);
if (result == null) result = caseVisibleSupport(group);
if (result == null) result = caseValueSupport(group);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LIST: {
List list = (List)theEObject;
T result = caseList(list);
if (result == null) result = caseWidget(list);
if (result == null) result = caseSelectionSupport(list);
if (result == null) result = caseBorderSupport(list);
if (result == null) result = caseVerticalScrollbarSupport(list);
if (result == null) result = caseColorBackgroundSupport(list);
if (result == null) result = caseColorAlphaSupport(list);
if (result == null) result = caseListSupport(list);
if (result == null) result = caseFontSupport(list);
if (result == null) result = caseItemSupport(list);
if (result == null) result = caseColorAlternativeSupport(list);
if (result == null) result = caseNoteSupport(list);
if (result == null) result = caseNameSupport(list);
if (result == null) result = caseVisibleSupport(list);
if (result == null) result = caseValueSupport(list);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.POPUP: {
Popup popup = (Popup)theEObject;
T result = casePopup(popup);
if (result == null) result = caseWidget(popup);
if (result == null) result = caseSelectionSupport(popup);
if (result == null) result = caseItemSupport(popup);
if (result == null) result = caseNoteSupport(popup);
if (result == null) result = caseNameSupport(popup);
if (result == null) result = caseVisibleSupport(popup);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.MENU: {
Menu menu = (Menu)theEObject;
T result = caseMenu(menu);
if (result == null) result = caseWidget(menu);
if (result == null) result = caseSelectionSupport(menu);
if (result == null) result = caseIconSupport(menu);
if (result == null) result = caseItemSupport(menu);
if (result == null) result = caseSkinSupport(menu);
if (result == null) result = caseNoteSupport(menu);
if (result == null) result = caseNameSupport(menu);
if (result == null) result = caseVisibleSupport(menu);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TABLE: {
Table table = (Table)theEObject;
T result = caseTable(table);
if (result == null) result = caseWidget(table);
if (result == null) result = caseSelectionSupport(table);
if (result == null) result = caseBorderSupport(table);
if (result == null) result = caseVerticalScrollbarSupport(table);
if (result == null) result = caseColorBackgroundSupport(table);
if (result == null) result = caseColorAlphaSupport(table);
if (result == null) result = caseListSupport(table);
if (result == null) result = caseFontSupport(table);
if (result == null) result = caseTextAlignmentSupport(table);
if (result == null) result = caseColorAlternativeSupport(table);
if (result == null) result = caseTextLinksSupport(table);
if (result == null) result = caseClickSupport(table);
if (result == null) result = caseDoubleClickSupport(table);
if (result == null) result = caseTextInputSupport(table);
if (result == null) result = caseNoteSupport(table);
if (result == null) result = caseNameSupport(table);
if (result == null) result = caseVisibleSupport(table);
if (result == null) result = caseValueSupport(table);
if (result == null) result = caseItemSupport(table);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TREE: {
Tree tree = (Tree)theEObject;
T result = caseTree(tree);
if (result == null) result = caseWidget(tree);
if (result == null) result = caseBorderSupport(tree);
if (result == null) result = caseVerticalScrollbarSupport(tree);
if (result == null) result = caseColorBackgroundSupport(tree);
if (result == null) result = caseColorAlphaSupport(tree);
if (result == null) result = caseSelectionSupport(tree);
if (result == null) result = caseItemSupport(tree);
if (result == null) result = caseFontSupport(tree);
if (result == null) result = caseNoteSupport(tree);
if (result == null) result = caseNameSupport(tree);
if (result == null) result = caseVisibleSupport(tree);
if (result == null) result = caseValueSupport(tree);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ICON: {
Icon icon = (Icon)theEObject;
T result = caseIcon(icon);
if (result == null) result = caseWidget(icon);
if (result == null) result = caseColorForegroundSupport(icon);
if (result == null) result = caseIconSupport(icon);
if (result == null) result = caseLinkSupport(icon);
if (result == null) result = caseNoteSupport(icon);
if (result == null) result = caseNameSupport(icon);
if (result == null) result = caseVisibleSupport(icon);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT_AREA: {
TextArea textArea = (TextArea)theEObject;
T result = caseTextArea(textArea);
if (result == null) result = caseWidget(textArea);
if (result == null) result = caseStateSupport(textArea);
if (result == null) result = caseVerticalScrollbarSupport(textArea);
if (result == null) result = caseFontSupport(textArea);
if (result == null) result = caseTextAlignmentSupport(textArea);
if (result == null) result = caseColorBackgroundSupport(textArea);
if (result == null) result = caseColorAlphaSupport(textArea);
if (result == null) result = caseColorBorderSupport(textArea);
if (result == null) result = caseSkinSupport(textArea);
if (result == null) result = caseLineHeightSupport(textArea);
if (result == null) result = caseTextLinksSupport(textArea);
if (result == null) result = caseNoteSupport(textArea);
if (result == null) result = caseNameSupport(textArea);
if (result == null) result = caseVisibleSupport(textArea);
if (result == null) result = caseValueSupport(textArea);
if (result == null) result = caseItemSupport(textArea);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.HSCROLLBAR: {
HScrollbar hScrollbar = (HScrollbar)theEObject;
T result = caseHScrollbar(hScrollbar);
if (result == null) result = caseWidget(hScrollbar);
if (result == null) result = caseValueSupport(hScrollbar);
if (result == null) result = caseSkinSupport(hScrollbar);
if (result == null) result = caseNoteSupport(hScrollbar);
if (result == null) result = caseNameSupport(hScrollbar);
if (result == null) result = caseVisibleSupport(hScrollbar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VSCROLLBAR: {
VScrollbar vScrollbar = (VScrollbar)theEObject;
T result = caseVScrollbar(vScrollbar);
if (result == null) result = caseWidget(vScrollbar);
if (result == null) result = caseValueSupport(vScrollbar);
if (result == null) result = caseSkinSupport(vScrollbar);
if (result == null) result = caseNoteSupport(vScrollbar);
if (result == null) result = caseNameSupport(vScrollbar);
if (result == null) result = caseVisibleSupport(vScrollbar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.HLINE: {
HLine hLine = (HLine)theEObject;
T result = caseHLine(hLine);
if (result == null) result = caseWidget(hLine);
if (result == null) result = caseColorForegroundSupport(hLine);
if (result == null) result = caseLineStyleSupport(hLine);
if (result == null) result = caseSkinSupport(hLine);
if (result == null) result = caseNoteSupport(hLine);
if (result == null) result = caseNameSupport(hLine);
if (result == null) result = caseVisibleSupport(hLine);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VLINE: {
VLine vLine = (VLine)theEObject;
T result = caseVLine(vLine);
if (result == null) result = caseWidget(vLine);
if (result == null) result = caseColorForegroundSupport(vLine);
if (result == null) result = caseLineStyleSupport(vLine);
if (result == null) result = caseSkinSupport(vLine);
if (result == null) result = caseNoteSupport(vLine);
if (result == null) result = caseNameSupport(vLine);
if (result == null) result = caseVisibleSupport(vLine);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.HSLIDER: {
HSlider hSlider = (HSlider)theEObject;
T result = caseHSlider(hSlider);
if (result == null) result = caseWidget(hSlider);
if (result == null) result = caseValueSupport(hSlider);
if (result == null) result = caseStateSupport(hSlider);
if (result == null) result = caseColorBackgroundSupport(hSlider);
if (result == null) result = caseSkinSupport(hSlider);
if (result == null) result = caseNoteSupport(hSlider);
if (result == null) result = caseNameSupport(hSlider);
if (result == null) result = caseVisibleSupport(hSlider);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VSLIDER: {
VSlider vSlider = (VSlider)theEObject;
T result = caseVSlider(vSlider);
if (result == null) result = caseWidget(vSlider);
if (result == null) result = caseValueSupport(vSlider);
if (result == null) result = caseStateSupport(vSlider);
if (result == null) result = caseColorBackgroundSupport(vSlider);
if (result == null) result = caseSkinSupport(vSlider);
if (result == null) result = caseNoteSupport(vSlider);
if (result == null) result = caseNameSupport(vSlider);
if (result == null) result = caseVisibleSupport(vSlider);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TABS: {
Tabs tabs = (Tabs)theEObject;
T result = caseTabs(tabs);
if (result == null) result = caseWidget(tabs);
if (result == null) result = caseSelectionSupport(tabs);
if (result == null) result = caseItemSupport(tabs);
if (result == null) result = caseFontSupport(tabs);
if (result == null) result = caseSkinSupport(tabs);
if (result == null) result = caseNoteSupport(tabs);
if (result == null) result = caseNameSupport(tabs);
if (result == null) result = caseVisibleSupport(tabs);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.WIDGET_DESCRIPTOR: {
WidgetDescriptor widgetDescriptor = (WidgetDescriptor)theEObject;
T result = caseWidgetDescriptor(widgetDescriptor);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.FONT: {
Font font = (Font)theEObject;
T result = caseFont(font);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.WIDGET_CONTAINER: {
WidgetContainer widgetContainer = (WidgetContainer)theEObject;
T result = caseWidgetContainer(widgetContainer);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.WIDGET_GROUP: {
WidgetGroup widgetGroup = (WidgetGroup)theEObject;
T result = caseWidgetGroup(widgetGroup);
if (result == null) result = caseWidget(widgetGroup);
if (result == null) result = caseWidgetContainer(widgetGroup);
if (result == null) result = caseLinkSupport(widgetGroup);
if (result == null) result = caseNoteSupport(widgetGroup);
if (result == null) result = caseNameSupport(widgetGroup);
if (result == null) result = caseVisibleSupport(widgetGroup);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.MASTER: {
Master master = (Master)theEObject;
T result = caseMaster(master);
if (result == null) result = caseWidget(master);
if (result == null) result = caseLinkSupport(master);
if (result == null) result = caseNoteSupport(master);
if (result == null) result = caseNameSupport(master);
if (result == null) result = caseVisibleSupport(master);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.IMAGE: {
Image image = (Image)theEObject;
T result = caseImage(image);
if (result == null) result = caseWidget(image);
if (result == null) result = caseLinkSupport(image);
if (result == null) result = caseRotationSupport(image);
if (result == null) result = caseFlipSupport(image);
if (result == null) result = caseBorderSupport(image);
if (result == null) result = caseNoteSupport(image);
if (result == null) result = caseNameSupport(image);
if (result == null) result = caseVisibleSupport(image);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SCREEN_FONT: {
ScreenFont screenFont = (ScreenFont)theEObject;
T result = caseScreenFont(screenFont);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.FONT_SUPPORT: {
FontSupport fontSupport = (FontSupport)theEObject;
T result = caseFontSupport(fontSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_FOREGROUND_SUPPORT: {
ColorForegroundSupport colorForegroundSupport = (ColorForegroundSupport)theEObject;
T result = caseColorForegroundSupport(colorForegroundSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_BACKGROUND_SUPPORT: {
ColorBackgroundSupport colorBackgroundSupport = (ColorBackgroundSupport)theEObject;
T result = caseColorBackgroundSupport(colorBackgroundSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_BORDER_SUPPORT: {
ColorBorderSupport colorBorderSupport = (ColorBorderSupport)theEObject;
T result = caseColorBorderSupport(colorBorderSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_ALPHA_SUPPORT: {
ColorAlphaSupport colorAlphaSupport = (ColorAlphaSupport)theEObject;
T result = caseColorAlphaSupport(colorAlphaSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SELECTION_SUPPORT: {
SelectionSupport selectionSupport = (SelectionSupport)theEObject;
T result = caseSelectionSupport(selectionSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT_ALIGNMENT_SUPPORT: {
TextAlignmentSupport textAlignmentSupport = (TextAlignmentSupport)theEObject;
T result = caseTextAlignmentSupport(textAlignmentSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BOOLEAN_SELECTION_SUPPORT: {
BooleanSelectionSupport booleanSelectionSupport = (BooleanSelectionSupport)theEObject;
T result = caseBooleanSelectionSupport(booleanSelectionSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.NOTE: {
Note note = (Note)theEObject;
T result = caseNote(note);
if (result == null) result = caseWidget(note);
if (result == null) result = caseFontSupport(note);
if (result == null) result = caseTextAlignmentSupport(note);
if (result == null) result = caseColorBackgroundSupport(note);
if (result == null) result = caseColorAlphaSupport(note);
if (result == null) result = caseLinkSupport(note);
if (result == null) result = caseSkinSupport(note);
if (result == null) result = caseAnnotationSupport(note);
if (result == null) result = caseTextLinksSupport(note);
if (result == null) result = caseNoteSupport(note);
if (result == null) result = caseNameSupport(note);
if (result == null) result = caseVisibleSupport(note);
if (result == null) result = caseItemSupport(note);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.PROGRESS_BAR: {
ProgressBar progressBar = (ProgressBar)theEObject;
T result = caseProgressBar(progressBar);
if (result == null) result = caseWidget(progressBar);
if (result == null) result = caseValueSupport(progressBar);
if (result == null) result = caseColorBackgroundSupport(progressBar);
if (result == null) result = caseSkinSupport(progressBar);
if (result == null) result = caseNoteSupport(progressBar);
if (result == null) result = caseNameSupport(progressBar);
if (result == null) result = caseVisibleSupport(progressBar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CALLOUT: {
Callout callout = (Callout)theEObject;
T result = caseCallout(callout);
if (result == null) result = caseWidget(callout);
if (result == null) result = caseFontSupport(callout);
if (result == null) result = caseColorBackgroundSupport(callout);
if (result == null) result = caseColorAlphaSupport(callout);
if (result == null) result = caseLinkSupport(callout);
if (result == null) result = caseSkinSupport(callout);
if (result == null) result = caseAnnotationSupport(callout);
if (result == null) result = caseNoteSupport(callout);
if (result == null) result = caseNameSupport(callout);
if (result == null) result = caseVisibleSupport(callout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SEARCH_FIELD: {
SearchField searchField = (SearchField)theEObject;
T result = caseSearchField(searchField);
if (result == null) result = caseWidget(searchField);
if (result == null) result = caseFontSupport(searchField);
if (result == null) result = caseStateSupport(searchField);
if (result == null) result = caseColorBorderSupport(searchField);
if (result == null) result = caseLinkSupport(searchField);
if (result == null) result = caseSkinSupport(searchField);
if (result == null) result = caseNoteSupport(searchField);
if (result == null) result = caseNameSupport(searchField);
if (result == null) result = caseVisibleSupport(searchField);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LINK_BAR: {
LinkBar linkBar = (LinkBar)theEObject;
T result = caseLinkBar(linkBar);
if (result == null) result = caseWidget(linkBar);
if (result == null) result = caseFontSupport(linkBar);
if (result == null) result = caseSelectionSupport(linkBar);
if (result == null) result = caseItemSupport(linkBar);
if (result == null) result = caseSkinSupport(linkBar);
if (result == null) result = caseNoteSupport(linkBar);
if (result == null) result = caseNameSupport(linkBar);
if (result == null) result = caseVisibleSupport(linkBar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TOOLTIP: {
Tooltip tooltip = (Tooltip)theEObject;
T result = caseTooltip(tooltip);
if (result == null) result = caseWidget(tooltip);
if (result == null) result = caseFontSupport(tooltip);
if (result == null) result = caseTextAlignmentSupport(tooltip);
if (result == null) result = caseColorBackgroundSupport(tooltip);
if (result == null) result = caseSkinSupport(tooltip);
if (result == null) result = caseTextLinksSupport(tooltip);
if (result == null) result = caseNoteSupport(tooltip);
if (result == null) result = caseNameSupport(tooltip);
if (result == null) result = caseVisibleSupport(tooltip);
if (result == null) result = caseItemSupport(tooltip);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SCRATCH_OUT: {
ScratchOut scratchOut = (ScratchOut)theEObject;
T result = caseScratchOut(scratchOut);
if (result == null) result = caseWidget(scratchOut);
if (result == null) result = caseColorForegroundSupport(scratchOut);
if (result == null) result = caseColorAlphaSupport(scratchOut);
if (result == null) result = caseSkinSupport(scratchOut);
if (result == null) result = caseAnnotationSupport(scratchOut);
if (result == null) result = caseNoteSupport(scratchOut);
if (result == null) result = caseNameSupport(scratchOut);
if (result == null) result = caseVisibleSupport(scratchOut);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BORDER_SUPPORT: {
BorderSupport borderSupport = (BorderSupport)theEObject;
T result = caseBorderSupport(borderSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.STATE_SUPPORT: {
StateSupport stateSupport = (StateSupport)theEObject;
T result = caseStateSupport(stateSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BREADCRUMBS: {
Breadcrumbs breadcrumbs = (Breadcrumbs)theEObject;
T result = caseBreadcrumbs(breadcrumbs);
if (result == null) result = caseWidget(breadcrumbs);
if (result == null) result = caseFontSupport(breadcrumbs);
if (result == null) result = caseItemSupport(breadcrumbs);
if (result == null) result = caseSkinSupport(breadcrumbs);
if (result == null) result = caseNoteSupport(breadcrumbs);
if (result == null) result = caseNameSupport(breadcrumbs);
if (result == null) result = caseVisibleSupport(breadcrumbs);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ACCORDION: {
Accordion accordion = (Accordion)theEObject;
T result = caseAccordion(accordion);
if (result == null) result = caseWidget(accordion);
if (result == null) result = caseSelectionSupport(accordion);
if (result == null) result = caseVerticalScrollbarSupport(accordion);
if (result == null) result = caseItemSupport(accordion);
if (result == null) result = caseFontSupport(accordion);
if (result == null) result = caseNoteSupport(accordion);
if (result == null) result = caseNameSupport(accordion);
if (result == null) result = caseVisibleSupport(accordion);
if (result == null) result = caseValueSupport(accordion);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VERTICAL_SCROLLBAR_SUPPORT: {
VerticalScrollbarSupport verticalScrollbarSupport = (VerticalScrollbarSupport)theEObject;
T result = caseVerticalScrollbarSupport(verticalScrollbarSupport);
if (result == null) result = caseValueSupport(verticalScrollbarSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.DATE_FIELD: {
DateField dateField = (DateField)theEObject;
T result = caseDateField(dateField);
if (result == null) result = caseWidget(dateField);
if (result == null) result = caseStateSupport(dateField);
if (result == null) result = caseColorBorderSupport(dateField);
if (result == null) result = caseColorBackgroundSupport(dateField);
if (result == null) result = caseColorAlphaSupport(dateField);
if (result == null) result = caseSkinSupport(dateField);
if (result == null) result = caseNoteSupport(dateField);
if (result == null) result = caseNameSupport(dateField);
if (result == null) result = caseVisibleSupport(dateField);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VIDEO_PLAYER: {
VideoPlayer videoPlayer = (VideoPlayer)theEObject;
T result = caseVideoPlayer(videoPlayer);
if (result == null) result = caseWidget(videoPlayer);
if (result == null) result = caseSkinSupport(videoPlayer);
if (result == null) result = caseNoteSupport(videoPlayer);
if (result == null) result = caseNameSupport(videoPlayer);
if (result == null) result = caseVisibleSupport(videoPlayer);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.MAP: {
Map map = (Map)theEObject;
T result = caseMap(map);
if (result == null) result = caseWidget(map);
if (result == null) result = caseSkinSupport(map);
if (result == null) result = caseNoteSupport(map);
if (result == null) result = caseNameSupport(map);
if (result == null) result = caseVisibleSupport(map);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COVER_FLOW: {
CoverFlow coverFlow = (CoverFlow)theEObject;
T result = caseCoverFlow(coverFlow);
if (result == null) result = caseWidget(coverFlow);
if (result == null) result = caseSkinSupport(coverFlow);
if (result == null) result = caseNoteSupport(coverFlow);
if (result == null) result = caseNameSupport(coverFlow);
if (result == null) result = caseVisibleSupport(coverFlow);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TABBED_PANE: {
TabbedPane tabbedPane = (TabbedPane)theEObject;
T result = caseTabbedPane(tabbedPane);
if (result == null) result = caseWidget(tabbedPane);
if (result == null) result = caseSelectionSupport(tabbedPane);
if (result == null) result = caseVerticalScrollbarSupport(tabbedPane);
if (result == null) result = caseColorBackgroundSupport(tabbedPane);
if (result == null) result = caseColorAlphaSupport(tabbedPane);
if (result == null) result = caseItemSupport(tabbedPane);
if (result == null) result = caseFontSupport(tabbedPane);
if (result == null) result = caseSkinSupport(tabbedPane);
if (result == null) result = caseNoteSupport(tabbedPane);
if (result == null) result = caseNameSupport(tabbedPane);
if (result == null) result = caseVisibleSupport(tabbedPane);
if (result == null) result = caseValueSupport(tabbedPane);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ICON_SUPPORT: {
IconSupport iconSupport = (IconSupport)theEObject;
T result = caseIconSupport(iconSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.HSPLITTER: {
HSplitter hSplitter = (HSplitter)theEObject;
T result = caseHSplitter(hSplitter);
if (result == null) result = caseWidget(hSplitter);
if (result == null) result = caseSkinSupport(hSplitter);
if (result == null) result = caseNoteSupport(hSplitter);
if (result == null) result = caseNameSupport(hSplitter);
if (result == null) result = caseVisibleSupport(hSplitter);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VSPLITTER: {
VSplitter vSplitter = (VSplitter)theEObject;
T result = caseVSplitter(vSplitter);
if (result == null) result = caseWidget(vSplitter);
if (result == null) result = caseSkinSupport(vSplitter);
if (result == null) result = caseNoteSupport(vSplitter);
if (result == null) result = caseNameSupport(vSplitter);
if (result == null) result = caseVisibleSupport(vSplitter);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VALUE_SUPPORT: {
ValueSupport valueSupport = (ValueSupport)theEObject;
T result = caseValueSupport(valueSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_PICKER: {
ColorPicker colorPicker = (ColorPicker)theEObject;
T result = caseColorPicker(colorPicker);
if (result == null) result = caseWidget(colorPicker);
if (result == null) result = caseColorBackgroundSupport(colorPicker);
if (result == null) result = caseSkinSupport(colorPicker);
if (result == null) result = caseNoteSupport(colorPicker);
if (result == null) result = caseNameSupport(colorPicker);
if (result == null) result = caseVisibleSupport(colorPicker);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ARROW: {
Arrow arrow = (Arrow)theEObject;
T result = caseArrow(arrow);
if (result == null) result = caseWidget(arrow);
if (result == null) result = caseColorForegroundSupport(arrow);
if (result == null) result = caseLineStyleSupport(arrow);
if (result == null) result = caseAnnotationSupport(arrow);
if (result == null) result = caseNoteSupport(arrow);
if (result == null) result = caseNameSupport(arrow);
if (result == null) result = caseVisibleSupport(arrow);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CURLY_BRACE: {
CurlyBrace curlyBrace = (CurlyBrace)theEObject;
T result = caseCurlyBrace(curlyBrace);
if (result == null) result = caseWidget(curlyBrace);
if (result == null) result = caseFontSupport(curlyBrace);
if (result == null) result = caseColorForegroundSupport(curlyBrace);
if (result == null) result = caseSkinSupport(curlyBrace);
if (result == null) result = caseAnnotationSupport(curlyBrace);
if (result == null) result = caseTextLinksSupport(curlyBrace);
if (result == null) result = caseNoteSupport(curlyBrace);
if (result == null) result = caseNameSupport(curlyBrace);
if (result == null) result = caseVisibleSupport(curlyBrace);
if (result == null) result = caseItemSupport(curlyBrace);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BUTTON_BAR: {
ButtonBar buttonBar = (ButtonBar)theEObject;
T result = caseButtonBar(buttonBar);
if (result == null) result = caseWidget(buttonBar);
if (result == null) result = caseSelectionSupport(buttonBar);
if (result == null) result = caseFontSupport(buttonBar);
if (result == null) result = caseColorBackgroundSupport(buttonBar);
if (result == null) result = caseItemSupport(buttonBar);
if (result == null) result = caseSkinSupport(buttonBar);
if (result == null) result = caseNoteSupport(buttonBar);
if (result == null) result = caseNameSupport(buttonBar);
if (result == null) result = caseVisibleSupport(buttonBar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.BORDER_STYLE_SUPPORT: {
BorderStyleSupport borderStyleSupport = (BorderStyleSupport)theEObject;
T result = caseBorderStyleSupport(borderStyleSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CIRCLE: {
Circle circle = (Circle)theEObject;
T result = caseCircle(circle);
if (result == null) result = caseWidget(circle);
if (result == null) result = caseColorBackgroundSupport(circle);
if (result == null) result = caseColorAlphaSupport(circle);
if (result == null) result = caseColorForegroundSupport(circle);
if (result == null) result = caseBorderSupport(circle);
if (result == null) result = caseIconPositionSupport(circle);
if (result == null) result = caseFontSupport(circle);
if (result == null) result = caseLinkSupport(circle);
if (result == null) result = caseTextAlignmentSupport(circle);
if (result == null) result = caseLineStyleSupport(circle);
if (result == null) result = caseNoteSupport(circle);
if (result == null) result = caseNameSupport(circle);
if (result == null) result = caseVisibleSupport(circle);
if (result == null) result = caseIconSupport(circle);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.RECTANGLE: {
Rectangle rectangle = (Rectangle)theEObject;
T result = caseRectangle(rectangle);
if (result == null) result = caseWidget(rectangle);
if (result == null) result = caseColorBackgroundSupport(rectangle);
if (result == null) result = caseColorAlphaSupport(rectangle);
if (result == null) result = caseColorForegroundSupport(rectangle);
if (result == null) result = caseBorderStyleSupport(rectangle);
if (result == null) result = caseIconPositionSupport(rectangle);
if (result == null) result = caseFontSupport(rectangle);
if (result == null) result = caseLinkSupport(rectangle);
if (result == null) result = caseTextAlignmentSupport(rectangle);
if (result == null) result = caseNoteSupport(rectangle);
if (result == null) result = caseNameSupport(rectangle);
if (result == null) result = caseVisibleSupport(rectangle);
if (result == null) result = caseIconSupport(rectangle);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ICON_POSITION_SUPPORT: {
IconPositionSupport iconPositionSupport = (IconPositionSupport)theEObject;
T result = caseIconPositionSupport(iconPositionSupport);
if (result == null) result = caseIconSupport(iconPositionSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LIST_SUPPORT: {
ListSupport listSupport = (ListSupport)theEObject;
T result = caseListSupport(listSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CHART: {
Chart chart = (Chart)theEObject;
T result = caseChart(chart);
if (result == null) result = caseWidget(chart);
if (result == null) result = caseSkinSupport(chart);
if (result == null) result = caseNoteSupport(chart);
if (result == null) result = caseNameSupport(chart);
if (result == null) result = caseVisibleSupport(chart);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CROSS_OUT: {
CrossOut crossOut = (CrossOut)theEObject;
T result = caseCrossOut(crossOut);
if (result == null) result = caseWidget(crossOut);
if (result == null) result = caseColorForegroundSupport(crossOut);
if (result == null) result = caseColorAlphaSupport(crossOut);
if (result == null) result = caseSkinSupport(crossOut);
if (result == null) result = caseAnnotationSupport(crossOut);
if (result == null) result = caseNoteSupport(crossOut);
if (result == null) result = caseNameSupport(crossOut);
if (result == null) result = caseVisibleSupport(crossOut);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ITEM: {
Item item = (Item)theEObject;
T result = caseItem(item);
if (result == null) result = caseClickSupport(item);
if (result == null) result = caseLinkSupport(item);
if (result == null) result = caseVisibleSupport(item);
if (result == null) result = caseNameSupport(item);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ITEM_SUPPORT: {
ItemSupport itemSupport = (ItemSupport)theEObject;
T result = caseItemSupport(itemSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LINK_SUPPORT: {
LinkSupport linkSupport = (LinkSupport)theEObject;
T result = caseLinkSupport(linkSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.HOTSPOT: {
Hotspot hotspot = (Hotspot)theEObject;
T result = caseHotspot(hotspot);
if (result == null) result = caseWidget(hotspot);
if (result == null) result = caseLinkSupport(hotspot);
if (result == null) result = caseNoteSupport(hotspot);
if (result == null) result = caseNameSupport(hotspot);
if (result == null) result = caseVisibleSupport(hotspot);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.NAME_SUPPORT: {
NameSupport nameSupport = (NameSupport)theEObject;
T result = caseNameSupport(nameSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.COLOR_ALTERNATIVE_SUPPORT: {
ColorAlternativeSupport colorAlternativeSupport = (ColorAlternativeSupport)theEObject;
T result = caseColorAlternativeSupport(colorAlternativeSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LINE_STYLE_SUPPORT: {
LineStyleSupport lineStyleSupport = (LineStyleSupport)theEObject;
T result = caseLineStyleSupport(lineStyleSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ROTATION_SUPPORT: {
RotationSupport rotationSupport = (RotationSupport)theEObject;
T result = caseRotationSupport(rotationSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.FLIP_SUPPORT: {
FlipSupport flipSupport = (FlipSupport)theEObject;
T result = caseFlipSupport(flipSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SVG_IMAGE: {
SVGImage svgImage = (SVGImage)theEObject;
T result = caseSVGImage(svgImage);
if (result == null) result = caseWidget(svgImage);
if (result == null) result = caseLinkSupport(svgImage);
if (result == null) result = caseColorBackgroundSupport(svgImage);
if (result == null) result = caseColorForegroundSupport(svgImage);
if (result == null) result = caseColorAlphaSupport(svgImage);
if (result == null) result = caseRotationSupport(svgImage);
if (result == null) result = caseFlipSupport(svgImage);
if (result == null) result = caseNoteSupport(svgImage);
if (result == null) result = caseNameSupport(svgImage);
if (result == null) result = caseVisibleSupport(svgImage);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SKIN_SUPPORT: {
SkinSupport skinSupport = (SkinSupport)theEObject;
T result = caseSkinSupport(skinSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SHAPE: {
Shape shape = (Shape)theEObject;
T result = caseShape(shape);
if (result == null) result = caseWidget(shape);
if (result == null) result = caseColorBackgroundSupport(shape);
if (result == null) result = caseColorAlphaSupport(shape);
if (result == null) result = caseColorForegroundSupport(shape);
if (result == null) result = caseBorderSupport(shape);
if (result == null) result = caseIconPositionSupport(shape);
if (result == null) result = caseFontSupport(shape);
if (result == null) result = caseLinkSupport(shape);
if (result == null) result = caseTextAlignmentSupport(shape);
if (result == null) result = caseLineStyleSupport(shape);
if (result == null) result = caseSkinSupport(shape);
if (result == null) result = caseRotationSupport(shape);
if (result == null) result = caseNoteSupport(shape);
if (result == null) result = caseNameSupport(shape);
if (result == null) result = caseVisibleSupport(shape);
if (result == null) result = caseIconSupport(shape);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ALERT: {
Alert alert = (Alert)theEObject;
T result = caseAlert(alert);
if (result == null) result = caseWidget(alert);
if (result == null) result = caseIconSupport(alert);
if (result == null) result = caseItemSupport(alert);
if (result == null) result = caseFontSupport(alert);
if (result == null) result = caseSkinSupport(alert);
if (result == null) result = caseNoteSupport(alert);
if (result == null) result = caseNameSupport(alert);
if (result == null) result = caseVisibleSupport(alert);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.SWITCH: {
com.wireframesketcher.model.Switch switch_ = (com.wireframesketcher.model.Switch)theEObject;
T result = caseSwitch(switch_);
if (result == null) result = caseWidget(switch_);
if (result == null) result = caseBooleanSelectionSupport(switch_);
if (result == null) result = caseColorBackgroundSupport(switch_);
if (result == null) result = caseFontSupport(switch_);
if (result == null) result = caseLinkSupport(switch_);
if (result == null) result = caseStateSupport(switch_);
if (result == null) result = caseSkinSupport(switch_);
if (result == null) result = caseNoteSupport(switch_);
if (result == null) result = caseNameSupport(switch_);
if (result == null) result = caseVisibleSupport(switch_);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.LINE_HEIGHT_SUPPORT: {
LineHeightSupport lineHeightSupport = (LineHeightSupport)theEObject;
T result = caseLineHeightSupport(lineHeightSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.CLICK_SUPPORT: {
ClickSupport clickSupport = (ClickSupport)theEObject;
T result = caseClickSupport(clickSupport);
if (result == null) result = caseNameSupport(clickSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT_INPUT_SUPPORT: {
TextInputSupport textInputSupport = (TextInputSupport)theEObject;
T result = caseTextInputSupport(textInputSupport);
if (result == null) result = caseNameSupport(textInputSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.DOUBLE_CLICK_SUPPORT: {
DoubleClickSupport doubleClickSupport = (DoubleClickSupport)theEObject;
T result = caseDoubleClickSupport(doubleClickSupport);
if (result == null) result = caseNameSupport(doubleClickSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VISIBLE_SUPPORT: {
VisibleSupport visibleSupport = (VisibleSupport)theEObject;
T result = caseVisibleSupport(visibleSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.FRAME: {
Frame frame = (Frame)theEObject;
T result = caseFrame(frame);
if (result == null) result = casePanel(frame);
if (result == null) result = caseWidget(frame);
if (result == null) result = caseColorBackgroundSupport(frame);
if (result == null) result = caseColorAlphaSupport(frame);
if (result == null) result = caseVerticalScrollbarSupport(frame);
if (result == null) result = caseColorForegroundSupport(frame);
if (result == null) result = caseBorderStyleSupport(frame);
if (result == null) result = caseLinkSupport(frame);
if (result == null) result = caseSkinSupport(frame);
if (result == null) result = caseNoteSupport(frame);
if (result == null) result = caseNameSupport(frame);
if (result == null) result = caseVisibleSupport(frame);
if (result == null) result = caseValueSupport(frame);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.VBUTTON_BAR: {
VButtonBar vButtonBar = (VButtonBar)theEObject;
T result = caseVButtonBar(vButtonBar);
if (result == null) result = caseWidget(vButtonBar);
if (result == null) result = caseSelectionSupport(vButtonBar);
if (result == null) result = caseFontSupport(vButtonBar);
if (result == null) result = caseTextAlignmentSupport(vButtonBar);
if (result == null) result = caseColorBackgroundSupport(vButtonBar);
if (result == null) result = caseItemSupport(vButtonBar);
if (result == null) result = caseSkinSupport(vButtonBar);
if (result == null) result = caseNoteSupport(vButtonBar);
if (result == null) result = caseNameSupport(vButtonBar);
if (result == null) result = caseVisibleSupport(vButtonBar);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.ANNOTATION_SUPPORT: {
AnnotationSupport annotationSupport = (AnnotationSupport)theEObject;
T result = caseAnnotationSupport(annotationSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.TEXT_LINKS_SUPPORT: {
TextLinksSupport textLinksSupport = (TextLinksSupport)theEObject;
T result = caseTextLinksSupport(textLinksSupport);
if (result == null) result = caseItemSupport(textLinksSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
case ModelPackage.NOTE_SUPPORT: {
NoteSupport noteSupport = (NoteSupport)theEObject;
T result = caseNoteSupport(noteSupport);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Screen</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Screen</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseScreen(Screen object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Screen Ruler</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Screen Ruler</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseScreenRuler(ScreenRuler object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Ruler Guide</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Ruler Guide</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRulerGuide(RulerGuide object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Widget</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Widget</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWidget(Widget object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Button</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Button</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseButton(Button object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Checkbox</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Checkbox</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCheckbox(Checkbox object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Combo</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Combo</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCombo(Combo object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Label</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Label</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLabel(Label object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Link</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Link</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLink(Link object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Placeholder</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Placeholder</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePlaceholder(Placeholder object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Radio Button</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Radio Button</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRadioButton(RadioButton object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text Field</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text Field</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTextField(TextField object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Window</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Window</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWindow(Window object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Widget Descriptor</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Widget Descriptor</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWidgetDescriptor(WidgetDescriptor object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseText(Text object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Area</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Area</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArea(Area object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Popup</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Popup</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePopup(Popup object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Menu</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Menu</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseMenu(Menu object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Table</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTable(Table object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Tree</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Tree</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTree(Tree object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Icon</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Icon</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIcon(Icon object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text Area</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text Area</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTextArea(TextArea object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Browser</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Browser</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBrowser(Browser object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Font</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Font</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFont(Font object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Widget Container</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Widget Container</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWidgetContainer(WidgetContainer object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Widget Group</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Widget Group</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWidgetGroup(WidgetGroup object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Master</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Master</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseMaster(Master object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Image</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Image</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseImage(Image object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Screen Font</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Screen Font</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseScreenFont(ScreenFont object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Font Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Font Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFontSupport(FontSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Foreground Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Foreground Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorForegroundSupport(ColorForegroundSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Background Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Background Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorBackgroundSupport(ColorBackgroundSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Border Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Border Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorBorderSupport(ColorBorderSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Alpha Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Alpha Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorAlphaSupport(ColorAlphaSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Selection Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Selection Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSelectionSupport(SelectionSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text Alignment Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text Alignment Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTextAlignmentSupport(TextAlignmentSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Boolean Selection Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Boolean Selection Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBooleanSelectionSupport(BooleanSelectionSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Note</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Note</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNote(Note object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Progress Bar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Progress Bar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseProgressBar(ProgressBar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Callout</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Callout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCallout(Callout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Search Field</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Search Field</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSearchField(SearchField object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Tooltip</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Tooltip</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTooltip(Tooltip object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Scratch Out</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Scratch Out</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseScratchOut(ScratchOut object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Border Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Border Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBorderSupport(BorderSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>State Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>State Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseStateSupport(StateSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Breadcrumbs</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Breadcrumbs</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBreadcrumbs(Breadcrumbs object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Link Bar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Link Bar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLinkBar(LinkBar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Accordion</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Accordion</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAccordion(Accordion object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Vertical Scrollbar Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Vertical Scrollbar Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVerticalScrollbarSupport(VerticalScrollbarSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Date Field</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Date Field</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDateField(DateField object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Video Player</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Video Player</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVideoPlayer(VideoPlayer object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Map</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Map</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseMap(Map object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Cover Flow</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Cover Flow</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCoverFlow(CoverFlow object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Tabbed Pane</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Tabbed Pane</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTabbedPane(TabbedPane object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Icon Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Icon Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIconSupport(IconSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>HSplitter</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>HSplitter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseHSplitter(HSplitter object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>VSplitter</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>VSplitter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVSplitter(VSplitter object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Value Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Value Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseValueSupport(ValueSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Picker</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Picker</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorPicker(ColorPicker object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Arrow</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Arrow</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArrow(Arrow object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Curly Brace</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Curly Brace</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCurlyBrace(CurlyBrace object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Button Bar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Button Bar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseButtonBar(ButtonBar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Border Style Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Border Style Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBorderStyleSupport(BorderStyleSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Circle</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Circle</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCircle(Circle object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Rectangle</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Rectangle</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRectangle(Rectangle object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Icon Position Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Icon Position Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIconPositionSupport(IconPositionSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>List Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>List Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseListSupport(ListSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Chart</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Chart</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseChart(Chart object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Cross Out</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Cross Out</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCrossOut(CrossOut object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Item</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Item</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseItem(Item object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Item Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Item Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseItemSupport(ItemSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Link Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Link Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLinkSupport(LinkSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Hotspot</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Hotspot</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseHotspot(Hotspot object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Name Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Name Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNameSupport(NameSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Color Alternative Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Color Alternative Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseColorAlternativeSupport(ColorAlternativeSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Line Style Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Line Style Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLineStyleSupport(LineStyleSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Rotation Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Rotation Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRotationSupport(RotationSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Flip Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Flip Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFlipSupport(FlipSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>SVG Image</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>SVG Image</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSVGImage(SVGImage object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Skin Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Skin Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSkinSupport(SkinSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Shape</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Shape</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseShape(Shape object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Alert</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Alert</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAlert(Alert object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Switch</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Switch</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSwitch(com.wireframesketcher.model.Switch object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Line Height Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Line Height Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseLineHeightSupport(LineHeightSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Click Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Click Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseClickSupport(ClickSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text Input Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text Input Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTextInputSupport(TextInputSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Double Click Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Double Click Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDoubleClickSupport(DoubleClickSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Visible Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Visible Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVisibleSupport(VisibleSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Frame</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Frame</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFrame(Frame object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>VButton Bar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>VButton Bar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVButtonBar(VButtonBar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Annotation Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Annotation Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAnnotationSupport(AnnotationSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Text Links Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Text Links Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTextLinksSupport(TextLinksSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Note Support</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Note Support</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNoteSupport(NoteSupport object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Spinner</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Spinner</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSpinner(Spinner object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>HScrollbar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>HScrollbar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseHScrollbar(HScrollbar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>VScrollbar</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>VScrollbar</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVScrollbar(VScrollbar object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>HLine</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>HLine</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseHLine(HLine object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>VLine</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>VLine</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVLine(VLine object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>HSlider</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>HSlider</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseHSlider(HSlider object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>VSlider</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>VSlider</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVSlider(VSlider object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Tabs</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Tabs</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTabs(Tabs object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Group</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Group</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGroup(Group object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>List</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>List</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseList(List object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Panel</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Panel</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePanel(Panel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
@Override
public T defaultCase(EObject object) {
return null;
}
} //ModelSwitch
| epl-1.0 |
rohitmohan96/ceylon-ide-eclipse | plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/core/model/JDTModule.java | 50254 | /*
* Copyright Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the authors tag. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*
* This particular file is subject to the "Classpath" exception as provided in the
* LICENSE file that accompanied this code.
*
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License,
* along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package com.redhat.ceylon.eclipse.core.model;
import static com.redhat.ceylon.eclipse.core.model.modelJ2C.ceylonModel;
import java.io.File;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.CommonTokenStream;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IParent;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.PackageFragment;
import com.redhat.ceylon.cmr.api.ArtifactContext;
import com.redhat.ceylon.cmr.api.RepositoryManager;
import com.redhat.ceylon.common.Backend;
import com.redhat.ceylon.common.Backends;
import com.redhat.ceylon.compiler.typechecker.context.PhasedUnit;
import com.redhat.ceylon.compiler.typechecker.context.PhasedUnitMap;
import com.redhat.ceylon.compiler.typechecker.io.ClosableVirtualFile;
import com.redhat.ceylon.compiler.typechecker.io.VirtualFile;
import com.redhat.ceylon.compiler.typechecker.parser.CeylonLexer;
import com.redhat.ceylon.compiler.typechecker.parser.CeylonParser;
import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.compiler.typechecker.util.NewlineFixingStringStream;
import com.redhat.ceylon.eclipse.core.builder.CeylonBuilder;
import com.redhat.ceylon.eclipse.core.classpath.CeylonLanguageModuleContainer;
import com.redhat.ceylon.eclipse.core.classpath.CeylonProjectModulesContainer;
import com.redhat.ceylon.eclipse.core.model.JDTModuleSourceMapper.ExternalModulePhasedUnits;
import com.redhat.ceylon.ide.common.model.ModuleDependencies.TraversalAction;
import com.redhat.ceylon.eclipse.core.typechecker.CrossProjectPhasedUnit;
import com.redhat.ceylon.eclipse.core.typechecker.ExternalPhasedUnit;
import com.redhat.ceylon.eclipse.core.typechecker.IdePhasedUnit;
import com.redhat.ceylon.eclipse.ui.CeylonPlugin;
import com.redhat.ceylon.eclipse.util.CarUtils;
import com.redhat.ceylon.eclipse.util.SingleSourceUnitPackage;
import com.redhat.ceylon.ide.common.model.CeylonProject;
import com.redhat.ceylon.ide.common.model.ModuleDependencies;
import com.redhat.ceylon.model.cmr.ArtifactResult;
import com.redhat.ceylon.model.cmr.ArtifactResultType;
import com.redhat.ceylon.model.cmr.ImportType;
import com.redhat.ceylon.model.cmr.JDKUtils;
import com.redhat.ceylon.model.cmr.PathFilter;
import com.redhat.ceylon.model.cmr.Repository;
import com.redhat.ceylon.model.cmr.RepositoryException;
import com.redhat.ceylon.model.cmr.VisibilityType;
import com.redhat.ceylon.model.loader.model.LazyModule;
import com.redhat.ceylon.model.typechecker.model.Declaration;
import com.redhat.ceylon.model.typechecker.model.Module;
import com.redhat.ceylon.model.typechecker.model.ModuleImport;
import com.redhat.ceylon.model.typechecker.model.Modules;
import com.redhat.ceylon.model.typechecker.model.Package;
import com.redhat.ceylon.model.typechecker.model.TypeDeclaration;
import com.redhat.ceylon.model.typechecker.model.Unit;
import com.redhat.ceylon.model.typechecker.model.ModelUtil;
public class JDTModule extends LazyModule {
private JDTModuleManager moduleManager;
private JDTModuleSourceMapper moduleSourceMapper;
private List<IPackageFragmentRoot> packageFragmentRoots;
private File artifact;
private String repositoryDisplayString = "";
private WeakReference<ExternalModulePhasedUnits> sourceModulePhasedUnits; // Here we have a weak ref on the PhasedUnits because there are already stored as strong references in the TypeChecker phasedUnitsOfDependencies list.
// But in the future we might remove the strong reference in the typeChecker and use strong references here, which would be
// much more modular (think of several versions of a module imported in a non-shared way in the same projet).
private PhasedUnitMap<ExternalPhasedUnit, SoftReference<ExternalPhasedUnit>> binaryModulePhasedUnits;
private List<String> sourceRelativePaths = new ArrayList<>();
private Properties classesToSources = new Properties();
private Map<String, String> javaImplFilesToCeylonDeclFiles = new HashMap<String, String>();
private String sourceArchivePath = null;
private IProject originalProject = null;
private JDTModule originalModule = null;
private Set<String> originalUnitsToRemove = new LinkedHashSet<>();
private Set<String> originalUnitsToAdd = new LinkedHashSet<>();
private ArtifactResultType artifactType = ArtifactResultType.OTHER;
private Exception resolutionException = null;
public JDTModule(JDTModuleManager jdtModuleManager, JDTModuleSourceMapper jdtModuleSourceMapper, List<IPackageFragmentRoot> packageFragmentRoots) {
this.moduleManager = jdtModuleManager;
this.moduleSourceMapper = jdtModuleSourceMapper;
this.packageFragmentRoots = packageFragmentRoots;
}
private File returnCarFile() {
if (isCeylonBinaryArchive()) {
return artifact;
}
if (isSourceArchive()) {
return new File(sourceArchivePath.substring(0, sourceArchivePath.length()-ArtifactContext.SRC.length()) + ArtifactContext.CAR);
}
return null;
}
private class BinaryPhasedUnits extends PhasedUnitMap<ExternalPhasedUnit, SoftReference<ExternalPhasedUnit>> {
Set<String> sourceCannotBeResolved = new HashSet<String>();
final String fullPathPrefix = sourceArchivePath + "!/";
public BinaryPhasedUnits() {
for (String sourceRelativePath : sourceRelativePaths) {
if (sourceRelativePath.endsWith(".java")) {
String ceylonRelativePath = javaImplFilesToCeylonDeclFiles.get(sourceRelativePath);
if (ceylonRelativePath != null) {
sourceRelativePath = ceylonRelativePath;
}
}
putRelativePath(sourceRelativePath);
}
}
public void putRelativePath(String sourceRelativePath) {
String path = fullPathPrefix + sourceRelativePath;
phasedUnitPerPath.put(path, new SoftReference<ExternalPhasedUnit>(null));
relativePathToPath.put(sourceRelativePath, path);
}
@Override
public ExternalPhasedUnit getPhasedUnit(String path) {
if (! phasedUnitPerPath.containsKey(path)) {
if (path.endsWith(".java")) {
// Case of a Ceylon file with a Java implementation, the classesToSources key is the Java source file.
String ceylonFileRelativePath = getCeylonDeclarationFile(path.replace(sourceArchivePath + "!/", ""));
if (ceylonFileRelativePath != null) {
return super.getPhasedUnit(sourceArchivePath + "!/" + ceylonFileRelativePath);
}
}
return null;
}
return super.getPhasedUnit(path);
}
@Override
public ExternalPhasedUnit getPhasedUnitFromRelativePath(String relativePath) {
if (relativePath.startsWith("/")) {
relativePath = relativePath.substring(1);
}
if (! relativePathToPath.containsKey(relativePath)) {
if (relativePath.endsWith(".java")) {
// Case of a Ceylon file with a Java implementation, the classesToSources key is the Java source file.
String ceylonFileRelativePath = getCeylonDeclarationFile(relativePath);
if (ceylonFileRelativePath != null) {
return super.getPhasedUnitFromRelativePath(ceylonFileRelativePath);
}
}
return null;
}
return super.getPhasedUnitFromRelativePath(relativePath);
}
@Override
protected ExternalPhasedUnit fromStoredType(SoftReference<ExternalPhasedUnit> storedValue, String path) {
ExternalPhasedUnit result = storedValue.get();
if (result == null) {
if (!sourceCannotBeResolved.contains(path)) {
result = buildPhasedUnitForBinaryUnit(path);
if (result != null) {
phasedUnitPerPath.put(path, toStoredType(result));
} else {
sourceCannotBeResolved.add(path);
}
}
}
return result;
}
@Override
protected void addInReturnedList(List<ExternalPhasedUnit> list,
ExternalPhasedUnit phasedUnit) {
if (phasedUnit != null) {
list.add(phasedUnit);
}
}
@Override
protected SoftReference<ExternalPhasedUnit> toStoredType(ExternalPhasedUnit phasedUnit) {
return new SoftReference<ExternalPhasedUnit>(phasedUnit);
}
@Override
public void removePhasedUnitForRelativePath(String relativePath) {
// Don't clean the Package since we are in the binary case
String path = relativePathToPath.get(relativePath);
relativePathToPath.remove(relativePath);
phasedUnitPerPath.remove(path);
}
};
private void fillSourceRelativePaths() throws ZipException {
classesToSources = CarUtils.retrieveMappingFile(returnCarFile());
sourceRelativePaths.clear();
File sourceArchiveFile = new File( sourceArchivePath);
boolean sourcePathsFilled = false;
if (sourceArchiveFile.exists()) {
ZipFile sourceArchive;
try {
sourceArchive = new ZipFile(sourceArchiveFile);
try {
Enumeration<? extends ZipEntry> entries = sourceArchive.entries();
while(entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
sourceRelativePaths.add(entry.getName());
}
sourcePathsFilled = true;
} finally {
sourceArchive.close();
}
} catch (IOException e) {
e.printStackTrace();
sourceRelativePaths.clear();
}
}
if (!sourcePathsFilled) {
for (Object value : classesToSources.values()) {
sourceRelativePaths.add((String)value);
}
}
javaImplFilesToCeylonDeclFiles = CarUtils.searchCeylonFilesForJavaImplementations(classesToSources, new File(sourceArchivePath));
}
synchronized void setArtifact(ArtifactResult artifactResult) {
artifact = artifactResult.artifact();
repositoryDisplayString = artifactResult.repositoryDisplayString();
if (artifact.getName().endsWith(ArtifactContext.SRC)) {
moduleType = ModuleType.CEYLON_SOURCE_ARCHIVE;
} else if(artifact.getName().endsWith(ArtifactContext.CAR)) {
moduleType = ModuleType.CEYLON_BINARY_ARCHIVE;
} else if(artifact.getName().endsWith(ArtifactContext.JAR)) {
moduleType = ModuleType.JAVA_BINARY_ARCHIVE;
}
artifactType = artifactResult.type();
if (isCeylonBinaryArchive()){
String carPath = artifact.getPath();
sourceArchivePath = carPath.substring(0, carPath.length()-ArtifactContext.CAR.length()) + ArtifactContext.SRC;
try {
fillSourceRelativePaths();
} catch (Exception e) {
CeylonPlugin.getInstance().getLog().log(new Status(IStatus.WARNING, CeylonPlugin.PLUGIN_ID, "Cannot find the source archive for the Ceylon binary module " + getSignature(), e));
}
binaryModulePhasedUnits = new BinaryPhasedUnits();
}
if (isSourceArchive()) {
sourceArchivePath = artifact.getPath();
try {
fillSourceRelativePaths();
} catch (Exception e) {
e.printStackTrace();
}
sourceModulePhasedUnits = new WeakReference<ExternalModulePhasedUnits>(null);
}
try {
IJavaProject javaProject = moduleManager.getJavaProject();
if (javaProject != null) {
for (IProject refProject : javaProject.getProject().getReferencedProjects()) {
CeylonProject<IProject> ceylonProject = ceylonModel().getProject(refProject);
if (refProject.isAccessible() && ceylonProject != null) {
if (artifact.getAbsolutePath().contains(CeylonBuilder.getCeylonModulesOutputDirectory(refProject).getAbsolutePath())) {
originalProject = refProject;
}
}
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (isJavaBinaryArchive()){
String carPath = artifact.getPath();
sourceArchivePath = carPath.substring(0, carPath.length()-ArtifactContext.JAR.length())
+ (artifactResult.type().equals(ArtifactResultType.MAVEN) ? ArtifactContext.MAVEN_SRC : ArtifactContext.SRC);
}
}
public String getRepositoryDisplayString() {
if (isJDKModule()) {
return "Java SE Modules";
}
return repositoryDisplayString;
}
synchronized void setSourcePhasedUnits(final ExternalModulePhasedUnits modulePhasedUnits) {
sourceModulePhasedUnits = new WeakReference<ExternalModulePhasedUnits>(modulePhasedUnits);
}
public File getArtifact() {
return artifact;
}
public ArtifactResultType getArtifactType() {
return artifactType;
}
private Properties getClassesToSources() {
if (classesToSources.isEmpty() && getNameAsString().equals("java.base")) {
for (Map.Entry<Object, Object> entry : ((JDTModule)getLanguageModule()).getClassesToSources().entrySet()) {
if (entry.getKey().toString().startsWith("com/redhat/ceylon/compiler/java/language/")) {
classesToSources.put(entry.getKey().toString().replace("com/redhat/ceylon/compiler/java/language/", "java/lang/"),
entry.getValue().toString());
}
}
}
return classesToSources;
}
public boolean containsJavaImplementations() {
for (String className : classesToSources.stringPropertyNames()) {
String sourceFile = classesToSources.getProperty(className);
if (sourceFile != null && sourceFile.endsWith(".java")) {
return true;
}
}
return false;
}
public String toSourceUnitRelativePath(String binaryUnitRelativePath) {
return getClassesToSources().getProperty(binaryUnitRelativePath);
}
public String getJavaImplementationFile(String ceylonFileRelativePath) {
String javaFileRelativePath = null;
for (Entry<String, String> entry : javaImplFilesToCeylonDeclFiles.entrySet()) {
if (entry.getValue().equals(ceylonFileRelativePath)) {
javaFileRelativePath = entry.getKey();
}
}
return javaFileRelativePath;
}
public String getCeylonDeclarationFile(String sourceUnitRelativePath) {
if (sourceUnitRelativePath==null||sourceUnitRelativePath.endsWith(".ceylon")) {
return sourceUnitRelativePath;
}
return javaImplFilesToCeylonDeclFiles.get(sourceUnitRelativePath);
}
public List<String> toBinaryUnitRelativePaths(String sourceUnitRelativePath) {
if (sourceUnitRelativePath == null) {
return Collections.emptyList();
}
List<String> result = new ArrayList<String>();
for (Entry<Object, Object> entry : classesToSources.entrySet()) {
if (sourceUnitRelativePath.equals(entry.getValue())) {
result.add((String) entry.getKey());
}
}
return result;
}
public List<IPackageFragmentRoot> getPackageFragmentRoots() {
synchronized (packageFragmentRoots) {
if (packageFragmentRoots.isEmpty() &&
! moduleManager.isExternalModuleLoadedFromSource(getNameAsString())) {
IJavaProject javaProject = moduleManager.getJavaProject();
if (javaProject != null) {
if (this.equals(getLanguageModule())) {
IClasspathEntry runtimeClasspathEntry = null;
try {
for (IClasspathEntry entry : javaProject.getRawClasspath()) {
if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
entry.getPath().segment(0).equals(CeylonLanguageModuleContainer.CONTAINER_ID)) {
runtimeClasspathEntry = entry;
break;
}
}
if (runtimeClasspathEntry != null) {
for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots()) {
if (root.exists() &&
javaProject.isOnClasspath(root) &&
root.getRawClasspathEntry().equals(runtimeClasspathEntry)) {
packageFragmentRoots.add(root);
}
}
}
} catch (JavaModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else {
File jarToSearch = null;
try {
jarToSearch = returnCarFile();
if (jarToSearch == null) {
RepositoryManager repoMgr = CeylonBuilder.getProjectRepositoryManager(javaProject.getProject());
if (repoMgr != null) {
jarToSearch = CeylonProjectModulesContainer.getModuleArtifact(repoMgr, this);
}
}
if (jarToSearch != null) {
IPackageFragmentRoot root = moduleManager.getJavaProject().getPackageFragmentRoot(jarToSearch.toString());
if (root instanceof JarPackageFragmentRoot) {
JarPackageFragmentRoot jarRoot = (JarPackageFragmentRoot) root;
if (jarRoot.getJar().getName().equals(jarToSearch.getPath())) {
packageFragmentRoots.add(root);
}
}
}
} catch (CoreException e) {
if (jarToSearch != null) {
System.err.println("Exception trying to get Jar file '" + jarToSearch + "' :");
}
e.printStackTrace();
}
}
}
}
}
return packageFragmentRoots;
}
@Override
protected JDTModelLoader getModelLoader() {
return moduleManager.getModelLoader();
}
public JDTModuleManager getModuleManager() {
return moduleManager;
}
public JDTModuleSourceMapper getModuleSourceMapper() {
return moduleSourceMapper;
}
@Override
public List<Package> getAllVisiblePackages() {
synchronized (getModelLoader()) {
// force-load every package from the module if we can
loadAllPackages(new HashSet<String>());
// now delegate
return super.getAllVisiblePackages();
}
}
@Override
public List<Package> getAllReachablePackages() {
synchronized (getModelLoader()) {
// force-load every package from the module if we can
loadAllPackages(new HashSet<String>());
// now delegate
return super.getAllReachablePackages();
}
}
private void loadAllPackages(Set<String> alreadyScannedModules) {
Set<String> packageList = listPackages();
for (String packageName : packageList) {
getPackage(packageName);
}
// now force-load other modules
for (ModuleImport mi: getImports()) {
Module importedModule = mi.getModule();
if(importedModule instanceof JDTModule &&
alreadyScannedModules.add(importedModule.getNameAsString())){
((JDTModule)importedModule).loadAllPackages(alreadyScannedModules);
}
}
}
private Set<String> listPackages() {
Set<String> packageList = new TreeSet<String>();
String name = getNameAsString();
if(JDKUtils.isJDKModule(name)){
packageList.addAll(JDKUtils.getJDKPackagesByModule(name));
}else if(JDKUtils.isOracleJDKModule(name)){
packageList.addAll(JDKUtils.getOracleJDKPackagesByModule(name));
} else if(isJava() || true){
for(IPackageFragmentRoot fragmentRoot : getPackageFragmentRoots()){
if(!fragmentRoot.exists())
continue;
IParent parent = fragmentRoot;
listPackages(packageList, parent);
}
}
return packageList;
}
private void listPackages(Set<String> packageList, IParent parent) {
try {
for (IJavaElement child : parent.getChildren()) {
if (child instanceof PackageFragment) {
packageList.add(child.getElementName());
listPackages(packageList, (IPackageFragment) child);
}
}
} catch (JavaModelException e) {
e.printStackTrace();
}
}
@Override
public void loadPackageList(ArtifactResult artifact) {
try {
super.loadPackageList(artifact);
} catch(Exception e) {
CeylonPlugin.getInstance().getLog().log(new Status(IStatus.ERROR, CeylonPlugin.PLUGIN_ID, "Failed loading the package list of module " + getSignature(), e));
}
JDTModelLoader modelLoader = getModelLoader();
if (modelLoader != null) {
synchronized(modelLoader){
String name = getNameAsString();
for(String pkg : jarPackages){
if(name.equals("ceylon.language") && ! pkg.startsWith("ceylon.language")) {
// special case for the language module to hide stuff
continue;
}
modelLoader.findOrCreatePackage(this, pkg);
}
}
}
}
private ModuleType moduleType;
private enum ModuleType {
PROJECT_MODULE,
CEYLON_SOURCE_ARCHIVE,
CEYLON_BINARY_ARCHIVE,
JAVA_BINARY_ARCHIVE,
SDK_MODULE,
UNKNOWN
}
public void setProjectModule() {
moduleType = ModuleType.PROJECT_MODULE;
}
public boolean isCeylonArchive() {
return isCeylonBinaryArchive() || isSourceArchive();
}
public boolean isDefaultModule() {
return this.equals(moduleManager.getModules().getDefaultModule());
}
public boolean isProjectModule() {
return ModuleType.PROJECT_MODULE.equals(moduleType);
}
public boolean isJDKModule() {
synchronized (this) {
if (moduleType == null) {
if (JDKUtils.isJDKModule(getNameAsString()) ||
JDKUtils.isOracleJDKModule(getNameAsString())) {
moduleType = ModuleType.SDK_MODULE;
}
}
}
return ModuleType.SDK_MODULE.equals(moduleType);
}
public boolean isUnresolved() {
return artifact == null && ! isAvailable();
}
public boolean isJavaBinaryArchive() {
return ModuleType.JAVA_BINARY_ARCHIVE.equals(moduleType);
}
public boolean isCeylonBinaryArchive() {
return ModuleType.CEYLON_BINARY_ARCHIVE.equals(moduleType);
}
public boolean isSourceArchive() {
return ModuleType.CEYLON_SOURCE_ARCHIVE.equals(moduleType);
}
public List<? extends PhasedUnit> getPhasedUnits() {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
synchronized (phasedUnitMap) {
return phasedUnitMap.getPhasedUnits();
}
}
return Collections.emptyList();
}
public ExternalPhasedUnit getPhasedUnit(IPath path) {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
IPath sourceArchiveIPath = new Path(sourceArchivePath+"!");
synchronized (phasedUnitMap) {
return (ExternalPhasedUnit) phasedUnitMap.getPhasedUnitFromRelativePath(path.makeRelativeTo(sourceArchiveIPath).toString());
}
}
return null;
}
public ExternalPhasedUnit getPhasedUnit(String path) {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
synchronized (phasedUnitMap) {
return (ExternalPhasedUnit) phasedUnitMap.getPhasedUnit(path);
}
}
return null;
}
public ExternalPhasedUnit getPhasedUnit(VirtualFile file) {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
synchronized (phasedUnitMap) {
return (ExternalPhasedUnit) phasedUnitMap.getPhasedUnit(file);
}
}
return null;
}
public ExternalPhasedUnit getPhasedUnitFromRelativePath(String relativePathToSource) {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
synchronized (phasedUnitMap) {
return (ExternalPhasedUnit) phasedUnitMap.getPhasedUnitFromRelativePath(relativePathToSource);
}
}
return null;
}
public void removedOriginalUnit(String relativePathToSource) {
if (isProjectModule()) {
return;
}
originalUnitsToRemove.add(relativePathToSource);
try {
if (isCeylonBinaryArchive() || JavaCore.isJavaLikeFileName(relativePathToSource)) {
List<String> unitPathsToSearch = new ArrayList<>();
unitPathsToSearch.add(relativePathToSource);
unitPathsToSearch.addAll(toBinaryUnitRelativePaths(relativePathToSource));
for (String relativePathOfUnitToRemove : unitPathsToSearch) {
Package p = getPackageFromRelativePath(relativePathOfUnitToRemove);
if (p != null) {
Set<Unit> units = new HashSet<>();
try {
for(Declaration d : p.getMembers()) {
Unit u = d.getUnit();
if (u.getRelativePath().equals(relativePathOfUnitToRemove)) {
units.add(u);
}
}
} catch(Exception e) {
e.printStackTrace();
}
for (Unit u : units) {
try {
for (Declaration d : u.getDeclarations()) {
d.getMembers();
// Just to fully load the declaration before
// the corresponding class is removed (so that
// the real removing from the model loader
// will not require reading the bindings.
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
public void addedOriginalUnit(String relativePathToSource) {
if (isProjectModule()) {
return;
}
originalUnitsToAdd.add(relativePathToSource);
}
public void refresh() {
if (originalUnitsToAdd.size() + originalUnitsToRemove.size() == 0) {
// Nothing to refresh
return;
}
try {
PhasedUnitMap<? extends PhasedUnit, ?> phasedUnitMap = null;
if (isCeylonBinaryArchive()) {
JavaModelManager.getJavaModelManager().resetClasspathListCache();
JavaModelManager.getJavaModelManager().getJavaModel().refreshExternalArchives(getPackageFragmentRoots().toArray(new IPackageFragmentRoot[0]), null);
phasedUnitMap = binaryModulePhasedUnits;
}
if (isSourceArchive()) {
phasedUnitMap = sourceModulePhasedUnits.get();
}
if (phasedUnitMap != null) {
synchronized (phasedUnitMap) {
for (String relativePathToRemove : originalUnitsToRemove) {
if (isCeylonBinaryArchive() || JavaCore.isJavaLikeFileName(relativePathToRemove)) {
List<String> unitPathsToSearch = new ArrayList<>();
unitPathsToSearch.add(relativePathToRemove);
unitPathsToSearch.addAll(toBinaryUnitRelativePaths(relativePathToRemove));
for (String relativePathOfUnitToRemove : unitPathsToSearch) {
Package p = getPackageFromRelativePath(relativePathOfUnitToRemove);
if (p != null) {
Set<Unit> units = new HashSet<>();
for(Declaration d : p.getMembers()) {
Unit u = d.getUnit();
if (u.getRelativePath().equals(relativePathOfUnitToRemove)) {
units.add(u);
}
}
for (Unit u : units) {
try {
p.removeUnit(u);
// In the future, when we are sure that we cannot add several unit objects with the
// same relative path, we can add a break.
} catch(Exception e) {
e.printStackTrace();
}
}
} else {
System.out.println("WARNING : The package of the following binary unit (" + relativePathOfUnitToRemove + ") "
+ "cannot be found in module " + getNameAsString() +
artifact != null ? " (artifact=" + artifact.getAbsolutePath() + ")" : "");
}
}
}
phasedUnitMap.removePhasedUnitForRelativePath(relativePathToRemove);
}
if (isSourceArchive()) {
ClosableVirtualFile sourceArchive = null;
try {
sourceArchive = moduleSourceMapper.getContext().getVfs().getFromZipFile(new File(sourceArchivePath));
for (String relativePathToAdd : originalUnitsToAdd) {
VirtualFile archiveEntry = null;
archiveEntry = searchInSourceArchive(
relativePathToAdd, sourceArchive);
if (archiveEntry != null) {
Package pkg = getPackageFromRelativePath(relativePathToAdd);
((ExternalModulePhasedUnits)phasedUnitMap).parseFile(archiveEntry, sourceArchive, pkg);
}
}
} catch (Exception e) {
StringBuilder error = new StringBuilder("Unable to read source artifact from ");
error.append(sourceArchive);
error.append( "\ndue to connection error: ").append(e.getMessage());
throw e;
} finally {
if (sourceArchive != null) {
sourceArchive.close();
}
}
} else if (isCeylonBinaryArchive() && binaryModulePhasedUnits != null){
for (String relativePathToAdd : originalUnitsToAdd) {
((BinaryPhasedUnits) binaryModulePhasedUnits).putRelativePath(relativePathToAdd);
}
}
fillSourceRelativePaths();
originalUnitsToRemove.clear();
originalUnitsToAdd.clear();
}
}
if (isCeylonBinaryArchive() || isJavaBinaryArchive()) {
jarPackages.clear();
loadPackageList(new ArtifactResult() {
@Override
public VisibilityType visibilityType() {
return null;
}
@Override
public String version() {
return null;
}
@Override
public ArtifactResultType type() {
return null;
}
@Override
public String name() {
return null;
}
@Override
public ImportType importType() {
return null;
}
@Override
public List<ArtifactResult> dependencies() throws RepositoryException {
return null;
}
@Override
public File artifact() throws RepositoryException {
return artifact;
}
@Override
public String repositoryDisplayString() {
return "";
}
@Override
public PathFilter filter() {
return null;
}
@Override
public Repository repository() {
return null;
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Package getPackageFromRelativePath(
String relativePathOfClassToRemove) {
List<String> pathElements = Arrays.asList(relativePathOfClassToRemove.split("/"));
String packageName = ModelUtil.formatPath(pathElements.subList(0, pathElements.size()-1));
Package p = findPackageNoLazyLoading(packageName);
return p;
}
@SuppressWarnings("unchecked")
private ExternalPhasedUnit buildPhasedUnitForBinaryUnit(String sourceUnitFullPath) {
if (sourceArchivePath == null || sourceUnitFullPath == null) {
return null;
}
if (! sourceUnitFullPath.startsWith(sourceArchivePath)) {
return null;
}
File sourceArchiveFile = new File(sourceArchivePath);
if (! sourceArchiveFile.exists()) {
return null;
}
ExternalPhasedUnit phasedUnit = null;
String sourceUnitRelativePath = sourceUnitFullPath.replace(sourceArchivePath + "!/", "");
Package pkg = getPackageFromRelativePath(sourceUnitRelativePath);
if (pkg != null) {
try {
JDTModuleManager moduleManager = getModuleManager();
JDTModuleSourceMapper moduleSourceMapper = getModuleSourceMapper();
ClosableVirtualFile sourceArchive = null;
try {
sourceArchive = moduleSourceMapper.getContext().getVfs().getFromZipFile(sourceArchiveFile);
String ceylonSourceUnitRelativePath = getCeylonDeclarationFile(sourceUnitRelativePath);
if (ceylonSourceUnitRelativePath !=null) {
String ceylonSourceUnitFullPath = sourceArchivePath + "!/" + ceylonSourceUnitRelativePath;
VirtualFile archiveEntry = searchInSourceArchive(
ceylonSourceUnitRelativePath, sourceArchive);
if (archiveEntry != null) {
IProject project = moduleManager.getJavaProject().getProject();
CeylonLexer lexer = new CeylonLexer(NewlineFixingStringStream.fromStream(archiveEntry.getInputStream(), project.getDefaultCharset()));
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
CeylonParser parser = new CeylonParser(tokenStream);
Tree.CompilationUnit cu = parser.compilationUnit();
List<CommonToken> tokens = new ArrayList<CommonToken>(tokenStream.getTokens().size());
tokens.addAll(tokenStream.getTokens());
SingleSourceUnitPackage proxyPackage = new SingleSourceUnitPackage(pkg, ceylonSourceUnitFullPath);
if(originalProject == null) {
phasedUnit = new ExternalPhasedUnit(archiveEntry, sourceArchive, cu,
proxyPackage, moduleManager, moduleSourceMapper, CeylonBuilder.getProjectTypeChecker(project), tokens) {
@Override
protected boolean isAllowedToChangeModel(Declaration declaration) {
return !IdePhasedUnit.isCentralModelDeclaration(declaration);
}
};
} else {
phasedUnit = new CrossProjectPhasedUnit(archiveEntry, sourceArchive, cu,
proxyPackage, moduleManager, moduleSourceMapper, CeylonBuilder.getProjectTypeChecker(project), tokens, originalProject) {
@Override
protected boolean isAllowedToChangeModel(Declaration declaration) {
return !IdePhasedUnit.isCentralModelDeclaration(declaration);
}
};
}
}
}
} catch (Exception e) {
StringBuilder error = new StringBuilder("Unable to read source artifact from ");
error.append(sourceArchive);
error.append( "\ndue to connection error: ").append(e.getMessage());
System.err.println(error);
} finally {
if (sourceArchive != null) {
sourceArchive.close();
}
}
if (phasedUnit != null) {
phasedUnit.validateTree();
phasedUnit.visitSrcModulePhase();
phasedUnit.visitRemainingModulePhase();
phasedUnit.scanDeclarations();
phasedUnit.scanTypeDeclarations();
phasedUnit.validateRefinement();
}
} catch (Exception e) {
e.printStackTrace();
phasedUnit = null;
}
}
return phasedUnit;
}
private VirtualFile searchInSourceArchive(String sourceUnitRelativePath,
ClosableVirtualFile sourceArchive) {
VirtualFile archiveEntry;
archiveEntry = sourceArchive;
for (String part : sourceUnitRelativePath.split("/")) {
boolean found = false;
for (VirtualFile vf : archiveEntry.getChildren()) {
if (part.equals(vf.getName().replace("/", ""))) {
archiveEntry = vf;
found = true;
break;
}
}
if (!found) {
archiveEntry = null;
break;
}
}
return archiveEntry;
}
public String getSourceArchivePath() {
return sourceArchivePath;
}
public IProject getOriginalProject() {
return originalProject;
}
public JDTModule getOriginalModule() {
if (originalProject != null) {
if (originalModule == null) {
Modules modules = CeylonBuilder.getProjectModules(originalProject);
if (modules != null) {
for (Module m : modules.getListOfModules()) {
// TODO : in the future : manage version ?? in case we reference 2 identical projects with different version in the workspace
if (m.getNameAsString().equals(getNameAsString())) {
assert(m instanceof JDTModule);
if (((JDTModule) m).isProjectModule()) {
originalModule = (JDTModule) m;
break;
}
}
}
}
}
return originalModule;
}
return null;
}
public boolean containsClass(String className) {
return className != null &&
(classesToSources != null ? classesToSources.containsKey(className) : false);
}
@Override
public List<Package> getPackages() {
return super.getPackages();
}
@Override
public void clearCache(final TypeDeclaration declaration) {
clearCacheLocally(declaration);
if (getProjectModuleDependencies() != null) {
getProjectModuleDependencies().doWithReferencingModules(this, new TraversalAction<Module>() {
@Override
public void applyOn(Module module) {
assert(module instanceof JDTModule);
if (module instanceof JDTModule) {
((JDTModule) module).clearCacheLocally(declaration);
}
}
});
getProjectModuleDependencies().doWithTransitiveDependencies(this, new TraversalAction<Module>() {
@Override
public void applyOn(Module module) {
assert(module instanceof JDTModule);
if (module instanceof JDTModule) {
((JDTModule) module).clearCacheLocally(declaration);
}
}
});
((JDTModule)getLanguageModule()).clearCacheLocally(declaration);
}
}
private void clearCacheLocally(final TypeDeclaration declaration) {
super.clearCache(declaration);
}
private ModuleDependencies projectModuleDependencies = null;
private ModuleDependencies getProjectModuleDependencies() {
if (projectModuleDependencies == null) {
IJavaProject javaProject = moduleManager.getJavaProject();
if (javaProject != null) {
projectModuleDependencies = CeylonBuilder.getModuleDependenciesForProject(javaProject.getProject());
}
}
return projectModuleDependencies;
}
public Iterable<Module> getReferencingModules() {
if (getProjectModuleDependencies() != null) {
return getProjectModuleDependencies().getReferencingModules(this);
}
return Collections.emptyList();
}
public boolean resolutionFailed() {
return resolutionException != null;
}
public void setResolutionException(Exception resolutionException) {
if (resolutionException instanceof RuntimeException)
this.resolutionException = resolutionException;
}
public List<JDTModule> getModuleInReferencingProjects() {
if (! isProjectModule()) {
return Collections.emptyList();
}
IProject project = moduleManager.getJavaProject().getProject();
IProject[] referencingProjects = project.getReferencingProjects();
if (referencingProjects.length == 0) {
return Collections.emptyList();
}
List<JDTModule> result = new ArrayList<>();
for(IProject referencingProject : referencingProjects) {
JDTModule referencingModule = null;
Modules referencingProjectModules = CeylonBuilder.getProjectModules(referencingProject);
if (referencingProjectModules != null) {
for (Module m : referencingProjectModules.getListOfModules()) {
if (m.getSignature().equals(getSignature())) {
assert(m instanceof JDTModule);
referencingModule = (JDTModule) m;
break;
}
}
}
if (referencingModule != null) {
result.add(referencingModule);
}
}
return result;
}
}
| epl-1.0 |
elucash/eclipse-oxygen | org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarManifestProvider.java | 7632 | /*******************************************************************************
* Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
*******************************************************************************/
package org.eclipse.jdt.internal.ui.jarpackagerfat;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.ui.jarpackager.IManifestProvider;
import org.eclipse.jdt.ui.jarpackager.JarPackageData;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.jarpackager.JarPackagerUtil;
/**
* A manifest provider creates manifest files for a fat jar.
*
* @since 3.4
*/
public class FatJarManifestProvider implements IManifestProvider {
private static final String SEALED_VALUE= "true"; //$NON-NLS-1$
private static final String UNSEALED_VALUE= "false"; //$NON-NLS-1$
private FatJarBuilder fBuilder;
public FatJarManifestProvider(FatJarBuilder builder) {
fBuilder= builder;
}
@Override
public Manifest create(JarPackageData jarPackage) throws CoreException {
Manifest result;
Manifest ownManifest= createOwn(jarPackage);
setManifestClasspath(ownManifest, fBuilder.getManifestClasspath());
if (fBuilder.isMergeManifests()) {
List<ZipFile> openZips= new ArrayList<>();
try {
List<Manifest> otherManifests= new ArrayList<>();
Object[] elements= jarPackage.getElements();
for (int i= 0; i < elements.length; i++) {
Object element= elements[i];
if (element instanceof IPackageFragmentRoot && ((IPackageFragmentRoot) element).isArchive()) {
ZipFile zip= JarPackagerUtil.getArchiveFile(((IPackageFragmentRoot) element).getPath());
openZips.add(zip);
Enumeration<? extends ZipEntry> entries= zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry= entries.nextElement();
if (entry.getName().equalsIgnoreCase("META-INF/MANIFEST.MF")) { //$NON-NLS-1$
InputStream inputStream= null;
try {
inputStream= zip.getInputStream(entry);
Manifest otherManifest= new Manifest(inputStream);
otherManifests.add(otherManifest);
} catch (IOException e) {
JavaPlugin.log(e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch(IOException e){
}
}
}
}
}
}
}
result= merge(ownManifest, otherManifests);
} finally {
for (Iterator<ZipFile> iter= openZips.iterator(); iter.hasNext(); ) {
ZipFile file= iter.next();
try {
file.close();
} catch (IOException e) {
JavaPlugin.log(e);
}
}
}
} else {
result= ownManifest;
}
return result;
}
private void setManifestClasspath(Manifest ownManifest, String manifestClasspath) {
if ((manifestClasspath != null) && !manifestClasspath.trim().equals("")) { //$NON-NLS-1$
Attributes mainAttr= ownManifest.getMainAttributes();
mainAttr.putValue("Class-Path", manifestClasspath); //$NON-NLS-1$
}
}
private Manifest merge(Manifest ownManifest, List<Manifest> otherManifests) {
Manifest mergedManifest= new Manifest(ownManifest);
Map<String, Attributes> mergedEntries= mergedManifest.getEntries();
for (Iterator<Manifest> iter= otherManifests.iterator(); iter.hasNext();) {
Manifest otherManifest= iter.next();
Map<String, Attributes> otherEntries= otherManifest.getEntries();
for (Iterator<String> iterator= otherEntries.keySet().iterator(); iterator.hasNext();) {
String attributeName= iterator.next();
if (mergedEntries.containsKey(attributeName)) {
// TODO: WARNING
} else {
mergedEntries.put(attributeName, otherEntries.get(attributeName));
}
}
}
return mergedManifest;
}
private Manifest createOwn(JarPackageData jarPackage) throws CoreException {
if (jarPackage.isManifestGenerated())
return createGeneratedManifest(jarPackage);
try {
return createSuppliedManifest(jarPackage);
} catch (IOException ex) {
throw JarPackagerUtil.createCoreException(ex.getLocalizedMessage(), ex);
}
}
@Override
public Manifest createDefault(String manifestVersion) {
Manifest manifest= new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, manifestVersion);
return manifest;
}
/**
* Hook for subclasses to add additional manifest entries.
*
* @param manifest the manifest to which the entries should be added
* @param jarPackage the JAR package specification
*/
protected void putAdditionalEntries(Manifest manifest, JarPackageData jarPackage) {
}
private Manifest createGeneratedManifest(JarPackageData jarPackage) {
Manifest manifest= new Manifest();
putVersion(manifest, jarPackage);
putSealing(manifest, jarPackage);
putMainClass(manifest, jarPackage);
putAdditionalEntries(manifest, jarPackage);
return manifest;
}
private void putVersion(Manifest manifest, JarPackageData jarPackage) {
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, jarPackage.getManifestVersion());
}
private void putSealing(Manifest manifest, JarPackageData jarPackage) {
if (jarPackage.isJarSealed()) {
manifest.getMainAttributes().put(Attributes.Name.SEALED, SEALED_VALUE);
IPackageFragment[] packages= jarPackage.getPackagesToUnseal();
if (packages != null) {
for (int i= 0; i < packages.length; i++) {
Attributes attributes= new Attributes();
attributes.put(Attributes.Name.SEALED, UNSEALED_VALUE);
manifest.getEntries().put(getInManifestFormat(packages[i]), attributes);
}
}
} else {
IPackageFragment[] packages= jarPackage.getPackagesToSeal();
if (packages != null)
for (int i= 0; i < packages.length; i++) {
Attributes attributes= new Attributes();
attributes.put(Attributes.Name.SEALED, SEALED_VALUE);
manifest.getEntries().put(getInManifestFormat(packages[i]), attributes);
}
}
}
private void putMainClass(Manifest manifest, JarPackageData jarPackage) {
if (jarPackage.getManifestMainClass() != null && jarPackage.getManifestMainClass().getFullyQualifiedName().length() > 0)
manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, jarPackage.getManifestMainClass().getFullyQualifiedName());
}
private String getInManifestFormat(IPackageFragment packageFragment) {
String name= packageFragment.getElementName();
return name.replace('.', '/') + '/';
}
private Manifest createSuppliedManifest(JarPackageData jarPackage) throws CoreException, IOException {
Manifest manifest;
// No need to use buffer here because Manifest(...) does
InputStream stream= jarPackage.getManifestFile().getContents(false);
try {
manifest= new Manifest(stream);
} finally {
if (stream != null)
stream.close();
}
return manifest;
}
}
| epl-1.0 |
scmod/nexus-public | components/nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/HaltCommand.java | 1358 | /*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2008-present Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.nexus.bootstrap.monitor.commands;
import org.sonatype.nexus.bootstrap.ShutdownHelper;
import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
/**
* Command to forcibly halt the JVM (via {@link ShutdownHelper#halt(int)}).
*
* @since 2.2
*/
public class HaltCommand
implements CommandMonitorThread.Command
{
public static final String NAME = "HALT";
@Override
public String getId() {
return NAME;
}
@Override
public boolean execute() {
ShutdownHelper.halt(666);
throw new Error("Unreachable statement");
}
}
| epl-1.0 |
niuqg/controller | opendaylight/md-sal/model/model-inventory/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/inventory/rev130819/NodeConnectorType.java | 519 | package org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.common.QName;
/**
Base identity for node connectors type
**/
public abstract class NodeConnectorType extends BaseIdentity
{
public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:inventory","2013-08-19","node-connector-type")
;
public NodeConnectorType() {
}
}
| epl-1.0 |
alovassy/titan.EclipsePlug-ins | org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/GlobalIntervalHandler.java | 2029 | /******************************************************************************
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.eclipse.titan.designer.editors;
import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.jface.text.IDocument;
import org.eclipse.titan.common.parsers.Interval;
/**
* Single class used to store and access the interval lists related to documents.
*
* Usually parsers detect the interval hierarchy.
* And they are used by folding in the editors.
*
* @author Kristof Szabados
* */
public final class GlobalIntervalHandler {
/**
* The set of documents we know about right now, and the root of the
* interval tree present in each
*/
private static final Map<IDocument, Interval> INTERVAL_MAP = new WeakHashMap<IDocument, Interval>();
// Disabled constructor
private GlobalIntervalHandler() {
// Do nothing
}
/**
* Puts in the root of an interval tree into the map of known intervals.
* This must be here as it is impossible to find out which project an
* IDocument object belongs to.
*
* @param doc
* the document from which the interval tree was
* extracted
* @param interval
* the root of the extracted interval tree
* */
public static void putInterval(final IDocument doc, final Interval interval) {
INTERVAL_MAP.put(doc, interval);
}
/**
* Returns the root of the interval tree which was extracted from the
* provided IDocument instance.
*
* @param doc
* the document
* @return the root of the extracted interval tree
* */
public static Interval getInterval(final IDocument doc) {
return INTERVAL_MAP.get(doc);
}
}
| epl-1.0 |
elexis/elexis-3-austria | at.medevit.elexis.kassen.vaeb/src/at/medevit/elexis/kassen/vaeb/model/VaebLeistung.java | 5409 | /*******************************************************************************
* Copyright (c) 2015 MEDEVIT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MEDEVIT <office@medevit.at> - initial API and implementation
*******************************************************************************/
package at.medevit.elexis.kassen.vaeb.model;
import java.util.List;
import at.medevit.elexis.kassen.core.model.IPointsArea;
import at.medevit.elexis.kassen.core.model.KassenLeistung;
import at.medevit.elexis.kassen.core.model.LeistungBean;
import at.medevit.elexis.kassen.core.model.PointsAreaFactory;
import ch.elexis.core.data.interfaces.IFall;
import ch.elexis.data.PersistentObject;
import ch.rgw.tools.TimeTool;
import ch.rgw.tools.VersionInfo;
public class VaebLeistung extends KassenLeistung {
protected static final String TABLENAME = "at_medevit_elexis_kassen_VAEB_leistungen";
protected static final String VERSION = "0.1.0";
protected static final String createDB =
"CREATE TABLE " + TABLENAME + "(" + "ID VARCHAR(25) PRIMARY KEY," // Elexis internal
+ "lastupdate BIGINT," // Elexis internal
+ "deleted CHAR(1) default '0'," // Elexis internal
+ "gruppeid VARCHAR(8)," + "positiongruppenid VARCHAR(8),"
+ "positionid VARCHAR(8)," + "positionneuid VARCHAR(8),"
+ "validfromdate CHAR(8)," + "validtodate CHAR(8),"
+ "positiontitle TEXT," + "positionhinweis TEXT,"
+ "positionausfach CHAR(1) default '0'," + "positionfachgebiete VARCHAR(64),"
+ "positionpunktwert VARCHAR(16)," + "positiongeldwert VARCHAR(16),"
+ "positionzusatz TEXT," + "positionlogik TEXT" + ");"
+ "CREATE INDEX VAEBIDX1 ON " + TABLENAME + " (positionid);" + "INSERT INTO "
+ TABLENAME + " (ID,positionpunktwert) VALUES ('VERSION','" + VERSION + "');";
static {
addMapping(TABLENAME, FLD_GRUPPEID, FLD_POSITIONGRUPPENID, FLD_POSITIONID,
FLD_POSITIONNEUID, FLD_VALIDFROMDATE, FLD_VALIDTODATE, FLD_POSITIONTITLE,
FLD_POSITIONHINWEIS, FLD_POSITIONAUSFACH, FLD_POSITIONFACHGEBIETE,
FLD_POSITIONPUNKTWERT, FLD_POSITIONGELDWERT, FLD_POSITIONZUSATZ, FLD_POSITIONLOGIK);
VaebLeistung version = load("VERSION");
if (version.state() < PersistentObject.DELETED) {
createOrModifyTable(createDB);
} else {
VersionInfo vi = new VersionInfo(version.get(FLD_POSITIONPUNKTWERT));
// if (vi.isOlder(VERSION)) {
// createOrModifyTable(update010to011);
// version.set(FLD_POSITIONPUNKTWERT, VERSION);
// }
}
}
public VaebLeistung(){
}
protected VaebLeistung(final String id){
super(id);
}
public VaebLeistung(LeistungBean leistung){
create(null);
setLeistungFromBean(leistung);
}
public static VaebLeistung load(final String id){
return new VaebLeistung(id);
}
@Override
public int getTP(TimeTool date, IFall fall){
double money = getMoneyValue();
double points = getPointValue();
if (money == 0 && points > 0) {
// return points and getFactor is responsible for locating
// the right multiplier for the system state
return (int) Math.round((points) * 100.0);
} else if (points == 0 && money > 0) {
// return money and getFactor will return 1.0
return (int) Math.round((money) * 100.0);
} else {
// it is possible that a Leistung has money and point value
// so do the calculation for the points here and handle
// like money value only
List<IPointsArea> areas =
PointsAreaFactory.getInstance().getEnabledPointsAreasForClass(getClass());
double mv = Double.NaN;
for (IPointsArea area : areas) {
if (area.includesPosition(this, date.getTime()))
mv = area.getMoneyValue();
}
return (int) Math.round((points * mv) * 100.0) + (int) Math.round((money) * 100.0);
}
}
@Override
public double getFactor(TimeTool date, IFall fall){
double money = getMoneyValue();
double points = getPointValue();
// if caller does not care about the time set it to current time
if (date == null)
date = new TimeTool();
if (money == 0 && points > 0) {
List<IPointsArea> areas =
PointsAreaFactory.getInstance().getEnabledPointsAreasForClass(getClass());
double currentValue = Double.NaN;
int currentWeight = -1;
for (IPointsArea area : areas) {
if (area.includesPosition(this, date.getTime())) {
if (currentWeight < area.getWeight()) {
currentValue = area.getMoneyValue();
currentWeight = area.getWeight();
}
}
}
return currentValue;
} else if (points == 0 && money > 0) {
// return money and getFactor will return 1.0
return 1.0;
} else {
// handle like money value only
return 1.0;
}
}
@Override
public String getXidDomain(){
// TODO Auto-generated method stub
return null;
}
@Override
protected String getTableName(){
return TABLENAME;
}
@Override
public String getCodeSystemName(){
return "VAEB";
}
@Override
public List<Object> getActions(Object context){
// TODO Auto-generated method stub
return null;
}
}
| epl-1.0 |
Juholei/lunch-time | android/app/src/main/java/com/lunchtime/MainActivity.java | 363 | package com.lunchtime;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "LunchTime";
}
}
| epl-1.0 |
miklossy/xtext-core | org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/terminalrules/xtextTerminalsTestLanguage/impl/CharacterRangeImpl.java | 7354 | /**
* generated by Xtext
*/
package org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.CharacterRange;
import org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.Keyword;
import org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.XtextTerminalsTestLanguagePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Character Range</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.impl.CharacterRangeImpl#getLeft <em>Left</em>}</li>
* <li>{@link org.eclipse.xtext.parser.terminalrules.xtextTerminalsTestLanguage.impl.CharacterRangeImpl#getRight <em>Right</em>}</li>
* </ul>
*
* @generated
*/
public class CharacterRangeImpl extends AbstractElementImpl implements CharacterRange
{
/**
* The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeft()
* @generated
* @ordered
*/
protected Keyword left;
/**
* The cached value of the '{@link #getRight() <em>Right</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRight()
* @generated
* @ordered
*/
protected Keyword right;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CharacterRangeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XtextTerminalsTestLanguagePackage.Literals.CHARACTER_RANGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Keyword getLeft()
{
return left;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Keyword newLeft, NotificationChain msgs)
{
Keyword oldLeft = left;
left = newLeft;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT, oldLeft, newLeft);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeft(Keyword newLeft)
{
if (newLeft != left)
{
NotificationChain msgs = null;
if (left != null)
msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT, null, msgs);
if (newLeft != null)
msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT, null, msgs);
msgs = basicSetLeft(newLeft, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT, newLeft, newLeft));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Keyword getRight()
{
return right;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRight(Keyword newRight, NotificationChain msgs)
{
Keyword oldRight = right;
right = newRight;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT, oldRight, newRight);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRight(Keyword newRight)
{
if (newRight != right)
{
NotificationChain msgs = null;
if (right != null)
msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT, null, msgs);
if (newRight != null)
msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT, null, msgs);
msgs = basicSetRight(newRight, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT, newRight, newRight));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT:
return basicSetLeft(null, msgs);
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT:
return basicSetRight(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT:
return getLeft();
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT:
return getRight();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT:
setLeft((Keyword)newValue);
return;
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT:
setRight((Keyword)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT:
setLeft((Keyword)null);
return;
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT:
setRight((Keyword)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__LEFT:
return left != null;
case XtextTerminalsTestLanguagePackage.CHARACTER_RANGE__RIGHT:
return right != null;
}
return super.eIsSet(featureID);
}
} //CharacterRangeImpl
| epl-1.0 |
NABUCCO/org.nabucco.business.provision | org.nabucco.business.provision.impl.service/src/main/man/org/nabucco/business/provision/impl/service/produce/ProduceActivityAreaServiceHandlerImpl.java | 1808 | /*
* Copyright 2012 PRODYNA AG
*
* Licensed under the Eclipse Public License (EPL), Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/eclipse-1.0.php or
* http://www.nabucco.org/License.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nabucco.business.provision.impl.service.produce;
import org.nabucco.business.provision.facade.datatype.ActivityArea;
import org.nabucco.business.provision.facade.message.ActivityAreaListMsg;
import org.nabucco.business.provision.facade.message.produce.ActivityAreaProduceRq;
import org.nabucco.framework.base.facade.datatype.DatatypeState;
import org.nabucco.framework.base.facade.exception.service.ProduceException;
/**
* ProduceActivityAreaServiceHandlerImpl
*
* @author Dominic Trumpfheller, PRODYNA AG
*/
public class ProduceActivityAreaServiceHandlerImpl extends ProduceActivityAreaServiceHandler {
private static final long serialVersionUID = 1L;
@Override
protected ActivityAreaListMsg produceActivityArea(ActivityAreaProduceRq rq) throws ProduceException {
ActivityAreaListMsg response = new ActivityAreaListMsg();
for (int i = 0; i < rq.getAmount().getValue(); i++) {
ActivityArea datatype = new ActivityArea();
datatype.setDatatypeState(DatatypeState.INITIALIZED);
response.getActivityAreaList().add(datatype);
}
return response;
}
}
| epl-1.0 |
viatra/VIATRA-Generator | Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/QuantifiedExpressionImpl.java | 6864 | /**
*/
package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.QuantifiedExpression;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Term;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Quantified Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.QuantifiedExpressionImpl#getQuantifiedVariables <em>Quantified Variables</em>}</li>
* <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.QuantifiedExpressionImpl#getExpression <em>Expression</em>}</li>
* </ul>
*
* @generated
*/
public abstract class QuantifiedExpressionImpl extends TermImpl implements QuantifiedExpression {
/**
* The cached value of the '{@link #getQuantifiedVariables() <em>Quantified Variables</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQuantifiedVariables()
* @generated
* @ordered
*/
protected EList<Variable> quantifiedVariables;
/**
* The cached value of the '{@link #getExpression() <em>Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpression()
* @generated
* @ordered
*/
protected Term expression;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected QuantifiedExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LogiclanguagePackage.Literals.QUANTIFIED_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Variable> getQuantifiedVariables() {
if (quantifiedVariables == null) {
quantifiedVariables = new EObjectContainmentEList<Variable>(Variable.class, this, LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES);
}
return quantifiedVariables;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Term getExpression() {
return expression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression(Term newExpression, NotificationChain msgs) {
Term oldExpression = expression;
expression = newExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, oldExpression, newExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setExpression(Term newExpression) {
if (newExpression != expression) {
NotificationChain msgs = null;
if (expression != null)
msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, null, msgs);
if (newExpression != null)
msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, null, msgs);
msgs = basicSetExpression(newExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION, newExpression, newExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return ((InternalEList<?>)getQuantifiedVariables()).basicRemove(otherEnd, msgs);
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return basicSetExpression(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return getQuantifiedVariables();
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return getExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
getQuantifiedVariables().clear();
getQuantifiedVariables().addAll((Collection<? extends Variable>)newValue);
return;
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
setExpression((Term)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
getQuantifiedVariables().clear();
return;
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
setExpression((Term)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__QUANTIFIED_VARIABLES:
return quantifiedVariables != null && !quantifiedVariables.isEmpty();
case LogiclanguagePackage.QUANTIFIED_EXPRESSION__EXPRESSION:
return expression != null;
}
return super.eIsSet(featureID);
}
} //QuantifiedExpressionImpl
| epl-1.0 |
elexis/elexis-3-core | bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/preferences/AnwenderPref.java | 4228 | /*******************************************************************************
* Copyright (c) 2006-2009, G. Weirich and Elexis
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* G. Weirich - initial implementation
*
*******************************************************************************/
package ch.elexis.core.ui.preferences;
import java.util.Hashtable;
import java.util.List;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import ch.elexis.admin.AccessControlDefaults;
import ch.elexis.core.constants.Preferences;
import ch.elexis.core.data.activator.CoreHub;
import ch.elexis.core.services.holder.ConfigServiceHolder;
import ch.elexis.core.ui.Hub;
import ch.elexis.core.ui.UiDesk;
import ch.elexis.core.ui.preferences.inputs.PrefAccessDenied;
import ch.elexis.core.ui.util.LabeledInputField;
import ch.elexis.core.ui.util.LabeledInputField.InputData;
import ch.elexis.core.ui.util.LabeledInputField.InputData.Typ;
import ch.elexis.core.ui.util.SWTHelper;
import ch.elexis.data.Anwender;
import ch.elexis.data.Mandant;
import ch.elexis.data.Query;
public class AnwenderPref extends PreferencePage implements IWorkbenchPreferencePage {
private static final String EXT_INFO = "ExtInfo"; //$NON-NLS-1$
public static final String ID = "ch.elexis.anwenderprefs"; //$NON-NLS-1$
private LabeledInputField.AutoForm lfa;
private InputData[] def;
private Hashtable<String, Anwender> hAnwender = new Hashtable<String, Anwender>();
@Override
protected Control createContents(Composite parent){
if (CoreHub.acl.request(AccessControlDefaults.ACL_USERS)) {
FormToolkit tk = new FormToolkit(UiDesk.getDisplay());
Form form = tk.createForm(parent);
Composite body = form.getBody();
body.setLayout(new GridLayout(1, false));
Combo cbAnwender = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
Query<Anwender> qbe = new Query<Anwender>(Anwender.class);
List<Anwender> list = qbe.execute();
for (Anwender m : list) {
cbAnwender.add(m.getLabel());
hAnwender.put(m.getLabel(), m);
}
cbAnwender.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e){
Combo source = (Combo) e.getSource();
String m = (source.getItem(source.getSelectionIndex()));
Anwender anw = hAnwender.get(m);
lfa.reload(anw);
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
// gd.horizontalSpan=2;
cbAnwender.setLayoutData(gd);
tk.adapt(cbAnwender);
lfa = new LabeledInputField.AutoForm(body, def);
lfa.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
tk.paintBordersFor(body);
return form;
} else {
return new PrefAccessDenied(parent);
}
}
public void init(IWorkbench workbench){
List<Mandant> ml = Hub.getMandantenList();
String[] mands = new String[ml.size()];
for (int i = 0; i < mands.length; i++) {
mands[i] = ml.get(i).getLabel();
}
String grp = ConfigServiceHolder.getGlobal(Preferences.ACC_GROUPS, "Admin"); //$NON-NLS-1$
def =
new InputData[] {
new InputData(Messages.AnwenderPref_kuerzel, "Label", Typ.STRING, null), //$NON-NLS-1$
new InputData(Messages.AnwenderPref_passwort, EXT_INFO, Typ.STRING, "UsrPwd"), //$NON-NLS-1$
new InputData(Messages.AnwenderPref_gruppe, EXT_INFO, "Groups", grp.split(",")), //$NON-NLS-1$ //$NON-NLS-2$
new InputData(Messages.AnwenderPref_fuerMandant, Messages.AnwenderPref_12,
"Mandant", mands) //$NON-NLS-1$
};
}
}
| epl-1.0 |
BotondBaranyi/titan.core | titan_executor_api/TITAN_Executor_API/src/org/eclipse/titan/executorapi/exception/JniExecutorIllegalArgumentException.java | 1049 | /******************************************************************************
* Copyright (c) 2000-2017 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Balasko, Jeno
* Lovassy, Arpad
*
******************************************************************************/
package org.eclipse.titan.executorapi.exception;
import org.eclipse.titan.executorapi.JniExecutor;
/**
* This exception is thrown if any method is called with illegal arguments in {@link JniExecutor}.
* @see JniExecutor
*/
public class JniExecutorIllegalArgumentException extends JniExecutorException {
/**
* Generated serial version ID
* (to avoid warning)
*/
private static final long serialVersionUID = -5375700845783136227L;
public JniExecutorIllegalArgumentException( final String aMsg ) {
super( aMsg );
}
}
| epl-1.0 |
Achref001/My-Fashion-assistant--Android- | src/com/andy/myfashionassistant/model/ShoesFragment.java | 3796 | package com.andy.myfashionassistant.model;
import java.util.ArrayList;
import java.util.List;
import org.codepond.wizardroid.WizardStep;
import org.codepond.wizardroid.persistence.ContextVariable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import com.andy.myfashionassistant.adapter.AssistanceAdapter;
import com.andy.myfashionassistant.entities.Vetement;
import com.andy.myfashionassistant.sqlLite.VetementBDD;
import com.fashion.R;
public class ShoesFragment extends WizardStep {
@ContextVariable
private String todo;
@ContextVariable
private String upper;
@ContextVariable
private String lower;
@ContextVariable
private String shoes;
@ContextVariable
private String access;
@ContextVariable
private String coat;
@ContextVariable
private String dress;
public ShoesFragment() {
}
VetementBDD vetementBDD;
List<Vetement> vetementList,vetementListfiltre;
View rootView;
GridView grid;
String text;
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub
rootView =inflater.inflate(R.layout.fragment_shoes, container,false);
grid = (GridView) rootView.findViewById(R.id.gridShoes);
vetementBDD = new VetementBDD(getActivity());
vetementBDD.open();
vetementList = vetementBDD.selectAll();
vetementBDD.close();
vetementListfiltre = new ArrayList<Vetement>();
//Log.e("yass",vetementList.get(0).getType());
Log.e("yass2",""+vetementList.size());
for (int i = 0; i < vetementList.size(); i++) {
if(vetementList.get(i).getType().equals("Shoes"))
{
vetementListfiltre.add(vetementList.get(i));
}
}
grid.setAdapter(new AssistanceAdapter(getActivity(),
R.layout.assistance_item, vetementListfiltre));
grid.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
grid.setSelector(getResources().getDrawable(R.drawable.grid_selection));
grid.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//Toast.makeText(getActivity(), "position = "+position, Toast.LENGTH_LONG).show();
grid.requestFocusFromTouch();
grid.setSelection(position);
for (int i = 0; i < vetementListfiltre.size(); i++) {
if (position==i) {
text = vetementListfiltre.get(i).getTitle().toString();
//Toast.makeText(getActivity(), "text = "+vetementListfiltre.get(i).getTitle().toString(), Toast.LENGTH_LONG).show();
}
}
}
});
return rootView;
}
@Override
public void onExit(int exitCode) {
switch (exitCode) {
case WizardStep.EXIT_NEXT:
bindDataFields();
break;
case WizardStep.EXIT_PREVIOUS:
//Do nothing...
break;
}
}
private void bindDataFields() {
//Do some work
//...
//The values of these fields will be automatically stored in the wizard context
//and will be populated in the next steps only if the same field names are used.
/*todo = rbJob.getText().toString();
upper = rbMeeting.getText().toString();
lower = rbMeeting.getText().toString();
shoes = rbMeeting.getText().toString();
access = rbMeeting.getText().toString();
dress = rbMeeting.getText().toString();
coat = rbMeeting.getText().toString();*/
shoes = text;
}
}
| epl-1.0 |
theanuradha/debrief | org.mwc.cmap.core/src/org/mwc/cmap/core/wizards/SelectColorPage.java | 3645 | /*
* Debrief - the Open Source Maritime Analysis Application
* http://debrief.info
*
* (C) 2000-2014, PlanetMayo Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html)
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.mwc.cmap.core.wizards;
import java.awt.Color;
import java.beans.PropertyDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.osgi.service.prefs.Preferences;
import MWC.GUI.Editable;
public class SelectColorPage extends CoreEditableWizardPage
{
public static class DataItem implements Editable
{
Color _myColor;
public Color getColor()
{
return _myColor;
}
@Override
public EditorType getInfo()
{
return null;
}
@Override
public String getName()
{
return null;
}
@Override
public boolean hasEditor()
{
return false;
}
public void setColor(final Color color)
{
this._myColor = color;
}
}
private static final String COLOR_RED = "RED";
private static final String COLOR_BLUE = "GREEN";
private static final String COLOR_GREEN = "BLUE";
public static String NAME = "Get Color";
DataItem _myWrapper;
private Color _startColor;
private final String _fieldExplanation;
private final boolean _skipPrefs;
public SelectColorPage(final ISelection selection, final Color startColor,
final String pageTitle, final String pageExplanation,
final String fieldExplanation, final String imagePath,
final String helpContext, final String trailingMessage,
final boolean skipPrefs)
{
super(selection, NAME, pageTitle, pageExplanation, imagePath, helpContext,
false, trailingMessage);
_startColor = startColor;
_skipPrefs = skipPrefs;
_fieldExplanation = fieldExplanation;
setDefaults();
}
@Override
protected Editable createMe()
{
if (_myWrapper == null)
{
_myWrapper = new DataItem();
_myWrapper.setColor(_startColor);
}
return _myWrapper;
}
@Override
public void dispose()
{
if (!_skipPrefs)
{
// try to store some defaults
final Preferences prefs = getPrefs();
prefs.putInt(COLOR_RED, _myWrapper.getColor().getRed());
prefs.putInt(COLOR_BLUE, _myWrapper.getColor().getBlue());
prefs.putInt(COLOR_GREEN, _myWrapper.getColor().getGreen());
}
super.dispose();
}
public Color getColor()
{
Color res = Color.red;
if (_myWrapper.getColor() != null)
res = _myWrapper.getColor();
return res;
}
@Override
protected PropertyDescriptor[] getPropertyDescriptors()
{
final PropertyDescriptor[] descriptors =
{prop("Color", _fieldExplanation, getEditable())};
return descriptors;
}
public String getString()
{
return _myWrapper.getName();
}
private void setDefaults()
{
if (!_skipPrefs)
{
final Preferences prefs = getPrefs();
if (prefs != null)
{
final int red = prefs.getInt(COLOR_RED, 255);
final int green = prefs.getInt(COLOR_GREEN, 0);
final int blue = prefs.getInt(COLOR_BLUE, 0);
_startColor = new Color(red, green, blue);
}
}
}
}
| epl-1.0 |
UnimibSoftEngCourse1516/lab2-es3-s.renzo | src/test/java/org/junit/tests/assertion/AssertionTest.java | 25175 | package org.junit.tests.assertion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.expectThrows;
import static org.junit.Assert.assertGreaterThan;
import static org.junit.Assert.assertGreaterThanPrimitive;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Comparator;
import org.junit.Assert;
import org.junit.Assert.ThrowingRunnable;
import org.junit.ComparisonFailure;
import org.junit.Test;
import org.junit.internal.ArrayComparisonFailure;
/**
* Tests for {@link org.junit.Assert}
*/
public class AssertionTest {
// If you want to use 1.4 assertions, they will be reported correctly.
// However, you need to add the -ea VM argument when running.
// @Test (expected=AssertionError.class) public void error() {
// assert false;
// }
@Test(expected = AssertionError.class)
public void fails() {
Assert.fail();
}
@Test
public void failWithNoMessageToString() {
try {
Assert.fail();
} catch (AssertionError exception) {
assertEquals("java.lang.AssertionError", exception.toString());
}
}
@Test
public void failWithMessageToString() {
try {
Assert.fail("woops!");
} catch (AssertionError exception) {
assertEquals("java.lang.AssertionError: woops!", exception.toString());
}
}
@Test(expected = AssertionError.class)
public void arraysNotEqual() {
assertArrayEquals((new Object[]{new Object()}), (new Object[]{new Object()}));
}
@Test(expected = AssertionError.class)
public void arraysNotEqualWithMessage() {
assertArrayEquals("not equal", (new Object[]{new Object()}), (new Object[]{new Object()}));
}
@Test
public void arraysExpectedNullMessage() {
try {
assertArrayEquals("not equal", null, (new Object[]{new Object()}));
} catch (AssertionError exception) {
assertEquals("not equal: expected array was null", exception.getMessage());
}
}
@Test
public void arraysActualNullMessage() {
try {
assertArrayEquals("not equal", (new Object[]{new Object()}), null);
} catch (AssertionError exception) {
assertEquals("not equal: actual array was null", exception.getMessage());
}
}
@Test
public void arraysDifferentLengthMessage() {
try {
assertArrayEquals("not equal", (new Object[0]), (new Object[1]));
} catch (AssertionError exception) {
assertEquals("not equal: array lengths differed, expected.length=0 actual.length=1", exception.getMessage());
}
}
@Test(expected = ArrayComparisonFailure.class)
public void arraysElementsDiffer() {
assertArrayEquals("not equal", (new Object[]{"this is a very long string in the middle of an array"}), (new Object[]{"this is another very long string in the middle of an array"}));
}
@Test
public void arraysDifferAtElement0nullMessage() {
try {
assertArrayEquals((new Object[]{true}), (new Object[]{false}));
} catch (AssertionError exception) {
assertEquals("arrays first differed at element [0]; expected:<true> but was:<false>", exception
.getMessage());
}
}
@Test
public void arraysDifferAtElement1nullMessage() {
try {
assertArrayEquals((new Object[]{true, true}), (new Object[]{true,
false}));
} catch (AssertionError exception) {
assertEquals("arrays first differed at element [1]; expected:<true> but was:<false>", exception
.getMessage());
}
}
@Test
public void arraysDifferAtElement0withMessage() {
try {
assertArrayEquals("message", (new Object[]{true}), (new Object[]{false}));
} catch (AssertionError exception) {
assertEquals("message: arrays first differed at element [0]; expected:<true> but was:<false>", exception
.getMessage());
}
}
@Test
public void arraysDifferAtElement1withMessage() {
try {
assertArrayEquals("message", (new Object[]{true, true}), (new Object[]{true, false}));
fail();
} catch (AssertionError exception) {
assertEquals("message: arrays first differed at element [1]; expected:<true> but was:<false>", exception.getMessage());
}
}
@Test
public void multiDimensionalArraysAreEqual() {
assertArrayEquals((new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {false, false}}));
}
@Test
public void multiDimensionalIntArraysAreEqual() {
int[][] int1 = {{1, 2, 3}, {4, 5, 6}};
int[][] int2 = {{1, 2, 3}, {4, 5, 6}};
assertArrayEquals(int1, int2);
}
@Test
public void oneDimensionalPrimitiveArraysAreEqual() {
assertArrayEquals(new boolean[]{true}, new boolean[]{true});
assertArrayEquals(new byte[]{1}, new byte[]{1});
assertArrayEquals(new char[]{1}, new char[]{1});
assertArrayEquals(new short[]{1}, new short[]{1});
assertArrayEquals(new int[]{1}, new int[]{1});
assertArrayEquals(new long[]{1}, new long[]{1});
assertArrayEquals(new double[]{1.0}, new double[]{1.0}, 1.0);
assertArrayEquals(new float[]{1.0f}, new float[]{1.0f}, 1.0f);
}
@Test(expected = AssertionError.class)
public void oneDimensionalDoubleArraysAreNotEqual() {
assertArrayEquals(new double[]{1.0}, new double[]{2.5}, 1.0);
}
@Test(expected = AssertionError.class)
public void oneDimensionalFloatArraysAreNotEqual() {
assertArrayEquals(new float[]{1.0f}, new float[]{2.5f}, 1.0f);
}
@Test(expected = AssertionError.class)
public void oneDimensionalBooleanArraysAreNotEqual() {
assertArrayEquals(new boolean[]{true}, new boolean[]{false});
}
@Test(expected = AssertionError.class)
public void IntegerDoesNotEqualLong() {
assertEquals(new Integer(1), new Long(1));
}
@Test
public void intsEqualLongs() {
assertEquals(1, 1L);
}
@Test
public void multiDimensionalArraysDeclaredAsOneDimensionalAreEqual() {
assertArrayEquals((new Object[]{new Object[]{true, true}, new Object[]{false, false}}), (new Object[]{new Object[]{true, true}, new Object[]{false, false}}));
}
@Test
public void multiDimensionalArraysAreNotEqual() {
try {
assertArrayEquals("message", (new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {true, false}}));
fail();
} catch (AssertionError exception) {
assertEquals("message: arrays first differed at element [1][0]; expected:<false> but was:<true>", exception.getMessage());
}
}
@Test
public void multiDimensionalArraysAreNotEqualNoMessage() {
try {
assertArrayEquals((new Object[][]{{true, true}, {false, false}}), (new Object[][]{{true, true}, {true, false}}));
fail();
} catch (AssertionError exception) {
assertEquals("arrays first differed at element [1][0]; expected:<false> but was:<true>", exception.getMessage());
}
}
@Test
public void multiDimensionalArraysDifferentLengthMessage() {
try {
assertArrayEquals("message", new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {false}});
} catch (AssertionError exception) {
assertEquals("message: arrays first differed at element [1]; array lengths differed, expected.length=2 actual.length=1", exception.getMessage());
return;
}
fail("Expected AssertionError to be thrown");
}
@Test
public void multiDimensionalArraysDifferentLengthNoMessage() {
try {
assertArrayEquals(new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {false}});
} catch (AssertionError exception) {
assertEquals("arrays first differed at element [1]; array lengths differed, expected.length=2 actual.length=1", exception.getMessage());
return;
}
fail("Expected AssertionError to be thrown");
}
@Test
public void arraysWithNullElementEqual() {
Object[] objects1 = new Object[]{null};
Object[] objects2 = new Object[]{null};
assertArrayEquals(objects1, objects2);
}
@Test
public void stringsDifferWithUserMessage() {
try {
assertEquals("not equal", "one", "two");
} catch (Throwable exception) {
assertEquals("not equal expected:<[one]> but was:<[two]>", exception.getMessage());
}
}
@Test
public void arraysEqual() {
Object element = new Object();
Object[] objects1 = new Object[]{element};
Object[] objects2 = new Object[]{element};
assertArrayEquals(objects1, objects2);
}
@Test
public void arraysEqualWithMessage() {
Object element = new Object();
Object[] objects1 = new Object[]{element};
Object[] objects2 = new Object[]{element};
assertArrayEquals("equal", objects1, objects2);
}
@Test
public void equals() {
Object o = new Object();
assertEquals(o, o);
assertEquals("abc", "abc");
assertEquals(true, true);
assertEquals((byte) 1, (byte) 1);
assertEquals('a', 'a');
assertEquals((short) 1, (short) 1);
assertEquals(1, 1); // int by default, cast is unnecessary
assertEquals(1l, 1l);
assertEquals(1.0, 1.0, 0.0);
assertEquals(1.0d, 1.0d, 0.0d);
}
@Test(expected = AssertionError.class)
public void notEqualsObjectWithNull() {
assertEquals(new Object(), null);
}
@Test(expected = AssertionError.class)
public void notEqualsNullWithObject() {
assertEquals(null, new Object());
}
@Test
public void notEqualsObjectWithNullWithMessage() {
Object o = new Object();
try {
assertEquals("message", null, o);
fail();
} catch (AssertionError e) {
assertEquals("message expected:<null> but was:<" + o.toString() + ">", e.getMessage());
}
}
@Test
public void notEqualsNullWithObjectWithMessage() {
Object o = new Object();
try {
assertEquals("message", o, null);
fail();
} catch (AssertionError e) {
assertEquals("message expected:<" + o.toString() + "> but was:<null>", e.getMessage());
}
}
@Test(expected = AssertionError.class)
public void objectsNotEquals() {
assertEquals(new Object(), new Object());
}
@Test(expected = ComparisonFailure.class)
public void stringsNotEqual() {
assertEquals("abc", "def");
}
@Test(expected = AssertionError.class)
public void booleansNotEqual() {
assertEquals(true, false);
}
@Test(expected = AssertionError.class)
public void bytesNotEqual() {
assertEquals((byte) 1, (byte) 2);
}
@Test(expected = AssertionError.class)
public void charsNotEqual() {
assertEquals('a', 'b');
}
@Test(expected = AssertionError.class)
public void shortsNotEqual() {
assertEquals((short) 1, (short) 2);
}
@Test(expected = AssertionError.class)
public void intsNotEqual() {
assertEquals(1, 2);
}
@Test(expected = AssertionError.class)
public void longsNotEqual() {
assertEquals(1l, 2l);
}
@Test(expected = AssertionError.class)
public void floatsNotEqual() {
assertEquals(1.0, 2.0, 0.9);
}
@SuppressWarnings("deprecation")
@Test(expected = AssertionError.class)
public void floatsNotEqualWithoutDelta() {
assertEquals(1.0, 1.1);
}
@Test
public void floatsNotDoublesInArrays() {
float delta = 4.444f;
float[] f1 = new float[]{1.111f};
float[] f2 = new float[]{5.555f};
Assert.assertArrayEquals(f1, f2, delta);
}
@Test(expected = AssertionError.class)
public void bigDecimalsNotEqual() {
assertEquals(new BigDecimal("123.4"), new BigDecimal("123.0"));
}
@Test(expected = AssertionError.class)
public void doublesNotEqual() {
assertEquals(1.0d, 2.0d, 0.9d);
}
@Test
public void naNsAreEqual() {
assertEquals(Float.NaN, Float.NaN, Float.POSITIVE_INFINITY);
assertEquals(Double.NaN, Double.NaN, Double.POSITIVE_INFINITY);
}
@SuppressWarnings("unused")
@Test
public void nullNullmessage() {
try {
assertNull("junit");
fail();
} catch (AssertionError e) {
assertEquals("expected null, but was:<junit>", e.getMessage());
}
}
@SuppressWarnings("unused")
@Test
public void nullWithMessage() {
try {
assertNull("message", "hello");
fail();
} catch (AssertionError exception) {
assertEquals("message expected null, but was:<hello>", exception.getMessage());
}
}
@Test
public void same() {
Object o1 = new Object();
assertSame(o1, o1);
}
@Test
public void notSame() {
Object o1 = new Object();
Object o2 = new Object();
assertNotSame(o1, o2);
}
@Test(expected = AssertionError.class)
public void objectsNotSame() {
assertSame(new Object(), new Object());
}
@Test(expected = AssertionError.class)
public void objectsAreSame() {
Object o = new Object();
assertNotSame(o, o);
}
@Test
public void sameWithMessage() {
try {
assertSame("not same", "hello", "good-bye");
fail();
} catch (AssertionError exception) {
assertEquals("not same expected same:<hello> was not:<good-bye>",
exception.getMessage());
}
}
@Test
public void sameNullMessage() {
try {
assertSame("hello", "good-bye");
fail();
} catch (AssertionError exception) {
assertEquals("expected same:<hello> was not:<good-bye>", exception.getMessage());
}
}
@Test
public void notSameWithMessage() {
Object o = new Object();
try {
assertNotSame("message", o, o);
fail();
} catch (AssertionError exception) {
assertEquals("message expected not same", exception.getMessage());
}
}
@Test
public void notSameNullMessage() {
Object o = new Object();
try {
assertNotSame(o, o);
fail();
} catch (AssertionError exception) {
assertEquals("expected not same", exception.getMessage());
}
}
@Test
public void nullMessage() {
try {
fail(null);
} catch (AssertionError exception) {
// we used to expect getMessage() to return ""; see failWithNoMessageToString()
assertNull(exception.getMessage());
}
}
@Test
public void nullMessageDisappearsWithStringAssertEquals() {
try {
assertEquals(null, "a", "b");
fail();
} catch (ComparisonFailure e) {
assertEquals("expected:<[a]> but was:<[b]>", e.getMessage());
}
}
@Test
public void nullMessageDisappearsWithAssertEquals() {
try {
assertEquals(null, 1, 2);
fail();
} catch (AssertionError e) {
assertEquals("expected:<1> but was:<2>", e.getMessage());
}
}
@Test(expected = AssertionError.class)
public void arraysDeclaredAsObjectAreComparedAsObjects() {
Object a1 = new Object[]{"abc"};
Object a2 = new Object[]{"abc"};
assertEquals(a1, a2);
}
@Test
public void implicitTypecastEquality() {
byte b = 1;
short s = 1;
int i = 1;
long l = 1L;
float f = 1.0f;
double d = 1.0;
assertEquals(b, s);
assertEquals(b, i);
assertEquals(b, l);
assertEquals(s, i);
assertEquals(s, l);
assertEquals(i, l);
assertEquals(f, d, 0);
}
@Test
public void errorMessageDistinguishesDifferentValuesWithSameToString() {
try {
assertEquals("4", new Integer(4));
} catch (AssertionError e) {
assertEquals("expected: java.lang.String<4> but was: java.lang.Integer<4>", e.getMessage());
}
}
@Test
public void assertThatIncludesDescriptionOfTestedValueInErrorMessage() {
String expected = "expected";
String actual = "actual";
String expectedMessage = "identifier\nExpected: \"expected\"\n but: was \"actual\"";
try {
assertThat("identifier", actual, equalTo(expected));
} catch (AssertionError e) {
assertEquals(expectedMessage, e.getMessage());
}
}
@Test
public void assertThatIncludesAdvancedMismatch() {
String expectedMessage = "identifier\nExpected: is an instance of java.lang.Integer\n but: \"actual\" is a java.lang.String";
try {
assertThat("identifier", "actual", is(instanceOf(Integer.class)));
} catch (AssertionError e) {
assertEquals(expectedMessage, e.getMessage());
}
}
@Test
public void assertThatDescriptionCanBeElided() {
String expected = "expected";
String actual = "actual";
String expectedMessage = "\nExpected: \"expected\"\n but: was \"actual\"";
try {
assertThat(actual, equalTo(expected));
} catch (AssertionError e) {
assertEquals(expectedMessage, e.getMessage());
}
}
@Test
public void nullAndStringNullPrintCorrectError() {
try {
assertEquals(null, "null");
} catch (AssertionError e) {
assertEquals("expected: null<null> but was: java.lang.String<null>", e.getMessage());
}
}
@Test(expected = AssertionError.class)
public void stringNullAndNullWorksToo() {
assertEquals("null", null);
}
@Test(expected = AssertionError.class)
public void compareBigDecimalAndInteger() {
final BigDecimal bigDecimal = new BigDecimal("1.2");
final Integer integer = Integer.valueOf("1");
assertEquals(bigDecimal, integer);
}
@Test(expected = AssertionError.class)
public void sameObjectIsNotEqual() {
Object o = new Object();
assertNotEquals(o, o);
}
@Test
public void objectsWithDiferentReferencesAreNotEqual() {
assertNotEquals(new Object(), new Object());
}
@Test
public void assertNotEqualsIncludesCorrectMessage() {
Integer value1 = new Integer(1);
Integer value2 = new Integer(1);
String message = "The values should be different";
try {
assertNotEquals(message, value1, value2);
} catch (AssertionError e) {
assertEquals(message + ". Actual: " + value1, e.getMessage());
return;
}
fail("Failed on assertion.");
}
@Test
public void assertNotEqualsIncludesTheValueBeingTested() {
Integer value1 = new Integer(1);
Integer value2 = new Integer(1);
try {
assertNotEquals(value1, value2);
} catch (AssertionError e) {
assertTrue(e.getMessage().contains(value1.toString()));
return;
}
fail("Failed on assertion.");
}
@Test
public void assertNotEqualsWorksWithPrimitiveTypes() {
assertNotEquals(1L, 2L);
assertNotEquals("The values should be different", 1L, 2L);
assertNotEquals(1.0, 2.0, 0);
assertNotEquals("The values should be different", 1.0, 2.0, 0);
assertNotEquals(1.0f, 2.0f, 0f);
assertNotEquals("The values should be different", 1.0f, 2.0f, 0f);
}
@Test(expected = AssertionError.class)
public void assertNotEqualsConsidersDeltaCorrectly() {
assertNotEquals(1.0, 0.9, 0.1);
}
@Test(expected = AssertionError.class)
public void assertNotEqualsConsidersFloatDeltaCorrectly() {
assertNotEquals(1.0f, 0.75f, 0.25f);
}
@Test(expected = AssertionError.class)
public void assertNotEqualsIgnoresDeltaOnNaN() {
assertNotEquals(Double.NaN, Double.NaN, 1);
}
@Test(expected = AssertionError.class)
public void assertNotEqualsIgnoresFloatDeltaOnNaN() {
assertNotEquals(Float.NaN, Float.NaN, 1f);
}
@Test(expected = AssertionError.class)
public void expectThrowsRequiresAnExceptionToBeThrown() {
expectThrows(Throwable.class, nonThrowingRunnable());
}
@Test
public void expectThrowsIncludesAnInformativeDefaultMessage() {
try {
expectThrows(Throwable.class, nonThrowingRunnable());
} catch (AssertionError ex) {
assertEquals("expected Throwable to be thrown, but nothing was thrown", ex.getMessage());
return;
}
fail();
}
@Test
public void expectThrowsReturnsTheSameObjectThrown() {
NullPointerException npe = new NullPointerException();
Throwable throwable = expectThrows(Throwable.class, throwingRunnable(npe));
assertSame(npe, throwable);
}
@Test(expected = AssertionError.class)
public void expectThrowsDetectsTypeMismatchesViaExplicitTypeHint() {
NullPointerException npe = new NullPointerException();
expectThrows(IOException.class, throwingRunnable(npe));
}
@Test
public void expectThrowsWrapsAndPropagatesUnexpectedExceptions() {
NullPointerException npe = new NullPointerException("inner-message");
try {
expectThrows(IOException.class, throwingRunnable(npe));
} catch (AssertionError ex) {
assertSame(npe, ex.getCause());
assertEquals("inner-message", ex.getCause().getMessage());
return;
}
fail();
}
@Test
public void expectThrowsSuppliesACoherentErrorMessageUponTypeMismatch() {
NullPointerException npe = new NullPointerException();
try {
expectThrows(IOException.class, throwingRunnable(npe));
} catch (AssertionError error) {
assertEquals("unexpected exception type thrown; expected:<IOException> but was:<NullPointerException>",
error.getMessage());
assertSame(npe, error.getCause());
return;
}
fail();
}
private static ThrowingRunnable nonThrowingRunnable() {
return new ThrowingRunnable() {
public void run() throws Throwable {
}
};
}
private static ThrowingRunnable throwingRunnable(final Throwable t) {
return new ThrowingRunnable() {
public void run() throws Throwable {
throw t;
}
};
}
@Test
public void checkGreaterThan() {
Integer o1 = new Integer(10);
Integer o2 = new Integer(20);
MyComparator comparator = new MyComparator();
// Testing if o2 is greater than o1 based on my own comparator
assertGreaterThan(o2, o1, comparator);
byte b1 = 2, b2 = 3;
assertGreaterThanPrimitive(b2, b1);
short s1 = 2, s2 = 3;
assertGreaterThanPrimitive(s2, s1);
int i1 = 2, i2 = 3;
assertGreaterThanPrimitive(i2, i1);
long l1 = 2, l2 = 3;
assertGreaterThanPrimitive(l2, l1);
float f1 = 2.1f, f2 = 3.2f;
assertGreaterThanPrimitive(f2, f1);
double d1 = 2.2f, d2 = 3.3f;
assertGreaterThanPrimitive(d2, d1);
char c1 = 'a', c2 = 'b';
assertGreaterThanPrimitive(c2, c1);
String str1 = "abc", str2 = "abcde";
assertGreaterThanPrimitive(str1, str2);
}
public class MyComparator implements Comparator<Integer> {
public int compare(Integer o1, Integer o2) {
if(o1.intValue() > o2.intValue())
return 1;
else if(o1.intValue() == o2.intValue())
return 0;
else
return -1;
}
}
}
| epl-1.0 |
msche/oval | src/main/java/net/sf/oval/integration/spring/SpringValidator.java | 2697 | /*******************************************************************************
* Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
* Thomschke.
*
* All Rights Reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sebastian Thomschke - initial implementation.
*******************************************************************************/
package net.sf.oval.integration.spring;
import net.sf.oval.ConstraintViolation;
import net.sf.oval.Validator;
import net.sf.oval.context.FieldContext;
import net.sf.oval.context.OValContext;
import net.sf.oval.exception.ValidationFailedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.validation.Errors;
/**
* @author Sebastian Thomschke
*/
public class SpringValidator implements org.springframework.validation.Validator, InitializingBean
{
private static final Logger LOG = LoggerFactory.getLogger(SpringValidator.class);
private Validator validator;
public SpringValidator()
{
super();
}
public SpringValidator(final Validator validator)
{
this.validator = validator;
}
/**
* {@inheritDoc}
*/
public void afterPropertiesSet() throws Exception
{
Assert.notNull(validator, "Property [validator] must be set");
}
/**
* @return the validator
*/
public Validator getValidator()
{
return validator;
}
/**
* @param validator the validator to set
*/
public void setValidator(final Validator validator)
{
this.validator = validator;
}
/**
* {@inheritDoc}
*/
public boolean supports(@SuppressWarnings("rawtypes") final Class clazz)
{
return true;
}
/**
* {@inheritDoc}
*/
public void validate(final Object objectToValidate, final Errors errors)
{
try
{
for (final ConstraintViolation violation : validator.validate(objectToValidate))
{
final OValContext ctx = violation.getContext();
final String errorCode = violation.getErrorCode();
final String errorMessage = violation.getMessage();
if (ctx instanceof FieldContext)
{
final String fieldName = ((FieldContext) ctx).getField().getName();
errors.rejectValue(fieldName, errorCode, errorMessage);
}
else
errors.reject(errorCode, errorMessage);
}
}
catch (final ValidationFailedException ex)
{
LOG.error("Unexpected error during validation", ex);
errors.reject(ex.getMessage());
}
}
}
| epl-1.0 |
rmcilroy/HeraJVM | rvm/src/org/jikesrvm/compilers/opt/OPT_VCGEdge.java | 2498 | /*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
package org.jikesrvm.compilers.opt;
/**
* OPT_VCGEdge provides the minimum set of routines for printing a graph
* edge in VCG format. The graph should implement OPT_VCGGraph interface,
* and its nodes - OPT_VCGNode interface.
*
* @see OPT_VCG
* @see OPT_VCGGraph
* @see OPT_VCGNode
*/
public interface OPT_VCGEdge extends OPT_VisEdge {
/**
* Returns a VCG descriptor for the edge which will provide VCG-relevant
* information for the edge.
* If finer control over edge options is not needed, it's enough to
* implement in the following fashion:
* <pre>
* public EdgeDesc getVCGDescriptor() { return defaultVCGDesc; }
* </pre>
* @return edge descriptor
*/
EdgeDesc getVCGDescriptor();
/**
* Returns whether this edge is a backedge.
* @return true if the edge is a backedge, false otherwise
*/
boolean backEdge();
/**
* Default VCG descriptor
*/
EdgeDesc defaultVCGDesc = new EdgeDesc();
/**
* VCG Graph Edge Descriptor class
* Subclass to extend functionality
*/
class EdgeDesc implements OPT_VCGConstants {
/**
* Returns the label of the edge (contents).
* Default is blank.
* @return edge label
*/
public String getLabel() { return null; }
/**
* Returns the class of the edge.
* @return edge class
*/
public int getType() { return NONE; }
/**
* Returns the color of the edge.
* Default is black if edge colors are not defined,
* and the color corresponding to the edge class if they are defined.
* To assign edge colors, use getEdgeColors in OPT_VCGGraph.GraphDesc.
* NOTE: colors for ALL classes must be defined.
* @return edge color
*/
public String getColor() { return null; }
/**
* Returns the thickness of the edge.
* @return edge thickness
*/
public int getThickness() { return 1; }
/**
* Returns the line style of the edge.
* Default is solid.
* @return edge line style
*/
public String getStyle() { return null; }
}
}
| epl-1.0 |
nicolatimeus/kura | kura/org.eclipse.kura.linux.bluetooth/src/main/java/org/eclipse/kura/linux/bluetooth/le/beacon/BluetoothAdvertisingData.java | 3973 | /*******************************************************************************
* Copyright (c) 2011, 2020 Eurotech and/or its affiliates
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech
*******************************************************************************/
package org.eclipse.kura.linux.bluetooth.le.beacon;
public class BluetoothAdvertisingData {
private static final String PKT_BYTES_NUMBER = "1e";
private static final String AD_BYTES_NUMBER = "02";
private static final String AD_FLAG = "01";
private static final String PAYLOAD_BYTES_NUMBER = "1a";
private static final String MANUFACTURER_AD = "ff";
private static final String BEACON_ID = "0215";
private static final int MAJOR_MAX = 65535;
private static final int MAJOR_MIN = 0;
private static final int MINOR_MAX = 65535;
private static final int MINOR_MIN = 0;
private static final short TX_POWER_MAX = 126;
private static final short TX_POWER_MIN = -127;
private static final String UUID_DEFAULT = "aaaaaaaabbbbccccddddeeeeeeeeeeee";
private BluetoothAdvertisingData() {
}
@SuppressWarnings("checkstyle:parameterNumber")
public static String getData(String uuid, Integer major, Integer minor, String companyCode, Integer txPower,
boolean leLimited, boolean leGeneral, boolean brEDRSupported, boolean leBRController, boolean leBRHost) {
String data = "";
// Create flags
String flags = "000";
flags += Integer.toString(leBRHost ? 1 : 0);
flags += Integer.toString(leBRController ? 1 : 0);
flags += Integer.toString(brEDRSupported ? 1 : 0);
flags += Integer.toString(leGeneral ? 1 : 0);
flags += Integer.toString(leLimited ? 1 : 0);
String flagsString = Integer.toHexString(Integer.parseInt(flags, 2));
if (flagsString.length() == 1) {
flagsString = "0" + flagsString;
}
txPower = inSetRange(txPower, TX_POWER_MAX, TX_POWER_MIN);
String txPowerString = Integer.toHexString(txPower & 0xFF);
if (txPowerString.length() == 1) {
txPowerString = "0" + txPowerString;
}
// Create Advertising data
data += PKT_BYTES_NUMBER;
data += AD_BYTES_NUMBER;
data += AD_FLAG;
data += flagsString;
data += PAYLOAD_BYTES_NUMBER;
data += MANUFACTURER_AD;
data += companyCode.substring(2, 4);
data += companyCode.substring(0, 2);
data += BEACON_ID;
if (uuid.length() == 32) {
data += inSetHex(uuid, UUID_DEFAULT);
} else {
data += UUID_DEFAULT;
}
data += to2BytesHex(inSetRange(major, MAJOR_MAX, MAJOR_MIN));
data += to2BytesHex(inSetRange(minor, MINOR_MAX, MINOR_MIN));
data += txPowerString;
data += "00";
return data;
}
private static String inSetHex(String uuid, String defaultUuid) {
if (!uuid.matches("^[0-9a-fA-F]+$")) {
return defaultUuid;
} else {
return uuid;
}
}
private static int inSetRange(int value, int max, int min) {
if (value <= max && value >= min) {
return value;
} else {
return value > max ? max : min;
}
}
public static String to2BytesHex(Integer in) {
String out = Integer.toHexString(in);
if (out.length() == 1) {
out = "000" + out;
} else if (out.length() == 2) {
out = "00" + out;
} else if (out.length() == 3) {
out = "0" + out;
} else if (out.length() > 4) {
out = out.substring(out.length() - 4);
}
return out;
}
}
| epl-1.0 |
rkadle/Tank | web/web_support/src/main/java/com/intuit/tank/script/TestUploadBean.java | 2096 | package com.intuit.tank.script;
/*
* #%L
* JSF Support Beans
* %%
* Copyright (C) 2011 - 2015 Intuit Inc.
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/
import java.io.File;
import java.io.Serializable;
import java.util.UUID;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Logger;
import org.jboss.seam.international.status.Messages;
import org.primefaces.model.UploadedFile;
@Named
@ApplicationScoped
public class TestUploadBean implements Serializable {
private static final Logger LOG = Logger.getLogger(TestUploadBean.class);
private static final long serialVersionUID = 1L;
private UploadedFile file;
@Inject
private Messages messages;
/**
* @return the file
*/
public UploadedFile getFile() {
return file;
}
/**
* @param file
* the file to set
*/
public void setFile(UploadedFile file) {
this.file = file;
}
/**
* Saves the script in the database.
*/
public String save() {
UploadedFile item = getFile();
try {
String fileName = item.getFileName();
fileName = FilenameUtils.getBaseName(fileName) + "-" + UUID.randomUUID().toString() + "."
+ FilenameUtils.getExtension(fileName);
File parent = new File("uploads");
parent.mkdirs();
File f = new File(parent, fileName);
LOG.info("Writing file to " + f.getAbsolutePath());
FileUtils.writeByteArrayToFile(f, item.getContents());
messages.info("Wrote file to " + f.getAbsolutePath());
} catch (Exception e) {
messages.error(e.getMessage());
}
return null;
}
}
| epl-1.0 |
sleshchenko/che | wsagent/che-core-api-git-shared/src/main/java/org/eclipse/che/api/git/shared/TagCreateRequest.java | 968 | /*
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.git.shared;
import org.eclipse.che.dto.shared.DTO;
/**
* Request to create new tag.
*
* @author andrew00x
*/
@DTO
public interface TagCreateRequest {
/** @return name of tag to create */
String getName();
void setName(String name);
/** @return commit to make tag. If <code>null</code> then HEAD is used */
String getCommit();
void setCommit(String commit);
/** @return message for tag */
String getMessage();
void setMessage(String message);
/** @return force create tag operation */
boolean isForce();
void setForce(boolean isForce);
}
| epl-1.0 |
sudaraka94/che | plugins/plugin-zend-debugger/che-plugin-zend-debugger-server/src/main/java/org/eclipse/che/plugin/zdb/server/variables/IDbgVariable.java | 1088 | /**
* ***************************************************************************** Copyright (c) 2016
* Rogue Wave Software, Inc. All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
*
* <p>Contributors: Rogue Wave Software, Inc. - initial API and implementation
* *****************************************************************************
*/
package org.eclipse.che.plugin.zdb.server.variables;
import java.util.List;
import org.eclipse.che.api.debug.shared.model.Variable;
/**
* Zend debugger specific variable.
*
* @author Bartlomiej Laczkowski
*/
public interface IDbgVariable extends Variable {
@Override
List<IDbgVariable> getVariables();
/** Requests child variables computation. */
public void makeComplete();
/**
* Assigns new value to this variable.
*
* @param newValue
*/
public void setValue(String newValue);
}
| epl-1.0 |
forge/furnace | test-harness/arquillian/core/src/main/java/org/jboss/forge/arquillian/maven/ProjectHelper.java | 10381 | /*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.arquillian.maven;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequestPopulator;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.building.DefaultModelBuilderFactory;
import org.apache.maven.model.building.DefaultModelBuildingRequest;
import org.apache.maven.model.building.ModelBuilder;
import org.apache.maven.model.building.ModelBuildingException;
import org.apache.maven.model.building.ModelBuildingResult;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingResult;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Profile;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Repository;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
import org.eclipse.aether.util.repository.DefaultMirrorSelector;
import org.eclipse.aether.util.repository.DefaultProxySelector;
import org.jboss.forge.furnace.manager.maven.MavenContainer;
import org.jboss.forge.furnace.manager.maven.addon.MavenAddonDependencyResolver;
import org.jboss.forge.furnace.manager.maven.util.MavenRepositories;
public class ProjectHelper
{
private final MavenContainer mavenContainer;
private ProjectBuildingRequest request;
public ProjectHelper()
{
this.mavenContainer = new MavenContainer();
}
public Model loadPomFromFile(File pomFile, String... profiles)
{
RepositorySystem system = mavenContainer.getRepositorySystem();
Settings settings = mavenContainer.getSettings();
DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
.setSystemProperties(System.getProperties())
.setPomFile(pomFile)
.setActiveProfileIds(settings.getActiveProfiles());
ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
ModelBuildingResult result;
try
{
request.setModelResolver(new MavenModelResolver(system, session,
MavenRepositories.getRemoteRepositories(mavenContainer, settings)));
result = builder.build(request);
}
// wrap exception message
catch (ModelBuildingException e)
{
String pomPath = request.getPomFile().getAbsolutePath();
StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size())
.append(" problems while building POM model from ").append(pomPath).append("\n");
int counter = 1;
for (ModelProblem problem : e.getProblems())
{
sb.append(counter++).append("/ ").append(problem).append("\n");
}
throw new RuntimeException(sb.toString());
}
return result.getEffectiveModel();
}
public List<Dependency> resolveDependenciesFromPOM(File pomFile) throws Exception
{
PlexusContainer plexus = new PlexusContainer();
List<Dependency> result;
try
{
ProjectBuildingRequest request = getBuildingRequest(plexus);
request.setResolveDependencies(true);
ProjectBuilder builder = plexus.lookup(ProjectBuilder.class);
ProjectBuildingResult build = builder.build(pomFile, request);
result = build.getDependencyResolutionResult().getDependencies();
}
finally
{
plexus.shutdown();
}
return result;
}
private ProjectBuildingRequest getBuildingRequest(PlexusContainer plexus)
{
if (this.request == null)
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
Settings settings = mavenContainer.getSettings();
// TODO this needs to be configurable via .forge
// TODO this reference to the M2_REPO should probably be centralized
MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
RepositorySystem repositorySystem = plexus.lookup(RepositorySystem.class);
MavenExecutionRequestPopulator requestPopulator = plexus.lookup(MavenExecutionRequestPopulator.class);
requestPopulator.populateFromSettings(executionRequest, settings);
requestPopulator.populateDefaults(executionRequest);
ProjectBuildingRequest request = executionRequest.getProjectBuildingRequest();
org.apache.maven.artifact.repository.ArtifactRepository localRepository = RepositoryUtils
.toArtifactRepository("local",
new File(settings.getLocalRepository()).toURI().toURL().toString(), null, true, true);
request.setLocalRepository(localRepository);
List<org.apache.maven.artifact.repository.ArtifactRepository> settingsRepos = new ArrayList<>(
request.getRemoteRepositories());
List<String> activeProfiles = settings.getActiveProfiles();
Map<String, Profile> profiles = settings.getProfilesAsMap();
for (String id : activeProfiles)
{
Profile profile = profiles.get(id);
if (profile != null)
{
List<Repository> repositories = profile.getRepositories();
for (Repository repository : repositories)
{
settingsRepos.add(RepositoryUtils.convertFromMavenSettingsRepository(repository));
}
}
}
request.setRemoteRepositories(settingsRepos);
request.setSystemProperties(System.getProperties());
DefaultRepositorySystemSession repositorySession = MavenRepositorySystemUtils.newSession();
Proxy activeProxy = settings.getActiveProxy();
if (activeProxy != null)
{
DefaultProxySelector dps = new DefaultProxySelector();
dps.add(RepositoryUtils.convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
repositorySession.setProxySelector(dps);
}
LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());
repositorySession.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(repositorySession,
localRepo));
repositorySession.setOffline(settings.isOffline());
List<Mirror> mirrors = executionRequest.getMirrors();
DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
if (mirrors != null)
{
for (Mirror mirror : mirrors)
{
mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
mirror.getMirrorOfLayouts());
}
}
repositorySession.setMirrorSelector(mirrorSelector);
LazyAuthenticationSelector authSelector = new LazyAuthenticationSelector(mirrorSelector);
for (Server server : settings.getServers())
{
authSelector.add(
server.getId(),
new AuthenticationBuilder().addUsername(server.getUsername()).addPassword(server.getPassword())
.addPrivateKey(server.getPrivateKey(), server.getPassphrase()).build());
}
repositorySession.setAuthenticationSelector(authSelector);
request.setRepositorySession(repositorySession);
request.setProcessPlugins(false);
request.setResolveDependencies(false);
this.request = request;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new RuntimeException(
"Could not create Maven project building request", e);
}
finally
{
/*
* We reset the classloader to prevent potential modules bugs if Classwords container changes classloaders
* on us
*/
Thread.currentThread().setContextClassLoader(cl);
}
}
return request;
}
/**
* Returns <code>true</code> if this model is a single-project addon
*/
public boolean isAddon(Model model)
{
boolean result = false;
Build build = model.getBuild();
if (build != null)
{
PLUGIN_LOOP: for (Plugin plugin : build.getPlugins())
{
if ("maven-jar-plugin".equals(plugin.getArtifactId()))
{
for (PluginExecution execution : plugin.getExecutions())
{
Xpp3Dom config = (Xpp3Dom) execution.getConfiguration();
if (config != null)
{
Xpp3Dom classifierNode = config.getChild("classifier");
if (classifierNode != null
&& MavenAddonDependencyResolver.FORGE_ADDON_CLASSIFIER.equals(classifierNode.getValue()))
{
result = true;
break PLUGIN_LOOP;
}
}
}
}
}
}
return result;
}
}
| epl-1.0 |
maxeler/eclipse | eclipse.jdt.core/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunModelTests.java | 1022 | /*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.jdt.core.tests.model.AllJavaModelTests;
/**
* Runs all Java model tests.
*/
public class RunModelTests extends TestCase {
public RunModelTests(String name) {
super(name);
}
public static Test suite() {
TestSuite suite = new TestSuite(RunModelTests.class.getName());
suite.addTest(AllJavaModelTests.suite());
return suite;
}
}
| epl-1.0 |
lhillah/pnmlframework | pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/terms/hlapi/OperatorHLAPI.java | 17533 | /**
* Copyright 2009-2016 Université Paris Ouest and Sorbonne Universités,
Univ. Paris 06 - CNRS UMR 7606 (LIP6)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Project leader / Initial Contributor:
* Lom Messan Hillah - <lom-messan.hillah@lip6.fr>
*
* Contributors:
* ${ocontributors} - <$oemails}>
*
* Mailing list:
* lom-messan.hillah@lip6.fr
*/
/**
* (C) Sorbonne Universités, UPMC Univ Paris 06, UMR CNRS 7606 (LIP6)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Lom HILLAH (LIP6) - Initial models and implementation
* Rachid Alahyane (UPMC) - Infrastructure and continuous integration
* Bastien Bouzerau (UPMC) - Architecture
* Guillaume Giffo (UPMC) - Code generation refactoring, High-level API
*
* $Id ggiffo, Thu Feb 11 16:30:27 CET 2016$
*/
package fr.lip6.move.pnml.pthlpng.terms.hlapi;
import java.util.List;
import fr.lip6.move.pnml.framework.hlapi.HLAPIClass;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.Condition;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.HLAnnotation;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.HLMarking;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.ConditionHLAPI;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.HLAnnotationHLAPI;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.HLMarkingHLAPI;
import fr.lip6.move.pnml.pthlpng.partitions.PartitionElement;
import fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementHLAPI;
import fr.lip6.move.pnml.pthlpng.terms.NamedOperator;
import fr.lip6.move.pnml.pthlpng.terms.Operator;
import fr.lip6.move.pnml.pthlpng.terms.Sort;
import fr.lip6.move.pnml.pthlpng.terms.Term;
public interface OperatorHLAPI extends HLAPIClass, TermHLAPI {
// getters giving LLAPI object
/**
*
*/
public Sort getSort();
/**
*
*/
public Operator getContainerOperator();
/**
*
*/
public NamedOperator getContainerNamedOperator();
/**
*
*/
public HLMarking getContainerHLMarking();
/**
*
*/
public Condition getContainerCondition();
/**
*
*/
public HLAnnotation getContainerHLAnnotation();
/**
*
*/
public PartitionElement getContainerPartitionElement();
/**
*
*/
public List<Term> getSubterm();
/**
*
*/
public Sort getOutput();
/**
*
*/
public List<Sort> getInput();
// getters giving HLAPI object
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public SortHLAPI getSortHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public OperatorHLAPI getContainerOperatorHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public NamedOperatorHLAPI getContainerNamedOperatorHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public HLMarkingHLAPI getContainerHLMarkingHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public ConditionHLAPI getContainerConditionHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public HLAnnotationHLAPI getContainerHLAnnotationHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public PartitionElementHLAPI getContainerPartitionElementHLAPI();
/**
* This accessor automaticaly encapsulate all elements of the selected sublist.
* WARNING : this can creates a lot of new object in memory.
*/
public java.util.List<TermHLAPI> getSubtermHLAPI();
/**
* This accessor automaticaly encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*/
public SortHLAPI getOutputHLAPI();
/**
* This accessor automaticaly encapsulate all elements of the selected sublist.
* WARNING : this can creates a lot of new object in memory.
*/
public java.util.List<SortHLAPI> getInputHLAPI();
// setters (including container setter if aviable)
/**
* set Sort
*/
public void setSortHLAPI(SortHLAPI elem);
/**
* set Output
*/
public void setOutputHLAPI(SortHLAPI elem);
/**
* set ContainerOperator
*/
public void setContainerOperatorHLAPI(OperatorHLAPI elem);
/**
* set ContainerNamedOperator
*/
public void setContainerNamedOperatorHLAPI(NamedOperatorHLAPI elem);
/**
* set ContainerHLMarking
*/
public void setContainerHLMarkingHLAPI(HLMarkingHLAPI elem);
/**
* set ContainerCondition
*/
public void setContainerConditionHLAPI(ConditionHLAPI elem);
/**
* set ContainerHLAnnotation
*/
public void setContainerHLAnnotationHLAPI(HLAnnotationHLAPI elem);
/**
* set ContainerPartitionElement
*/
public void setContainerPartitionElementHLAPI(PartitionElementHLAPI elem);
/**
* This accessor return a list of encapsulated subelement, only of VariableHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.VariableHLAPI> getSubterm_terms_VariableHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of TupleHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.TupleHLAPI> getSubterm_terms_TupleHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* UserOperatorHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.UserOperatorHLAPI> getSubterm_terms_UserOperatorHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of EqualityHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.EqualityHLAPI> getSubterm_booleans_EqualityHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* InequalityHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI> getSubterm_booleans_InequalityHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* BooleanConstantHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.BooleanConstantHLAPI> getSubterm_booleans_BooleanConstantHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of OrHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.OrHLAPI> getSubterm_booleans_OrHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of AndHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.AndHLAPI> getSubterm_booleans_AndHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of ImplyHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.ImplyHLAPI> getSubterm_booleans_ImplyHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of NotHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.NotHLAPI> getSubterm_booleans_NotHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* DotConstantHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.dots.hlapi.DotConstantHLAPI> getSubterm_dots_DotConstantHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* NumberConstantHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.NumberConstantHLAPI> getSubterm_integers_NumberConstantHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of AdditionHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.AdditionHLAPI> getSubterm_integers_AdditionHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* SubtractionHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.SubtractionHLAPI> getSubterm_integers_SubtractionHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* MultiplicationHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.MultiplicationHLAPI> getSubterm_integers_MultiplicationHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of DivisionHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.DivisionHLAPI> getSubterm_integers_DivisionHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of ModuloHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.ModuloHLAPI> getSubterm_integers_ModuloHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* GreaterThanHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.GreaterThanHLAPI> getSubterm_integers_GreaterThanHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* GreaterThanOrEqualHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.GreaterThanOrEqualHLAPI> getSubterm_integers_GreaterThanOrEqualHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of LessThanHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.LessThanHLAPI> getSubterm_integers_LessThanHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* LessThanOrEqualHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.LessThanOrEqualHLAPI> getSubterm_integers_LessThanOrEqualHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* CardinalityHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.CardinalityHLAPI> getSubterm_multisets_CardinalityHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of ContainsHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.ContainsHLAPI> getSubterm_multisets_ContainsHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* CardinalityOfHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.CardinalityOfHLAPI> getSubterm_multisets_CardinalityOfHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of AddHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.AddHLAPI> getSubterm_multisets_AddHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of AllHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.AllHLAPI> getSubterm_multisets_AllHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of EmptyHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.EmptyHLAPI> getSubterm_multisets_EmptyHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of NumberOfHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.NumberOfHLAPI> getSubterm_multisets_NumberOfHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of SubtractHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.SubtractHLAPI> getSubterm_multisets_SubtractHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* ScalarProductHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.multisets.hlapi.ScalarProductHLAPI> getSubterm_multisets_ScalarProductHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* GreaterThanHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.GreaterThanHLAPI> getSubterm_partitions_GreaterThanHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* PartitionElementOfHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI> getSubterm_partitions_PartitionElementOfHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of LessThanHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.LessThanHLAPI> getSubterm_partitions_LessThanHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* MultisetSortHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.MultisetSortHLAPI> getInput_terms_MultisetSortHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* ProductSortHLAPI kind. WARNING : this method can creates a lot of new object
* in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.ProductSortHLAPI> getInput_terms_ProductSortHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of UserSortHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.terms.hlapi.UserSortHLAPI> getInput_terms_UserSortHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of BoolHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.BoolHLAPI> getInput_booleans_BoolHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of DotHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.dots.hlapi.DotHLAPI> getInput_dots_DotHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of NaturalHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.NaturalHLAPI> getInput_integers_NaturalHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of PositiveHLAPI
* kind. WARNING : this method can creates a lot of new object in memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.PositiveHLAPI> getInput_integers_PositiveHLAPI();
/**
* This accessor return a list of encapsulated subelement, only of
* HLIntegerHLAPI kind. WARNING : this method can creates a lot of new object in
* memory.
*/
public java.util.List<fr.lip6.move.pnml.pthlpng.integers.hlapi.HLIntegerHLAPI> getInput_integers_HLIntegerHLAPI();
// setters/remover for lists.
public void addSubtermHLAPI(TermHLAPI unit);
public void removeSubtermHLAPI(TermHLAPI unit);
// equals method
public boolean equals(Object item);
} | epl-1.0 |
RodriguesJ/Atem | src/com/runescape/server/revised/content/skill/combat/magic/spells/lunar/StatSpy.java | 1218 | package com.runescape.server.revised.content.skill.combat.magic.spells.lunar;
import com.runescape.server.revised.content.skill.combat.magic.spells.AbstractSpell;
import com.runescape.server.revised.content.skill.combat.magic.spells.SpellBookType;
import com.runescape.server.revised.content.skill.combat.magic.spells.SpellGroup;
import com.runescape.server.revised.content.skill.combat.magic.spells.SpellType;
import com.runescape.server.revised.content.skill.runecrafting.Rune;
public class StatSpy extends AbstractSpell {
@Override
public byte getLevelNeeded() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Rune[] getRunesNeeded() {
// TODO Auto-generated method stub
return null;
}
@Override
public SpellType getSpellType() {
// TODO Auto-generated method stub
return null;
}
@Override
public SpellGroup getSpellGroup() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getNotes() {
// TODO Auto-generated method stub
return null;
}
@Override
public SpellBookType getSpellBookType() {
// TODO Auto-generated method stub
return null;
}
@Override
public void castSpell() {
// TODO Auto-generated method stub
}
} | epl-1.0 |
ModelWriter/Deliverables | WP2/D2.5.2_Generation/Jeni/lib/weka-src/src/main/java/weka/gui/knowledgeflow/steps/ClassValuePickerStepEditorDialog.java | 4405 | /*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* ClassValuePickerStepEditorDialog.java
* Copyright (C) 2015 University of Waikato, Hamilton, New Zealand
*
*/
package weka.gui.knowledgeflow.steps;
import weka.core.Instances;
import weka.core.WekaException;
import weka.gui.EnvironmentField;
import weka.gui.knowledgeflow.GOEStepEditorDialog;
import weka.knowledgeflow.StepManager;
import weka.knowledgeflow.steps.ClassValuePicker;
import weka.knowledgeflow.steps.Step;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Editor dialog for the ClassValuePicker step.
*
* @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
* @version $Revision: $
*/
public class ClassValuePickerStepEditorDialog extends GOEStepEditorDialog {
private static final long serialVersionUID = 7009335918650499183L;
/** For displaying class values */
protected JComboBox m_classValueCombo = new EnvironmentField.WideComboBox();
/**
* Set the step to edit
*
* @param step the step to edit
*/
@Override
@SuppressWarnings("unchecked")
public void setStepToEdit(Step step) {
copyOriginal(step);
Instances incomingStructure = null;
try {
incomingStructure = step.getStepManager()
.getIncomingStructureForConnectionType(StepManager.CON_DATASET);
if (incomingStructure == null) {
incomingStructure = step.getStepManager()
.getIncomingStructureForConnectionType(StepManager.CON_TRAININGSET);
}
if (incomingStructure == null) {
incomingStructure = step.getStepManager()
.getIncomingStructureForConnectionType(StepManager.CON_TESTSET);
}
if (incomingStructure == null) {
incomingStructure = step.getStepManager()
.getIncomingStructureForConnectionType(StepManager.CON_INSTANCE);
}
} catch (WekaException ex) {
showErrorDialog(ex);
}
if (incomingStructure != null) {
if (incomingStructure.classIndex() < 0) {
showInfoDialog("No class attribute is set in the data",
"ClassValuePicker", true);
add(new JLabel("No class attribute set in data"), BorderLayout.CENTER);
} else if (incomingStructure.classAttribute().isNumeric()) {
showInfoDialog("Cant set class value - class is numeric!",
"ClassValuePicker", true);
add(new JLabel("Can't set class value - class is numeric"),
BorderLayout.CENTER);
} else {
m_classValueCombo.setEditable(true);
m_classValueCombo
.setToolTipText("Class label. /first, /last and /<num> "
+ "can be used to specify the first, last or specific index "
+ "of the label to use respectively");
for (int i = 0; i < incomingStructure.classAttribute()
.numValues(); i++) {
m_classValueCombo
.addItem(incomingStructure.classAttribute().value(i));
}
String stepL = ((ClassValuePicker) getStepToEdit()).getClassValue();
if (stepL != null && stepL.length() > 0) {
m_classValueCombo.setSelectedItem(stepL);
}
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createTitledBorder("Choose class value"));
p.add(m_classValueCombo, BorderLayout.NORTH);
createAboutPanel(step);
add(p, BorderLayout.CENTER);
}
} else {
super.setStepToEdit(step);
}
}
/**
* Called when the OK button is pressed
*/
@Override
public void okPressed() {
Object selected = m_classValueCombo.getSelectedItem();
if (selected != null) {
((ClassValuePicker) getStepToEdit()).setClassValue(selected.toString());
}
}
}
| epl-1.0 |
Tasktop/code2cloud.server | com.tasktop.c2c.server/com.tasktop.c2c.server.tasks.web.ui/src/main/java/com/tasktop/c2c/server/tasks/client/widgets/TaskDetailsPopupPanel.java | 10128 | /*******************************************************************************
* Copyright (c) 2010, 2012 Tasktop Technologies
* Copyright (c) 2010, 2011 SpringSource, a division of VMware
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tasktop Technologies - initial API and implementation
******************************************************************************/
package com.tasktop.c2c.server.tasks.client.widgets;
import java.math.BigDecimal;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.editor.client.Editor;
import com.google.gwt.editor.client.SimpleBeanEditorDriver;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseWheelEvent;
import com.google.gwt.event.dom.client.MouseWheelHandler;
import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.place.shared.PlaceChangeEvent;
import com.google.gwt.place.shared.PlaceChangeRequestEvent;
import com.google.gwt.text.shared.AbstractRenderer;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.DateLabel;
import com.google.gwt.user.client.ui.DecoratedPopupPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.NumberLabel;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.ValueLabel;
import com.tasktop.c2c.server.common.profile.web.client.CommonProfileMessages;
import com.tasktop.c2c.server.common.web.client.event.AppScrollEvent;
import com.tasktop.c2c.server.common.web.client.view.CommonGinjector;
import com.tasktop.c2c.server.common.web.client.widgets.time.TimePeriodRenderer;
import com.tasktop.c2c.server.tasks.client.TasksMessages;
import com.tasktop.c2c.server.tasks.domain.Keyword;
import com.tasktop.c2c.server.tasks.domain.Task;
/**
* @author Clint Morgan (Tasktop Technologies Inc.)
*
*/
public class TaskDetailsPopupPanel extends DecoratedPopupPanel implements Editor<Task>, PlaceChangeEvent.Handler,
PlaceChangeRequestEvent.Handler {
private static final int MAX_DESCRIPTION_LEN = 50;
interface Binder extends UiBinder<HTMLPanel, TaskDetailsPopupPanel> {
}
interface Driver extends SimpleBeanEditorDriver<Task, TaskDetailsPopupPanel> {
}
private static Binder uiBinder = GWT.create(Binder.class);
private static Driver driver = GWT.create(Driver.class);
private static TaskDetailsPopupPanel instance;
public static TaskDetailsPopupPanel getInstance() {
if (instance == null) {
instance = new TaskDetailsPopupPanel();
}
return instance;
}
private TasksMessages tasksMessages = GWT.create(TasksMessages.class);
private CommonProfileMessages commonProfileMessages = GWT.create(CommonProfileMessages.class);
@UiField
Label taskType;
@UiField
NumberLabel<Integer> id;
@UiField
Label shortDescription;
@UiField
@Editor.Ignore
AnchorElement taskAnchorElement;
@UiField
// @Editor.Path("reporter.loginName")
@Ignore
Label reporter;
@UiField(provided = true)
DateLabel creationDate = new DateLabel(DateTimeFormat.getFormat("mm/dd/yy"));
@UiField
@Editor.Ignore
Anchor commentsAnchor;
@UiField
@Editor.Ignore
DivElement priorityDivElement;
@UiField
@Editor.Ignore
SpanElement resolvedStatusIconSpanElement;
@UiField
@Editor.Path("status.value")
Label status;
@UiField
@Editor.Path("resolution.value")
Label resolution;
@UiField
DivElement severityDivElement;
@UiField
@Editor.Ignore
Label description;
@UiField
@Editor.Ignore
Anchor moreDescriptionAnchor;
@UiField
@Editor.Path("product.name")
Label productName;
@UiField
@Editor.Path("component.name")
Label componentName;
@UiField
@Editor.Path("milestone.value")
Label milestoneValue;
@UiField
@Editor.Path("iteration.value")
Label iteration;
@UiField(provided = true)
ValueLabel<BigDecimal> estimatedTime = new ValueLabel<BigDecimal>(TimePeriodRenderer.HOUR_RENDERER);
@UiField(provided = true)
ValueLabel<List<Keyword>> keywords = new ValueLabel<List<Keyword>>(new AbstractRenderer<List<Keyword>>() {
@Override
public String render(List<Keyword> keywords) {
String result = "";
if (keywords != null) {
for (Keyword k : keywords) {
if (!result.isEmpty()) {
result += commonProfileMessages.comma() + " ";
}
result += k.getName();
}
}
return result;
}
});
@UiField()
@Editor.Path("assignee.realname")
Label assignee;
public TaskDetailsPopupPanel() {
super(true, false); // Not modal so that mouseout events on the hover source element can cause this to hide.
setWidget(uiBinder.createAndBindUi(this));
driver.initialize(this);
setStyleName("tasks");
CommonGinjector.get.instance().getEventBus()
.addHandler(AppScrollEvent.TYPE, new AppScrollEvent.AppScrollEventHandler() {
@Override
public void onScroll() {
hide();
}
});
CommonGinjector.get.instance().getEventBus().addHandler(PlaceChangeRequestEvent.TYPE, this);
CommonGinjector.get.instance().getEventBus().addHandler(PlaceChangeEvent.TYPE, this);
History.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
hide();
}
});
super.addDomHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
hide();
}
}, MouseOutEvent.getType());
super.addDomHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
hide();
}
}, ScrollEvent.getType());
super.addDomHandler(new MouseWheelHandler() {
@Override
public void onMouseWheel(MouseWheelEvent event) {
hide();
}
}, MouseWheelEvent.getType());
}
@Override
public void onPlaceChangeRequest(PlaceChangeRequestEvent event) {
hide();
}
@Override
public void onPlaceChange(PlaceChangeEvent event) {
hide();
}
public void setTask(Task task) {
driver.edit(task);
String urlString = task.getUrl();
if (urlString.indexOf("#") >= 0) {
// If we have a hash, only keep the part after it.
urlString = urlString.substring(urlString.indexOf("#"));
}
taskAnchorElement.setHref(urlString);
commentsAnchor.setText(tasksMessages.numberOfComments(task.getComments().size()));
commentsAnchor.setHref(urlString);
reporter.setText(tasksMessages.createdByReporter(task.getReporter().getLoginName()));
UIObject.setVisible(resolvedStatusIconSpanElement, !task.getStatus().isOpen());
String desc = task.getDescription();
if (desc.length() > MAX_DESCRIPTION_LEN) {
desc = desc.substring(0, MAX_DESCRIPTION_LEN);
moreDescriptionAnchor.setVisible(true);
} else {
moreDescriptionAnchor.setVisible(false);
}
description.setText(desc);
priorityDivElement.setClassName("priority left");
switch (task.getPriority().getId()) {
case 1:
priorityDivElement.addClassName("five");
break;
case 2:
priorityDivElement.addClassName("four");
break;
case 3:
default:
priorityDivElement.addClassName("three");
break;
case 4:
priorityDivElement.addClassName("two");
break;
case 5:
priorityDivElement.addClassName("one");
break;
}
severityDivElement.setClassName("severity right");
switch (task.getSeverity().getId()) {
case 1:
case 2:
severityDivElement.addClassName("five");
break;
case 3:
severityDivElement.addClassName("four");
break;
case 4:
default:
severityDivElement.addClassName("three");
break;
case 5:
severityDivElement.addClassName("two");
break;
case 6:
severityDivElement.addClassName("two");
break;
}
}
public void showAt(final int targetAbsoluteLeft, final int targetAbsoluteTop, final int targetOffsetWidth,
final int targetOffsetHeight) {
setPopupPositionAndShow(new PopupPanel.PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
// There doesn't appear to be a reliable way to get the width and height of this popup from the element
// itself, so I have to resort to hardcoded values (spent a couple of hours trying to get the right
// values here - popup.getWidget().getElement().getClientHeight() returned the correct height, but the
// width was way off
int popupWidth = 297;
int popupHeight = 350;
int anchorRight = targetAbsoluteLeft + targetOffsetWidth;
int anchorBottom = targetAbsoluteTop + targetOffsetHeight;
int windowRight = Window.getClientWidth() + Window.getScrollLeft();
int windowBottom = Window.getScrollTop() + Window.getClientHeight();
// By default, set our left and top to be just below the Anchor's bottom right corner.
int popupLeft = anchorRight;
int popupTop = anchorBottom;
if ((popupLeft + popupWidth) > windowRight) {
// If there's not enough space to the right, then make sure our popup is touching the
// right edge of the screen
popupLeft = windowRight - popupWidth;
}
if ((popupTop + popupHeight) > windowBottom) {
// If there's not enough space at the bottom, then make sure our popup is touching the
// bottom edge of the screen
popupTop = windowBottom - popupHeight;
}
setPopupPosition(popupLeft, popupTop);
}
});
}
}
| epl-1.0 |
asupdev/asup | org.asup.fw.core/src/org/asup/fw/core/QContextProvider.java | 802 | /**
* Copyright (c) 2012, 2014 Sme.UP and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.asup.fw.core;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Context Provider</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.asup.fw.core.QFrameworkCorePackage#getContextProvider()
* @model interface="true" abstract="true"
* @generated
*/
public interface QContextProvider {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation" required="true"
* @generated
*/
QContext getContext();
} // QContextProvider
| epl-1.0 |
subclipse/subclipse | bundles/subclipse.ui/src/org/tigris/subversion/subclipse/ui/ImageDescriptors.java | 13456 | /**
* ***************************************************************************** Copyright (c) 2003,
* 2006 Subclipse project and others. All rights reserved. This program and the accompanying
* materials are made available under the terms of the Eclipse Public License v1.0 which accompanies
* this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
*
* <p>Contributors: Subclipse project committers - initial API and implementation
* ****************************************************************************
*/
package org.tigris.subversion.subclipse.ui;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
import org.eclipse.jface.resource.ImageDescriptor;
/** The image descrptors for the plugin */
public class ImageDescriptors {
private Hashtable imageDescriptors = new Hashtable(20);
/** Creates an image and places it in the image registry. */
protected void createImageDescriptor(String id, URL baseURL) {
URL url = null;
try {
url = new URL(baseURL, ISVNUIConstants.ICON_PATH + id);
} catch (MalformedURLException e) {
}
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
imageDescriptors.put(id, desc);
}
/** Creates an image and places it in the image registry. */
protected void createImageDescriptor(String id, String name, URL baseURL) {
URL url = null;
try {
url = new URL(baseURL, ISVNUIConstants.ICON_PATH + name);
} catch (MalformedURLException e) {
}
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
imageDescriptors.put(id, desc);
}
/**
* Returns the image descriptor for the given image ID. Returns null if there is no such image.
*/
public ImageDescriptor getImageDescriptor(String id) {
return (ImageDescriptor) imageDescriptors.get(id);
}
/** Initializes the table of images used in this plugin. */
public void initializeImages(URL baseURL, int iconSet) {
// objects
createImageDescriptor(ISVNUIConstants.IMG_REPOSITORY, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_REFRESH, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_REFRESH_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_REFRESH_DISABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_SYNCPANE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PROPERTIES, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_URL_SOURCE_REPO, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_LINK_WITH_EDITOR, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_GET_ALL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_GET_NEXT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FILTER_HISTORY, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_FILTER_HISTORY_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FILTER_HISTORY_DISABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PARTICIPANT_REM_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PARTICIPANT_REM_DISABLED, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_LINK_WITH_EDITOR_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_COLLAPSE_ALL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_COLLAPSE_ALL_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_EXPAND_ALL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_EXPAND_ALL_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_NEWLOCATION, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_NEWFOLDER, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_BRANCH, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_MODULE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_CLEAR, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_CLEAR_ENABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_CLEAR_DISABLED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_BRANCHES_CATEGORY, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_VERSIONS_CATEGORY, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PROJECT_VERSION, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WARNING, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_MERGE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_SVN, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_RESOLVE_TREE_CONFLICT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_SHARE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_SYNCH, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_DIFF, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_KEYWORD, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_NEW_LOCATION, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_WIZBAN_NEW_FOLDER, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_MERGEABLE_CONFLICT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_QUESTIONABLE, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_MERGED, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_EDITED, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_NO_REMOTEDIR, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_CONFLICTED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_ADDED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MOVED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_EXTERNAL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_LOCKED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_NEEDSLOCK, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_DELETED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_SWITCHED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PROPERTY_CHANGED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_TEXT_CONFLICTED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_TREE_CONFLICT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_PROPERTY_CONFLICTED, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_UPDATE_ALL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_COMMIT_ALL, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_SHOW_DELETED, baseURL);
// special
createImageDescriptor("glyphs/glyph1.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph2.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph3.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph4.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph5.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph6.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph7.gif", baseURL); // $NON-NLS-1$
createImageDescriptor("glyphs/glyph8.gif", baseURL); // $NON-NLS-1$
createImageDescriptor(ISVNUIConstants.IMG_FILEADD_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FILEDELETE_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FOLDERADD_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FOLDERDELETE_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FILEMODIFIED_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FOLDERMODIFIED_PENDING, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_FOLDER, baseURL);
// createImageDescriptor(ISVNUIConstants.IMG_FILEMISSING_PENDING,baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_TABLE_MODE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_COMPRESSED_MODE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_TREE_MODE, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_HORIZONTAL_LAYOUT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_VERTICAL_LAYOUT, baseURL);
createImageDescriptor(ISVNUIConstants.IMG_COMMENTS, baseURL);
// views
createImageDescriptor(ISVNUIConstants.IMG_SVN_CONSOLE, baseURL);
// Menues
switch (iconSet) {
case ISVNUIConstants.MENU_ICON_SET_TORTOISESVN:
createImageDescriptor(ISVNUIConstants.IMG_MENU_UPDATE, "tortoise/update.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COMMIT, "tortoise/commit.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_SYNC, "obj16/synch_synch.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_REVERT, "tortoise/revert.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_ADD, "tortoise/add.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_IGNORE, "tortoise/ignore.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_PROPSET, "ctool16/svn_prop_add.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_SHOWPROPERTY, "cview16/props_view.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_RELOCATE, "tortoise/relocate.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_CHECKOUTAS, "tortoise/checkout.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_IMPORTFOLDER, "tortoise/import.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_LOCK, "tortoise/lock.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_UNLOCK, "tortoise/unlock.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_CLEANUP, "tortoise/cleanup.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_EXPORT, "tortoise/export.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_DIFF, "tortoise/diff.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_PROPDELETE, "ctool16/delete.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_DELETE, "ctool16/delete.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_BRANCHTAG, "tortoise/copy.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_MOVE, "tortoise/rename.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COMPARE, "tortoise/compare.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_RESOLVE, "tortoise/resolve.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_EDITCONFLICT, "tortoise/conflict.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_SWITCH, "tortoise/switch.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_MARKMERGED, "tortoise/merge.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_MERGE, "tortoise/merge.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_SHOWHISTORY, "cview16/history_view.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_ANNOTATE, "cview16/annotate_view.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COPY, "ctool16/copy_edit.gif", baseURL);
break;
case ISVNUIConstants.MENU_ICON_SET_SUBVERSIVE:
createImageDescriptor(ISVNUIConstants.IMG_MENU_UPDATE, "subversive/update.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COMMIT, "subversive/commit.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_SYNC, "subversive/synch.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_REVERT, "subversive/revert.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_CHECKOUTAS, "subversive/checkout.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_LOCK, "subversive/lock.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_UNLOCK, "subversive/unlock.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_BRANCHTAG, "subversive/branch.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_SWITCH, "subversive/switch.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_MERGE, "subversive/merge.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_SHOWHISTORY, "subversive/showhistory.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_EXPORT, "subversive/export.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_IMPORTFOLDER, "subversive/import.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_ANNOTATE, "subversive/annotate.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COPY, "subversive/copy.gif", baseURL);
break;
default: // CVS
createImageDescriptor(ISVNUIConstants.IMG_MENU_MERGE, "tortoise/merge.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_SHOWHISTORY, "cview16/history_view.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_ANNOTATE, "cview16/annotate_view.gif", baseURL);
createImageDescriptor(ISVNUIConstants.IMG_MENU_COPY, "ctool16/copy_edit.gif", baseURL);
createImageDescriptor(
ISVNUIConstants.IMG_MENU_SHOWPROPERTY, "cview16/props_view.gif", baseURL);
break;
}
}
}
| epl-1.0 |
dlitz/resin | modules/resin/src/com/caucho/servlets/ssi/SSIServlet.java | 3998 | /*
* Copyright (c) 1998-2011 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Resin Open Source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
* of NON-INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with Resin Open Source; if not, write to the
*
* Free Software Foundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307 USA
*
* @author Scott Ferguson
*/
package com.caucho.servlets.ssi;
import com.caucho.vfs.Path;
import com.caucho.vfs.Vfs;
import com.caucho.vfs.WriteStream;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Serves server-side include files.
*/
public class SSIServlet extends HttpServlet
{
private static final Logger log
= Logger.getLogger(SSIServlet.class.getName());
private SSIFactory _factory;
/**
* Set's the SSIFactory, default is a factory that handles
* the standard Apache SSI commands.
*/
public void setFactory(SSIFactory factory)
{
_factory = factory;
}
public void init()
throws ServletException
{
super.init();
if (_factory == null)
_factory = new SSIFactory();
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
String servletPath;
String pathInfo;
servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
pathInfo
= (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
if (servletPath == null && pathInfo == null) {
servletPath = request.getServletPath();
pathInfo = request.getPathInfo();
}
String fullPath;
if (pathInfo != null)
fullPath = servletPath + pathInfo;
else
fullPath = servletPath;
// XXX: check cache
String realPath = request.getRealPath(servletPath);
Path path = Vfs.lookup().lookup(realPath);
if (! path.canRead() || path.isDirectory()) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
response.setContentType("text/html");
Statement stmt = new SSIParser(_factory).parse(path);
WriteStream out = Vfs.openWrite(response.getOutputStream());
try {
stmt.apply(out, request, response);
out.close();
} catch (Exception e) {
String errmsg = (String) request.getAttribute("caucho.ssi.errmsg");
if (errmsg != null && ! response.isCommitted()) {
log.log(Level.FINE, e.toString(), e);
response.setStatus(500, errmsg);
response.setContentType("text/html");
out.clearWrite();
out.println("<html><head>");
out.println("<title>" + errmsg + "</title>");
out.println("</head>");
out.println("<h1>" + errmsg + "</h1>");
out.println("</html>");
out.close();
}
else if (e instanceof RuntimeException)
throw (RuntimeException) e;
else if (e instanceof IOException)
throw (IOException) e;
else if (e instanceof ServletException)
throw (ServletException) e;
else
throw new ServletException(e);
}
}
}
| gpl-2.0 |
aweinert/pwgen-android | src/com/alexweinert/pwgen/PronouncablePasswordFactory.java | 10206 | package com.alexweinert.pwgen;
public class PronouncablePasswordFactory extends PasswordFactory {
private class pwElement {
String str;
boolean isConsonant;
boolean isDiphtong;
boolean notFirst;
private pwElement(String str, boolean isConsonant, boolean isDiphtong, boolean notFirst) {
this.str = str;
this.isConsonant = isConsonant;
this.isDiphtong = isDiphtong;
this.notFirst = notFirst;
}
}
private final pwElement[] elements = { new pwElement("a", false, false, false),// { "a", VOWEL },
new pwElement("ae", false, true, false), // { "ae", VOWEL | DIPTHONG },
new pwElement("ah", false, true, false), // { "ah", VOWEL | DIPTHONG },
new pwElement("ai", false, true, false), // { "ai", VOWEL | DIPTHONG },
new pwElement("b", true, false, false), // { "b", CONSONANT },
new pwElement("c", true, false, false), // { "c", CONSONANT },
new pwElement("ch", true, true, false), // { "ch", CONSONANT | DIPTHONG },
new pwElement("d", true, false, false), // { "d", CONSONANT },
new pwElement("e", false, false, false), // { "e", VOWEL },
new pwElement("ee", false, true, false), // { "ee", VOWEL | DIPTHONG },
new pwElement("ei", false, true, false), // { "ei", VOWEL | DIPTHONG },
new pwElement("f", true, false, false), // { "f", CONSONANT },
new pwElement("g", true, false, false), // { "g", CONSONANT },
new pwElement("gh", true, true, true), // { "gh", CONSONANT | DIPTHONG | NOT_FIRST },
new pwElement("h", true, false, false), // { "h", CONSONANT },
new pwElement("i", false, false, false), // { "i", VOWEL },
new pwElement("ie", false, true, false), // { "ie", VOWEL | DIPTHONG },
new pwElement("j", true, false, false), // { "j", CONSONANT },
new pwElement("k", true, false, false), // { "k", CONSONANT },
new pwElement("l", true, false, false), // { "l", CONSONANT },
new pwElement("m", true, false, false), // { "m", CONSONANT },
new pwElement("n", true, false, false), // { "n", CONSONANT },
new pwElement("ng", true, true, true), // { "ng", CONSONANT | DIPTHONG | NOT_FIRST },
new pwElement("o", false, false, false), // { "o", VOWEL },
new pwElement("oh", false, true, false), // { "oh", VOWEL | DIPTHONG },
new pwElement("oo", false, true, false), // { "oo", VOWEL | DIPTHONG},
new pwElement("p", true, false, false), // { "p", CONSONANT },
new pwElement("ph", true, true, false), // { "ph", CONSONANT | DIPTHONG },
new pwElement("qu", true, true, false), // { "qu", CONSONANT | DIPTHONG},
new pwElement("r", true, false, false), // { "r", CONSONANT },
new pwElement("s", true, false, false), // { "s", CONSONANT },
new pwElement("sh", true, true, false), // { "sh", CONSONANT | DIPTHONG},
new pwElement("t", true, false, false), // { "t", CONSONANT },
new pwElement("th", true, true, false), // { "th", CONSONANT | DIPTHONG},
new pwElement("u", false, false, false), // { "u", VOWEL },
new pwElement("v", true, false, false), // { "v", CONSONANT },
new pwElement("w", true, false, false), // { "w", CONSONANT },
new pwElement("x", true, false, false), // { "x", CONSONANT },
new pwElement("y", true, false, false), // { "y", CONSONANT },
new pwElement("z", true, false, false), // { "z", CONSONANT }
};
protected PronouncablePasswordFactory(IRandom randomGenerator, TriValueBoolean mayIncludeAmbiguous,
TriValueBoolean mayIncludeVowels, TriValueBoolean mustIncludeSymbols, TriValueBoolean mustIncludeDigits,
TriValueBoolean mustIncludeUppercase, TriValueBoolean includeLowercase) {
super(randomGenerator, mayIncludeAmbiguous, mayIncludeVowels, mustIncludeSymbols, mustIncludeDigits,
mustIncludeUppercase, includeLowercase);
}
@Override
public String getPassword(int length) {
String password = null;
do {
StringBuilder passwordBuilder = new StringBuilder();
boolean isFirst = true;
boolean shouldBeConsonant = (this.randomGenerator.getRandomInt(2) == 0);
pwElement previous = null;
while (passwordBuilder.length() < length) {
pwElement candidateElement = this.getAdmissableElement(shouldBeConsonant);
// Make sure that we do not pick an inadmissable element as first element
if (isFirst && candidateElement.notFirst) {
continue;
}
// Don't allow a vowel followed by a vowel/diphtong
if (previous != null && !previous.isConsonant && !candidateElement.isConsonant
&& candidateElement.isDiphtong) {
continue;
}
// Don't allow us to overflow the buffer
if (candidateElement.str.length() > (length - passwordBuilder.length())) {
continue;
}
String toAdd = candidateElement.str;
if (this.includeUppercase == TriValueBoolean.MUST && (isFirst || candidateElement.isConsonant)
&& this.randomGenerator.getRandomInt(10) < 2) {
char[] toAddCharArray = candidateElement.str.toCharArray();
toAddCharArray[0] = Character.toUpperCase(toAddCharArray[0]);
toAdd = String.valueOf(toAddCharArray);
}
// Ok, we found an element which matches our criteria, let's do it!
passwordBuilder.append(toAdd);
// If we are at the correct length, do not continue
if (passwordBuilder.length() >= length) {
break;
}
if (this.includeDigits == TriValueBoolean.MUST) {
if (!isFirst && this.randomGenerator.getRandomInt(10) < 3) {
char digit = this.getDigit();
passwordBuilder.append(digit);
// Restart the generation
isFirst = true;
previous = null;
shouldBeConsonant = (this.randomGenerator.getRandomInt(2) == 0);
continue;
}
}
if (this.includeSymbols == TriValueBoolean.MUST) {
if (!isFirst && this.randomGenerator.getRandomInt(10) < 2) {
char symbol = this.getSymbol();
passwordBuilder.append(symbol);
}
}
if (shouldBeConsonant) {
shouldBeConsonant = false;
} else {
if ((previous != null && !previous.isConsonant) || candidateElement.isDiphtong
|| this.randomGenerator.getRandomInt(10) < 3) {
shouldBeConsonant = true;
} else {
shouldBeConsonant = false;
}
}
previous = candidateElement;
isFirst = false;
}
password = passwordBuilder.toString();
} while (!this.isAdmissablePassword(password));
return password;
}
private char getDigit() {
char returnValue;
do {
returnValue = this.pw_digits.charAt(this.randomGenerator.getRandomInt(this.pw_digits.length()));
// If this may include ambiguous characters, one iteration is enough
} while (this.includeAmbiguous != TriValueBoolean.MUSTNOT ? false : this.pw_ambiguous.contains(String
.valueOf(returnValue)));
return returnValue;
}
private char getSymbol() {
char returnValue;
do {
returnValue = this.pw_symbols.charAt(this.randomGenerator.getRandomInt(this.pw_symbols.length()));
// If this may include ambiguous characters, one iteration is enough
} while (this.includeAmbiguous != TriValueBoolean.MUSTNOT ? false : this.pw_ambiguous.contains(String
.valueOf(returnValue)));
return returnValue;
}
private pwElement getAdmissableElement(boolean shouldBeConsonant) {
pwElement current = null;
do {
current = this.elements[this.randomGenerator.getRandomInt(this.elements.length)];
} while (shouldBeConsonant ? !current.isConsonant : current.isConsonant);
return current;
}
private boolean isAdmissablePassword(String password) {
boolean includesUppercase = false, includesDigits = false, includesSymbols = false;
for (char character : password.toCharArray()) {
CharSequence currentCharSequence = String.valueOf(character);
if (this.pw_uppers.contains(currentCharSequence)) {
includesUppercase = true;
}
if (this.pw_digits.contains(currentCharSequence)) {
includesDigits = true;
}
if (this.pw_symbols.contains(currentCharSequence)) {
includesSymbols = true;
}
}
if (this.includeUppercase == TriValueBoolean.MUST && !includesUppercase) {
return false;
}
if (this.includeDigits == TriValueBoolean.MUST && !includesDigits) {
return false;
}
if (this.includeSymbols == TriValueBoolean.MUST && !includesSymbols) {
return false;
}
return true;
}
public static void main(String[] args) {
PasswordFactory factory = (new Builder(new RandomGenerator())).mustIncludeUppercase().mustIncludeDigits()
.mustBePronouncable().create();
for (int i = 0; i < 20; ++i) {
System.out.println(factory.getPassword(8));
}
}
}
| gpl-2.0 |
dlitz/resin | modules/jca/src/javax/resource/spi/EISSystemException.java | 1569 | /*
* Copyright (c) 1998-2011 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Resin Open Source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
* of NON-INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with Resin Open Source; if not, write to the
* Free SoftwareFoundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307 USA
*
* @author Scott Ferguson
*/
package javax.resource.spi;
import javax.resource.ResourceException;
/**
* An exception with internal causes.
*/
public class EISSystemException extends ResourceException {
public EISSystemException()
{
}
public EISSystemException(String reason)
{
super(reason);
}
public EISSystemException(String reason, String errorCode)
{
super(reason, errorCode);
}
public EISSystemException(String reason, Throwable e)
{
super(reason, e);
}
public EISSystemException(Throwable e)
{
super(e);
}
}
| gpl-2.0 |
thangbn/Direct-File-Downloader | src/src/com/aelitis/azureus/core/networkmanager/impl/IncomingConnectionManager.java | 15120 | /*
* Created on 22 Jun 2006
* Created by Paul Gardner
* Copyright (C) 2006 Aelitis, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* AELITIS, SAS au capital de 46,603.30 euros
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
*
*/
package com.aelitis.azureus.core.networkmanager.impl;
import com.aelitis.azureus.core.networkmanager.NetworkManager;
import com.aelitis.azureus.core.networkmanager.Transport;
import org.gudy.azureus2.core3.logging.LogEvent;
import org.gudy.azureus2.core3.logging.LogIDs;
import org.gudy.azureus2.core3.logging.Logger;
import org.gudy.azureus2.core3.util.*;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class
IncomingConnectionManager
{
private static final LogIDs LOGID = LogIDs.NWMAN;
private static IncomingConnectionManager singleton = new IncomingConnectionManager();
public static IncomingConnectionManager
getSingleton()
{
return( singleton );
}
private volatile Map match_buffers_cow = new HashMap(); // copy-on-write
private final AEMonitor match_buffers_mon = new AEMonitor( "IncomingConnectionManager:match" );
private int max_match_buffer_size = 0;
private int max_min_match_buffer_size = 0;
private final ArrayList connections = new ArrayList();
private final AEMonitor connections_mon = new AEMonitor( "IncomingConnectionManager:conns" );
protected
IncomingConnectionManager()
{
SimpleTimer.addPeriodicEvent(
"IncomingConnectionManager:timeouts",
5000,
new TimerEventPerformer() {
public void perform( TimerEvent ev ) {
doTimeoutChecks();
}
}
);
}
public boolean
isEmpty()
{
return( match_buffers_cow.isEmpty());
}
// returns MatchListener,RoutingData if matched
public Object[]
checkForMatch(
TransportHelper transport,
int incoming_port,
ByteBuffer to_check,
boolean min_match )
{
//remember original values for later restore
int orig_position = to_check.position();
int orig_limit = to_check.limit();
//rewind
to_check.position( 0 );
MatchListener listener = null;
Object routing_data = null;
for( Iterator i = match_buffers_cow.entrySet().iterator(); i.hasNext() && !transport.isClosed(); ) {
Map.Entry entry = (Map.Entry)i.next();
NetworkManager.ByteMatcher bm = (NetworkManager.ByteMatcher)entry.getKey();
MatchListener this_listener = (MatchListener)entry.getValue();
int specific_port = bm.getSpecificPort();
if ( specific_port != -1 && specific_port != incoming_port ){
continue;
}
if ( min_match ){
if( orig_position < bm.minSize() ) { //not enough bytes yet to compare
continue;
}
routing_data = bm.minMatches( transport, to_check, incoming_port );
if ( routing_data != null ){
listener = this_listener;
break;
}
}else{
if( orig_position < bm.matchThisSizeOrBigger() ) { //not enough bytes yet to compare
continue;
}
routing_data = bm.matches( transport, to_check, incoming_port );
if ( routing_data != null ){
listener = this_listener;
break;
}
}
}
//restore original values in case the checks changed them
to_check.position( orig_position );
to_check.limit( orig_limit );
if ( listener == null ){
return( null );
}
return( new Object[]{ listener, routing_data });
}
/**
* Register the given byte sequence matcher to handle matching against new incoming connection
* initial data; i.e. the first bytes read from a connection must match in order for the given
* listener to be invoked.
* @param matcher byte filter sequence
* @param listener to call upon match
*/
public void
registerMatchBytes(
NetworkManager.ByteMatcher matcher,
MatchListener listener )
{
try { match_buffers_mon.enter();
if( matcher.maxSize() > max_match_buffer_size ) {
max_match_buffer_size = matcher.maxSize();
}
if ( matcher.minSize() > max_min_match_buffer_size ){
max_min_match_buffer_size = matcher.minSize();
}
Map new_match_buffers = new HashMap( match_buffers_cow );
new_match_buffers.put( matcher, listener );
match_buffers_cow = new_match_buffers;
addSharedSecrets( matcher.getSharedSecrets());
}finally {
match_buffers_mon.exit();
}
}
/**
* Remove the given byte sequence match from the registration list.
* @param to_remove byte sequence originally used to register
*/
public void
deregisterMatchBytes(
NetworkManager.ByteMatcher to_remove )
{
try { match_buffers_mon.enter();
Map new_match_buffers = new HashMap( match_buffers_cow );
new_match_buffers.remove( to_remove );
if( to_remove.maxSize() == max_match_buffer_size ) { //recalc longest buffer if necessary
max_match_buffer_size = 0;
for( Iterator i = new_match_buffers.keySet().iterator(); i.hasNext(); ) {
NetworkManager.ByteMatcher bm = (NetworkManager.ByteMatcher)i.next();
if( bm.maxSize() > max_match_buffer_size ) {
max_match_buffer_size = bm.maxSize();
}
}
}
match_buffers_cow = new_match_buffers;
removeSharedSecrets( to_remove.getSharedSecrets());
} finally { match_buffers_mon.exit(); }
}
public void
addSharedSecrets(
byte[][] secrets )
{
if ( secrets != null ){
ProtocolDecoder.addSecrets( secrets );
}
}
public void
removeSharedSecrets(
byte[][] secrets )
{
if ( secrets != null ){
ProtocolDecoder.removeSecrets( secrets );
}
}
public int
getMaxMatchBufferSize()
{
return( max_match_buffer_size );
}
public int
getMaxMinMatchBufferSize()
{
return( max_min_match_buffer_size );
}
public void
addConnection(
int local_port,
TransportHelperFilter filter,
Transport new_transport )
{
TransportHelper transport_helper = filter.getHelper();
if ( isEmpty()) { //no match registrations, just close
if ( Logger.isEnabled()){
Logger.log(new LogEvent(LOGID, "Incoming connection from [" + transport_helper.getAddress() +
"] dropped because zero routing handlers registered"));
}
transport_helper.close( "No routing handler" );
return;
}
// note that the filter may have some data internally queued in it after the crypto handshake decode
// (in particular the BT header). However, there should be some data right behind it that will trigger
// a read-select below, thus giving prompt access to the queued data
final IncomingConnection ic = new IncomingConnection( filter, getMaxMatchBufferSize());
TransportHelper.selectListener sel_listener = new SelectorListener( local_port, new_transport );
try{
connections_mon.enter();
connections.add( ic );
transport_helper.registerForReadSelects( sel_listener, ic );
}finally{
connections_mon.exit();
}
// might be stuff queued up in the filter - force one process cycle (NAT check in particular )
sel_listener.selectSuccess( transport_helper, ic );
}
protected void
removeConnection(
IncomingConnection connection,
boolean close_as_well,
String reason )
{
try{
connections_mon.enter();
connection.filter.getHelper().cancelReadSelects();
connections.remove( connection ); //remove from connection list
}finally{
connections_mon.exit();
}
if( close_as_well ) {
connection.filter.getHelper().close( "Tidy close" + ( reason==null||reason.length()==0?"":(": " + reason )));
}
}
protected void
doTimeoutChecks()
{
try{ connections_mon.enter();
ArrayList to_close = null;
long now = SystemTime.getCurrentTime();
for( int i=0; i < connections.size(); i++ ){
IncomingConnection ic = (IncomingConnection)connections.get( i );
TransportHelper transport_helper = ic.filter.getHelper();
if( ic.last_read_time > 0 ) { //at least one read op has occured
if( now < ic.last_read_time ) { //time went backwards!
ic.last_read_time = now;
}
else if( now - ic.last_read_time > transport_helper.getReadTimeout()) {
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, "Incoming connection ["
+ transport_helper.getAddress()
+ "] forcibly timed out due to socket read inactivity ["
+ ic.buffer.position() + " bytes read: "
+ new String(ic.buffer.array()) + "]"));
if( to_close == null ) to_close = new ArrayList();
to_close.add( ic );
}
}
else { //no bytes have been read yet
if( now < ic.initial_connect_time ) { //time went backwards!
ic.initial_connect_time = now;
}
else if( now - ic.initial_connect_time > transport_helper.getConnectTimeout()) {
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, "Incoming connection ["
+ transport_helper.getAddress() + "] forcibly timed out after "
+ "60sec due to socket inactivity"));
if( to_close == null ) to_close = new ArrayList();
to_close.add( ic );
}
}
}
if( to_close != null ) {
for( int i=0; i < to_close.size(); i++ ) {
IncomingConnection ic = (IncomingConnection)to_close.get( i );
removeConnection( ic, true, "incoming connection routing timeout" );
}
}
} finally { connections_mon.exit(); }
}
protected static class
IncomingConnection
{
protected final TransportHelperFilter filter;
protected final ByteBuffer buffer;
protected long initial_connect_time;
protected long last_read_time = -1;
protected
IncomingConnection(
TransportHelperFilter filter, int buff_size )
{
this.filter = filter;
this.buffer = ByteBuffer.allocate( buff_size );
this.initial_connect_time = SystemTime.getCurrentTime();
}
}
protected class
SelectorListener
implements TransportHelper.selectListener
{
private int local_port;
private Transport transport;
protected
SelectorListener(
int _local_port,
Transport _transport )
{
local_port = _local_port;
transport = _transport;
}
public boolean
selectSuccess(
TransportHelper transport_helper, Object attachment )
{
IncomingConnection ic = (IncomingConnection)attachment;
try {
long bytes_read = ic.filter.read( new ByteBuffer[]{ ic.buffer }, 0, 1 );
if( bytes_read < 0 ) {
throw new IOException( "end of stream on socket read" );
}
if( bytes_read == 0 ) {
return false;
}
ic.last_read_time = SystemTime.getCurrentTime();
Object[] match_data = checkForMatch( transport_helper, local_port, ic.buffer, false );
if( match_data == null ) { //no match found
if( transport_helper.isClosed() ||
ic.buffer.position() >= getMaxMatchBufferSize()) { //we've already read in enough bytes to have compared against all potential match buffers
ic.buffer.flip();
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID,
LogEvent.LT_WARNING,
"Incoming stream from [" + transport_helper.getAddress()
+ "] does not match "
+ "any known byte pattern: "
+ ByteFormatter.nicePrint(ic.buffer.array(), 128)));
removeConnection( ic, true, "routing failed: unknown hash" );
}
}
else { //match found!
ic.buffer.flip();
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID,
"Incoming stream from [" + transport_helper.getAddress()
+ "] recognized as "
+ "known byte pattern: "
+ ByteFormatter.nicePrint(ic.buffer.array(), 64)));
removeConnection( ic, false, null );
transport.setAlreadyRead( ic.buffer );
transport.connectedInbound();
IncomingConnectionManager.MatchListener listener = (IncomingConnectionManager.MatchListener)match_data[0];
listener.connectionMatched( transport, match_data[1] );
}
return( true );
}
catch( Throwable t ) {
try {
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID,
LogEvent.LT_WARNING,
"Incoming connection [" + transport_helper.getAddress()
+ "] socket read exception: "
+ t.getMessage()));
}
catch( Throwable x ) {
Debug.out( "Caught exception on incoming exception log:" );
x.printStackTrace();
System.out.println( "CAUSED BY:" );
t.printStackTrace();
}
removeConnection( ic, true, t==null?null:Debug.getNestedExceptionMessage(t));
return( false );
}
}
//FAILURE
public void
selectFailure(
TransportHelper transport_helper,
Object attachment,
Throwable msg )
{
IncomingConnection ic = (IncomingConnection)attachment;
if (Logger.isEnabled()){
Logger.log(new LogEvent(LOGID, LogEvent.LT_WARNING,
"Incoming connection [" + transport_helper.getAddress()
+ "] socket select op failure: "
+ msg.getMessage()));
}
removeConnection( ic, true, msg==null?null:Debug.getNestedExceptionMessage(msg));
}
}
/**
* Listener for byte matches.
*/
public interface MatchListener {
/**
* Currently if message crypto is on and default fallback for incoming not
* enabled then we would bounce incoming messages from non-crypto transports
* For example, NAT check
* This method allows auto-fallback for such transports
* @return
*/
public boolean
autoCryptoFallback();
/**
* The given socket has been accepted as matching the byte filter.
* @param channel matching accepted connection
* @param read_so_far bytes already read
*/
public void
connectionMatched(
Transport transport,
Object routing_data );
}
}
| gpl-2.0 |
sigee/Open-Realms-of-Stars | src/test/java/org/openRealmOfStars/player/fleet/FleetListTest2.java | 13087 | package org.openRealmOfStars.player.fleet;
import static org.junit.Assert.*;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Mockito.*;
import org.openRealmOfStars.player.fleet.Fleet;
import org.openRealmOfStars.player.fleet.FleetList;
/**
*
* Open Realm of Stars game project Copyright (C) 2017 tnwls654
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses/
*
*
* Test for FleetList class
*/
public class FleetListTest2 {
/**
* testing constructor of FleetList
*/
@Test
public void constructorTest() {
FleetList fleetlist = new FleetList();
assertEquals(0, fleetlist.getNumberOfFleets()); // test
assertNull(fleetlist.getCurrent());
}
/**
* testing add method input: Fleet fleet1, Fleet fleet2 output: fleetlist
* with fleet1,fleet2
*/
@Test
public void addtest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
fleetlist.add(fleet1);
assertEquals(0, fleetlist.getIndex());
assertEquals(fleet1, fleetlist.getCurrent());
fleetlist.add(fleet2);
assertEquals(0, fleetlist.getIndex());
assertEquals(fleet1, fleetlist.getCurrent());
}
/**
* testing remove method input: index of fleetlist to remove: 0, 1 output:
* fleetlist with removing fleet1, fleet2
*/
@Test
public void removeTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
fleetlist.add(fleet1); // 0
fleetlist.add(fleet2); // 1
fleetlist.add(fleet3); // 2
// indexToremove =< index
fleetlist.remove(0);
assertEquals(2, fleetlist.getNumberOfFleets());
assertEquals(fleet2, fleetlist.getCurrent());
// indexToremove > index
fleetlist.remove(1);
assertEquals(1, fleetlist.getNumberOfFleets());
assertEquals(fleet2, fleetlist.getCurrent());
}
/**
* testing method getNext input: nothing output: return the next index from
* current index of a fleetlist
*/
@Test
public void getNextTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList(); //
assertNull(fleetlist.getNext());
fleetlist.add(fleet1);
assertEquals(fleet1, fleetlist.getNext()); // index=0 test
fleetlist.add(fleet2);
fleetlist.add(fleet3);
assertEquals(fleet1, fleetlist.getCurrent());
assertEquals(fleet2, fleetlist.getNext());
assertEquals(fleet3, fleetlist.getNext());
assertEquals(fleet1, fleetlist.getNext());
}
/**
* testing method getFirst input : nothing output: return the first index of
* a fleetlist
*/
@Test
public void getFirstTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList(); //
assertNull(fleetlist.getFirst());
fleetlist.add(fleet1);
fleetlist.add(fleet2);
assertEquals(fleet1, fleetlist.getFirst());
}
/**
* testing method getPrev input: nothing output: return the previous index
* from current index of a fleetlist
*/
@Test
public void getPrevTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList(); //
assertNull(fleetlist.getPrev());
fleetlist.add(fleet1);
assertEquals(fleet1, fleetlist.getPrev());
fleetlist.add(fleet2);
fleetlist.add(fleet3);
assertEquals(fleet1, fleetlist.getCurrent());
assertEquals(fleet3, fleetlist.getPrev());
assertEquals(fleet2, fleetlist.getPrev());
assertEquals(fleet1, fleetlist.getPrev());
}
/**
* testing method getByIndex input: index of fleetlist: 3, -1, 1 output:
* return fleet matching to input index : null, null, fleet2 ( if input
* index is out of array, then return null )
*/
@Test
public void getByIndexTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
assertNull(fleetlist.getByIndex(0));
fleetlist.add(fleet1);
fleetlist.add(fleet2);
fleetlist.add(fleet3);// index=0,
assertNull(fleetlist.getByIndex(3));
assertNull(fleetlist.getByIndex(-1));
assertEquals(fleet2, fleetlist.getByIndex(1));
}
/**
* testing method getByName input: (String) fleet name : "Fleet #1", "Fleet
* #2" output: return fleet matching to fleet name: fleet1, fleet2
*/
@Test
public void getByNameTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
assertNull(fleetlist.getByName("Fleet #1"));
fleetlist.add(fleet1);
fleetlist.add(fleet2);
fleetlist.add(fleet3);
assertEquals(fleet1, fleetlist.getByName("Fleet #1"));
assertNotEquals(fleet1, fleetlist.getByName("Fleet #2"));
}
/**
* testing method getIndexByname input: (String) fleet name: "Fleet #1",
* "Fleet #4", "Fleet #2", output: return index of the input fleet : 0, 3, 1
*/
@Test
public void getIndexByNameTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
assertEquals(-1, fleetlist.getIndexByName("Fleet #1"));
fleetlist.add(fleet1);
fleetlist.add(fleet2);
fleetlist.add(fleet3);
assertEquals(0, fleetlist.getIndexByName("Fleet #1"));
assertNotEquals(3, fleetlist.getIndexByName("Fleet #4")); // i >
// fleetlist.size
assertNotEquals(0, fleetlist.getIndexByName("Fleet #2")); // NOT
// fleet.getName().equals
}
/**
* testing method recalculateList input: nothing output: recalculated
* fleetlist
*/
@Test
public void recalculateListTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
fleetlist.add(fleet1);
fleetlist.add(fleet2);
fleetlist.add(fleet3);
fleetlist.remove(0);
fleetlist.remove(0);
fleetlist.recalculateList();
}
/**
* testing method howManyFleetWithStartingNames input: (String)fleet name :
* "Fleet", "abc" output: return (int)number of fleet containing same
* starting name: 3, 0
*/
@Test
public void howManyFleetWithStartingNamesTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
fleetlist.add(fleet1);
fleetlist.add(fleet2);
fleetlist.add(fleet3);
assertEquals(3, fleetlist.howManyFleetWithStartingNames("Fleet"));
assertEquals(0, fleetlist.howManyFleetWithStartingNames("abc"));
}
/**
* testing method isUniqueName input: (String) fleet name: "abc", "fleet #1"
* output: return false, true
*/
@Test
public void isUniqueNameTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
fleetlist.add(fleet1);
fleetlist.add(fleet2);
assertTrue(fleetlist.isUniqueName("abc", null));
assertEquals(false, fleetlist.isUniqueName("fleet #1", null));
assertEquals(true, fleetlist.isUniqueName("fleet #1", fleet1));
assertEquals(false, fleetlist.isUniqueName("fleet #1", fleet2));
}
/**
* testing method generateUniqueName input: nothing output: return (String)
* new fleet name: "Fleet #1","Fleet #3", "Fleet #6"
*/
@Test
public void generateUniqueNameTest() {
Fleet fleet1 = Mockito.mock(Fleet.class);
Mockito.when(fleet1.getName()).thenReturn("Fleet #1");
Fleet fleet2 = Mockito.mock(Fleet.class);
Mockito.when(fleet2.getName()).thenReturn("Fleet #2");
Fleet fleet3 = Mockito.mock(Fleet.class);
Mockito.when(fleet3.getName()).thenReturn("Fleet #3");
FleetList fleetlist = new FleetList();
assertEquals("Fleet #1", fleetlist.generateUniqueName());
fleetlist.add(fleet1); // 2
fleetlist.add(fleet2); // 3
assertEquals("Fleet #3", fleetlist.generateUniqueName());
fleetlist.add(fleet3);// 4
fleetlist.add(fleet3);// 5
fleetlist.add(fleet3);// 6
assertEquals("Fleet #6", fleetlist.generateUniqueName());
}
}
| gpl-2.0 |
Hirokachi/SimpleNetworkReportingTool | src/snrt/GUIComponent.java | 18184 | /*
* This class contains the information for the GUI to run
* on this program.
*/
package snrt;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.Timer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTable;
import java.awt.*;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import java.util.ArrayDeque;
import javax.swing.JPasswordField;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Alex Gaskill
*/
public class GUIComponent extends JPanel
implements ActionListener {
/**
* The private variables that I don't wish to pass everywhere.
* Here is the List:
* JButton getProcess, killTask, goSearch, settings
* JTable processList
* JScrollPane scrollerText
* ProcessComponent pID
* JPasswordField password
* JTextField user
* integer resultFilterNumber, delay
* boolean isMatchedHighlighted
*/
private final JButton getProcess, killTask, settings;
private final JTable processList;
private final JScrollPane scrollerText;
private final ProcessComponent processComponent;
private final JTextArea numberOfProcess;
private JRadioButtonMenuItem namesOfComputers;
private JPasswordField password;
private JTextField user, searchFilter;
private int resultFilterNumber, delay;
private boolean isMatchedHighlighted;
/**
* Defines the GUIComponent class and sets it up to be used.
* No parameters needed.
*/
public GUIComponent() {
//Default Delay for refresh of the tasklist in milliseconds
delay = 4500;
//Creating the ProcessComponent object.
processComponent = new ProcessComponent();
//sets the possible connected computers
setRadioButtons();
//get the number of tasks
int numberOfProcesses = processComponent.getProcesses().size()-3;
//Set up the string that will go in to the text area
String processes = "number of Processes: " + numberOfProcesses;
//Create an object of a textArea.
numberOfProcess = new JTextArea(processes);
//The textbox for filtering processes
searchFilter = new JTextField(12);
//Make the number of processes not editable.
numberOfProcess.setEditable(false);
//Creates the JTable with the correct number of columns and rows
processList = new JTable (numberOfProcesses, 5);
//Set the names for the title of the jtable "processList"
String[] title = {"Image Name", "PID", "Session Name", "Session#",
"Mem Usage (K)"};
//this sets the title of the jtable "processList".
for (int x = 0 ; x < 5; x++) {
processList.getColumnModel().getColumn(x).setHeaderValue(title[x]);
}
//Sets the "processList" to fully fill the scroller text
processList.setFillsViewportHeight(true);
//Sets the processList in the ScrollPane
scrollerText = new JScrollPane(processList);
//Sets the scroller panel to be able to detect the wheel and scroll.
scrollerText.setWheelScrollingEnabled(true);
//Creates the Button "Go Get Processes" and sets it up to allow the user
//to refresh the task list anytime they want.
getProcess = new JButton("Go Get Processes!");
getProcess.setActionCommand("goGetIt");
//Creates a local actionListener to refresh the task list.
ActionListener taskPerformer = (ActionEvent evt) -> {
if (searchFilter.getText().equalsIgnoreCase("")) {
if ( !namesOfComputers.isSelected()){
setJTable(processComponent.getProcesses());
}
else {
setJTable(processComponent.getProcesses(namesOfComputers.getSelectedObjects()
[0], user.getText(), password.getPassword()));
}
}
else {
if (isMatchedHighlighted) {
highlightFilter(searchFilter.getText()
,processComponent.getProcesses());
}
else {
setJTable(searchFilter(searchFilter.getText(),
processComponent.getProcesses()));
}
}
};
//Creates a new timer to be used in refreshing the task list after the
//number of milliseconds defined by the delay variable.
new Timer(delay, taskPerformer).start();
//Settings button
settings = new JButton("settings");
settings.setActionCommand("goSetIt");
settings.addActionListener(this);
//Creates the Button "Kill Selected Process" and sets it up.
killTask = new JButton("Kill Selected Process");
killTask.setActionCommand("goKillIt");
//Listens for pressed button "getProcess".
getProcess.addActionListener(this);
//Listens for pressed button "killTask".
killTask.addActionListener(this);
//Sets the tool tip on the buttons.
getProcess.setToolTipText("Click this button to get processes on this"
+ " computer.");
killTask.setToolTipText("Click this button after selecting a process"
+ " to kill it.");
}
/**
* This method dictates what happens when one of the predefined buttons is
* pressed
* @param e: whole button object which is passed to this method when
* the button is pressed and released.
*/
@Override
public void actionPerformed(ActionEvent e) {
//The action command is obtained by the internal method called
//"getActionCommand" as long as that is not null then it will switch
//on whatever the actioncommand had assigned to it.
if (null != e.getActionCommand())
switch (e.getActionCommand()) {
case "goGetIt":
//sets the Jlist with the "processList" from the "getProcesses"
//method.
setJTable(processComponent.getProcesses());
break;
case "goKillIt":
int row;
int column;
//before trying to kill selected process it will check to see
//if there is a process selected. if no process is selected and
//they click the kill button it will display the warning message.
if (processList.getSelectedRow() != -1) {
//Set the row and column of the selected cell.
row = processList.getSelectedRow();
column = processList.getSelectedColumn();
//if no radio button is selected then kill the task on this
//computer.
if(!namesOfComputers.isSelected()) {
//pass the Process ID to the kill method
processComponent.killSelectedProcess(processList.getValueAt(row, column)
.toString());
}
else {
//To-Do: make a new killtask process.
}
}
else
JOptionPane.showMessageDialog(null, "No process was"
+ " selected; not ending any tasks.", "Warning:"
, JOptionPane.OK_OPTION);
break;
case "goGetThat":
password = new JPasswordField(12);
user = new JTextField(12);
JTextPane menu = new JTextPane();
menu.add(password);
menu.add(user);
JOptionPane.showConfirmDialog(null, menu, "Please enter the username and"
+ " password for the selected computer:", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
setJTable(processComponent.getProcesses(namesOfComputers.getSelectedObjects()
[0], user.getText(), password.getPassword()));
break;
case "goSetIt":
SettingComponent setIt = new SettingComponent();
setIt.SettingGUI(this);
break;
}
}
/*
* Filter the tasks by the searchValue
* @param searchValue, tasks
* @return
*/
private ArrayDeque<String> searchFilter (String searchValue, ArrayDeque<String> tasks) {
//Set the "resultFilterNumber" to zero.
resultFilterNumber = 0;
//add the number of rows to the jtable so it looks nice.
DefaultTableModel dtm = (DefaultTableModel) processList.getModel();
dtm.setRowCount(0);
//The variable that will store the tasks that match the filter value
ArrayDeque<String> filteredTasks = new ArrayDeque();
//Verifies that the searchvalue is not empty
if (searchValue != null) {
//start looking throught the processes.
tasks.stream().forEach((task) -> {
//grab the image name to see if the search value is contained in
// the image name. Add one to the resulting processes number in
// the search.
String name = task.split(" ")[0];
if (name.toLowerCase().contains(searchValue.toLowerCase())) {
filteredTasks.add(task);
resultFilterNumber++;
}
});
}
return (filteredTasks);
}
/*
* Highlights the rows that contains the searchValue.
*/
private void highlightFilter (String searchValue, ArrayDeque<String> taskList ) {
//Verifies that we aren't looking for a empty string
if (!searchValue.isEmpty()) {
//Creates a counter to count the number of the tasks that matched
//the searchValue
int matchedTasks;
// Creates the array to store the matching tasks
ArrayDeque<String> matchedTaskList = new ArrayDeque();
//Duplicate the taskList
ArrayDeque<String> DuplicateTaskList = new ArrayDeque();
DuplicateTaskList.addAll(taskList);
//start looking throught the processes.
taskList.stream().forEach((task) -> {
//grab the image name to see if the search value is contained in
// the image name. Add the matched value to the Array. Remove
//that matched task from task list.
String name = task.split(" ")[0];
if (name.toLowerCase().contains(searchValue.toLowerCase())) {
matchedTaskList.add(task);
DuplicateTaskList.remove(task);
}
});
//Find the size of the ArrayDeque at this point to highLight the
//found matches
matchedTasks = matchedTaskList.size();
//Adds the rest of the tasks to the sorted tasks
matchedTaskList.addAll(DuplicateTaskList);
//Sets the table with the sorted Tasks
setJTable(matchedTaskList);
//Selects the tasks from the top of the to the row that the task
processList.addRowSelectionInterval(0, matchedTasks);
}
}
/**
* Set the delay until the next time it refreshes
* @param refreshRate: is the time until next refresh in milliseconds
*/
public void setDelay(int refreshRate) {
delay = refreshRate;
}
/**
* Gets the delay until the next time it refreshes
* @return delay: returns the String version if the delay number
*/
public String getDelay() {
return (Integer.toString(delay));
}
/**
* Sets the way that the filter shows results
* @param filter: description of how filter shows results
*/
public void setFilter(String filter) {
String answer = "Highlight results";
isMatchedHighlighted = answer.equals(filter);
}
/*
* sets the JTable with the data for the program.
* @param taskList is the information that it gets from the process
* component.
*/
private void setJTable(ArrayDeque<String> taskList) {
//if the "resultFilterNumber" more than or equal to the total number of
//processes than it wasn't filtered. Otherwise it is filtered, so set the
//number of rows in the table to the result number of processes
if (searchFilter.getText().equalsIgnoreCase("")
|| isMatchedHighlighted) {
//add the number of rows to the jtable so it looks nice.
DefaultTableModel dtm = (DefaultTableModel) processList.getModel();
dtm.setRowCount(processComponent.getProcesses().size()-3);
}
else {
//add the number of rows to the jtable so it looks nice.
DefaultTableModel dtm = (DefaultTableModel) processList.getModel();
dtm.setRowCount(resultFilterNumber);
}
//Set up the string that will go in to the text area
String processes = "number of Processes: " + processComponent.getProcesses().size();
//Set the number of processes in the text area.
numberOfProcess.setText(processes);
//verifies that the table has been set
boolean hasBeenSet = false;
int i = 0;
//does the heavy lifting of getting the data into the table.
for(String words:taskList) {
int j = 0;
for(String word: words.split("\\s")) {
if(word.matches("[a-zA-Z]+\\.*[a-zA-Z]+\\.exe") ||
word.contains("System") ||
word.matches("\\p{Digit}+\\,*\\p{Digit}*") ||
word.contains("HP") || word.contains("Services") ||
word.contains("Console") ||
word.matches("[a-zA-Z]+[0-9]+\\.exe") ||
word.matches("[a-zA-Z]+\\-[a-zA-Z]+\\.exe")) {
processList.setValueAt(word, i, j);
hasBeenSet = true;
}
else if(j == 2 && !hasBeenSet && word.isEmpty()) {
processList.setValueAt("No Value", i, j);
hasBeenSet = true;
}
if (j < 5 && j >= 0 && hasBeenSet){
j++;
hasBeenSet = false;
}
}
if(words.contains(".exe") || words.contains("HP")
|| words.contains("System")) {
i++;
}
}
}
/*
* set the names of the connected devices as radio button
*/
private void setRadioButtons() {
//create the holder to hold the resulting computer names
namesOfComputers = new JRadioButtonMenuItem();
//as long as there are computers that are seen by this computer then
//show the names of those computers
if (!processComponent.getComputerNames().isEmpty()) {
//Does the heavy Lifting for the names of computers;
processComponent.getComputerNames().stream().map((lines) -> new JRadioButton(lines)).map((computerName) -> {
computerName.setActionCommand("goGetThat");
return computerName;
}).map((computerName) -> {
computerName.addActionListener(this);
return computerName;
}).forEach((computerName) -> {
namesOfComputers.add(computerName);
});
}
}
/** * Create the GUI and show it.
*/
public void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("Simple Network Reporter Tool - SNRT");
//Sets the DefaultCloseOperation to exit; this means that when you hit
//the x on the window how will the program respond.In this case, it will
//exit the program cleanly once the window is closed by hitting the x.
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//sets the layout to a GridBagLayout
frame.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
//Sets the constraints for this component
c.gridy = 10;
c.weightx = 0.5;
// the anchor tells the following component where to be on the frame
// from row it is set with the gridy
c.anchor = GridBagConstraints.CENTER;
//add this component to the frame with the above constrants
frame.add(scrollerText, c);
c.gridx = 0;
c.gridy = 0; //resets the row where the component will go.
c.anchor = GridBagConstraints.FIRST_LINE_START;
frame.add(settings, c);
c.anchor = GridBagConstraints.PAGE_START;
frame.add(searchFilter, c);
c.gridy = 15; // sets the following components to be at the end of
// the frame
c.anchor = GridBagConstraints.LAST_LINE_START;
frame.add(getProcess, c);
c.anchor = GridBagConstraints.PAGE_END;
frame.add(killTask, c);
c.anchor = GridBagConstraints.LAST_LINE_END;
frame.add(numberOfProcess, c);
//Display the window.
frame.pack();
frame.setBounds(0, 0, 550, 600);
frame.setVisible(true);
}
} | gpl-2.0 |
paawak/blog | code/SpringMVC/src/main/java/com/swayam/demo/web/formbean/ItemBean.java | 2795 | /*
* ItemBean.java
*
* Created on Aug 28, 2010 8:37:19 PM
*
* Copyright (c) 2002 - 2008 : Swayam Inc.
*
* P R O P R I E T A R Y & C O N F I D E N T I A L
*
* The copyright of this document is vested in Swayam Inc. without
* whose prior written permission its contents must not be published,
* adapted or reproduced in any form or disclosed or
* issued to any third party.
*/
package com.swayam.demo.web.formbean;
import java.util.Date;
import java.util.List;
/**
*
* @author paawak
*/
public class ItemBean {
private List<ItemRow> items;
private float totalPrice;
private Date expectedDelivery;
public List<ItemRow> getItems() {
return items;
}
public void setItems(List<ItemRow> items) {
this.items = items;
}
public float getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(float totalPrice) {
this.totalPrice = totalPrice;
}
public Date getExpectedDelivery() {
return expectedDelivery;
}
public void setExpectedDelivery(Date expectedDelivery) {
this.expectedDelivery = expectedDelivery;
}
public static class ItemRow {
private boolean selected;
private String itemName;
private float price;
private int quantity;
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((itemName == null) ? 0 : itemName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ItemRow other = (ItemRow) obj;
if (itemName == null) {
if (other.itemName != null)
return false;
} else if (!itemName.equals(other.itemName))
return false;
return true;
}
}
}
| gpl-2.0 |
ccancellieri/shoppingCart | src/test/java/it/ccancellieri/cart/ReceiptTest.java | 1431 | package it.ccancellieri.cart;
import it.ccancellieri.goods.Book;
import it.ccancellieri.goods.Food;
import it.ccancellieri.goods.RegularGood;
import it.ccancellieri.taxes.RegularSaleTax;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.math.BigDecimal;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
public class ReceiptTest {
private final ShoppingCart cart = new ShoppingCart();
@Before
public void before() {
cart.buy(new Book("book", new BigDecimal("12.49")));
cart.buy(new RegularGood("music CD", new BigDecimal("14.99"), new RegularSaleTax()));
cart.buy(new Food("chocolate bar", new BigDecimal("0.85")));
}
@Test
public void givenAShoppingCart_whenPurcaseAllItems_thenIReceiveAReceiptListingAllTheNamesAndTheirPriceInTheDesiredFormat() {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = null;
try {
ps = new PrintStream(baos);
final Receipt receipt = new Receipt(cart, ps);
receipt.printReceipt();
// System.out.println(baos.toString());
Assert.assertTrue(baos.toString().equals("1 book: 12.49\n1 music CD: 16.49\n1 chocolate bar: 0.85\nSales Taxes: 1.50\nTotal: 29.83\n"));
} finally {
if (ps != null) {
ps.close();
}
}
}
}
| gpl-2.0 |
rebeca-lang/org.rebecalang.modeltransformer | src/main/java/org/rebecalang/modeltransformer/ros/packageCreator/SrcDirectoryCreator.java | 2185 | package org.rebecalang.modeltransformer.ros.packageCreator;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import org.rebecalang.compiler.utils.ExceptionContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SrcDirectoryCreator{
// protected String dirPath;
// protected String rosPackagePath;
// protected ExceptionContainer container;
// public SrcDirectoryCreator(File destinationLocation, String modelName, ExceptionContainer container) {
// this.rosPackagePath = destinationLocation.getAbsolutePath() + File.separatorChar + modelName;
// this.dirPath = rosPackagePath + File.separatorChar + "src";
// this.container = container;
// this.createDirectory();
// }
@Autowired
ExceptionContainer exceptionContainer;
private String getPath(File destinationLocation, String modelName) {
String rosPackagePath = destinationLocation.getAbsolutePath() + File.separatorChar + modelName;
return rosPackagePath + File.separatorChar + "src";
}
public boolean createDirectory(File destinationLocation, String modelName) {
boolean success = true;
File file = new File(getPath(destinationLocation, modelName));
file.mkdirs();
return success;
}
public boolean addFile(File destinationLocation, String modelName, String fileName, String fileContent) throws IOException {
boolean success = true;
/* create file */
String filePath = getPath(destinationLocation, modelName) + File.separatorChar + fileName;
File file = new File(filePath);
try{
file.createNewFile();
} catch(IOException e) {
exceptionContainer.addException(e);
e.printStackTrace();
success = false;
}
/* fill the file */
try {
Writer writer = new FileWriter(file);
BufferedWriter bufferedWriter = new BufferedWriter(writer);
bufferedWriter.write(fileContent);
bufferedWriter.close();
} catch (IOException e) {
exceptionContainer.addException(e);
e.printStackTrace();
success = false;
}
return success;
}
}
| gpl-2.0 |
crotwell/sod | src/main/java/edu/sc/seis/sod/subsetter/availableData/AvailableDataAND.java | 1735 | package edu.sc.seis.sod.subsetter.availableData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import edu.iris.Fissures.IfSeismogramDC.RequestFilter;
import edu.iris.Fissures.network.ChannelImpl;
import edu.sc.seis.fissuresUtil.cache.CacheEvent;
import edu.sc.seis.sod.ConfigurationException;
import edu.sc.seis.sod.CookieJar;
import edu.sc.seis.sod.status.ShortCircuit;
import edu.sc.seis.sod.status.StringTree;
import edu.sc.seis.sod.status.StringTreeBranch;
public final class AvailableDataAND extends AvailableDataLogicalSubsetter
implements AvailableDataSubsetter {
public AvailableDataAND(Element config) throws ConfigurationException {
super(config);
}
public StringTree accept(CacheEvent event,
ChannelImpl channel,
RequestFilter[] request,
RequestFilter[] available,
CookieJar cookieJar) throws Exception {
StringTree[] result = new StringTree[filterList.size()];
for(int i = 0; i < filterList.size(); i++) {
AvailableDataSubsetter f = (AvailableDataSubsetter)filterList.get(i);
result[i] = f.accept(event, channel, request, available, cookieJar);
if(!result[i].isSuccess()) {
for(int j = i + 1; j < result.length; j++) {
result[j] = new ShortCircuit(filterList.get(j));
}
return new StringTreeBranch(this, false, result);
}
}
return new StringTreeBranch(this, true, result);
}
static Logger logger = LoggerFactory.getLogger(AvailableDataAND.class.getName());
}// AvailableDataAND
| gpl-2.0 |
BuddhaLabs/DeD-OSX | soot/soot-2.3.0/src/soot/Value.java | 1753 | /* Soot - a J*va Optimization Framework
* Copyright (C) 1997-1999 Raja Vallee-Rai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the Sable Research Group and others 1997-1999.
* See the 'credits' file distributed with Soot for the complete list of
* contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
*/
package soot;
import soot.util.*;
import java.util.*;
import java.io.*;
/** Data used as, for instance, arguments to instructions; typical implementations are
* constants or expressions.
*
* Values are typed, clonable and must declare which other
* Values they use (contain). */
public interface Value extends Switchable, EquivTo, Serializable
{
/** Returns a List of boxes corresponding to Values
* which are used by (ie contained within) this Value. */
public List getUseBoxes();
/** Returns the Soot type of this Value. */
public Type getType();
/** Returns a clone of this Value. */
public Object clone();
public void toString( UnitPrinter up );
}
| gpl-2.0 |
zhang123shuo/javamop | src/javamop/parser/ast/expr/BooleanLiteralExpr.java | 1638 | /*
* Copyright (C) 2007 Julio Vilmar Gesser.
*
* This file is part of Java 1.5 parser and Abstract Syntax Tree.
*
* Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Java 1.5 parser and Abstract Syntax Tree. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Created on 02/03/2007
*/
package javamop.parser.ast.expr;
import javamop.parser.ast.visitor.GenericVisitor;
import javamop.parser.ast.visitor.VoidVisitor;
/**
* @author Julio Vilmar Gesser
*/
public final class BooleanLiteralExpr extends LiteralExpr {
private final Boolean value;
public BooleanLiteralExpr(int line, int column, Boolean value) {
super(line, column);
this.value = value;
}
public Boolean getValue() {
return value;
}
@Override
public <A> void accept(VoidVisitor<A> v, A arg) {
v.visit(this, arg);
}
@Override
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
return v.visit(this, arg);
}
}
| gpl-2.0 |
vnu-dse/rtl | src/main/org/tzi/use/parser/soil/ast/ASTIterationStatement.java | 3956 | /*
* USE - UML based specification environment
* Copyright (C) 1999-2010 Mark Richters, University of Bremen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// $Id: ASTIterationStatement.java 3209 2012-04-11 14:15:10Z green $
package org.tzi.use.parser.soil.ast;
import java.io.PrintWriter;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.CollectionType;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.sys.soil.MEmptyStatement;
import org.tzi.use.uml.sys.soil.MIterationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
import org.tzi.use.util.soil.exceptions.CompilationFailedException;
/**
* AST node of an iteration statement.
* @author Daniel Gent
*
*/
public class ASTIterationStatement extends ASTStatement {
private String fIterVarName;
private ASTExpression fRange;
private ASTStatement fBody;
/**
* Constructs a new AST node.
* @param iterVarName
* @param range
* @param body
*/
public ASTIterationStatement(
String iterVarName,
ASTExpression range,
ASTStatement body) {
fIterVarName = iterVarName;
fRange = range;
fBody = body;
addChildStatement(body);
}
/**
* Name of the iteration variable.
* @return
*/
public String getIterVarName() {
return fIterVarName;
}
/**
* The AST of the source expression
* @return
*/
public ASTExpression getRange() {
return fRange;
}
/**
* The AST of the body statements.
* @return
*/
public ASTStatement getBody() {
return fBody;
}
@Override
protected MStatement generateStatement() throws CompilationFailedException {
Expression range = generateExpression(fRange);
if (!range.type().isCollection(false)) {
throw new CompilationFailedException(this, "Expression "
+ StringUtil.inQuotes(fRange.getStringRep())
+ " is expected to be of type "
+ StringUtil.inQuotes("Collection") + ", found "
+ StringUtil.inQuotes(range.type()) + ".");
}
Type iterVarType = ((CollectionType)range.type()).elemType();
fSymtable.storeState();
fSymtable.setType(fIterVarName, iterVarType);
MStatement body = generateStatement(fBody);
fSymtable.restoreState(this);
if (fBody.assigns(fIterVarName)) {
throw new CompilationFailedException(this,
"There is possible assignment to the iteration variable " +
StringUtil.inQuotes(this.getIterVarName()) +
". This is prohibited.");
}
// assigned(iteration) = assigned(body)
if (! fSymtable.isExplicit()) {
fAssignedSet.add(fBody.fAssignedSet);
fAssignedSet.add(fIterVarName, iterVarType);
}
// range is empty!
if (iterVarType.isVoidType()) {
return MEmptyStatement.getInstance();
} else {
return new MIterationStatement(fIterVarName, range, body);
}
}
@Override
protected void printTree(StringBuilder prelude, PrintWriter target) {
target.println(prelude + "[ITERATION]");
if (prelude.length() == 0) {
prelude.append("+-");
} else {
prelude.insert(0, "| ");
}
fBody.printTree(prelude, target);
prelude.delete(0, 2);
}
@Override
public String toString() {
return
"for " +
fIterVarName +
" in " +
fRange.getStringRep() +
"do ... end";
}
} | gpl-2.0 |
MilchReis/PicSearch | src/de/nartis/picsearch/gui/PreviewPanel.java | 2017 | package de.nartis.picsearch.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.ScrollPane;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import de.nartis.picsearch.model.AppModel;
import de.nartis.picsearch.model.Picture;
public class PreviewPanel extends JPanel implements Observer {
private static final long serialVersionUID = 1L;
private JList list;
private DefaultListModel listModel;
private AppModel model;
public PreviewPanel(AppModel model) {
super(new BorderLayout());
super.setBackground(Colors.BACKGROUND);
this.model = model;
listModel = new DefaultListModel();
list = new JList( listModel );
list.setBackground(Colors.BACKGROUND_LIGHT);
list.setForeground(Color.WHITE);
list.setSelectionBackground(Colors.BACKGROUND);
list.setCellRenderer(new PreviewInformationCellRenderer());
list.addMouseListener( new MouseAdapter() {
@Override
public void mouseClicked( MouseEvent e ) {
if( e.getClickCount() == 2 ) {
int index = list.locationToIndex(e.getPoint());
Picture p = (Picture) listModel.get(index);
try {
Desktop.getDesktop().open(new File(p.getPath()));
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
} );
JScrollPane scroll = new JScrollPane(list);
scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
add( scroll, BorderLayout.CENTER );
setBorder( BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) );
}
@Override
public void update(Observable o, Object arg) {
List<Picture> previews = model.getPreviews();
listModel.clear();
for(Picture p : previews)
listModel.addElement(p);
list.invalidate();
}
}
| gpl-2.0 |
mupi/readinweb | impl/src/main/java/br/unicamp/iel/util/CourseProperties.java | 4218 | package br.unicamp.iel.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonObject.Member;
public class CourseProperties {
private JsonObject courseProperties;
public CourseProperties(JsonObject courseProperties) {
this.courseProperties = courseProperties;
}
public Long[] getPublishedModulesIds() {
System.out.println("Published Modules: ");
System.out.println(courseProperties.toString());
JsonObject modules = courseProperties.get("modules").asObject();
ArrayList<Long> ids = new ArrayList<Long>();
Iterator<Member> it = modules.iterator();
while (it.hasNext()) {
Member m = it.next();
JsonObject module = m.getValue().asObject();
if (module.get("status").asBoolean()) {
System.out.println("Module published: " + module.get("status"));
ids.add(Long.parseLong(m.getName()));
}
}
return Arrays.copyOf(ids.toArray(), ids.size(), Long[].class);
}
public Long[] getPublishedActivitiesIds(Long module) {
JsonObject activities = courseProperties.get("modules").asObject()
.get(Long.toString(module)).asObject().get("activities")
.asObject();
ArrayList<Long> ids = new ArrayList<Long>();
Iterator<Member> it = activities.iterator();
while (it.hasNext()) {
Member m = it.next();
JsonObject activity = m.getValue().asObject();
if (activity.get("status").asBoolean()) {
ids.add(Long.parseLong(m.getName()));
}
}
return Arrays.copyOf(ids.toArray(), ids.size(), Long[].class);
}
public Long[] getAllPublishedActivities() {
JsonObject modules = courseProperties.get("modules").asObject();
ArrayList<Long> ids = new ArrayList<Long>();
Iterator<Member> itM = modules.iterator();
while (itM.hasNext()) {
Member m = itM.next();
JsonObject module = m.getValue().asObject();
if (module.get("status").asBoolean()) { // Verify activities
JsonObject activities = module.get("activities").asObject();
Iterator<Member> itA = activities.iterator();
while (itA.hasNext()) {
Member a = itA.next();
JsonObject activity = a.getValue().asObject();
if (activity.get("status").asBoolean()) {
ids.add(Long.parseLong(a.getName()));
}
}
}
}
return Arrays.copyOf(ids.toArray(), ids.size(), Long[].class);
}
public void publishModule(Long module) {
JsonObject j_module = courseProperties.get("modules").asObject()
.get(Long.toString(module)).asObject();
j_module.set("status", true);
}
public void publishActivity(Long module, Long activity) {
JsonObject j_activity = courseProperties.get("modules").asObject()
.get(Long.toString(module)).asObject().get("activities")
.asObject().get(Long.toString(activity)).asObject();
j_activity.set("status", true);
}
public void publishNextActivities() {
int pub = 0;
JsonObject modules = courseProperties.get("modules").asObject();
Iterator<Member> itM = modules.iterator();
while (itM.hasNext() && pub < 2) {
Member m = itM.next();
JsonObject module = m.getValue().asObject();
if (!module.get("status").asBoolean()) {
module.set("status", true);
}
JsonObject activities = module.get("activities").asObject();
Iterator<Member> itA = activities.iterator();
while (itA.hasNext() && pub < 2) {
Member a = itA.next();
JsonObject activity = a.getValue().asObject();
if (!activity.get("status").asBoolean()) {
activity.set("status", true);
pub++;
}
}
}
}
@Override
public String toString() {
return courseProperties.toString();
}
public boolean isActivityPublished(Long module, Long activity) {
JsonObject j_activity = courseProperties.get("modules").asObject()
.get(Long.toString(module)).asObject().get("activities")
.asObject().get(Long.toString(activity)).asObject();
return j_activity.get("status").asBoolean();
}
public boolean isModulePublished(Long module) {
JsonObject j_module = courseProperties.get("modules").asObject()
.get(Long.toString(module)).asObject();
return j_module.get("status").asBoolean();
}
public Long countPublishedActivities() {
return new Long(getAllPublishedActivities().length);
}
}
| gpl-2.0 |
Qwaz/solved-hacking-problem | SSCTF/2016/Reverse/Re1/re1-e7e4ad1a_source_from_JADX/android/support/v4/app/aa.java | 953 | package android.support.v4.app;
import android.content.Context;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
class aa extends FrameLayout {
public aa(Context context) {
super(context);
}
static ViewGroup m68a(View view) {
ViewGroup aaVar = new aa(view.getContext());
LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams != null) {
aaVar.setLayoutParams(layoutParams);
}
view.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
aaVar.addView(view);
return aaVar;
}
protected void dispatchRestoreInstanceState(SparseArray sparseArray) {
dispatchThawSelfOnly(sparseArray);
}
protected void dispatchSaveInstanceState(SparseArray sparseArray) {
dispatchFreezeSelfOnly(sparseArray);
}
}
| gpl-2.0 |
jeslev/ProgramaVentas | app/src/main/java/com/example/yarvis/programaventas/BuyActivity.java | 9975 | package com.example.yarvis.programaventas;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class BuyActivity extends ListActivity {
private static StaticVariables staticVariables = new StaticVariables();
// Progress Dialog
private ProgressDialog pDialog;
// Creating JSON Parser object
JSONParser jParser = new JSONParser();
ArrayList<HashMap<String, String>> productsList;
HashMap<String,Integer> productsBuying;
// url to get all products list
private static String url_all_products = "http://"+staticVariables.getIpServer()+"/lab3/get_all_products.php";
// JSON Node names
private static final String TAG_SUCCESS = staticVariables.getTagSuccess();
private static final String TAG_PRODUCTS = staticVariables.getTagProducts();
private static final String TAG_PID = staticVariables.getTagPid();
private static final String TAG_NAME = staticVariables.getTagName();
private static final String TAG_PRICE = staticVariables.getTagPrice();
private static final String TAG_QUANT = staticVariables.getTagQuant();
// products JSONArray
JSONArray products = null;
public Button btn1;
public Button btn2;
int uid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_buy);
btn1 = (Button) findViewById(R.id.button);
btn2 = (Button) findViewById(R.id.button2);
// Hashmap for ListView
productsList = new ArrayList<HashMap<String, String>>();
Intent intent = getIntent();
uid = intent.getIntExtra("UserID",0);
productsBuying = new HashMap<String,Integer>();
// Loading products in Background Thread
new LoadAllProducts().execute();
// Get listview
ListView lv = getListView();
final View mylayout=getLayoutInflater().inflate(R.layout.quantity, null);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// getting values from selected ListItem
String pid = ((TextView) view.findViewById(R.id.pid)).getText().toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(), BuyProductActibity.class);
// sending pid to next activity
in.putExtra(TAG_PID, pid);
in.putExtra("UserID",uid);
startActivity(in);
}
});
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// setear estado a 0 del recibo
new terminaRecibo().execute();
//abrir activity para pagar
}
});
btn2.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
}
);
}
class terminaRecibo extends AsyncTask<String, String, String> {
private String url_terminar_recibo = "http://"+staticVariables.getIpServer()+"/lab3/make_buy.php";
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(BuyActivity.this);
pDialog.setMessage("Enviando recibo...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
/**
* getting All products from url
* */
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("uid", ""+uid));
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_terminar_recibo, "GET", params);
// Check your log cat for JSON reponse
Log.d("All Products: ", json.toString());
try {
// Checking for SUCCESS TAG
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
//se agrego recibo, inicia intent a
// activity de pagar recibo
} else {
// no products found
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
BuyActivity.this, productsList,
R.layout.list_item, new String[] { TAG_PID,
TAG_NAME, TAG_PRICE, TAG_QUANT},
new int[] { R.id.pid, R.id.name, R.id.price, R.id.cant });
// updating listview
setListAdapter(adapter);
}
});
}
}
/**
* Background Async Task to Load all product by making HTTP Request
* */
class LoadAllProducts extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(BuyActivity.this);
pDialog.setMessage("Cargando productos...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
/**
* getting All products from url
* */
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);
// Check your log cat for JSON reponse
Log.d("All Products: ", json.toString());
try {
// Checking for SUCCESS TAG
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// products found
// Getting Array of Products
products = json.getJSONArray(TAG_PRODUCTS);
// looping through All Products
for (int i = 0; i < products.length(); i++) {
JSONObject c = products.getJSONObject(i);
// Storing each json item in variable
String id = c.getString(TAG_PID);
String name = c.getString(TAG_NAME);
String price = c.getString(TAG_PRICE);
String quant = c.getString(TAG_QUANT);
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put(TAG_PID, id);
//map.put(TAG_PID, "5");
map.put(TAG_NAME, name);
map.put(TAG_PRICE, price);
map.put(TAG_QUANT, quant);
// adding HashList to ArrayList
productsList.add(map);
}
} else {
// no products found
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
BuyActivity.this, productsList,
R.layout.list_item, new String[] { TAG_PID,
TAG_NAME, TAG_PRICE, TAG_QUANT},
new int[] { R.id.pid, R.id.name, R.id.price, R.id.cant });
// updating listview
setListAdapter(adapter);
}
});
}
}
}
| gpl-2.0 |
pablanco/taskManager | Android/FlexibleClient/src/com/artech/fragments/ComponentContainer.java | 3373 | package com.artech.fragments;
import java.util.List;
import android.content.Context;
import android.view.ViewParent;
import android.widget.LinearLayout;
import com.artech.android.layout.GxLayoutInTab;
import com.artech.base.controls.IGxControlRuntime;
import com.artech.base.metadata.layout.ComponentDefinition;
import com.artech.base.metadata.layout.Size;
public class ComponentContainer extends LinearLayout implements IGxControlRuntime
{
//status
public static final int INACTIVE = 0;
public static final int TOACTIVATED = 1;
public static final int ACTIVE = 2;
public static final int TOINACTIVATED = 3;
private static final String METHOD_REFRESH = "Refresh";
private static final String METHOD_CLEAR = "Clear";
private static int sLastId = 95;
private final ComponentDefinition mDefinition;
private int mId;
private LayoutFragment mParentFragment;
private BaseFragment mFragment;
private Size mSize;
private int mStatus = INACTIVE;
public ComponentContainer(Context context, ComponentDefinition definition)
{
super(context);
setWillNotDraw(true);
mDefinition = definition;
}
public ComponentDefinition getDefinition()
{
return mDefinition;
}
public void setComponentSize(Size size)
{
mSize = size;
}
public Size getComponentSize()
{
return mSize;
}
public int getContentControlId()
{
if (mId==0)
{
mId = sLastId;
sLastId++;
}
return mId;
}
public int getStatus()
{
return mStatus;
}
public void setStatus(int status)
{
mStatus = status;
}
public void setActive(boolean active)
{
if (mFragment != null)
mFragment.setActive(active);
setStatus(active ? ACTIVE : INACTIVE);
}
public BaseFragment getFragment()
{
return mFragment;
}
public void setFragment(BaseFragment fragment)
{
mFragment = fragment;
}
public LayoutFragment getParentFragment()
{
return mParentFragment;
}
public void setParentFragment(LayoutFragment fragment)
{
mParentFragment = fragment;
}
public boolean hasTabParent()
{
return (getTabParent(getParent()) != null);
}
public boolean hasTabParentWithScroll()
{
GxLayoutInTab gxLayout = getTabParent(getParent());
return gxLayout != null && gxLayout.getHasScroll();
}
private GxLayoutInTab getTabParent(ViewParent parent)
{
if (parent != null)
{
if (parent instanceof GxLayoutInTab)
return (GxLayoutInTab) parent;
return getTabParent(parent.getParent());
}
else
return null;
}
public boolean hasTabParentDisconected()
{
if (getParent()!=null)
{
GxLayoutInTab tabParent = getTabParent(getParent().getParent());
if (tabParent!=null && tabParent.getParent()==null)
return true;
}
return false;
}
@Override
public void setProperty(String name, Object value) { }
@Override
public Object getProperty(String name)
{
return null;
}
@Override
public void runMethod(String name, List<Object> parameters)
{
if (METHOD_REFRESH.equalsIgnoreCase(name))
{
if (mFragment instanceof IDataView)
((IDataView)mFragment).refreshData(false);
}
else if (METHOD_CLEAR.equalsIgnoreCase(name))
{
if (mParentFragment != null && mFragment != null)
mParentFragment.removeInnerComponent(this);
}
}
}
| gpl-2.0 |
laurybueno/EP-IA-redes-neurais | LVQ/src/Inicializa.java | 5787 | import java.util.*;
//Classe Responsavel por fazer a inicializacao da Unidade de Saida(vetores de pesos), e receber os dados de Entrada
public class Inicializa{
double [][] vetoresDePesos; //vetores de pesos(matriz que carregas os neuronios de saida)
double [][] dadosEntrada; //matriz de dados de entrada (Treinamento)
double [][] dadosValidacao; //matriz de dados de Entrada (Validacao)
//contrutor de inicializacao principais dados do algoritmo
//recebe nome do arquivo de entrada de dados, e a quantidade de neuronios por classe(N)
public Inicializa(String nomeTreinamento, String nomeValidacao, int N, String TipoInicializacao)
{
//R = numero de atributos da base de dados que serao analisados (64)
//quantidade de Neuronios de saida por LVQ. N*10 pois existem 10 tipos de classes.
N =N*10;
//vetor de Unidades de Saida do Algoritmo
vetoresDePesos = new double [N][];
//Objeto de Leitura dos dados
Input arquivo = new Input();
//vetor de dados de entrada(treinamento)
dadosEntrada = arquivo.arquivoToMatrizDouble(nomeTreinamento);
//vetor de dados de entrada(validacao)
dadosValidacao = arquivo.arquivoToMatrizDouble(nomeValidacao);
//double[] centroide = centroMassa(dados);
//metodo que inicializa matriz de pesos
this.InicializaPesos(TipoInicializacao);
}
//metodo dedicado a determinar qual tipo de inicializacao
public void InicializaPesos(String TipoInicializacao){
//caso pesos iniciam com zero
if(TipoInicializacao == "zero")
{
this.PesosNulos();
}
//caso pesos iniciam aleatoriamente
else if(TipoInicializacao == "aleatoria")
{
this.PesosRandom();
}
//caso pesos iniciam com uma copia das primeiras m entradas
else if(TipoInicializacao == "primeiraEntrada")
{
this.PesosPrimeiraEntrada();
}
}
//----------INICIALIZACAO DOS PESOS--------------|-primeiros m vetores-INICIO//
//supondo que as classes vao de [0~9]
//metodo de Inicializacao dos N*10 vetores de peso (sendo N a quantidade de neuronios por classe)
//atribuindo para os N*10 vetores de pesos as primeiras entradas de classes diferentes
public void PesosPrimeiraEntrada()
{
//laco que inicializa os arrays de pesos como os primeiros dados de classes diferentes
//repetindo o processo no caso da existencia mais de um array de pesos por classe.
for(int i = 0; i < vetoresDePesos.length; i++){
vetoresDePesos[i] = this.EncontraPrimeiraEntrada(i%10);
}
}
//Encontra a primeira entrada de uma classe "c"
//recebe parametro "c", que eh o numero da classe, e retorno um array de dados
//para o primeiro valor encontrado da classe "c"
public double [] EncontraPrimeiraEntrada(int c){
//laco que procura o primeiro dado que aparece, e que eh da classe "c"
for(int i = 0; i< dadosEntrada.length; i++){
//caso encontrado o dado
if(c == dadosEntrada[i][dadosEntrada[i].length-1]){
//copia o dado para uma classe auxiliar
double [] aux;
aux = dadosEntrada[i].clone();
//e deleta o dado do array de dados, pois ele vai ser desconsiderado no treinamento
this.DeletaLinhaDadosEntrada(i);
//retorna o dado copiado
return aux;
}
}
//caso nao encontrado retorna null
return null;
}
//Deleta determinada linha da matriz de dadosEntrada, dada pelo indice da linha
//recebe inteiro com o valor da linha.
public void DeletaLinhaDadosEntrada(int linha){
//cria collection baseada em dadosEntrada
List<double []> auxDadosEntrada = new ArrayList<double[]>(Arrays.asList(dadosEntrada));
// remove determinada 'linha' da matriz
auxDadosEntrada.remove(linha);
//agrega a collection sem a linha deletada na antiga matriz
dadosEntrada = auxDadosEntrada.toArray(new double [][]{});
}
//----------INICIALIZACAO DOS PESOS--------------|-primeiros m vetores-FIM//
//----------INICIALIZACAO DOS PESOS--------------|-InicializacaoRandomica-Inicio//
//TODO especificar dominio da aleatoriedade.
public void PesosRandom(){
//recebe tamanho do Vetor de Dados de Entrada
int lengthDadosEntrada = dadosEntrada[0].length;
// Como Math.random sempre retorna valores positivos, é preciso acrescentar mais uma camada de aleatoriedade para variar o sinal
for(int i = 0; i < vetoresDePesos.length; i++){
//cria um novo vetor nulo com o mesmo tamanho de uma entrada.
double [] pesosAleatorios = new double [lengthDadosEntrada];
//seta na ultima possicao o valor das classes.
pesosAleatorios[pesosAleatorios.length-1] = i%10;
//percorre novo vetor atribuindo valores random para todos campos, menos o ultimo.
for(int j = 0; j < pesosAleatorios.length-1; j++){
if(Math.random() > 0.5)
pesosAleatorios[j] = Math.random();
else
pesosAleatorios[j] = Math.random()*(-1);
}
//atribui array de numeros aleatorios para cada linha da matriz de vetoresPeso.
vetoresDePesos[i] = pesosAleatorios;
}
}
//----------INICIALIZACAO DOS PESOS--------------|-InicializacaoRandomica-Inicio//
//----------INICIALIZACAO DOS PESOS--------------|-Inicializacao Pesos Nulos-Inicio//
//metodo responsavel por incializar os pesos com valores zero
public void PesosNulos(){
//recebe tamanho do Vetor de Dados de Entrada
int lengthDadosEntrada = dadosEntrada[0].length;
for(int i =0; i < vetoresDePesos.length; i++){//percorre os vetores de Pesos
//cria um novo vetor nulo com o mesmo tamanho de uma entrada.
double [] novoPeso = new double[lengthDadosEntrada];
//seta na ultima possicao o valor das classes.
novoPeso[novoPeso.length-1] = i%10;
//associa vetor ao arranjo de vetores de dados
vetoresDePesos[i] = novoPeso;
}
}
//----------INICIALIZACAO DOS PESOS--------------|-Inicializacao Pesos Nulos-Fim//
} | gpl-2.0 |
CleverCloud/Quercus | resin/src/main/java/com/caucho/util/Base64.java | 11485 | /*
* Copyright (c) 1998-2010 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Resin Open Source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
* of NON-INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with Resin Open Source; if not, write to the
*
* Free Software Foundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307 USA
*
* @author Scott Ferguson
*/
package com.caucho.util;
import java.io.*;
/**
* Base64 decoding.
*/
public class Base64 {
private static final int _decode[];
private static final char _encode[];
static {
_decode = new int[256];
for (int i = 'A'; i <= 'Z'; i++)
_decode[i] = i - 'A';
for (int i = 'a'; i <= 'z'; i++)
_decode[i] = i - 'a' + 26;
for (int i = '0'; i <= '9'; i++)
_decode[i] = i - '0' + 52;
_decode['+'] = 62;
_decode['/'] = 63;
_decode['='] = 0;
_encode = new char[64];
for (int ch = 'A'; ch <= 'Z'; ch++)
_encode[ch - 'A'] = (char) ch;
for (int ch = 'a'; ch <= 'z'; ch++)
_encode[ch - 'a' + 26] = (char) ch;
for (int ch = '0'; ch <= '9'; ch++)
_encode[ch - '0' + 52] = (char) ch;
_encode[62] = '+';
_encode[63] = '/';
}
public static void encode(CharBuffer cb, long data)
{
cb.append(Base64.encode(data >> 60));
cb.append(Base64.encode(data >> 54));
cb.append(Base64.encode(data >> 48));
cb.append(Base64.encode(data >> 42));
cb.append(Base64.encode(data >> 36));
cb.append(Base64.encode(data >> 30));
cb.append(Base64.encode(data >> 24));
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
}
public static void encode(StringBuilder sb, long data)
{
sb.append(encode(data >> 60));
sb.append(encode(data >> 54));
sb.append(encode(data >> 48));
sb.append(encode(data >> 42));
sb.append(encode(data >> 36));
sb.append(encode(data >> 30));
sb.append(encode(data >> 24));
sb.append(encode(data >> 18));
sb.append(encode(data >> 12));
sb.append(encode(data >> 6));
sb.append(encode(data));
}
public static void encode24(CharBuffer cb, int data)
{
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
}
public static String encode(byte []buffer)
{
StringBuilder sb = new StringBuilder();
encode(sb, buffer, 0, buffer.length);
return sb.toString();
}
public static void encode(CharBuffer cb, byte []buffer,
int offset, int length)
{
while (length >= 3) {
int data = (buffer[offset] & 0xff) << 16;
data += (buffer[offset + 1] & 0xff) << 8;
data += (buffer[offset + 2] & 0xff);
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
offset += 3;
length -= 3;
}
if (length == 2) {
int b1 = buffer[offset] & 0xff;
int b2 = buffer[offset + 1] & 0xff;
int data = (b1 << 16) + (b2 << 8);
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append('=');
}
else if (length == 1) {
int data = (buffer[offset] & 0xff) << 16;
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append('=');
cb.append('=');
}
}
public static void encode(StringBuilder cb, byte []buffer,
int offset, int length)
{
while (length >= 3) {
int data = (buffer[offset] & 0xff) << 16;
data += (buffer[offset + 1] & 0xff) << 8;
data += (buffer[offset + 2] & 0xff);
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
offset += 3;
length -= 3;
}
if (length == 2) {
int b1 = buffer[offset] & 0xff;
int b2 = buffer[offset + 1] & 0xff;
int data = (b1 << 16) + (b2 << 8);
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append('=');
}
else if (length == 1) {
int data = (buffer[offset] & 0xff) << 16;
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append('=');
cb.append('=');
}
}
public static void oldEncode(CharBuffer cb, byte []buffer,
int offset, int length)
{
while (length >= 3) {
int data = (buffer[offset] & 0xff) << 16;
data += (buffer[offset + 1] & 0xff) << 8;
data += (buffer[offset + 2] & 0xff);
cb.append(Base64.encode(data >> 18));
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
offset += 3;
length -= 3;
}
if (length == 2) {
int b1 = buffer[offset] & 0xff;
int b2 = buffer[offset + 1] & 0xff;
int data = (b1 << 8) + (b2);
cb.append(Base64.encode(data >> 12));
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
cb.append('=');
}
else if (length == 1) {
int data = (buffer[offset] & 0xff);
cb.append(Base64.encode(data >> 6));
cb.append(Base64.encode(data));
cb.append('=');
cb.append('=');
}
}
public static char encode(long d)
{
return _encode[(int) (d & 0x3f)];
}
public static int decode(int d)
{
return _decode[d];
}
public static String encode(String value)
{
try {
StringWriter sw = new StringWriter();
encode(sw, new ByteArrayInputStream(value.getBytes("iso-8859-1")));
return sw.toString();
}
catch (IOException e) {
throw new RuntimeException("this should not be possible: " + e);
}
}
public static String encodeFromByteArray(byte[] value)
{
try {
StringWriter sw = new StringWriter();
encode(sw, new ByteArrayInputStream(value));
return sw.toString();
}
catch (IOException e) {
throw new RuntimeException("this should not be possible " + e);
}
}
public static String encodeFromByteArray(byte[] value,
int offset,
int length)
{
try {
StringWriter sw = new StringWriter();
encode(sw, new ByteArrayInputStream(value, offset, length));
return sw.toString();
}
catch (IOException e) {
throw new RuntimeException("this should not be possible " + e);
}
}
public static void encode(Writer w, InputStream i)
throws IOException
{
while(true) {
int value1 = i.read();
int value2 = i.read();
int value3 = i.read();
if (value3 >= 0) {
long chunk = (value1 & 0xff);
chunk = (chunk << 8) + (value2 & 0xff);
chunk = (chunk << 8) + (value3 & 0xff);
w.write(encode(chunk >> 18));
w.write(encode(chunk >> 12));
w.write(encode(chunk >> 6));
w.write(encode(chunk));
continue;
}
if (value2 >= 0) {
long chunk = (value1 & 0xff);
chunk = (chunk << 8) + (value2 & 0xff);
chunk <<= 8;
w.write(encode(chunk >> 18));
w.write(encode(chunk >> 12));
w.write(encode(chunk >> 6));
w.write('=');
}
else if (value1 >= 0) {
long chunk = (value1 & 0xff);
chunk <<= 16;
w.write(encode(chunk >> 18));
w.write(encode(chunk >> 12));
w.write('=');
w.write('=');
}
break;
}
w.flush();
}
public static String decode(String value)
{
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
decode(new StringReader(value), baos);
return new String(baos.toByteArray(), "iso-8859-1");
}
catch (IOException e) {
throw new RuntimeException("this should not be possible: " + e);
}
}
public static byte[] decodeToByteArray(String value)
{
try {
if (value == null)
return new byte[0];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
decode(new StringReader(value), baos);
return baos.toByteArray();
}
catch (IOException e) {
throw new RuntimeException("this should not be possible: " + e);
}
}
private static int readNonWhitespace(Reader r)
throws IOException
{
while(true) {
int ret = r.read();
// skip whitespace
switch (ret) {
case 0xf0: case 0xf1: case 0xf2: case 0xf3:
case 0xf4: case 0xf5: case 0xf6: case 0xf7:
case 0xf8: case 0xf9: case 0xfa: case 0xfb:
case 0xfc: case 0xfd: case 0xfe: case 0xff:
case ' ': case '\n': case '\r': case '\t':
case '\f':
break;
default:
return ret;
}
}
}
public static void decode(Reader r, OutputStream os)
throws IOException
{
while (true) {
int ch0 = readNonWhitespace(r);
int ch1 = r.read();
int ch2 = r.read();
int ch3 = r.read();
if (ch1 < 0)
break;
if (ch2 < 0)
ch2 = '=';
if (ch3 < 0)
ch3 = '=';
int chunk = ((_decode[ch0] << 18)
+ (_decode[ch1] << 12)
+ (_decode[ch2] << 6)
+ (_decode[ch3]));
os.write((byte) ((chunk >> 16) & 0xff));
if (ch2 != '=' && ch2 != -1)
os.write((byte) ((chunk >> 8) & 0xff));
if (ch3 != '=' && ch3 != -1)
os.write((byte) ((chunk & 0xff)));
else
break;
}
os.flush();
}
/**
* XXX: decode() vs decodeIgnoreWhitespace(), check RFC
*/
public static void decodeIgnoreWhitespace(Reader r, OutputStream os)
throws IOException
{
while (true) {
int ch0 = readNonWhitespace(r);
int ch1 = readNonWhitespace(r);
int ch2 = readNonWhitespace(r);
int ch3 = readNonWhitespace(r);
if (ch1 < 0)
break;
if (ch2 < 0)
ch2 = '=';
if (ch3 < 0)
ch3 = '=';
int chunk = ((_decode[ch0] << 18)
+ (_decode[ch1] << 12)
+ (_decode[ch2] << 6)
+ (_decode[ch3]));
os.write((byte) ((chunk >> 16) & 0xff));
if (ch2 != '=' && ch2 != -1)
os.write((byte) ((chunk >> 8) & 0xff));
if (ch3 != '=' && ch3 != -1)
os.write((byte) ((chunk & 0xff)));
else
break;
}
os.flush();
}
}
| gpl-2.0 |
asifdahir/nscloud | src/com/nscloud/android/ui/dialog/SharePasswordDialogFragment.java | 4375 | /**
* ownCloud Android client application
* @author masensio
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.nscloud.android.ui.dialog;
import android.support.v7.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.nscloud.android.R;
import com.nscloud.android.datamodel.OCFile;
import com.nscloud.android.ui.activity.FileActivity;
/**
* Dialog to input the password for sharing a file/folder.
*
* Triggers the share when the password is introduced.
*/
public class SharePasswordDialogFragment extends DialogFragment
implements DialogInterface.OnClickListener {
private static final String ARG_FILE = "FILE";
private static final String ARG_SEND_INTENT = "SEND_INTENT";
public static final String PASSWORD_FRAGMENT = "PASSWORD_FRAGMENT";
private OCFile mFile;
private Intent mSendIntent;
/**
* Public factory method to create new SharePasswordDialogFragment instances.
*
* @param file
* @param sendIntent
* @return Dialog ready to show.
*/
public static SharePasswordDialogFragment newInstance(OCFile file, Intent sendIntent) {
SharePasswordDialogFragment frag = new SharePasswordDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, file);
args.putParcelable(ARG_SEND_INTENT, sendIntent);
frag.setArguments(args);
return frag;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mFile = getArguments().getParcelable(ARG_FILE);
mSendIntent = getArguments().getParcelable(ARG_SEND_INTENT);
// Inflate the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.password_dialog, null);
// Setup layout
EditText inputText = ((EditText)v.findViewById(R.id.share_password));
inputText.setText("");
inputText.requestFocus();
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(v)
.setPositiveButton(R.string.common_ok, this)
.setNegativeButton(R.string.common_cancel, this)
.setTitle(R.string.share_link_password_title);
Dialog d = builder.create();
d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return d;
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == AlertDialog.BUTTON_POSITIVE) {
// Enable the flag "Share again"
((FileActivity) getActivity()).setTryShareAgain(true);
String password =
((TextView)(getDialog().findViewById(R.id.share_password)))
.getText().toString();
if (password.length() <= 0) {
Toast.makeText(
getActivity(),
R.string.share_link_empty_password,
Toast.LENGTH_LONG).show();
return;
}
// Share the file
((FileActivity)getActivity()).getFileOperationsHelper()
.shareFileWithLinkToApp(mFile, password, mSendIntent);
} else {
// Disable the flag "Share again"
((FileActivity) getActivity()).setTryShareAgain(false);
}
}
}
| gpl-2.0 |
OpenSourceConsulting/gradle_sample | src/main/java/com/osc/edu/commons/employees/service/EmployeesService.java | 2329 | /*
* Copyright (C) 2012-2014 Open Source Consulting, Inc. All rights reserved by Open Source Consulting, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Revision History
* Author Date Description
* --------------- ---------------- ------------
* Sang-cheon Park 2014. 1. 7. First Draft.
*/
package com.osc.edu.commons.employees.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.osc.edu.commons.employees.dao.EmployeesDao;
import com.osc.edu.commons.employees.dto.EmployeesDto;
/**
* <pre>
* Service Class for Employees
* </pre>
* @author Sang-cheon Park
* @version 1.0
*/
public class EmployeesService {
@Autowired
private EmployeesDao employeesDao;
public void setUseMapper(boolean useMapper) {
employeesDao.setUseMapper(useMapper);
}
public List<EmployeesDto> getEmployeesList() {
return employeesDao.getEmployeesList();
}
public EmployeesDto getEmployees(Integer id) {
return employeesDao.getEmployees(id);
}
public void insertEmployees(EmployeesDto employees) {
employeesDao.insertEmployees(employees);
}
public void updateEmployees(EmployeesDto employees) {
employeesDao.updateEmployees(employees);
}
public void deleteEmployees(Integer id) {
employeesDao.deleteEmployees(id);
}
public void insertEmployeesList(List<EmployeesDto> employeesList) {
int i = employeesList.size();
for (EmployeesDto employees : employeesList) {
employeesDao.insertEmployees(employees);
if (--i <= 1) {
throw new RuntimeException("Throw RuntimeException manually for Rollback.");
}
}
}
}
//end of EmployeesService.java | gpl-2.0 |
kihira/MiniCreatures | src/main/java/kihira/minicreatures/common/entity/ai/EntityAIHappy.java | 2370 | package kihira.minicreatures.common.entity.ai;
import kihira.minicreatures.common.entity.EntityMiniCreature;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.MathHelper;
import java.util.Random;
public class EntityAIHappy extends EntityAIBase {
private final EntityTameable theEntity;
private int timesRunAround = 0;
public EntityAIHappy(EntityTameable theFox) {
this.theEntity = theFox;
this.setMutexBits(1);
}
@Override
public boolean shouldExecute() {
if (this.theEntity.isTamed() && !this.theEntity.isSitting() && theEntity.getRNG().nextInt(250) == 0) {
EntityPlayer player = (EntityPlayer) this.theEntity.getOwner();
return player != null && this.theEntity.getDistanceSq(player) < 32 && !this.theEntity.hasPath();
}
return false;
}
@Override
public void startExecuting() {
//Set a path next to the entity
this.findAndSetPath();
this.theEntity.getDataManager().set(EntityMiniCreature.IS_HAPPY, true);
}
@Override
public void updateTask() {
this.theEntity.getLookHelper().setLookPositionWithEntity(this.theEntity.getOwner(), 10.0F, this.theEntity.getVerticalFaceSpeed());
if (!this.theEntity.hasPath()) {
if (this.theEntity.getDistanceSq(this.theEntity.getOwner()) < 2 && this.theEntity.getRNG().nextInt(15) == 0) this.theEntity.getJumpHelper().setJumping();
this.timesRunAround++;
this.findAndSetPath();
}
}
@Override
public void resetTask() {
this.theEntity.getDataManager().set(EntityMiniCreature.IS_HAPPY, false);
this.timesRunAround = 0;
}
@Override
public boolean shouldContinueExecuting() {
return this.timesRunAround < 10;
}
private void findAndSetPath() {
Random random = new Random();
EntityPlayer player = (EntityPlayer) this.theEntity.getOwner();
if (player != null) {
this.theEntity.getNavigator().setPath(this.theEntity.getNavigator().getPathToXYZ(player.posX +
MathHelper.getInt(random, -1, 1), player.getEntityBoundingBox().minY, player.posZ + MathHelper.getInt(random, -1, 1)), 1.2D);
}
}
}
| gpl-2.0 |
Projet-JEE-EMN-FILA2-G8/EventManager | src/main/java/eventmanager/presentation/utils/Authentication.java | 1115 | /**
*
*/
package eventmanager.presentation.utils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import eventmanager.presentation.utils.Constants;
/**
* @author Hadrien
*
*/
public class Authentication {
public static boolean userIsAuthenticated(HttpServletRequest request) {
HttpSession session = request.getSession(false);
return (session != null) && (session.getAttribute("user") != null);
}
private static final String[] notRestrictedServlets = {
Constants.SERVLET_LOGIN,
Constants.SERVLET_SUBSCRIBE,
Constants.SERVLET_PUBLIC_EVENT
};
public static String[] getNotRestrictedServlets() {
return notRestrictedServlets;
}
private static final String[] notRestrictedPaths = {
Constants.FOLDER_CSS,
Constants.FOLDER_JS,
Constants.FOLDER_FONTS
};
public static String[] getNotRestrictedPaths() {
return notRestrictedPaths;
}
private static final String[] notRestrictedFiles = {};
public static String[] getNotRestrictedFiles() {
return notRestrictedFiles;
}
}
| gpl-2.0 |
Hana-Lee/baseball-game | src/main/java/kr/co/leehana/model/TotalRank.java | 914 | package kr.co.leehana.model;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author Hana Lee
* @since 2016-01-30 17:15
*/
@Entity
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(of = {"id"})
@ToString
public class TotalRank implements Serializable {
private static final long serialVersionUID = 7794090430292206635L;
@Id
@GeneratedValue
@Column(name = "total_rank_id")
@Setter(AccessLevel.NONE)
private Long id;
@NotNull
private Integer value;
public TotalRank(Integer value) {
this.value = value;
}
}
| gpl-2.0 |
specialk1st/messenger | src/main/java/org/kelly_ann/messenger/exception/DataNotFoundException.java | 253 | package org.kelly_ann.messenger.exception;
public class DataNotFoundException extends RuntimeException {
private static final long serialVersionUID = -8253384228036686622L;
public DataNotFoundException(String message) {
super(message);
}
}
| gpl-2.0 |
phantamanta44/OpenAargon | src/main/java/io/github/phantamanta44/openar/game/piece/impl/PieceMirror.java | 1851 | package io.github.phantamanta44.openar.game.piece.impl;
import io.github.phantamanta44.openar.game.beam.Beam;
import io.github.phantamanta44.openar.game.beam.Direction;
import io.github.phantamanta44.openar.game.map.IGameField;
import io.github.phantamanta44.openar.game.piece.IGamePiece;
import io.github.phantamanta44.openar.util.math.IntVector;
import java.util.Collection;
import java.util.Collections;
import static io.github.phantamanta44.openar.game.beam.Direction.*;
public class PieceMirror implements IGamePiece {
private static final Direction[][] rotationMap = new Direction[][] {
new Direction[] {NORTH, NW, null, null, null, null, null, NE},
new Direction[] {EAST, NE, NORTH, null, null, null, null, null},
new Direction[] {null, SE, EAST, NE, null, null, null, null},
new Direction[] {null, null, SOUTH, SE, EAST, null, null, null},
new Direction[] {null, null, null, SW, SOUTH, SE, null, null},
new Direction[] {null, null, null, null, WEST, SW, SOUTH, null},
new Direction[] {null, null, null, null, null, NW, WEST, SW},
new Direction[] {WEST, null, null, null, null, null, NORTH, NW}
};
@Override
public String getName() {
return "Mirror";
}
@Override
public String getToken() {
return "/";
}
@Override
public Collection<Beam> getReflections(IGameField field, IntVector coords, int rot, int meta, Beam in) {
Direction outputDir = rotationMap[rot][in.getDir().toRotation()];
if (outputDir != null)
return Collections.singleton(new Beam(in.getColor(), outputDir));
return Collections.emptyList();
}
@Override
public String getTexturePath(IGameField field, IntVector coords, int rot, int meta) {
return "texture/mirror.png";
}
@Override
public IntVector getTextureOffset(IGameField field, IntVector coords, int rot, int meta) {
return new IntVector(rot * 32, 0);
}
}
| gpl-2.0 |
TheTypoMaster/Scaper | openjdk/jdk/src/share/classes/sun/tools/jstat/OptionFormat.java | 3336 | /*
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.tools.jstat;
import java.util.*;
import sun.jvmstat.monitor.MonitorException;
/**
* A class for describing the output format specified by a command
* line option that was parsed from an option description file.
*
* @author Brian Doherty
* @since 1.5
*/
public class OptionFormat {
protected String name;
protected List<OptionFormat> children;
public OptionFormat(String name) {
this.name = name;
this.children = new ArrayList<OptionFormat>();
}
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof OptionFormat)) {
return false;
}
OptionFormat of = (OptionFormat)o;
return (this.name.compareTo(of.name) == 0);
}
public int hashCode() {
return name.hashCode();
}
public void addSubFormat(OptionFormat f) {
children.add(f);
}
public OptionFormat getSubFormat(int index) {
return children.get(index);
}
public void insertSubFormat(int index, OptionFormat f) {
children.add(index, f);
}
public String getName() {
return name;
}
public void apply(Closure c) throws MonitorException {
for (Iterator i = children.iterator(); i.hasNext(); /* empty */) {
OptionFormat o = (OptionFormat)i.next();
c.visit(o, i.hasNext());
}
for (Iterator i = children.iterator(); i.hasNext(); /* empty */) {
OptionFormat o = (OptionFormat)i.next();
o.apply(c);
}
}
public void printFormat() {
printFormat(0);
}
public void printFormat(int indentLevel) {
String indentAmount = " ";
StringBuilder indent = new StringBuilder("");
for (int j = 0; j < indentLevel; j++) {
indent.append(indentAmount);
}
System.out.println(indent + name + " {");
// iterate over all children and call their printFormat() methods
for (OptionFormat of : children) {
of.printFormat(indentLevel+1);
}
System.out.println(indent + "}");
}
}
| gpl-2.0 |
Romenig/ivprog2-final | ivprog-final/src/usp/ime/line/ivprog/interpreter/execution/expressions/booleans/comparisons/LessThan.java | 1790 | /**
* Instituto de Matemática e Estatística da Universidade de São Paulo (IME-USP)
* iVProg is a open source and free software of Laboratório de Informática na
* Educação (LInE) licensed under GNU GPL2.0 license.
* Prof. Dr. Leônidas de Oliveira Brandão - leo@ime.usp.br
* Romenig da Silva Ribeiro - romenig@ime.usp.br | romenig@gmail.com
* @author Romenig
*/
package usp.ime.line.ivprog.interpreter.execution.expressions.booleans.comparisons;
import java.util.HashMap;
import usp.ime.line.ivprog.interpreter.DataFactory;
import usp.ime.line.ivprog.interpreter.DataObject;
import usp.ime.line.ivprog.interpreter.execution.Context;
import usp.ime.line.ivprog.interpreter.execution.expressions.Expression;
import usp.ime.line.ivprog.interpreter.execution.expressions.value.IVPBoolean;
import usp.ime.line.ivprog.interpreter.execution.expressions.value.IVPNumber;
import usp.ime.line.ivprog.interpreter.execution.expressions.value.IVPValue;
public class LessThan extends Expression {
private String expA;
private String expB;
/**
* Set the left expression of and. EqualTo := expressionA == expressionB
*
* @param expressionA
*/
public void setExpressionA(String expressionA) {
expA = expressionA;
}
/**
* Set the right expression of and. EqualTo := expressionA == expressionB
*
* @param expressionB
*/
public void setExpressionB(String expressionB) {
expB = expressionB;
}
public Object evaluate(Context c, HashMap map, DataFactory factory) {
IVPNumber expressionA = (IVPNumber) ((DataObject)map.get(expA)).evaluate(c, map, factory);
IVPNumber expressionB = (IVPNumber) ((DataObject)map.get(expB)).evaluate(c, map, factory);
return expressionA.lessThan(expressionB, c, map, factory);
}
}
| gpl-2.0 |
ChristophGr/ownlist | listsync/src/test/java/com/example/listsync/WebDAVIT.java | 1706 | /*
* Copyright Christoph Gritschenberger 2014.
*
* This file is part of OwnList.
*
* OwnList is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OwnList is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OwnList. If not, see <http://www.gnu.org/licenses/>.
*/
package com.example.listsync;
import org.junit.Assert;
import org.junit.Test;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.InetAddress;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.is;
public class WebDAVIT extends WebDavServerTest {
@Test
public void testSavesItemInWebdav() throws Exception {
final WebDavConfiguration config = new WebDavConfiguration(InetAddress.getLocalHost().getHostAddress(), localPort, "", null, null, false);
Repository client1 = new WebDavRepository(config);
ListRepository foo = client1.getList("foo");
foo.add(new CheckItem("asdf"));
List<CheckItem> content = foo.getContent();
assertThat(content, contains(is(new CheckItem("asdf"))));
}
}
| gpl-2.0 |
smarr/Truffle | espresso/src/com.oracle.truffle.espresso.hotswap/src/com/oracle/truffle/espresso/hotswap/ServiceWatcher.java | 31640 | /*
* Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.oracle.truffle.espresso.hotswap;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.nio.file.Watchable;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Stream;
final class ServiceWatcher {
private static final String PREFIX = "META-INF/services/";
private static final WatchEvent.Kind<?>[] ALL_WATCH_KINDS = new WatchEvent.Kind<?>[]{
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.ENTRY_MODIFY,
StandardWatchEventKinds.OVERFLOW};
private static final WatchEvent.Kind<?>[] CREATE_KINDS = new WatchEvent.Kind<?>[]{
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.OVERFLOW};
private static final WatchEvent.Kind<?>[] DELETE_KINDS = new WatchEvent.Kind<?>[]{
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.OVERFLOW};
private static final WatchEvent.Kind<?>[] CREATE_DELETE_KINDS = new WatchEvent.Kind<?>[]{
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.OVERFLOW};
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
private final Map<String, Set<String>> services = new HashMap<>(4);
private WatcherThread serviceWatcherThread;
private URLWatcher urlWatcher;
public boolean addResourceWatcher(ClassLoader loader, String resource, HotSwapAction callback) throws IOException {
ensureInitialized();
URL url;
if (loader == null) {
url = ClassLoader.getSystemResource(resource);
} else {
url = loader.getResource(resource);
}
if (url == null) {
throw new IOException("Resource " + resource + " not found from class loader: " + loader.getClass().getName());
}
if ("file".equals(url.getProtocol())) {
// parent directory to register watch on
try {
Path path = Paths.get(url.toURI());
serviceWatcherThread.addWatch(path, () -> callback.fire());
return true;
} catch (URISyntaxException e) {
return false;
}
}
return false;
}
public synchronized void addServiceWatcher(Class<?> service, ClassLoader loader, HotSwapAction callback) throws IOException {
ensureInitialized();
// cache initial service implementations
Set<String> serviceImpl = Collections.synchronizedSet(new HashSet<>());
ServiceLoader<?> serviceLoader = ServiceLoader.load(service, loader);
Iterator<?> iterator = serviceLoader.iterator();
while (iterator.hasNext()) {
try {
Object o = iterator.next();
serviceImpl.add(o.getClass().getName());
} catch (ServiceConfigurationError e) {
// ignore services that we're not able to instantiate
}
}
String fullName = PREFIX + service.getName();
services.put(fullName, serviceImpl);
// pick up the initial URLs for the service class
ArrayList<URL> initialURLs = new ArrayList<>();
Enumeration<URL> urls;
if (loader == null) {
urls = ClassLoader.getSystemResources(fullName);
} else {
urls = loader.getResources(fullName);
}
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
if ("file".equals(url.getProtocol())) {
try {
Path path = Paths.get(url.toURI());
// listen for changes to the service registration file
initialURLs.add(url);
serviceWatcherThread.addWatch(path, () -> onServiceChange(callback, serviceLoader, fullName));
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
}
// listen for changes to URLs in the resources
urlWatcher.addWatch(new URLServiceState(initialURLs, loader, fullName, (url) -> {
try {
callback.fire();
} catch (Throwable t) {
// Checkstyle: stop warning message from guest code
System.err.println("[HotSwap API]: Unexpected exception while running service change action");
// Checkstyle: resume warning message from guest code
t.printStackTrace();
}
try {
Path path = Paths.get(url.toURI());
// listen for changes to the service registration file
serviceWatcherThread.addWatch(path, () -> onServiceChange(callback, serviceLoader, fullName));
} catch (Exception e) {
// perhaps fallback to reloading and fetching from service loader at intervals?
}
return null;
}, () -> {
try {
callback.fire();
} catch (Throwable t) {
// Checkstyle: stop warning message from guest code
System.err.println("[HotSwap API]: Unexpected exception while running service change action");
// Checkstyle: resume warning message from guest code
t.printStackTrace();
}
}));
}
private void ensureInitialized() throws IOException {
// start watcher threads
if (serviceWatcherThread == null) {
serviceWatcherThread = new WatcherThread();
serviceWatcherThread.start();
urlWatcher = new URLWatcher();
urlWatcher.startWatching();
}
}
private synchronized void onServiceChange(HotSwapAction callback, ServiceLoader<?> serviceLoader, String fullName) {
// sanity-check that the file modification has led to actual changes in services
serviceLoader.reload();
Set<String> currentServiceImpl = services.getOrDefault(fullName, Collections.emptySet());
Set<String> changedServiceImpl = Collections.synchronizedSet(new HashSet<>(currentServiceImpl.size() + 1));
Iterator<?> it = serviceLoader.iterator();
boolean callbackFired = false;
while (it.hasNext()) {
try {
Object o = it.next();
changedServiceImpl.add(o.getClass().getName());
if (!currentServiceImpl.contains(o.getClass().getName())) {
// new service implementation detected
callback.fire();
callbackFired = true;
break;
}
} catch (ServiceConfigurationError e) {
// services that we're not able to instantiate are irrelevant
}
}
if (!callbackFired && changedServiceImpl.size() != currentServiceImpl.size()) {
// removed service implementation, fire callback
callback.fire();
}
// update the cached services
services.put(fullName, changedServiceImpl);
}
private final class WatcherThread extends Thread {
private final WatchService watchService;
// The direct watched resources is mapped to the current known resource state.
// The state is managed by means of a file checksum.
private final Map<Path, ServiceWatcher.State> watchActions = Collections.synchronizedMap(new HashMap<>());
// Track existing folders for which we need notification upon deletion.
// This is relevant when parent folders of a watched resource are deleted.
private final Map<Path, Set<Path>> watchedForDeletion = new HashMap<>();
// Track non-existing folders for which we need notification upon creation.
// This is relevant when parent folders of a watched resource was previously deleted,
// and then recreated again.
private final Map<Path, Set<Path>> watchedForCreation = new HashMap<>();
// Map of registered file-system watches to allow us to cancel of watched path
// in case it's no longer needed for detecting changes to leaf resources.
private final Map<Path, WatchKey> registeredWatches = new HashMap<>();
// Map all active file watches with the set of paths for which the watch was
// registered to enable us to cancel watches when deleted folders are recreated.
// A counter on each path reason is kept for managing when we should cancel the
// file system watch on the registered path.
private final Map<Path, Map<Path, Integer>> activeFileWatches = new HashMap<>();
private WatcherThread() throws IOException {
super("hotswap-watcher-1");
this.setDaemon(true);
this.watchService = FileSystems.getDefault().newWatchService();
}
public void addWatch(Path resourcePath, Runnable callback) throws IOException {
watchActions.put(resourcePath, new ServiceWatcher.State(calculateChecksum(resourcePath), callback));
// register watch on parent folder
Path dir = resourcePath.getParent();
if (dir == null) {
throw new IOException("parent directory doesn't exist for: " + resourcePath);
}
registerFileSystemWatch(dir, resourcePath, ALL_WATCH_KINDS);
}
private void addWatchedDeletedFolder(Path path, Path leaf) {
Set<Path> set = watchedForDeletion.get(path);
if (set == null) {
set = new HashSet<>();
watchedForDeletion.put(path, set);
}
set.add(leaf);
}
private void addWatchedCreatedFolder(Path path, Path leaf) {
Set<Path> set = watchedForCreation.get(path);
if (set == null) {
set = new HashSet<>();
watchedForCreation.put(path, set);
}
set.add(leaf);
}
@Override
public void run() {
WatchKey key;
try {
while ((key = watchService.take()) != null) {
for (WatchEvent<?> event : key.pollEvents()) {
if (event.kind() == StandardWatchEventKinds.OVERFLOW) {
// OK, let's do a directory scan for watched files
for (Path path : watchActions.keySet()) {
scanDir(path.getParent());
}
continue;
}
String fileName = event.context().toString();
Path watchPath = null;
Watchable watchable = key.watchable();
if (watchable instanceof Path) {
watchPath = (Path) watchable;
}
if (watchPath == null) {
continue;
}
Path resourcePath = watchPath.resolve(fileName);
if (event.kind() == StandardWatchEventKinds.ENTRY_DELETE) {
if (watchActions.containsKey(resourcePath)) {
handleDeletedResource(watchPath, resourcePath);
} else if (watchedForDeletion.containsKey(resourcePath)) {
handleDeletedFolderEvent(resourcePath);
}
} else if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
if (watchActions.containsKey(resourcePath)) {
handleCreatedResource(watchPath, resourcePath);
} else if (watchedForCreation.containsKey(resourcePath)) {
handleCreatedFolderEvent(resourcePath);
}
} else if (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY) {
if (watchActions.containsKey(resourcePath)) {
detectChange(resourcePath);
}
}
}
key.reset();
}
} catch (InterruptedException e) {
throw new RuntimeException("Espresso HotSwap service watcher thread was interrupted!");
}
}
private void handleDeletedResource(Path watchPath, Path resourcePath) {
// the parent folder could also be deleted,
// so register a delete watch on the parent
addWatchedDeletedFolder(watchPath, resourcePath);
removeFilesystemWatchReason(watchPath, resourcePath);
Path parent = watchPath.getParent();
if (parent == null) {
return;
}
try {
registerFileSystemWatch(parent, watchPath, DELETE_KINDS);
} catch (IOException e) {
handleDeletedFolderEvent(watchPath);
return;
}
if (!Files.exists(watchPath)) {
handleDeletedFolderEvent(watchPath);
} else {
// We could have lost the file system watch on watchPath,
// so re-establish the file system watch and do a fresh scan
try {
registerFileSystemWatch(watchPath, resourcePath, ALL_WATCH_KINDS);
} catch (IOException e) {
// OK, now watchPath has been deleted,
// so handle as deleted
handleDeletedFolderEvent(watchPath);
}
scanDir(watchPath);
}
}
private void handleCreatedResource(Path watchPath, Path resourcePath) {
removeFilesystemWatchReason(watchPath.getParent(), watchPath);
Set<Path> set = watchedForDeletion.getOrDefault(watchPath, Collections.emptySet());
set.remove(resourcePath);
if (set.isEmpty()) {
watchedForDeletion.remove(watchPath);
}
detectChange(resourcePath);
}
private synchronized void registerFileSystemWatch(Path path, Path reason, WatchEvent.Kind<?>[] kinds) throws IOException {
// register the watch and store the watch key
WatchKey watchKey = path.register(watchService, kinds);
registeredWatches.put(path, watchKey);
// keep track of the file watch
Map<Path, Integer> reasons = activeFileWatches.get(path);
if (reasons == null) {
reasons = new HashMap<>(1);
activeFileWatches.put(path, reasons);
}
// increment the counter for the reason
reasons.put(reason, reasons.getOrDefault(reason, 0) + 1);
}
private synchronized void removeFilesystemWatchReason(Path path, Path reason) {
// remove the reason from file watch state
Map<Path, Integer> reasons = activeFileWatches.getOrDefault(path, Collections.emptyMap());
int count = reasons.getOrDefault(reason, 0);
if (count <= 1) {
reasons.remove(reason);
} else {
// decrement the reason count
reasons.put(reason, reasons.get(reason) - 1);
}
// only cancel the file system watch if the last reason
// to have it was removed
if (reasons.isEmpty()) {
activeFileWatches.remove(path);
// cancel the file watch and remove from state
WatchKey watchKey = registeredWatches.remove(path);
if (watchKey != null) {
watchKey.cancel();
}
}
}
private void handleCreatedFolderEvent(Path path) {
Path parent = path.getParent();
if (parent == null) { // find bugs complains about potential NPE
// this should never happen
return;
}
// get leaves and update state
Set<Path> leaves = watchedForCreation.remove(path);
// transfer delete watch from parent to path
Set<Path> deleteLeaves = watchedForDeletion.getOrDefault(parent, Collections.emptySet());
deleteLeaves.removeAll(leaves);
if (deleteLeaves.isEmpty()) {
// remove from internal state
watchedForDeletion.remove(parent);
}
Set<Path> directResources = new HashSet<>();
Set<Path> childrenToWatch = new HashSet<>();
for (Path leaf : leaves) {
addWatchedDeletedFolder(path, leaf);
removeFilesystemWatchReason(parent.getParent(), parent);
removeFilesystemWatchReason(parent, path);
// mark direct resources found
if (path.equals(leaf.getParent())) {
directResources.add(leaf);
// remove the reason for the file watches
continue;
}
// we need to find the direct child of the input path
// towards the leaf and add creation watches on those children
Path current = leaf;
while (current != null && !current.equals(path)) {
Path currentParent = current.getParent();
if (path.equals(currentParent)) {
addWatchedCreatedFolder(current, leaf);
childrenToWatch.add(current);
}
current = currentParent;
}
}
// done updating internal state, ready to register the new file watches now
try {
for (Path directResource : directResources) {
registerFileSystemWatch(path, directResource, ALL_WATCH_KINDS);
}
for (Path toWatch : childrenToWatch) {
registerFileSystemWatch(path, toWatch, CREATE_KINDS);
}
// we could have missed file creation within the path so do a scan
scanDir(path);
} catch (IOException e) {
// couldn't register all file watches
// check if path has been removed
if (!Files.exists(path)) {
handleDeletedFolderEvent(path);
} else {
// Checkstyle: stop warning message from guest code
System.err.println("[HotSwap API]: Unexpected exception while handling creation of path: " + path);
// Checkstyle: resume warning message from guest code
e.printStackTrace();
}
}
}
// The main idea is that we need to transfer the leaf paths
// to the parent directory, since this will be the new parent
// folder we keep track of.
//
// Furthermore, we need to transfer the created folder watches,
// to the input path or create new ones.
private void handleDeletedFolderEvent(Path path) {
Path parent = path.getParent();
// stop at the root, but this should never happen
if (parent == null) {
return;
}
// update state
Set<Path> leaves = watchedForDeletion.remove(path);
if (leaves == null) {
// must have been recreated and handled already
// so no further actions required here
return;
}
for (Path leaf : leaves) {
// transfer leaves to parent for deletion
addWatchedDeletedFolder(parent, leaf);
transferCreationWatch(path, leaf);
}
removeFilesystemWatchReason(parent, path);
// done updating internal state
// update file-system watches to new state
try {
Path grandParent = parent.getParent();
if (grandParent != null) {
registerDeleteFileSystemWatch(grandParent, parent);
}
if (Files.exists(parent) && Files.isReadable(parent)) {
// OK, parent exists, so register create watch on path
registerCreateFileSystemWatch(parent, path);
// make a scan to make sure we didn't miss any events
// just prior to registering the file system watch
scanDir(parent);
} else {
handleDeletedFolderEvent(parent);
}
} catch (IOException e) {
// didn't exist, move on to parent then
handleDeletedFolderEvent(parent);
}
}
private void transferCreationWatch(Path path, Path leaf) {
// we know path was deleted, so we need to find the direct
// child of the path to the leaf if any and transfer the
// create watch to the input path
Path current = leaf;
while (current != path) {
Path parent = current.getParent();
if (parent != null && parent.equals(path)) {
// found the direct child path!
// transfer creation watch from the
// found child to the input path
watchedForCreation.remove(current);
addWatchedCreatedFolder(path, leaf);
// remove the reason for the file system watch
removeFilesystemWatchReason(path, current);
break;
}
current = parent;
}
}
private void registerDeleteFileSystemWatch(Path path, Path reason) throws IOException {
// check if there's a create watch also registered
if (!watchedForCreation.getOrDefault(path, Collections.emptySet()).isEmpty()) {
// OK, then register both for creation and deletion
registerFileSystemWatch(path, reason, CREATE_DELETE_KINDS);
} else {
registerFileSystemWatch(path, reason, DELETE_KINDS);
}
}
private void registerCreateFileSystemWatch(Path path, Path reason) throws IOException {
// check if there's a create watch also registered
if (!watchedForDeletion.getOrDefault(path, Collections.emptySet()).isEmpty()) {
// OK, then register both for creation and deletion
registerFileSystemWatch(path, reason, CREATE_DELETE_KINDS);
} else {
registerFileSystemWatch(path, reason, CREATE_KINDS);
}
}
private void detectChange(Path path) {
ServiceWatcher.State state = watchActions.get(path);
if (state.hasChanged(path)) {
try {
state.getAction().run();
} catch (Throwable t) {
// Checkstyle: stop warning message from guest code
System.err.println("[HotSwap API]: Unexpected exception while running resource change action for: " + path);
// Checkstyle: resume warning message from guest code
t.printStackTrace();
}
}
}
private void scanDir(Path dir) {
try (Stream<Path> list = Files.list(dir)) {
list.forEach((path) -> {
if (watchActions.containsKey(path)) {
handleCreatedResource(dir, path);
} else if (watchedForCreation.containsKey(path)) {
handleCreatedFolderEvent(path);
}
});
} catch (IOException e) {
// ignore deleted or invalid files here
}
}
}
private static byte[] calculateChecksum(Path resourcePath) {
try {
byte[] buffer = new byte[4096];
MessageDigest md = MessageDigest.getInstance("MD5");
try (InputStream is = Files.newInputStream(resourcePath); DigestInputStream dis = new DigestInputStream(is, md)) {
// read through the entire stream which updates the message digest underneath
while (dis.read(buffer) != -1) {
dis.read();
}
}
return md.digest();
} catch (Exception e) {
// Checkstyle: stop warning message from guest code
System.err.println("[HotSwap API]: unable to calculate checksum for watched resource " + resourcePath);
// Checkstyle: resume warning message from guest code
}
return EMPTY_BYTE_ARRAY;
}
private static final class State {
private byte[] checksum;
private Runnable action;
State(byte[] checksum, Runnable action) {
this.checksum = checksum;
this.action = action;
}
public Runnable getAction() {
return action;
}
public boolean hasChanged(Path path) {
byte[] currentChecksum = calculateChecksum(path);
if (!MessageDigest.isEqual(currentChecksum, checksum)) {
checksum = currentChecksum;
return true;
}
// mark as if changed when we can't calculate the checksum
return checksum.length == 0 || currentChecksum.length == 0;
}
}
private final class URLWatcher {
private final List<URLServiceState> cache = Collections.synchronizedList(new ArrayList<>());
public void addWatch(URLServiceState state) {
synchronized (cache) {
cache.add(state);
}
}
public void startWatching() {
TimerTask task = new TimerTask() {
@Override
public void run() {
synchronized (cache) {
for (URLServiceState urlServiceState : cache) {
urlServiceState.detectChanges();
}
}
}
};
ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
es.scheduleWithFixedDelay(task, 500, 500, TimeUnit.MILLISECONDS);
}
}
private final class URLServiceState {
private List<URL> knownURLs;
private final ClassLoader classLoader;
private final String fullName;
private final Function<URL, Void> onAddedURL;
private final Runnable onRemovedURL;
private URLServiceState(ArrayList<URL> initialURLs, ClassLoader classLoader, String fullName, Function<URL, Void> onAddedURL, Runnable onRemovedURL) {
this.knownURLs = Collections.synchronizedList(initialURLs);
this.classLoader = classLoader;
this.fullName = fullName;
this.onAddedURL = onAddedURL;
this.onRemovedURL = onRemovedURL;
}
private void detectChanges() {
try {
boolean changed = false;
ArrayList<URL> currentURLs = new ArrayList<>(knownURLs.size());
Enumeration<URL> urls;
if (classLoader == null) {
urls = ClassLoader.getSystemResources(fullName);
} else {
urls = classLoader.getResources(fullName);
}
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
if ("file".equals(url.getProtocol())) {
currentURLs.add(url);
if (!knownURLs.contains(url)) {
changed = true;
onAddedURL.apply(url);
}
}
}
if (currentURLs.size() != knownURLs.size()) {
changed = true;
onRemovedURL.run();
}
if (changed) {
// update cache
knownURLs = currentURLs;
}
} catch (IOException e) {
return;
}
}
}
}
| gpl-2.0 |
rfc1459/moca | src/main/java/org/level28/android/moca/ui/faq/FaqItemView.java | 1782 | // @formatter:off
/*
* FaqItemView.java - view holder for FAQ items
* Copyright (C) 2012 Matteo Panella <morpheus@level28.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @formatter:on
package org.level28.android.moca.ui.faq;
import org.level28.android.moca.R;
import org.level28.android.moca.ui.ItemView;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
/**
* View holder for FAQ items.
*
* @author Matteo Panella
*/
public class FaqItemView extends ItemView {
/**
* Category header (visible only on the first entry of a category)
*/
public final TextView header;
/**
* Question view
*/
public final TextView question;
/**
* Answer view (link-enabled)
*/
public final TextView answer;
public FaqItemView(View view) {
super(view);
header = textView(view, R.id.headerView);
question = textView(view, R.id.faqQuestion);
answer = textView(view, R.id.faqAnswer);
answer.setMovementMethod(LinkMovementMethod.getInstance());
}
}
| gpl-2.0 |
joshmoore/openmicroscopy | components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/DirectoryMonitor.java | 3176 | /*
* org.openmicroscopy.shoola.agents.fsimporter.DirectoryMonitor
*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2008 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*------------------------------------------------------------------------------
*/
package org.openmicroscopy.shoola.agents.fsimporter;
//Java imports
import java.io.File;
//Third-party libraries
//Application-internal dependencies
import org.openmicroscopy.shoola.agents.fsimporter.view.Importer;
import org.openmicroscopy.shoola.env.data.views.CallHandle;
import pojos.DataObject;
/**
* Loads a directory.
*
* @author Jean-Marie Burel
* <a href="mailto:j.burel@dundee.ac.uk">j.burel@dundee.ac.uk</a>
* @author Donald MacDonald
* <a href="mailto:donald@lifesci.dundee.ac.uk">donald@lifesci.dundee.ac.uk</a>
* @version 3.0
* <small>
* (<b>Internal version:</b> $Revision: $Date: $)
* </small>
* @since 3.0-Beta4
*/
public class DirectoryMonitor
extends DataImporterLoader
{
/** Handle to the asynchronous call so that we can cancel it. */
private CallHandle handle;
/** The directory to monitor. */
private File directory;
/** The container where to import the images into. */
private DataObject container;
/**
* Creates a new instance.
*
* @param viewer The Importer this data loader is for.
* Mustn't be <code>null</code>.
* @param directory The directory to monitor.
* @param container The container where to import the image to.
*/
public DirectoryMonitor(Importer viewer, File directory,
DataObject container)
{
super(viewer);
if (directory == null)
throw new IllegalArgumentException("No directory to monitor.");
this.directory = directory;
this.container = container;
}
/**
* Monitors the directory.
* @see DataImporterLoader#load()
*/
public void load()
{
handle = ivView.monitorDirectory(directory, container,
getCurrentUserID(), -1, this);
}
/**
* Cancels the import.
* @see DataImporterLoader#load()
*/
public void cancel() { handle.cancel(); }
/**
* Feeds the result back to the viewer.
* @see DataImporterLoader#handleResult(Object)
*/
public void handleResult(Object result)
{
if (viewer.getState() == Importer.DISCARDED) return; //Async cancel.
}
}
| gpl-2.0 |
unkascrack/curso-struts2 | resources/ejercicio-2.05/src/es/curso/struts2/ejercicio25/dao/UsuarioDAO.java | 1421 | package es.curso.struts2.ejercicio25.dao;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import es.curso.struts2.ejercicio25.model.Usuario;
public class UsuarioDAO {
private static UsuarioDAO usuarioDAO = new UsuarioDAO();
private UsuarioDAO() {
}
public static UsuarioDAO getInstance() {
return usuarioDAO;
}
private static final Map<Integer, Usuario> USUARIOS = new HashMap<Integer, Usuario>();
static {
USUARIOS.put(Usuario.getDefaultId(), new Usuario("admin", "admin", "",
null, "", ""));
USUARIOS.put(Usuario.getDefaultId(), new Usuario("prueba", "Perico",
"Palotes", new Date(), "Desconocida", "666 666 666"));
USUARIOS.put(Usuario.getDefaultId(), new Usuario("usuario1",
"Usuario1", "", new Date(), "Madrid", "916-666-666"));
USUARIOS.put(Usuario.getDefaultId(), new Usuario("usuario2",
"Usuario2", "Apellido Usuario2", null, "Barcelona",
"555-666-666"));
}
public Collection<Usuario> getUsuarios() {
return new ArrayList<Usuario>(USUARIOS.values());
}
public Usuario getUsuario(Integer id) {
Usuario usuario = USUARIOS.get(id);
try {
return (Usuario) (usuario != null ? usuario.clone() : null);
} catch (CloneNotSupportedException e) {
return null;
}
}
public void alta(Usuario usuario) {
USUARIOS.put(Usuario.getDefaultId(), usuario);
usuario.setId();
}
}
| gpl-2.0 |
smarr/Truffle | sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/api/LLVMVoidStatementNode.java | 2211 | /*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.oracle.truffle.llvm.runtime.nodes.api;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
/**
* This node is used to execute an expression as a statement, discarding the result.
*/
@NodeChild(value = "value", type = LLVMExpressionNode.class)
@NodeInfo(cost = NodeCost.NONE)
public abstract class LLVMVoidStatementNode extends LLVMStatementNode {
@Specialization
protected void doVoid(@SuppressWarnings("unused") Object value) {
// nothing to do
}
}
| gpl-2.0 |
sunknife/GoJavaOnline | EE Module 6 Part2/src/main/java/objects/Dish.java | 1688 | package objects;
import java.util.List;
import java.util.Map;
public class Dish {
private int id;
private String name;
private String category;
private double cost;
private int weight;
private Map<Integer,Double> ingredients;
public Dish(int id, String name, String category, double cost, int weight) {
this.id = id;
this.name = name;
this.category = category;
this.cost = cost;
this.weight = weight;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Dish{" +
"id=" + id +
", name='" + name + '\'' +
", category='" + category + '\'' +
", cost=" + cost +
", weight=" + weight +
", ingredients=" + ingredients +
'}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public Map<Integer, Double> getIngredients() {
return ingredients;
}
public void setIngredients(Map<Integer, Double> ingredients) {
this.ingredients = ingredients;
}
}
| gpl-2.0 |
kingkybel/utilities | GUIComponents/src/com/kybelksties/gui/controls/ShapeComboBoxBeanInfo.java | 91775 | /*
* Copyright (C) 2015 Dieter J Kybelksties
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @date: 2015-12-16
* @author: Dieter J Kybelksties
*/
package com.kybelksties.gui.controls;
import java.beans.BeanDescriptor;
import java.beans.EventSetDescriptor;
import java.beans.IndexedPropertyDescriptor;
import java.beans.IntrospectionException;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.util.logging.Logger;
/**
* Bean information for combo-box to chose basic geometric shapes.
*
* @author kybelksd
*/
public class ShapeComboBoxBeanInfo extends SimpleBeanInfo
{
private static final Class CLAZZ = ShapeComboBoxBeanInfo.class;
private static final String CLASS_NAME = CLAZZ.getName();
private static final Logger LOGGER = Logger.getLogger(CLASS_NAME);
// Bean descriptor//GEN-FIRST:BeanDescriptor
/*lazy BeanDescriptor*/
private static BeanDescriptor getBdescriptor(){
BeanDescriptor beanDescriptor = new BeanDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class , null ); // NOI18N//GEN-HEADEREND:BeanDescriptor
// Here you can add code for customizing the BeanDescriptor.
return beanDescriptor; }//GEN-LAST:BeanDescriptor
// Property identifiers//GEN-FIRST:Properties
private static final int PROPERTY_accessibleContext = 0;
private static final int PROPERTY_action = 1;
private static final int PROPERTY_actionCommand = 2;
private static final int PROPERTY_actionListeners = 3;
private static final int PROPERTY_actionMap = 4;
private static final int PROPERTY_alignmentX = 5;
private static final int PROPERTY_alignmentY = 6;
private static final int PROPERTY_ancestorListeners = 7;
private static final int PROPERTY_autoscrolls = 8;
private static final int PROPERTY_background = 9;
private static final int PROPERTY_backgroundSet = 10;
private static final int PROPERTY_baselineResizeBehavior = 11;
private static final int PROPERTY_border = 12;
private static final int PROPERTY_bounds = 13;
private static final int PROPERTY_colorModel = 14;
private static final int PROPERTY_component = 15;
private static final int PROPERTY_componentCount = 16;
private static final int PROPERTY_componentListeners = 17;
private static final int PROPERTY_componentOrientation = 18;
private static final int PROPERTY_componentPopupMenu = 19;
private static final int PROPERTY_components = 20;
private static final int PROPERTY_containerListeners = 21;
private static final int PROPERTY_cursor = 22;
private static final int PROPERTY_cursorSet = 23;
private static final int PROPERTY_debugGraphicsOptions = 24;
private static final int PROPERTY_displayable = 25;
private static final int PROPERTY_doubleBuffered = 26;
private static final int PROPERTY_dropTarget = 27;
private static final int PROPERTY_editable = 28;
private static final int PROPERTY_editor = 29;
private static final int PROPERTY_enabled = 30;
private static final int PROPERTY_focusable = 31;
private static final int PROPERTY_focusCycleRoot = 32;
private static final int PROPERTY_focusCycleRootAncestor = 33;
private static final int PROPERTY_focusListeners = 34;
private static final int PROPERTY_focusOwner = 35;
private static final int PROPERTY_focusTraversable = 36;
private static final int PROPERTY_focusTraversalKeys = 37;
private static final int PROPERTY_focusTraversalKeysEnabled = 38;
private static final int PROPERTY_focusTraversalPolicy = 39;
private static final int PROPERTY_focusTraversalPolicyProvider = 40;
private static final int PROPERTY_focusTraversalPolicySet = 41;
private static final int PROPERTY_font = 42;
private static final int PROPERTY_fontSet = 43;
private static final int PROPERTY_foreground = 44;
private static final int PROPERTY_foregroundSet = 45;
private static final int PROPERTY_graphics = 46;
private static final int PROPERTY_graphicsConfiguration = 47;
private static final int PROPERTY_height = 48;
private static final int PROPERTY_hierarchyBoundsListeners = 49;
private static final int PROPERTY_hierarchyListeners = 50;
private static final int PROPERTY_ignoreRepaint = 51;
private static final int PROPERTY_inheritsPopupMenu = 52;
private static final int PROPERTY_inputContext = 53;
private static final int PROPERTY_inputMap = 54;
private static final int PROPERTY_inputMethodListeners = 55;
private static final int PROPERTY_inputMethodRequests = 56;
private static final int PROPERTY_inputVerifier = 57;
private static final int PROPERTY_insets = 58;
private static final int PROPERTY_itemAt = 59;
private static final int PROPERTY_itemCount = 60;
private static final int PROPERTY_itemListeners = 61;
private static final int PROPERTY_keyListeners = 62;
private static final int PROPERTY_keySelectionManager = 63;
private static final int PROPERTY_layout = 64;
private static final int PROPERTY_lightweight = 65;
private static final int PROPERTY_lightWeightPopupEnabled = 66;
private static final int PROPERTY_locale = 67;
private static final int PROPERTY_location = 68;
private static final int PROPERTY_locationOnScreen = 69;
private static final int PROPERTY_managingFocus = 70;
private static final int PROPERTY_maximumRowCount = 71;
private static final int PROPERTY_maximumSize = 72;
private static final int PROPERTY_maximumSizeSet = 73;
private static final int PROPERTY_minimumSize = 74;
private static final int PROPERTY_minimumSizeSet = 75;
private static final int PROPERTY_model = 76;
private static final int PROPERTY_mouseListeners = 77;
private static final int PROPERTY_mouseMotionListeners = 78;
private static final int PROPERTY_mousePosition = 79;
private static final int PROPERTY_mouseWheelListeners = 80;
private static final int PROPERTY_name = 81;
private static final int PROPERTY_nextFocusableComponent = 82;
private static final int PROPERTY_opaque = 83;
private static final int PROPERTY_optimizedDrawingEnabled = 84;
private static final int PROPERTY_paintingForPrint = 85;
private static final int PROPERTY_paintingTile = 86;
private static final int PROPERTY_parent = 87;
private static final int PROPERTY_peer = 88;
private static final int PROPERTY_popupMenuListeners = 89;
private static final int PROPERTY_popupVisible = 90;
private static final int PROPERTY_preferredSize = 91;
private static final int PROPERTY_preferredSizeSet = 92;
private static final int PROPERTY_propertyChangeListeners = 93;
private static final int PROPERTY_prototypeDisplayValue = 94;
private static final int PROPERTY_registeredKeyStrokes = 95;
private static final int PROPERTY_renderer = 96;
private static final int PROPERTY_requestFocusEnabled = 97;
private static final int PROPERTY_rootPane = 98;
private static final int PROPERTY_selectedIndex = 99;
private static final int PROPERTY_selectedItem = 100;
private static final int PROPERTY_selectedObjects = 101;
private static final int PROPERTY_showing = 102;
private static final int PROPERTY_size = 103;
private static final int PROPERTY_toolkit = 104;
private static final int PROPERTY_toolTipText = 105;
private static final int PROPERTY_topLevelAncestor = 106;
private static final int PROPERTY_transferHandler = 107;
private static final int PROPERTY_treeLock = 108;
private static final int PROPERTY_UI = 109;
private static final int PROPERTY_UIClassID = 110;
private static final int PROPERTY_valid = 111;
private static final int PROPERTY_validateRoot = 112;
private static final int PROPERTY_verifyInputWhenFocusTarget = 113;
private static final int PROPERTY_vetoableChangeListeners = 114;
private static final int PROPERTY_visible = 115;
private static final int PROPERTY_visibleRect = 116;
private static final int PROPERTY_width = 117;
private static final int PROPERTY_x = 118;
private static final int PROPERTY_y = 119;
// Property array
/*lazy PropertyDescriptor*/
private static PropertyDescriptor[] getPdescriptor(){
PropertyDescriptor[] properties = new PropertyDescriptor[120];
try {
properties[PROPERTY_accessibleContext] = new PropertyDescriptor ( "accessibleContext", com.kybelksties.gui.controls.ShapeComboBox.class, "getAccessibleContext", null ); // NOI18N
properties[PROPERTY_action] = new PropertyDescriptor ( "action", com.kybelksties.gui.controls.ShapeComboBox.class, "getAction", "setAction" ); // NOI18N
properties[PROPERTY_actionCommand] = new PropertyDescriptor ( "actionCommand", com.kybelksties.gui.controls.ShapeComboBox.class, "getActionCommand", "setActionCommand" ); // NOI18N
properties[PROPERTY_actionListeners] = new PropertyDescriptor ( "actionListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getActionListeners", null ); // NOI18N
properties[PROPERTY_actionMap] = new PropertyDescriptor ( "actionMap", com.kybelksties.gui.controls.ShapeComboBox.class, "getActionMap", "setActionMap" ); // NOI18N
properties[PROPERTY_alignmentX] = new PropertyDescriptor ( "alignmentX", com.kybelksties.gui.controls.ShapeComboBox.class, "getAlignmentX", "setAlignmentX" ); // NOI18N
properties[PROPERTY_alignmentY] = new PropertyDescriptor ( "alignmentY", com.kybelksties.gui.controls.ShapeComboBox.class, "getAlignmentY", "setAlignmentY" ); // NOI18N
properties[PROPERTY_ancestorListeners] = new PropertyDescriptor ( "ancestorListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getAncestorListeners", null ); // NOI18N
properties[PROPERTY_autoscrolls] = new PropertyDescriptor ( "autoscrolls", com.kybelksties.gui.controls.ShapeComboBox.class, "getAutoscrolls", "setAutoscrolls" ); // NOI18N
properties[PROPERTY_background] = new PropertyDescriptor ( "background", com.kybelksties.gui.controls.ShapeComboBox.class, "getBackground", "setBackground" ); // NOI18N
properties[PROPERTY_backgroundSet] = new PropertyDescriptor ( "backgroundSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isBackgroundSet", null ); // NOI18N
properties[PROPERTY_baselineResizeBehavior] = new PropertyDescriptor ( "baselineResizeBehavior", com.kybelksties.gui.controls.ShapeComboBox.class, "getBaselineResizeBehavior", null ); // NOI18N
properties[PROPERTY_border] = new PropertyDescriptor ( "border", com.kybelksties.gui.controls.ShapeComboBox.class, "getBorder", "setBorder" ); // NOI18N
properties[PROPERTY_bounds] = new PropertyDescriptor ( "bounds", com.kybelksties.gui.controls.ShapeComboBox.class, "getBounds", "setBounds" ); // NOI18N
properties[PROPERTY_colorModel] = new PropertyDescriptor ( "colorModel", com.kybelksties.gui.controls.ShapeComboBox.class, "getColorModel", null ); // NOI18N
properties[PROPERTY_component] = new IndexedPropertyDescriptor ( "component", com.kybelksties.gui.controls.ShapeComboBox.class, null, null, "getComponent", null ); // NOI18N
properties[PROPERTY_componentCount] = new PropertyDescriptor ( "componentCount", com.kybelksties.gui.controls.ShapeComboBox.class, "getComponentCount", null ); // NOI18N
properties[PROPERTY_componentListeners] = new PropertyDescriptor ( "componentListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getComponentListeners", null ); // NOI18N
properties[PROPERTY_componentOrientation] = new PropertyDescriptor ( "componentOrientation", com.kybelksties.gui.controls.ShapeComboBox.class, "getComponentOrientation", "setComponentOrientation" ); // NOI18N
properties[PROPERTY_componentPopupMenu] = new PropertyDescriptor ( "componentPopupMenu", com.kybelksties.gui.controls.ShapeComboBox.class, "getComponentPopupMenu", "setComponentPopupMenu" ); // NOI18N
properties[PROPERTY_components] = new PropertyDescriptor ( "components", com.kybelksties.gui.controls.ShapeComboBox.class, "getComponents", null ); // NOI18N
properties[PROPERTY_containerListeners] = new PropertyDescriptor ( "containerListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getContainerListeners", null ); // NOI18N
properties[PROPERTY_cursor] = new PropertyDescriptor ( "cursor", com.kybelksties.gui.controls.ShapeComboBox.class, "getCursor", "setCursor" ); // NOI18N
properties[PROPERTY_cursorSet] = new PropertyDescriptor ( "cursorSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isCursorSet", null ); // NOI18N
properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor ( "debugGraphicsOptions", com.kybelksties.gui.controls.ShapeComboBox.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions" ); // NOI18N
properties[PROPERTY_displayable] = new PropertyDescriptor ( "displayable", com.kybelksties.gui.controls.ShapeComboBox.class, "isDisplayable", null ); // NOI18N
properties[PROPERTY_doubleBuffered] = new PropertyDescriptor ( "doubleBuffered", com.kybelksties.gui.controls.ShapeComboBox.class, "isDoubleBuffered", "setDoubleBuffered" ); // NOI18N
properties[PROPERTY_dropTarget] = new PropertyDescriptor ( "dropTarget", com.kybelksties.gui.controls.ShapeComboBox.class, "getDropTarget", "setDropTarget" ); // NOI18N
properties[PROPERTY_editable] = new PropertyDescriptor ( "editable", com.kybelksties.gui.controls.ShapeComboBox.class, "isEditable", "setEditable" ); // NOI18N
properties[PROPERTY_editor] = new PropertyDescriptor ( "editor", com.kybelksties.gui.controls.ShapeComboBox.class, "getEditor", "setEditor" ); // NOI18N
properties[PROPERTY_enabled] = new PropertyDescriptor ( "enabled", com.kybelksties.gui.controls.ShapeComboBox.class, "isEnabled", "setEnabled" ); // NOI18N
properties[PROPERTY_focusable] = new PropertyDescriptor ( "focusable", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusable", "setFocusable" ); // NOI18N
properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor ( "focusCycleRoot", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusCycleRoot", "setFocusCycleRoot" ); // NOI18N
properties[PROPERTY_focusCycleRootAncestor] = new PropertyDescriptor ( "focusCycleRootAncestor", com.kybelksties.gui.controls.ShapeComboBox.class, "getFocusCycleRootAncestor", null ); // NOI18N
properties[PROPERTY_focusListeners] = new PropertyDescriptor ( "focusListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getFocusListeners", null ); // NOI18N
properties[PROPERTY_focusOwner] = new PropertyDescriptor ( "focusOwner", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusOwner", null ); // NOI18N
properties[PROPERTY_focusTraversable] = new PropertyDescriptor ( "focusTraversable", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusTraversable", null ); // NOI18N
properties[PROPERTY_focusTraversalKeys] = new IndexedPropertyDescriptor ( "focusTraversalKeys", com.kybelksties.gui.controls.ShapeComboBox.class, null, null, null, "setFocusTraversalKeys" ); // NOI18N
properties[PROPERTY_focusTraversalKeysEnabled] = new PropertyDescriptor ( "focusTraversalKeysEnabled", com.kybelksties.gui.controls.ShapeComboBox.class, "getFocusTraversalKeysEnabled", "setFocusTraversalKeysEnabled" ); // NOI18N
properties[PROPERTY_focusTraversalPolicy] = new PropertyDescriptor ( "focusTraversalPolicy", com.kybelksties.gui.controls.ShapeComboBox.class, "getFocusTraversalPolicy", "setFocusTraversalPolicy" ); // NOI18N
properties[PROPERTY_focusTraversalPolicyProvider] = new PropertyDescriptor ( "focusTraversalPolicyProvider", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusTraversalPolicyProvider", "setFocusTraversalPolicyProvider" ); // NOI18N
properties[PROPERTY_focusTraversalPolicySet] = new PropertyDescriptor ( "focusTraversalPolicySet", com.kybelksties.gui.controls.ShapeComboBox.class, "isFocusTraversalPolicySet", null ); // NOI18N
properties[PROPERTY_font] = new PropertyDescriptor ( "font", com.kybelksties.gui.controls.ShapeComboBox.class, "getFont", "setFont" ); // NOI18N
properties[PROPERTY_fontSet] = new PropertyDescriptor ( "fontSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isFontSet", null ); // NOI18N
properties[PROPERTY_foreground] = new PropertyDescriptor ( "foreground", com.kybelksties.gui.controls.ShapeComboBox.class, "getForeground", "setForeground" ); // NOI18N
properties[PROPERTY_foregroundSet] = new PropertyDescriptor ( "foregroundSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isForegroundSet", null ); // NOI18N
properties[PROPERTY_graphics] = new PropertyDescriptor ( "graphics", com.kybelksties.gui.controls.ShapeComboBox.class, "getGraphics", null ); // NOI18N
properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor ( "graphicsConfiguration", com.kybelksties.gui.controls.ShapeComboBox.class, "getGraphicsConfiguration", null ); // NOI18N
properties[PROPERTY_height] = new PropertyDescriptor ( "height", com.kybelksties.gui.controls.ShapeComboBox.class, "getHeight", null ); // NOI18N
properties[PROPERTY_hierarchyBoundsListeners] = new PropertyDescriptor ( "hierarchyBoundsListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getHierarchyBoundsListeners", null ); // NOI18N
properties[PROPERTY_hierarchyListeners] = new PropertyDescriptor ( "hierarchyListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getHierarchyListeners", null ); // NOI18N
properties[PROPERTY_ignoreRepaint] = new PropertyDescriptor ( "ignoreRepaint", com.kybelksties.gui.controls.ShapeComboBox.class, "getIgnoreRepaint", "setIgnoreRepaint" ); // NOI18N
properties[PROPERTY_inheritsPopupMenu] = new PropertyDescriptor ( "inheritsPopupMenu", com.kybelksties.gui.controls.ShapeComboBox.class, "getInheritsPopupMenu", "setInheritsPopupMenu" ); // NOI18N
properties[PROPERTY_inputContext] = new PropertyDescriptor ( "inputContext", com.kybelksties.gui.controls.ShapeComboBox.class, "getInputContext", null ); // NOI18N
properties[PROPERTY_inputMap] = new PropertyDescriptor ( "inputMap", com.kybelksties.gui.controls.ShapeComboBox.class, "getInputMap", null ); // NOI18N
properties[PROPERTY_inputMethodListeners] = new PropertyDescriptor ( "inputMethodListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getInputMethodListeners", null ); // NOI18N
properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor ( "inputMethodRequests", com.kybelksties.gui.controls.ShapeComboBox.class, "getInputMethodRequests", null ); // NOI18N
properties[PROPERTY_inputVerifier] = new PropertyDescriptor ( "inputVerifier", com.kybelksties.gui.controls.ShapeComboBox.class, "getInputVerifier", "setInputVerifier" ); // NOI18N
properties[PROPERTY_insets] = new PropertyDescriptor ( "insets", com.kybelksties.gui.controls.ShapeComboBox.class, "getInsets", null ); // NOI18N
properties[PROPERTY_itemAt] = new IndexedPropertyDescriptor ( "itemAt", com.kybelksties.gui.controls.ShapeComboBox.class, null, null, "getItemAt", null ); // NOI18N
properties[PROPERTY_itemCount] = new PropertyDescriptor ( "itemCount", com.kybelksties.gui.controls.ShapeComboBox.class, "getItemCount", null ); // NOI18N
properties[PROPERTY_itemListeners] = new PropertyDescriptor ( "itemListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getItemListeners", null ); // NOI18N
properties[PROPERTY_keyListeners] = new PropertyDescriptor ( "keyListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getKeyListeners", null ); // NOI18N
properties[PROPERTY_keySelectionManager] = new PropertyDescriptor ( "keySelectionManager", com.kybelksties.gui.controls.ShapeComboBox.class, "getKeySelectionManager", "setKeySelectionManager" ); // NOI18N
properties[PROPERTY_layout] = new PropertyDescriptor ( "layout", com.kybelksties.gui.controls.ShapeComboBox.class, "getLayout", "setLayout" ); // NOI18N
properties[PROPERTY_lightweight] = new PropertyDescriptor ( "lightweight", com.kybelksties.gui.controls.ShapeComboBox.class, "isLightweight", null ); // NOI18N
properties[PROPERTY_lightWeightPopupEnabled] = new PropertyDescriptor ( "lightWeightPopupEnabled", com.kybelksties.gui.controls.ShapeComboBox.class, "isLightWeightPopupEnabled", "setLightWeightPopupEnabled" ); // NOI18N
properties[PROPERTY_locale] = new PropertyDescriptor ( "locale", com.kybelksties.gui.controls.ShapeComboBox.class, "getLocale", "setLocale" ); // NOI18N
properties[PROPERTY_location] = new PropertyDescriptor ( "location", com.kybelksties.gui.controls.ShapeComboBox.class, "getLocation", "setLocation" ); // NOI18N
properties[PROPERTY_locationOnScreen] = new PropertyDescriptor ( "locationOnScreen", com.kybelksties.gui.controls.ShapeComboBox.class, "getLocationOnScreen", null ); // NOI18N
properties[PROPERTY_managingFocus] = new PropertyDescriptor ( "managingFocus", com.kybelksties.gui.controls.ShapeComboBox.class, "isManagingFocus", null ); // NOI18N
properties[PROPERTY_maximumRowCount] = new PropertyDescriptor ( "maximumRowCount", com.kybelksties.gui.controls.ShapeComboBox.class, "getMaximumRowCount", "setMaximumRowCount" ); // NOI18N
properties[PROPERTY_maximumSize] = new PropertyDescriptor ( "maximumSize", com.kybelksties.gui.controls.ShapeComboBox.class, "getMaximumSize", "setMaximumSize" ); // NOI18N
properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor ( "maximumSizeSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isMaximumSizeSet", null ); // NOI18N
properties[PROPERTY_minimumSize] = new PropertyDescriptor ( "minimumSize", com.kybelksties.gui.controls.ShapeComboBox.class, "getMinimumSize", "setMinimumSize" ); // NOI18N
properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor ( "minimumSizeSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isMinimumSizeSet", null ); // NOI18N
properties[PROPERTY_model] = new PropertyDescriptor ( "model", com.kybelksties.gui.controls.ShapeComboBox.class, "getModel", "setModel" ); // NOI18N
properties[PROPERTY_mouseListeners] = new PropertyDescriptor ( "mouseListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getMouseListeners", null ); // NOI18N
properties[PROPERTY_mouseMotionListeners] = new PropertyDescriptor ( "mouseMotionListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getMouseMotionListeners", null ); // NOI18N
properties[PROPERTY_mousePosition] = new PropertyDescriptor ( "mousePosition", com.kybelksties.gui.controls.ShapeComboBox.class, "getMousePosition", null ); // NOI18N
properties[PROPERTY_mouseWheelListeners] = new PropertyDescriptor ( "mouseWheelListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getMouseWheelListeners", null ); // NOI18N
properties[PROPERTY_name] = new PropertyDescriptor ( "name", com.kybelksties.gui.controls.ShapeComboBox.class, "getName", "setName" ); // NOI18N
properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor ( "nextFocusableComponent", com.kybelksties.gui.controls.ShapeComboBox.class, "getNextFocusableComponent", "setNextFocusableComponent" ); // NOI18N
properties[PROPERTY_opaque] = new PropertyDescriptor ( "opaque", com.kybelksties.gui.controls.ShapeComboBox.class, "isOpaque", "setOpaque" ); // NOI18N
properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor ( "optimizedDrawingEnabled", com.kybelksties.gui.controls.ShapeComboBox.class, "isOptimizedDrawingEnabled", null ); // NOI18N
properties[PROPERTY_paintingForPrint] = new PropertyDescriptor ( "paintingForPrint", com.kybelksties.gui.controls.ShapeComboBox.class, "isPaintingForPrint", null ); // NOI18N
properties[PROPERTY_paintingTile] = new PropertyDescriptor ( "paintingTile", com.kybelksties.gui.controls.ShapeComboBox.class, "isPaintingTile", null ); // NOI18N
properties[PROPERTY_parent] = new PropertyDescriptor ( "parent", com.kybelksties.gui.controls.ShapeComboBox.class, "getParent", null ); // NOI18N
properties[PROPERTY_peer] = new PropertyDescriptor ( "peer", com.kybelksties.gui.controls.ShapeComboBox.class, "getPeer", null ); // NOI18N
properties[PROPERTY_popupMenuListeners] = new PropertyDescriptor ( "popupMenuListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getPopupMenuListeners", null ); // NOI18N
properties[PROPERTY_popupVisible] = new PropertyDescriptor ( "popupVisible", com.kybelksties.gui.controls.ShapeComboBox.class, "isPopupVisible", "setPopupVisible" ); // NOI18N
properties[PROPERTY_preferredSize] = new PropertyDescriptor ( "preferredSize", com.kybelksties.gui.controls.ShapeComboBox.class, "getPreferredSize", "setPreferredSize" ); // NOI18N
properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor ( "preferredSizeSet", com.kybelksties.gui.controls.ShapeComboBox.class, "isPreferredSizeSet", null ); // NOI18N
properties[PROPERTY_propertyChangeListeners] = new PropertyDescriptor ( "propertyChangeListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getPropertyChangeListeners", null ); // NOI18N
properties[PROPERTY_prototypeDisplayValue] = new PropertyDescriptor ( "prototypeDisplayValue", com.kybelksties.gui.controls.ShapeComboBox.class, "getPrototypeDisplayValue", "setPrototypeDisplayValue" ); // NOI18N
properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor ( "registeredKeyStrokes", com.kybelksties.gui.controls.ShapeComboBox.class, "getRegisteredKeyStrokes", null ); // NOI18N
properties[PROPERTY_renderer] = new PropertyDescriptor ( "renderer", com.kybelksties.gui.controls.ShapeComboBox.class, "getRenderer", "setRenderer" ); // NOI18N
properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor ( "requestFocusEnabled", com.kybelksties.gui.controls.ShapeComboBox.class, "isRequestFocusEnabled", "setRequestFocusEnabled" ); // NOI18N
properties[PROPERTY_rootPane] = new PropertyDescriptor ( "rootPane", com.kybelksties.gui.controls.ShapeComboBox.class, "getRootPane", null ); // NOI18N
properties[PROPERTY_selectedIndex] = new PropertyDescriptor ( "selectedIndex", com.kybelksties.gui.controls.ShapeComboBox.class, "getSelectedIndex", "setSelectedIndex" ); // NOI18N
properties[PROPERTY_selectedItem] = new PropertyDescriptor ( "selectedItem", com.kybelksties.gui.controls.ShapeComboBox.class, "getSelectedItem", "setSelectedItem" ); // NOI18N
properties[PROPERTY_selectedObjects] = new PropertyDescriptor ( "selectedObjects", com.kybelksties.gui.controls.ShapeComboBox.class, "getSelectedObjects", null ); // NOI18N
properties[PROPERTY_showing] = new PropertyDescriptor ( "showing", com.kybelksties.gui.controls.ShapeComboBox.class, "isShowing", null ); // NOI18N
properties[PROPERTY_size] = new PropertyDescriptor ( "size", com.kybelksties.gui.controls.ShapeComboBox.class, "getSize", "setSize" ); // NOI18N
properties[PROPERTY_toolkit] = new PropertyDescriptor ( "toolkit", com.kybelksties.gui.controls.ShapeComboBox.class, "getToolkit", null ); // NOI18N
properties[PROPERTY_toolTipText] = new PropertyDescriptor ( "toolTipText", com.kybelksties.gui.controls.ShapeComboBox.class, "getToolTipText", "setToolTipText" ); // NOI18N
properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor ( "topLevelAncestor", com.kybelksties.gui.controls.ShapeComboBox.class, "getTopLevelAncestor", null ); // NOI18N
properties[PROPERTY_transferHandler] = new PropertyDescriptor ( "transferHandler", com.kybelksties.gui.controls.ShapeComboBox.class, "getTransferHandler", "setTransferHandler" ); // NOI18N
properties[PROPERTY_treeLock] = new PropertyDescriptor ( "treeLock", com.kybelksties.gui.controls.ShapeComboBox.class, "getTreeLock", null ); // NOI18N
properties[PROPERTY_UI] = new PropertyDescriptor ( "UI", com.kybelksties.gui.controls.ShapeComboBox.class, "getUI", "setUI" ); // NOI18N
properties[PROPERTY_UIClassID] = new PropertyDescriptor ( "UIClassID", com.kybelksties.gui.controls.ShapeComboBox.class, "getUIClassID", null ); // NOI18N
properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", com.kybelksties.gui.controls.ShapeComboBox.class, "isValid", null ); // NOI18N
properties[PROPERTY_validateRoot] = new PropertyDescriptor ( "validateRoot", com.kybelksties.gui.controls.ShapeComboBox.class, "isValidateRoot", null ); // NOI18N
properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor ( "verifyInputWhenFocusTarget", com.kybelksties.gui.controls.ShapeComboBox.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget" ); // NOI18N
properties[PROPERTY_vetoableChangeListeners] = new PropertyDescriptor ( "vetoableChangeListeners", com.kybelksties.gui.controls.ShapeComboBox.class, "getVetoableChangeListeners", null ); // NOI18N
properties[PROPERTY_visible] = new PropertyDescriptor ( "visible", com.kybelksties.gui.controls.ShapeComboBox.class, "isVisible", "setVisible" ); // NOI18N
properties[PROPERTY_visibleRect] = new PropertyDescriptor ( "visibleRect", com.kybelksties.gui.controls.ShapeComboBox.class, "getVisibleRect", null ); // NOI18N
properties[PROPERTY_width] = new PropertyDescriptor ( "width", com.kybelksties.gui.controls.ShapeComboBox.class, "getWidth", null ); // NOI18N
properties[PROPERTY_x] = new PropertyDescriptor ( "x", com.kybelksties.gui.controls.ShapeComboBox.class, "getX", null ); // NOI18N
properties[PROPERTY_y] = new PropertyDescriptor ( "y", com.kybelksties.gui.controls.ShapeComboBox.class, "getY", null ); // NOI18N
}
catch(IntrospectionException e) {
e.printStackTrace();
}//GEN-HEADEREND:Properties
// Here you can add code for customizing the properties array.
return properties; }//GEN-LAST:Properties
// EventSet identifiers//GEN-FIRST:Events
private static final int EVENT_actionListener = 0;
private static final int EVENT_ancestorListener = 1;
private static final int EVENT_componentListener = 2;
private static final int EVENT_containerListener = 3;
private static final int EVENT_focusListener = 4;
private static final int EVENT_hierarchyBoundsListener = 5;
private static final int EVENT_hierarchyListener = 6;
private static final int EVENT_inputMethodListener = 7;
private static final int EVENT_itemListener = 8;
private static final int EVENT_keyListener = 9;
private static final int EVENT_mouseListener = 10;
private static final int EVENT_mouseMotionListener = 11;
private static final int EVENT_mouseWheelListener = 12;
private static final int EVENT_popupMenuListener = 13;
private static final int EVENT_propertyChangeListener = 14;
private static final int EVENT_vetoableChangeListener = 15;
// EventSet array
/*lazy EventSetDescriptor*/
private static EventSetDescriptor[] getEdescriptor(){
EventSetDescriptor[] eventSets = new EventSetDescriptor[16];
try {
eventSets[EVENT_actionListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "actionListener", java.awt.event.ActionListener.class, new String[] {"actionPerformed"}, "addActionListener", "removeActionListener" ); // NOI18N
eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[] {"ancestorAdded", "ancestorRemoved", "ancestorMoved"}, "addAncestorListener", "removeAncestorListener" ); // NOI18N
eventSets[EVENT_componentListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "componentListener", java.awt.event.ComponentListener.class, new String[] {"componentResized", "componentMoved", "componentShown", "componentHidden"}, "addComponentListener", "removeComponentListener" ); // NOI18N
eventSets[EVENT_containerListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "containerListener", java.awt.event.ContainerListener.class, new String[] {"componentAdded", "componentRemoved"}, "addContainerListener", "removeContainerListener" ); // NOI18N
eventSets[EVENT_focusListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "focusListener", java.awt.event.FocusListener.class, new String[] {"focusGained", "focusLost"}, "addFocusListener", "removeFocusListener" ); // NOI18N
eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[] {"ancestorMoved", "ancestorResized"}, "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); // NOI18N
eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[] {"hierarchyChanged"}, "addHierarchyListener", "removeHierarchyListener" ); // NOI18N
eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[] {"inputMethodTextChanged", "caretPositionChanged"}, "addInputMethodListener", "removeInputMethodListener" ); // NOI18N
eventSets[EVENT_itemListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "itemListener", java.awt.event.ItemListener.class, new String[] {"itemStateChanged"}, "addItemListener", "removeItemListener" ); // NOI18N
eventSets[EVENT_keyListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "keyListener", java.awt.event.KeyListener.class, new String[] {"keyTyped", "keyPressed", "keyReleased"}, "addKeyListener", "removeKeyListener" ); // NOI18N
eventSets[EVENT_mouseListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "mouseListener", java.awt.event.MouseListener.class, new String[] {"mouseClicked", "mousePressed", "mouseReleased", "mouseEntered", "mouseExited"}, "addMouseListener", "removeMouseListener" ); // NOI18N
eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[] {"mouseDragged", "mouseMoved"}, "addMouseMotionListener", "removeMouseMotionListener" ); // NOI18N
eventSets[EVENT_mouseWheelListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "mouseWheelListener", java.awt.event.MouseWheelListener.class, new String[] {"mouseWheelMoved"}, "addMouseWheelListener", "removeMouseWheelListener" ); // NOI18N
eventSets[EVENT_popupMenuListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "popupMenuListener", javax.swing.event.PopupMenuListener.class, new String[] {"popupMenuWillBecomeVisible", "popupMenuWillBecomeInvisible", "popupMenuCanceled"}, "addPopupMenuListener", "removePopupMenuListener" ); // NOI18N
eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); // NOI18N
eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( com.kybelksties.gui.controls.ShapeComboBox.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[] {"vetoableChange"}, "addVetoableChangeListener", "removeVetoableChangeListener" ); // NOI18N
}
catch(IntrospectionException e) {
e.printStackTrace();
}//GEN-HEADEREND:Events
// Here you can add code for customizing the event sets array.
return eventSets; }//GEN-LAST:Events
// Method identifiers//GEN-FIRST:Methods
private static final int METHOD_action0 = 0;
private static final int METHOD_actionPerformed1 = 1;
private static final int METHOD_add2 = 2;
private static final int METHOD_add3 = 3;
private static final int METHOD_add4 = 4;
private static final int METHOD_add5 = 5;
private static final int METHOD_add6 = 6;
private static final int METHOD_add7 = 7;
private static final int METHOD_addItem8 = 8;
private static final int METHOD_addNotify9 = 9;
private static final int METHOD_addPropertyChangeListener10 = 10;
private static final int METHOD_applyComponentOrientation11 = 11;
private static final int METHOD_areFocusTraversalKeysSet12 = 12;
private static final int METHOD_bounds13 = 13;
private static final int METHOD_checkImage14 = 14;
private static final int METHOD_checkImage15 = 15;
private static final int METHOD_computeVisibleRect16 = 16;
private static final int METHOD_configureEditor17 = 17;
private static final int METHOD_contains18 = 18;
private static final int METHOD_contains19 = 19;
private static final int METHOD_contentsChanged20 = 20;
private static final int METHOD_countComponents21 = 21;
private static final int METHOD_createImage22 = 22;
private static final int METHOD_createImage23 = 23;
private static final int METHOD_createToolTip24 = 24;
private static final int METHOD_createVolatileImage25 = 25;
private static final int METHOD_createVolatileImage26 = 26;
private static final int METHOD_deliverEvent27 = 27;
private static final int METHOD_disable28 = 28;
private static final int METHOD_dispatchEvent29 = 29;
private static final int METHOD_doLayout30 = 30;
private static final int METHOD_enable31 = 31;
private static final int METHOD_enable32 = 32;
private static final int METHOD_enableInputMethods33 = 33;
private static final int METHOD_findComponentAt34 = 34;
private static final int METHOD_findComponentAt35 = 35;
private static final int METHOD_firePopupMenuCanceled36 = 36;
private static final int METHOD_firePopupMenuWillBecomeInvisible37 = 37;
private static final int METHOD_firePopupMenuWillBecomeVisible38 = 38;
private static final int METHOD_firePropertyChange39 = 39;
private static final int METHOD_firePropertyChange40 = 40;
private static final int METHOD_firePropertyChange41 = 41;
private static final int METHOD_firePropertyChange42 = 42;
private static final int METHOD_firePropertyChange43 = 43;
private static final int METHOD_firePropertyChange44 = 44;
private static final int METHOD_firePropertyChange45 = 45;
private static final int METHOD_firePropertyChange46 = 46;
private static final int METHOD_getActionForKeyStroke47 = 47;
private static final int METHOD_getBaseline48 = 48;
private static final int METHOD_getBounds49 = 49;
private static final int METHOD_getClientProperty50 = 50;
private static final int METHOD_getComponentAt51 = 51;
private static final int METHOD_getComponentAt52 = 52;
private static final int METHOD_getComponentZOrder53 = 53;
private static final int METHOD_getConditionForKeyStroke54 = 54;
private static final int METHOD_getDefaultLocale55 = 55;
private static final int METHOD_getFocusTraversalKeys56 = 56;
private static final int METHOD_getFontMetrics57 = 57;
private static final int METHOD_getInsets58 = 58;
private static final int METHOD_getListeners59 = 59;
private static final int METHOD_getLocation60 = 60;
private static final int METHOD_getMousePosition61 = 61;
private static final int METHOD_getPopupLocation62 = 62;
private static final int METHOD_getPropertyChangeListeners63 = 63;
private static final int METHOD_getSize64 = 64;
private static final int METHOD_getToolTipLocation65 = 65;
private static final int METHOD_getToolTipText66 = 66;
private static final int METHOD_gotFocus67 = 67;
private static final int METHOD_grabFocus68 = 68;
private static final int METHOD_handleEvent69 = 69;
private static final int METHOD_hasFocus70 = 70;
private static final int METHOD_hide71 = 71;
private static final int METHOD_hidePopup72 = 72;
private static final int METHOD_imageUpdate73 = 73;
private static final int METHOD_insertItemAt74 = 74;
private static final int METHOD_insets75 = 75;
private static final int METHOD_inside76 = 76;
private static final int METHOD_intervalAdded77 = 77;
private static final int METHOD_intervalRemoved78 = 78;
private static final int METHOD_invalidate79 = 79;
private static final int METHOD_isAncestorOf80 = 80;
private static final int METHOD_isFocusCycleRoot81 = 81;
private static final int METHOD_isLightweightComponent82 = 82;
private static final int METHOD_keyDown83 = 83;
private static final int METHOD_keyUp84 = 84;
private static final int METHOD_layout85 = 85;
private static final int METHOD_list86 = 86;
private static final int METHOD_list87 = 87;
private static final int METHOD_list88 = 88;
private static final int METHOD_list89 = 89;
private static final int METHOD_list90 = 90;
private static final int METHOD_locate91 = 91;
private static final int METHOD_location92 = 92;
private static final int METHOD_lostFocus93 = 93;
private static final int METHOD_minimumSize94 = 94;
private static final int METHOD_mouseDown95 = 95;
private static final int METHOD_mouseDrag96 = 96;
private static final int METHOD_mouseEnter97 = 97;
private static final int METHOD_mouseExit98 = 98;
private static final int METHOD_mouseMove99 = 99;
private static final int METHOD_mouseUp100 = 100;
private static final int METHOD_move101 = 101;
private static final int METHOD_nextFocus102 = 102;
private static final int METHOD_paint103 = 103;
private static final int METHOD_paintAll104 = 104;
private static final int METHOD_paintComponents105 = 105;
private static final int METHOD_paintImmediately106 = 106;
private static final int METHOD_paintImmediately107 = 107;
private static final int METHOD_postEvent108 = 108;
private static final int METHOD_preferredSize109 = 109;
private static final int METHOD_prepareImage110 = 110;
private static final int METHOD_prepareImage111 = 111;
private static final int METHOD_print112 = 112;
private static final int METHOD_printAll113 = 113;
private static final int METHOD_printComponents114 = 114;
private static final int METHOD_processKeyEvent115 = 115;
private static final int METHOD_putClientProperty116 = 116;
private static final int METHOD_registerKeyboardAction117 = 117;
private static final int METHOD_registerKeyboardAction118 = 118;
private static final int METHOD_remove119 = 119;
private static final int METHOD_remove120 = 120;
private static final int METHOD_remove121 = 121;
private static final int METHOD_removeAll122 = 122;
private static final int METHOD_removeAllItems123 = 123;
private static final int METHOD_removeItem124 = 124;
private static final int METHOD_removeItemAt125 = 125;
private static final int METHOD_removeNotify126 = 126;
private static final int METHOD_removePropertyChangeListener127 = 127;
private static final int METHOD_repaint128 = 128;
private static final int METHOD_repaint129 = 129;
private static final int METHOD_repaint130 = 130;
private static final int METHOD_repaint131 = 131;
private static final int METHOD_repaint132 = 132;
private static final int METHOD_requestDefaultFocus133 = 133;
private static final int METHOD_requestFocus134 = 134;
private static final int METHOD_requestFocus135 = 135;
private static final int METHOD_requestFocusInWindow136 = 136;
private static final int METHOD_resetKeyboardActions137 = 137;
private static final int METHOD_reshape138 = 138;
private static final int METHOD_resize139 = 139;
private static final int METHOD_resize140 = 140;
private static final int METHOD_revalidate141 = 141;
private static final int METHOD_scrollRectToVisible142 = 142;
private static final int METHOD_selectWithKeyChar143 = 143;
private static final int METHOD_setBounds144 = 144;
private static final int METHOD_setComponentZOrder145 = 145;
private static final int METHOD_setDefaultLocale146 = 146;
private static final int METHOD_show147 = 147;
private static final int METHOD_show148 = 148;
private static final int METHOD_showPopup149 = 149;
private static final int METHOD_size150 = 150;
private static final int METHOD_toString151 = 151;
private static final int METHOD_transferFocus152 = 152;
private static final int METHOD_transferFocusBackward153 = 153;
private static final int METHOD_transferFocusDownCycle154 = 154;
private static final int METHOD_transferFocusUpCycle155 = 155;
private static final int METHOD_unregisterKeyboardAction156 = 156;
private static final int METHOD_update157 = 157;
private static final int METHOD_updateUI158 = 158;
private static final int METHOD_validate159 = 159;
// Method array
/*lazy MethodDescriptor*/
private static MethodDescriptor[] getMdescriptor(){
MethodDescriptor[] methods = new MethodDescriptor[160];
try {
methods[METHOD_action0] = new MethodDescriptor(java.awt.Component.class.getMethod("action", new Class[] {java.awt.Event.class, java.lang.Object.class})); // NOI18N
methods[METHOD_action0].setDisplayName ( "" );
methods[METHOD_actionPerformed1] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("actionPerformed", new Class[] {java.awt.event.ActionEvent.class})); // NOI18N
methods[METHOD_actionPerformed1].setDisplayName ( "" );
methods[METHOD_add2] = new MethodDescriptor(java.awt.Component.class.getMethod("add", new Class[] {java.awt.PopupMenu.class})); // NOI18N
methods[METHOD_add2].setDisplayName ( "" );
methods[METHOD_add3] = new MethodDescriptor(java.awt.Container.class.getMethod("add", new Class[] {java.awt.Component.class})); // NOI18N
methods[METHOD_add3].setDisplayName ( "" );
methods[METHOD_add4] = new MethodDescriptor(java.awt.Container.class.getMethod("add", new Class[] {java.lang.String.class, java.awt.Component.class})); // NOI18N
methods[METHOD_add4].setDisplayName ( "" );
methods[METHOD_add5] = new MethodDescriptor(java.awt.Container.class.getMethod("add", new Class[] {java.awt.Component.class, int.class})); // NOI18N
methods[METHOD_add5].setDisplayName ( "" );
methods[METHOD_add6] = new MethodDescriptor(java.awt.Container.class.getMethod("add", new Class[] {java.awt.Component.class, java.lang.Object.class})); // NOI18N
methods[METHOD_add6].setDisplayName ( "" );
methods[METHOD_add7] = new MethodDescriptor(java.awt.Container.class.getMethod("add", new Class[] {java.awt.Component.class, java.lang.Object.class, int.class})); // NOI18N
methods[METHOD_add7].setDisplayName ( "" );
methods[METHOD_addItem8] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("addItem", new Class[] {java.lang.Object.class})); // NOI18N
methods[METHOD_addItem8].setDisplayName ( "" );
methods[METHOD_addNotify9] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("addNotify", new Class[] {})); // NOI18N
methods[METHOD_addNotify9].setDisplayName ( "" );
methods[METHOD_addPropertyChangeListener10] = new MethodDescriptor(java.awt.Container.class.getMethod("addPropertyChangeListener", new Class[] {java.lang.String.class, java.beans.PropertyChangeListener.class})); // NOI18N
methods[METHOD_addPropertyChangeListener10].setDisplayName ( "" );
methods[METHOD_applyComponentOrientation11] = new MethodDescriptor(java.awt.Container.class.getMethod("applyComponentOrientation", new Class[] {java.awt.ComponentOrientation.class})); // NOI18N
methods[METHOD_applyComponentOrientation11].setDisplayName ( "" );
methods[METHOD_areFocusTraversalKeysSet12] = new MethodDescriptor(java.awt.Container.class.getMethod("areFocusTraversalKeysSet", new Class[] {int.class})); // NOI18N
methods[METHOD_areFocusTraversalKeysSet12].setDisplayName ( "" );
methods[METHOD_bounds13] = new MethodDescriptor(java.awt.Component.class.getMethod("bounds", new Class[] {})); // NOI18N
methods[METHOD_bounds13].setDisplayName ( "" );
methods[METHOD_checkImage14] = new MethodDescriptor(java.awt.Component.class.getMethod("checkImage", new Class[] {java.awt.Image.class, java.awt.image.ImageObserver.class})); // NOI18N
methods[METHOD_checkImage14].setDisplayName ( "" );
methods[METHOD_checkImage15] = new MethodDescriptor(java.awt.Component.class.getMethod("checkImage", new Class[] {java.awt.Image.class, int.class, int.class, java.awt.image.ImageObserver.class})); // NOI18N
methods[METHOD_checkImage15].setDisplayName ( "" );
methods[METHOD_computeVisibleRect16] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("computeVisibleRect", new Class[] {java.awt.Rectangle.class})); // NOI18N
methods[METHOD_computeVisibleRect16].setDisplayName ( "" );
methods[METHOD_configureEditor17] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("configureEditor", new Class[] {javax.swing.ComboBoxEditor.class, java.lang.Object.class})); // NOI18N
methods[METHOD_configureEditor17].setDisplayName ( "" );
methods[METHOD_contains18] = new MethodDescriptor(java.awt.Component.class.getMethod("contains", new Class[] {java.awt.Point.class})); // NOI18N
methods[METHOD_contains18].setDisplayName ( "" );
methods[METHOD_contains19] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("contains", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_contains19].setDisplayName ( "" );
methods[METHOD_contentsChanged20] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("contentsChanged", new Class[] {javax.swing.event.ListDataEvent.class})); // NOI18N
methods[METHOD_contentsChanged20].setDisplayName ( "" );
methods[METHOD_countComponents21] = new MethodDescriptor(java.awt.Container.class.getMethod("countComponents", new Class[] {})); // NOI18N
methods[METHOD_countComponents21].setDisplayName ( "" );
methods[METHOD_createImage22] = new MethodDescriptor(java.awt.Component.class.getMethod("createImage", new Class[] {java.awt.image.ImageProducer.class})); // NOI18N
methods[METHOD_createImage22].setDisplayName ( "" );
methods[METHOD_createImage23] = new MethodDescriptor(java.awt.Component.class.getMethod("createImage", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_createImage23].setDisplayName ( "" );
methods[METHOD_createToolTip24] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("createToolTip", new Class[] {})); // NOI18N
methods[METHOD_createToolTip24].setDisplayName ( "" );
methods[METHOD_createVolatileImage25] = new MethodDescriptor(java.awt.Component.class.getMethod("createVolatileImage", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_createVolatileImage25].setDisplayName ( "" );
methods[METHOD_createVolatileImage26] = new MethodDescriptor(java.awt.Component.class.getMethod("createVolatileImage", new Class[] {int.class, int.class, java.awt.ImageCapabilities.class})); // NOI18N
methods[METHOD_createVolatileImage26].setDisplayName ( "" );
methods[METHOD_deliverEvent27] = new MethodDescriptor(java.awt.Container.class.getMethod("deliverEvent", new Class[] {java.awt.Event.class})); // NOI18N
methods[METHOD_deliverEvent27].setDisplayName ( "" );
methods[METHOD_disable28] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("disable", new Class[] {})); // NOI18N
methods[METHOD_disable28].setDisplayName ( "" );
methods[METHOD_dispatchEvent29] = new MethodDescriptor(java.awt.Component.class.getMethod("dispatchEvent", new Class[] {java.awt.AWTEvent.class})); // NOI18N
methods[METHOD_dispatchEvent29].setDisplayName ( "" );
methods[METHOD_doLayout30] = new MethodDescriptor(java.awt.Container.class.getMethod("doLayout", new Class[] {})); // NOI18N
methods[METHOD_doLayout30].setDisplayName ( "" );
methods[METHOD_enable31] = new MethodDescriptor(java.awt.Component.class.getMethod("enable", new Class[] {boolean.class})); // NOI18N
methods[METHOD_enable31].setDisplayName ( "" );
methods[METHOD_enable32] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("enable", new Class[] {})); // NOI18N
methods[METHOD_enable32].setDisplayName ( "" );
methods[METHOD_enableInputMethods33] = new MethodDescriptor(java.awt.Component.class.getMethod("enableInputMethods", new Class[] {boolean.class})); // NOI18N
methods[METHOD_enableInputMethods33].setDisplayName ( "" );
methods[METHOD_findComponentAt34] = new MethodDescriptor(java.awt.Container.class.getMethod("findComponentAt", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_findComponentAt34].setDisplayName ( "" );
methods[METHOD_findComponentAt35] = new MethodDescriptor(java.awt.Container.class.getMethod("findComponentAt", new Class[] {java.awt.Point.class})); // NOI18N
methods[METHOD_findComponentAt35].setDisplayName ( "" );
methods[METHOD_firePopupMenuCanceled36] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("firePopupMenuCanceled", new Class[] {})); // NOI18N
methods[METHOD_firePopupMenuCanceled36].setDisplayName ( "" );
methods[METHOD_firePopupMenuWillBecomeInvisible37] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("firePopupMenuWillBecomeInvisible", new Class[] {})); // NOI18N
methods[METHOD_firePopupMenuWillBecomeInvisible37].setDisplayName ( "" );
methods[METHOD_firePopupMenuWillBecomeVisible38] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("firePopupMenuWillBecomeVisible", new Class[] {})); // NOI18N
methods[METHOD_firePopupMenuWillBecomeVisible38].setDisplayName ( "" );
methods[METHOD_firePropertyChange39] = new MethodDescriptor(java.awt.Component.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, byte.class, byte.class})); // NOI18N
methods[METHOD_firePropertyChange39].setDisplayName ( "" );
methods[METHOD_firePropertyChange40] = new MethodDescriptor(java.awt.Component.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, short.class, short.class})); // NOI18N
methods[METHOD_firePropertyChange40].setDisplayName ( "" );
methods[METHOD_firePropertyChange41] = new MethodDescriptor(java.awt.Component.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, long.class, long.class})); // NOI18N
methods[METHOD_firePropertyChange41].setDisplayName ( "" );
methods[METHOD_firePropertyChange42] = new MethodDescriptor(java.awt.Component.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, float.class, float.class})); // NOI18N
methods[METHOD_firePropertyChange42].setDisplayName ( "" );
methods[METHOD_firePropertyChange43] = new MethodDescriptor(java.awt.Component.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, double.class, double.class})); // NOI18N
methods[METHOD_firePropertyChange43].setDisplayName ( "" );
methods[METHOD_firePropertyChange44] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, boolean.class, boolean.class})); // NOI18N
methods[METHOD_firePropertyChange44].setDisplayName ( "" );
methods[METHOD_firePropertyChange45] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, int.class, int.class})); // NOI18N
methods[METHOD_firePropertyChange45].setDisplayName ( "" );
methods[METHOD_firePropertyChange46] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("firePropertyChange", new Class[] {java.lang.String.class, char.class, char.class})); // NOI18N
methods[METHOD_firePropertyChange46].setDisplayName ( "" );
methods[METHOD_getActionForKeyStroke47] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getActionForKeyStroke", new Class[] {javax.swing.KeyStroke.class})); // NOI18N
methods[METHOD_getActionForKeyStroke47].setDisplayName ( "" );
methods[METHOD_getBaseline48] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getBaseline", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_getBaseline48].setDisplayName ( "" );
methods[METHOD_getBounds49] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getBounds", new Class[] {java.awt.Rectangle.class})); // NOI18N
methods[METHOD_getBounds49].setDisplayName ( "" );
methods[METHOD_getClientProperty50] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getClientProperty", new Class[] {java.lang.Object.class})); // NOI18N
methods[METHOD_getClientProperty50].setDisplayName ( "" );
methods[METHOD_getComponentAt51] = new MethodDescriptor(java.awt.Container.class.getMethod("getComponentAt", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_getComponentAt51].setDisplayName ( "" );
methods[METHOD_getComponentAt52] = new MethodDescriptor(java.awt.Container.class.getMethod("getComponentAt", new Class[] {java.awt.Point.class})); // NOI18N
methods[METHOD_getComponentAt52].setDisplayName ( "" );
methods[METHOD_getComponentZOrder53] = new MethodDescriptor(java.awt.Container.class.getMethod("getComponentZOrder", new Class[] {java.awt.Component.class})); // NOI18N
methods[METHOD_getComponentZOrder53].setDisplayName ( "" );
methods[METHOD_getConditionForKeyStroke54] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getConditionForKeyStroke", new Class[] {javax.swing.KeyStroke.class})); // NOI18N
methods[METHOD_getConditionForKeyStroke54].setDisplayName ( "" );
methods[METHOD_getDefaultLocale55] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getDefaultLocale", new Class[] {})); // NOI18N
methods[METHOD_getDefaultLocale55].setDisplayName ( "" );
methods[METHOD_getFocusTraversalKeys56] = new MethodDescriptor(java.awt.Container.class.getMethod("getFocusTraversalKeys", new Class[] {int.class})); // NOI18N
methods[METHOD_getFocusTraversalKeys56].setDisplayName ( "" );
methods[METHOD_getFontMetrics57] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getFontMetrics", new Class[] {java.awt.Font.class})); // NOI18N
methods[METHOD_getFontMetrics57].setDisplayName ( "" );
methods[METHOD_getInsets58] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getInsets", new Class[] {java.awt.Insets.class})); // NOI18N
methods[METHOD_getInsets58].setDisplayName ( "" );
methods[METHOD_getListeners59] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getListeners", new Class[] {java.lang.Class.class})); // NOI18N
methods[METHOD_getListeners59].setDisplayName ( "" );
methods[METHOD_getLocation60] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getLocation", new Class[] {java.awt.Point.class})); // NOI18N
methods[METHOD_getLocation60].setDisplayName ( "" );
methods[METHOD_getMousePosition61] = new MethodDescriptor(java.awt.Container.class.getMethod("getMousePosition", new Class[] {boolean.class})); // NOI18N
methods[METHOD_getMousePosition61].setDisplayName ( "" );
methods[METHOD_getPopupLocation62] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getPopupLocation", new Class[] {java.awt.event.MouseEvent.class})); // NOI18N
methods[METHOD_getPopupLocation62].setDisplayName ( "" );
methods[METHOD_getPropertyChangeListeners63] = new MethodDescriptor(java.awt.Component.class.getMethod("getPropertyChangeListeners", new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_getPropertyChangeListeners63].setDisplayName ( "" );
methods[METHOD_getSize64] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getSize", new Class[] {java.awt.Dimension.class})); // NOI18N
methods[METHOD_getSize64].setDisplayName ( "" );
methods[METHOD_getToolTipLocation65] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getToolTipLocation", new Class[] {java.awt.event.MouseEvent.class})); // NOI18N
methods[METHOD_getToolTipLocation65].setDisplayName ( "" );
methods[METHOD_getToolTipText66] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("getToolTipText", new Class[] {java.awt.event.MouseEvent.class})); // NOI18N
methods[METHOD_getToolTipText66].setDisplayName ( "" );
methods[METHOD_gotFocus67] = new MethodDescriptor(java.awt.Component.class.getMethod("gotFocus", new Class[] {java.awt.Event.class, java.lang.Object.class})); // NOI18N
methods[METHOD_gotFocus67].setDisplayName ( "" );
methods[METHOD_grabFocus68] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("grabFocus", new Class[] {})); // NOI18N
methods[METHOD_grabFocus68].setDisplayName ( "" );
methods[METHOD_handleEvent69] = new MethodDescriptor(java.awt.Component.class.getMethod("handleEvent", new Class[] {java.awt.Event.class})); // NOI18N
methods[METHOD_handleEvent69].setDisplayName ( "" );
methods[METHOD_hasFocus70] = new MethodDescriptor(java.awt.Component.class.getMethod("hasFocus", new Class[] {})); // NOI18N
methods[METHOD_hasFocus70].setDisplayName ( "" );
methods[METHOD_hide71] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("hide", new Class[] {})); // NOI18N
methods[METHOD_hide71].setDisplayName ( "" );
methods[METHOD_hidePopup72] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("hidePopup", new Class[] {})); // NOI18N
methods[METHOD_hidePopup72].setDisplayName ( "" );
methods[METHOD_imageUpdate73] = new MethodDescriptor(java.awt.Component.class.getMethod("imageUpdate", new Class[] {java.awt.Image.class, int.class, int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_imageUpdate73].setDisplayName ( "" );
methods[METHOD_insertItemAt74] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("insertItemAt", new Class[] {java.lang.Object.class, int.class})); // NOI18N
methods[METHOD_insertItemAt74].setDisplayName ( "" );
methods[METHOD_insets75] = new MethodDescriptor(java.awt.Container.class.getMethod("insets", new Class[] {})); // NOI18N
methods[METHOD_insets75].setDisplayName ( "" );
methods[METHOD_inside76] = new MethodDescriptor(java.awt.Component.class.getMethod("inside", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_inside76].setDisplayName ( "" );
methods[METHOD_intervalAdded77] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("intervalAdded", new Class[] {javax.swing.event.ListDataEvent.class})); // NOI18N
methods[METHOD_intervalAdded77].setDisplayName ( "" );
methods[METHOD_intervalRemoved78] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("intervalRemoved", new Class[] {javax.swing.event.ListDataEvent.class})); // NOI18N
methods[METHOD_intervalRemoved78].setDisplayName ( "" );
methods[METHOD_invalidate79] = new MethodDescriptor(java.awt.Container.class.getMethod("invalidate", new Class[] {})); // NOI18N
methods[METHOD_invalidate79].setDisplayName ( "" );
methods[METHOD_isAncestorOf80] = new MethodDescriptor(java.awt.Container.class.getMethod("isAncestorOf", new Class[] {java.awt.Component.class})); // NOI18N
methods[METHOD_isAncestorOf80].setDisplayName ( "" );
methods[METHOD_isFocusCycleRoot81] = new MethodDescriptor(java.awt.Container.class.getMethod("isFocusCycleRoot", new Class[] {java.awt.Container.class})); // NOI18N
methods[METHOD_isFocusCycleRoot81].setDisplayName ( "" );
methods[METHOD_isLightweightComponent82] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("isLightweightComponent", new Class[] {java.awt.Component.class})); // NOI18N
methods[METHOD_isLightweightComponent82].setDisplayName ( "" );
methods[METHOD_keyDown83] = new MethodDescriptor(java.awt.Component.class.getMethod("keyDown", new Class[] {java.awt.Event.class, int.class})); // NOI18N
methods[METHOD_keyDown83].setDisplayName ( "" );
methods[METHOD_keyUp84] = new MethodDescriptor(java.awt.Component.class.getMethod("keyUp", new Class[] {java.awt.Event.class, int.class})); // NOI18N
methods[METHOD_keyUp84].setDisplayName ( "" );
methods[METHOD_layout85] = new MethodDescriptor(java.awt.Container.class.getMethod("layout", new Class[] {})); // NOI18N
methods[METHOD_layout85].setDisplayName ( "" );
methods[METHOD_list86] = new MethodDescriptor(java.awt.Component.class.getMethod("list", new Class[] {})); // NOI18N
methods[METHOD_list86].setDisplayName ( "" );
methods[METHOD_list87] = new MethodDescriptor(java.awt.Component.class.getMethod("list", new Class[] {java.io.PrintStream.class})); // NOI18N
methods[METHOD_list87].setDisplayName ( "" );
methods[METHOD_list88] = new MethodDescriptor(java.awt.Component.class.getMethod("list", new Class[] {java.io.PrintWriter.class})); // NOI18N
methods[METHOD_list88].setDisplayName ( "" );
methods[METHOD_list89] = new MethodDescriptor(java.awt.Container.class.getMethod("list", new Class[] {java.io.PrintStream.class, int.class})); // NOI18N
methods[METHOD_list89].setDisplayName ( "" );
methods[METHOD_list90] = new MethodDescriptor(java.awt.Container.class.getMethod("list", new Class[] {java.io.PrintWriter.class, int.class})); // NOI18N
methods[METHOD_list90].setDisplayName ( "" );
methods[METHOD_locate91] = new MethodDescriptor(java.awt.Container.class.getMethod("locate", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_locate91].setDisplayName ( "" );
methods[METHOD_location92] = new MethodDescriptor(java.awt.Component.class.getMethod("location", new Class[] {})); // NOI18N
methods[METHOD_location92].setDisplayName ( "" );
methods[METHOD_lostFocus93] = new MethodDescriptor(java.awt.Component.class.getMethod("lostFocus", new Class[] {java.awt.Event.class, java.lang.Object.class})); // NOI18N
methods[METHOD_lostFocus93].setDisplayName ( "" );
methods[METHOD_minimumSize94] = new MethodDescriptor(java.awt.Container.class.getMethod("minimumSize", new Class[] {})); // NOI18N
methods[METHOD_minimumSize94].setDisplayName ( "" );
methods[METHOD_mouseDown95] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseDown", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseDown95].setDisplayName ( "" );
methods[METHOD_mouseDrag96] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseDrag", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseDrag96].setDisplayName ( "" );
methods[METHOD_mouseEnter97] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseEnter", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseEnter97].setDisplayName ( "" );
methods[METHOD_mouseExit98] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseExit", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseExit98].setDisplayName ( "" );
methods[METHOD_mouseMove99] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseMove", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseMove99].setDisplayName ( "" );
methods[METHOD_mouseUp100] = new MethodDescriptor(java.awt.Component.class.getMethod("mouseUp", new Class[] {java.awt.Event.class, int.class, int.class})); // NOI18N
methods[METHOD_mouseUp100].setDisplayName ( "" );
methods[METHOD_move101] = new MethodDescriptor(java.awt.Component.class.getMethod("move", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_move101].setDisplayName ( "" );
methods[METHOD_nextFocus102] = new MethodDescriptor(java.awt.Component.class.getMethod("nextFocus", new Class[] {})); // NOI18N
methods[METHOD_nextFocus102].setDisplayName ( "" );
methods[METHOD_paint103] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("paint", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_paint103].setDisplayName ( "" );
methods[METHOD_paintAll104] = new MethodDescriptor(java.awt.Component.class.getMethod("paintAll", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_paintAll104].setDisplayName ( "" );
methods[METHOD_paintComponents105] = new MethodDescriptor(java.awt.Container.class.getMethod("paintComponents", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_paintComponents105].setDisplayName ( "" );
methods[METHOD_paintImmediately106] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("paintImmediately", new Class[] {int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_paintImmediately106].setDisplayName ( "" );
methods[METHOD_paintImmediately107] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("paintImmediately", new Class[] {java.awt.Rectangle.class})); // NOI18N
methods[METHOD_paintImmediately107].setDisplayName ( "" );
methods[METHOD_postEvent108] = new MethodDescriptor(java.awt.Component.class.getMethod("postEvent", new Class[] {java.awt.Event.class})); // NOI18N
methods[METHOD_postEvent108].setDisplayName ( "" );
methods[METHOD_preferredSize109] = new MethodDescriptor(java.awt.Container.class.getMethod("preferredSize", new Class[] {})); // NOI18N
methods[METHOD_preferredSize109].setDisplayName ( "" );
methods[METHOD_prepareImage110] = new MethodDescriptor(java.awt.Component.class.getMethod("prepareImage", new Class[] {java.awt.Image.class, java.awt.image.ImageObserver.class})); // NOI18N
methods[METHOD_prepareImage110].setDisplayName ( "" );
methods[METHOD_prepareImage111] = new MethodDescriptor(java.awt.Component.class.getMethod("prepareImage", new Class[] {java.awt.Image.class, int.class, int.class, java.awt.image.ImageObserver.class})); // NOI18N
methods[METHOD_prepareImage111].setDisplayName ( "" );
methods[METHOD_print112] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("print", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_print112].setDisplayName ( "" );
methods[METHOD_printAll113] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("printAll", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_printAll113].setDisplayName ( "" );
methods[METHOD_printComponents114] = new MethodDescriptor(java.awt.Container.class.getMethod("printComponents", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_printComponents114].setDisplayName ( "" );
methods[METHOD_processKeyEvent115] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("processKeyEvent", new Class[] {java.awt.event.KeyEvent.class})); // NOI18N
methods[METHOD_processKeyEvent115].setDisplayName ( "" );
methods[METHOD_putClientProperty116] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("putClientProperty", new Class[] {java.lang.Object.class, java.lang.Object.class})); // NOI18N
methods[METHOD_putClientProperty116].setDisplayName ( "" );
methods[METHOD_registerKeyboardAction117] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("registerKeyboardAction", new Class[] {java.awt.event.ActionListener.class, java.lang.String.class, javax.swing.KeyStroke.class, int.class})); // NOI18N
methods[METHOD_registerKeyboardAction117].setDisplayName ( "" );
methods[METHOD_registerKeyboardAction118] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("registerKeyboardAction", new Class[] {java.awt.event.ActionListener.class, javax.swing.KeyStroke.class, int.class})); // NOI18N
methods[METHOD_registerKeyboardAction118].setDisplayName ( "" );
methods[METHOD_remove119] = new MethodDescriptor(java.awt.Component.class.getMethod("remove", new Class[] {java.awt.MenuComponent.class})); // NOI18N
methods[METHOD_remove119].setDisplayName ( "" );
methods[METHOD_remove120] = new MethodDescriptor(java.awt.Container.class.getMethod("remove", new Class[] {int.class})); // NOI18N
methods[METHOD_remove120].setDisplayName ( "" );
methods[METHOD_remove121] = new MethodDescriptor(java.awt.Container.class.getMethod("remove", new Class[] {java.awt.Component.class})); // NOI18N
methods[METHOD_remove121].setDisplayName ( "" );
methods[METHOD_removeAll122] = new MethodDescriptor(java.awt.Container.class.getMethod("removeAll", new Class[] {})); // NOI18N
methods[METHOD_removeAll122].setDisplayName ( "" );
methods[METHOD_removeAllItems123] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("removeAllItems", new Class[] {})); // NOI18N
methods[METHOD_removeAllItems123].setDisplayName ( "" );
methods[METHOD_removeItem124] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("removeItem", new Class[] {java.lang.Object.class})); // NOI18N
methods[METHOD_removeItem124].setDisplayName ( "" );
methods[METHOD_removeItemAt125] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("removeItemAt", new Class[] {int.class})); // NOI18N
methods[METHOD_removeItemAt125].setDisplayName ( "" );
methods[METHOD_removeNotify126] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("removeNotify", new Class[] {})); // NOI18N
methods[METHOD_removeNotify126].setDisplayName ( "" );
methods[METHOD_removePropertyChangeListener127] = new MethodDescriptor(java.awt.Component.class.getMethod("removePropertyChangeListener", new Class[] {java.lang.String.class, java.beans.PropertyChangeListener.class})); // NOI18N
methods[METHOD_removePropertyChangeListener127].setDisplayName ( "" );
methods[METHOD_repaint128] = new MethodDescriptor(java.awt.Component.class.getMethod("repaint", new Class[] {})); // NOI18N
methods[METHOD_repaint128].setDisplayName ( "" );
methods[METHOD_repaint129] = new MethodDescriptor(java.awt.Component.class.getMethod("repaint", new Class[] {long.class})); // NOI18N
methods[METHOD_repaint129].setDisplayName ( "" );
methods[METHOD_repaint130] = new MethodDescriptor(java.awt.Component.class.getMethod("repaint", new Class[] {int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_repaint130].setDisplayName ( "" );
methods[METHOD_repaint131] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("repaint", new Class[] {long.class, int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_repaint131].setDisplayName ( "" );
methods[METHOD_repaint132] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("repaint", new Class[] {java.awt.Rectangle.class})); // NOI18N
methods[METHOD_repaint132].setDisplayName ( "" );
methods[METHOD_requestDefaultFocus133] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("requestDefaultFocus", new Class[] {})); // NOI18N
methods[METHOD_requestDefaultFocus133].setDisplayName ( "" );
methods[METHOD_requestFocus134] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("requestFocus", new Class[] {})); // NOI18N
methods[METHOD_requestFocus134].setDisplayName ( "" );
methods[METHOD_requestFocus135] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("requestFocus", new Class[] {boolean.class})); // NOI18N
methods[METHOD_requestFocus135].setDisplayName ( "" );
methods[METHOD_requestFocusInWindow136] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("requestFocusInWindow", new Class[] {})); // NOI18N
methods[METHOD_requestFocusInWindow136].setDisplayName ( "" );
methods[METHOD_resetKeyboardActions137] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("resetKeyboardActions", new Class[] {})); // NOI18N
methods[METHOD_resetKeyboardActions137].setDisplayName ( "" );
methods[METHOD_reshape138] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("reshape", new Class[] {int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_reshape138].setDisplayName ( "" );
methods[METHOD_resize139] = new MethodDescriptor(java.awt.Component.class.getMethod("resize", new Class[] {int.class, int.class})); // NOI18N
methods[METHOD_resize139].setDisplayName ( "" );
methods[METHOD_resize140] = new MethodDescriptor(java.awt.Component.class.getMethod("resize", new Class[] {java.awt.Dimension.class})); // NOI18N
methods[METHOD_resize140].setDisplayName ( "" );
methods[METHOD_revalidate141] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("revalidate", new Class[] {})); // NOI18N
methods[METHOD_revalidate141].setDisplayName ( "" );
methods[METHOD_scrollRectToVisible142] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("scrollRectToVisible", new Class[] {java.awt.Rectangle.class})); // NOI18N
methods[METHOD_scrollRectToVisible142].setDisplayName ( "" );
methods[METHOD_selectWithKeyChar143] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("selectWithKeyChar", new Class[] {char.class})); // NOI18N
methods[METHOD_selectWithKeyChar143].setDisplayName ( "" );
methods[METHOD_setBounds144] = new MethodDescriptor(java.awt.Component.class.getMethod("setBounds", new Class[] {int.class, int.class, int.class, int.class})); // NOI18N
methods[METHOD_setBounds144].setDisplayName ( "" );
methods[METHOD_setComponentZOrder145] = new MethodDescriptor(java.awt.Container.class.getMethod("setComponentZOrder", new Class[] {java.awt.Component.class, int.class})); // NOI18N
methods[METHOD_setComponentZOrder145].setDisplayName ( "" );
methods[METHOD_setDefaultLocale146] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("setDefaultLocale", new Class[] {java.util.Locale.class})); // NOI18N
methods[METHOD_setDefaultLocale146].setDisplayName ( "" );
methods[METHOD_show147] = new MethodDescriptor(java.awt.Component.class.getMethod("show", new Class[] {})); // NOI18N
methods[METHOD_show147].setDisplayName ( "" );
methods[METHOD_show148] = new MethodDescriptor(java.awt.Component.class.getMethod("show", new Class[] {boolean.class})); // NOI18N
methods[METHOD_show148].setDisplayName ( "" );
methods[METHOD_showPopup149] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("showPopup", new Class[] {})); // NOI18N
methods[METHOD_showPopup149].setDisplayName ( "" );
methods[METHOD_size150] = new MethodDescriptor(java.awt.Component.class.getMethod("size", new Class[] {})); // NOI18N
methods[METHOD_size150].setDisplayName ( "" );
methods[METHOD_toString151] = new MethodDescriptor(java.awt.Component.class.getMethod("toString", new Class[] {})); // NOI18N
methods[METHOD_toString151].setDisplayName ( "" );
methods[METHOD_transferFocus152] = new MethodDescriptor(java.awt.Component.class.getMethod("transferFocus", new Class[] {})); // NOI18N
methods[METHOD_transferFocus152].setDisplayName ( "" );
methods[METHOD_transferFocusBackward153] = new MethodDescriptor(java.awt.Component.class.getMethod("transferFocusBackward", new Class[] {})); // NOI18N
methods[METHOD_transferFocusBackward153].setDisplayName ( "" );
methods[METHOD_transferFocusDownCycle154] = new MethodDescriptor(java.awt.Container.class.getMethod("transferFocusDownCycle", new Class[] {})); // NOI18N
methods[METHOD_transferFocusDownCycle154].setDisplayName ( "" );
methods[METHOD_transferFocusUpCycle155] = new MethodDescriptor(java.awt.Component.class.getMethod("transferFocusUpCycle", new Class[] {})); // NOI18N
methods[METHOD_transferFocusUpCycle155].setDisplayName ( "" );
methods[METHOD_unregisterKeyboardAction156] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("unregisterKeyboardAction", new Class[] {javax.swing.KeyStroke.class})); // NOI18N
methods[METHOD_unregisterKeyboardAction156].setDisplayName ( "" );
methods[METHOD_update157] = new MethodDescriptor(javax.swing.JComponent.class.getMethod("update", new Class[] {java.awt.Graphics.class})); // NOI18N
methods[METHOD_update157].setDisplayName ( "" );
methods[METHOD_updateUI158] = new MethodDescriptor(javax.swing.JComboBox.class.getMethod("updateUI", new Class[] {})); // NOI18N
methods[METHOD_updateUI158].setDisplayName ( "" );
methods[METHOD_validate159] = new MethodDescriptor(java.awt.Container.class.getMethod("validate", new Class[] {})); // NOI18N
methods[METHOD_validate159].setDisplayName ( "" );
}
catch( Exception e) {}//GEN-HEADEREND:Methods
// Here you can add code for customizing the methods array.
return methods; }//GEN-LAST:Methods
private static java.awt.Image iconColor16 = null;//GEN-BEGIN:IconsDef
private static java.awt.Image iconColor32 = null;
private static java.awt.Image iconMono16 = null;
private static java.awt.Image iconMono32 = null;//GEN-END:IconsDef
private static String iconNameC16 = "/images/shape_combo_box_16.png";//GEN-BEGIN:Icons
private static String iconNameC32 = "/images/shape_combo_box_32.png";
private static String iconNameM16 = "/images/shape_combo_box_16.png";
private static String iconNameM32 = "/images/shape_combo_box_32.png";//GEN-END:Icons
private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
private static final int defaultEventIndex = -1;//GEN-END:Idx
//GEN-FIRST:Superclass
// Here you can add code for customizing the Superclass BeanInfo.
//GEN-LAST:Superclass
/**
* Gets the bean's <code>BeanDescriptor</code>s.
*
* @return BeanDescriptor describing the editable properties of this bean.
* May return null if the information should be obtained by
* automatic analysis.
*/
@Override
public BeanDescriptor getBeanDescriptor()
{
return getBdescriptor();
}
/**
* Gets the bean's <code>PropertyDescriptor</code>s.
*
* @return An array of PropertyDescriptors describing the editable
* properties supported by this bean. May return null if the
* information should be obtained by automatic analysis.
* <p>
* If a property is indexed, then its entry in the result array will belong
* to the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client
* of getPropertyDescriptors can use "instanceof" to check if a given
* PropertyDescriptor is an IndexedPropertyDescriptor.
*/
@Override
public PropertyDescriptor[] getPropertyDescriptors()
{
return getPdescriptor();
}
/**
* Gets the bean's <code>EventSetDescriptor</code>s.
*
* @return An array of EventSetDescriptors describing the kinds of events
* fired by this bean. May return null if the information should be
* obtained by automatic analysis.
*/
@Override
public EventSetDescriptor[] getEventSetDescriptors()
{
return getEdescriptor();
}
/**
* Gets the bean's <code>MethodDescriptor</code>s.
*
* @return An array of MethodDescriptors describing the methods implemented
* by this bean. May return null if the information should be
* obtained by automatic analysis.
*/
@Override
public MethodDescriptor[] getMethodDescriptors()
{
return getMdescriptor();
}
/**
* A bean may have a "default" property that is the property that will
* mostly commonly be initially chosen for update by human's who are
* customizing the bean.
*
* @return Index of default property in the PropertyDescriptor array
* returned by getPropertyDescriptors.
* <P>
* Returns -1 if there is no default property.
*/
@Override
public int getDefaultPropertyIndex()
{
return defaultPropertyIndex;
}
/**
* A bean may have a "default" event that is the event that will mostly
* commonly be used by human's when using the bean.
*
* @return Index of default event in the EventSetDescriptor array returned
* by getEventSetDescriptors.
* <P>
* Returns -1 if there is no default event.
*/
@Override
public int getDefaultEventIndex()
{
return defaultEventIndex;
}
/**
* This method returns an image object that can be used to represent the
* bean in toolboxes, toolbars, etc. Icon images will typically be GIFs, but
* may in future include other formats.
* <p>
* Beans aren't required to provide icons and may return null from this
* method.
* <p>
* There are four possible flavors of icons (16x16 color, 32x32 color, 16x16
* mono, 32x32 mono). If a bean choses to only support a single icon we
* recommend supporting 16x16 color.
* <p>
* We recommend that icons have a "transparent" background so they can be
* rendered onto an existing background.
*
* @param iconKind The kind of icon requested. This should be one of the
* constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
* ICON_MONO_16x16, or ICON_MONO_32x32.
* @return An image object representing the requested icon. May return null
* if no suitable icon is available.
*/
@Override
public java.awt.Image getIcon(int iconKind)
{
switch (iconKind)
{
case ICON_COLOR_16x16:
if (iconNameC16 == null)
{
return null;
}
else
{
if (iconColor16 == null)
{
iconColor16 = loadImage(iconNameC16);
}
return iconColor16;
}
case ICON_COLOR_32x32:
if (iconNameC32 == null)
{
return null;
}
else
{
if (iconColor32 == null)
{
iconColor32 = loadImage(iconNameC32);
}
return iconColor32;
}
case ICON_MONO_16x16:
if (iconNameM16 == null)
{
return null;
}
else
{
if (iconMono16 == null)
{
iconMono16 = loadImage(iconNameM16);
}
return iconMono16;
}
case ICON_MONO_32x32:
if (iconNameM32 == null)
{
return null;
}
else
{
if (iconMono32 == null)
{
iconMono32 = loadImage(iconNameM32);
}
return iconMono32;
}
default:
return null;
}
}
}
| gpl-2.0 |
monkeyk/spring-oauth-server | src/main/java/com/monkeyk/sos/SpringOauthServerServletInitializer.java | 851 | package com.monkeyk.sos;
import com.monkeyk.sos.web.WebUtils;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
/**
* 2017-12-05
*
* @author Shengzhao Li
*/
public class SpringOauthServerServletInitializer extends SpringBootServletInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
//主版本号
servletContext.setAttribute("mainVersion", WebUtils.VERSION);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringOauthServerApplication.class);
}
}
| gpl-2.0 |
Subsets and Splits