id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
2,600 | <s> package com . asakusafw . yaess . multidispatch ; import java . io . IOException ; import java . util . Map ; import com . asakusafw . yaess . core . CommandScript ; import com . asakusafw . yaess . core . CommandScriptHandler ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitor ; import com . asakusafw . yaess . core . ExecutionScriptHandlerBase ; import com . asakusafw . yaess . core . ServiceProfile ; public class MockCommandScriptHandler extends ExecutionScriptHandlerBase implements CommandScriptHandler { @ Override protected void doConfigure ( ServiceProfile < ? > profile , Map < String , String > desiredProperties , Map < String , String > desiredEnvironmentVariables ) throws InterruptedException , IOException { return ; } @ Override public void execute ( ExecutionMonitor monitor , ExecutionContext context , CommandScript script ) throws InterruptedException , IOException { monitor . open ( 1 ) ; try { hook ( context , script ) ; } finally { monitor . close ( | |
2,601 | <s> package org . rubypeople . rdt . internal . ui . text . ruby ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . ui . IEditorPart ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . ui . text . ruby . ContentAssistInvocationContext ; public class RubyContentAssistInvocationContext extends ContentAssistInvocationContext { private final IEditorPart fEditor ; private IRubyScript fCU = null ; | |
2,602 | <s> import java . io . * ; import java . util . Vector ; import org . kxml2 . io . * ; import org . xmlpull . v1 . * ; import javax . microedition . midlet . * ; import javax . microedition . lcdui . * ; import javax . microedition . io . * ; public class Newsreader extends MIDlet implements CommandListener { static final String URL = "" ; static final String TITLE = "NewsForge" ; Vector descriptions = new Vector ( ) ; List newsList = new List ( TITLE , Choice . IMPLICIT ) ; TextBox textBox = new TextBox ( "" , "" , 256 , TextField . ANY ) ; Display display ; Command backCmd = new Command | |
2,603 | <s> package net . sf . sveditor . ui . editor . actions ; import java . util . ResourceBundle ; import net . sf . sveditor . ui . editor . SVEditor ; import org . eclipse . ui . texteditor . TextEditorAction ; public class OpenQuickHierarchyAction extends TextEditorAction { private SVEditor fEditor ; public OpenQuickHierarchyAction ( ResourceBundle bundle , SVEditor editor | |
2,604 | <s> package com . asakusafw . compiler . flow . stage ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . NameGenerator ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . FlowElementProcessor ; import com . asakusafw . compiler . flow . FlowElementProcessor . Kind ; import com . asakusafw . compiler . flow . RendezvousProcessor ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Segment ; import com . asakusafw . compiler . flow . stage . StageModel . Factor ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . runtime . flow . Rendezvous ; import com . asakusafw . runtime . flow . SegmentedWritable ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . ConstructorDeclaration ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . QualifiedName ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw | |
2,605 | <s> package org . rubypeople . rdt . testunit . wizards ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Vector ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Widget ; import org . eclipse . ui . dialogs . ContainerCheckedTreeViewer ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . testunit . ui . TestunitPlugin ; import org . rubypeople . rdt . internal . testunit . util . LayoutUtil ; import org . rubypeople . rdt . internal . testunit . wizards . WizardMessages ; import org . rubypeople . rdt . ui . RubyElementLabelProvider ; public class RubyNewTestCaseWizardPageTwo extends WizardPage { private final static String PAGE_NAME = "" ; private final static String STORE_USE_TASKMARKER = PAGE_NAME + "" ; private IType fClassToTest ; private Button fCreateTasksButton ; private ContainerCheckedTreeViewer fMethodsTree ; private Button fSelectAllButton ; private Button fDeselectAllButton ; private Label fSelectedMethodsLabel ; private Object [ ] fCheckedObjects ; private boolean fCreateTasks ; public RubyNewTestCaseWizardPageTwo ( ) { super ( PAGE_NAME ) ; setTitle ( WizardMessages . NewTestCaseWizardPageTwo_title ) ; setDescription ( WizardMessages . NewTestCaseWizardPageTwo_description ) ; } public void createControl ( Composite parent ) { Composite container = new Composite ( parent , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; layout . numColumns = 2 ; container . setLayout ( layout ) ; createMethodsTreeControls ( container ) ; createSpacer ( container ) ; createButtonChoices ( container ) ; setControl ( container ) ; restoreWidgetValues ( ) ; Dialog . applyDialogFont ( container ) ; } private void createButtonChoices ( Composite container ) { GridLayout layout ; GridData gd ; Composite prefixContainer = new Composite ( container , SWT . NONE ) ; gd = new GridData ( ) ; gd . horizontalAlignment = GridData . FILL ; gd . horizontalSpan = 1 ; prefixContainer . setLayoutData ( gd ) ; layout = new GridLayout ( ) ; layout . numColumns = 1 ; layout . marginWidth = 0 ; layout . marginHeight = 0 ; prefixContainer . setLayout ( layout ) ; SelectionListener listener = new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { doCheckBoxSelected ( e . widget ) ; } } ; fCreateTasksButton = createCheckBox ( prefixContainer , WizardMessages . NewTestCaseWizardPageTwo_create_tasks_text , listener ) ; } private Button createCheckBox ( Composite parent , String name , SelectionListener listener ) { Button button = new Button ( parent , SWT . CHECK | SWT . LEFT ) ; button . setText ( name ) ; button . setEnabled ( true ) ; button . setSelection ( true ) ; button . addSelectionListener ( listener ) ; GridData gd = new GridData ( GridData . FILL , GridData . CENTER , false , false ) ; button . setLayoutData ( gd ) ; return button ; } private void doCheckBoxSelected ( Widget widget ) { if ( widget == fCreateTasksButton ) { fCreateTasks = fCreateTasksButton . getSelection ( ) ; } saveWidgetValues ( ) ; } private void createMethodsTreeControls ( Composite container ) { Label label = new Label ( container , SWT . LEFT | SWT . WRAP ) ; label . setFont ( container . getFont ( ) ) ; label . setText ( WizardMessages . NewTestCaseWizardPageTwo_methods_tree_label ) ; GridData gd = new GridData ( ) ; gd . horizontalSpan = 2 ; label . setLayoutData ( gd ) ; fMethodsTree = new ContainerCheckedTreeViewer ( container , SWT . BORDER ) ; gd = new GridData ( GridData . FILL_BOTH | GridData . GRAB_HORIZONTAL | GridData . GRAB_VERTICAL ) ; gd . heightHint = 180 ; fMethodsTree . getTree ( ) . setLayoutData ( gd ) ; fMethodsTree . setLabelProvider ( new RubyElementLabelProvider ( ) ) ; fMethodsTree . setAutoExpandLevel ( 2 ) ; fMethodsTree . addCheckStateListener ( new ICheckStateListener ( ) { public void checkStateChanged ( CheckStateChangedEvent event ) { doCheckedStateChanged ( ) ; } } ) ; fMethodsTree . addFilter ( new ViewerFilter ( ) { public boolean select ( Viewer viewer , Object parentElement , Object element ) { if ( element instanceof IMethod ) { IMethod method = ( IMethod ) element ; return ! method . getElementName | |
2,606 | <s> package com . asakusafw . dmdl . java . emitter . driver ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Before ; import org . junit . Test ; import com . asakusafw . dmdl . java . GeneratorTesterRoot ; import com . asakusafw . runtime . model . PropertyOrder ; public class PropertyOrderDriverTest extends GeneratorTesterRoot { @ Before public void setUp ( ) throws Exception { emitDrivers . add ( new PropertyOrderDriver ( ) ) ; } @ Test public void single_property ( ) throws Exception { ModelLoader loader = generate ( ) ; Class < ? > modelClass = loader . modelType ( "Model" ) ; PropertyOrder annotation = modelClass . getAnnotation ( PropertyOrder . class ) ; assertThat ( annotation , is ( notNullValue ( ) ) ) ; assertThat ( annotation . value ( | |
2,607 | <s> package com . asakusafw . compiler . flow . example ; import com . asakusafw . compiler . operator . model . MockHoge ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary | |
2,608 | <s> package com . asakusafw . compiler . batch ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . Map ; import java . util . Set ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graphs ; import com . asakusafw . vocabulary . batch . BatchDescription ; import com . asakusafw . vocabulary . batch . Work ; import com . asakusafw . vocabulary . batch . WorkDescription ; public class BatchCompiler { private final BatchCompilingEnvironment environment ; public BatchCompiler ( BatchCompilerConfiguration configuration ) { Precondition . checkMustNotBeNull ( configuration , "" ) ; this . environment = new BatchCompilingEnvironment ( configuration ) . bless ( ) ; } public Workflow compile ( BatchDescription description ) throws IOException { Precondition . checkMustNotBeNull ( description , "description" ) ; Workflow workflow = createWorkflow ( description ) ; processUnits ( workflow . getGraph ( ) . getNodeSet ( ) ) ; if ( environment . hasError ( ) ) { throw new IOException ( MessageFormat . format ( "" , environment . getErrorMessage ( ) ) ) ; } processWorkflow ( workflow ) ; if ( environment . hasError ( ) ) { throw new IOException ( MessageFormat . format ( "" , environment . getErrorMessage ( ) ) ) ; } return workflow ; } private void processWorkflow ( Workflow workflow ) throws IOException { assert workflow != null ; Set < WorkDescription > descriptions = Sets . create ( ) ; for ( Workflow . Unit unit : workflow . getGraph ( ) . getNodeSet ( ) ) { descriptions . add ( unit . getDescription ( ) ) ; } WorkflowProcessor . Repository repo = environment . getWorkflows ( ) ; Set < WorkflowProcessor > procs = repo . findWorkflowProcessors ( descriptions ) ; for ( WorkflowProcessor proc : procs ) { proc . process ( workflow ) ; } } private void processUnits ( Set < Workflow . Unit > units ) throws IOException { assert units != null ; WorkflowProcessor . Repository repo = environment . getWorkflows ( ) ; for ( Workflow . Unit unit : units ) { WorkDescriptionProcessor < ? > proc = repo . findDescriptionProcessor ( unit . getDescription ( ) ) ; if ( proc == null ) { environment . error ( "" , unit . getClass ( ) . getName ( ) ) ; continue ; } processUnit ( unit , proc ) ; } } private < T extends WorkDescription > | |
2,609 | <s> package fi . koku . services . utility . authorizationinfo . v1 . model ; public class Group { private String id ; private String name ; public Group ( String id ) { this . id = id ; } public Group ( String id , String name ) { this . id = id ; this . name = name ; } public String getId ( ) { return id ; } public void setId ( String id ) { this . id = id ; } public String getName ( ) { return name ; } public void setName ( String name ) { this . name = name ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( id == null ) ? 0 : id | |
2,610 | <s> package org . springframework . samples . petclinic . web ; import java . util . ArrayList ; import java . util . Date ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import com . sun . syndication . feed . atom . Entry ; import com . sun . syndication . feed . atom . Feed ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertNotNull ; import org . joda . time . LocalDate ; import org . junit . Before ; import org . junit . Test ; import org . springframework . samples . petclinic . Pet ; import org . springframework . samples . petclinic . PetType ; import org . springframework . samples . petclinic . Visit ; public class VisitsAtomViewTest { private VisitsAtomView visitView ; private Map < String , Object > model ; private Feed feed ; @ Before public void setUp ( ) { visitView = new VisitsAtomView ( ) ; PetType dog = new PetType ( ) ; dog . setName ( "dog" ) ; Pet bello = new Pet ( ) ; bello . setName ( "Bello" ) ; bello . | |
2,611 | <s> package org . oddjob . jmx . client ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ClassResolver ; public class VanillaHandlerResolver < T > implements ClientHandlerResolver < T > { private static final long | |
2,612 | <s> package org . oddjob . designer . components ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jobs . structural . SequentialJob ; public class SequentialDCTest extends TestCase { private static final Logger logger = Logger . getLogger ( SequentialDCTest . class ) ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } DesignInstance design ; public void testCreate ( ) throws ArooaParseException { String xml = "" + " <jobs>" + " <echo/>" + " <echo/>" + " </jobs>" + "" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( ) . createDescriptor ( getClass ( ) . getClassLoader ( ) ) ; DesignParser parser = new DesignParser ( new StandardArooaSession ( descriptor ) ) ; parser . setArooaType ( ArooaType . COMPONENT ) ; parser . parse ( new XMLConfiguration ( "TEST" , xml ) ) ; design = parser . getDesign ( ) ; assertEquals ( SequentialDesign . class , design . | |
2,613 | <s> package org . oddjob . monitor . model ; import org . oddjob . arooa . parsing . ConfigurationOwner ; import org . oddjob . monitor . context . ContextInitialiser ; import org . oddjob . monitor . context . ExplorerContext ; public class ConfigContextInialiser implements ContextInitialiser { public static String CONFIG_OWNER = "configOwner" ; private | |
2,614 | <s> package org . apache . camel . example . reportincident ; import org . apache . camel . example . reportincident . model . Incident ; import org . apache . camel . example . reportincident . service . IncidentService ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . wicket . AttributeModifier ; import org . apache . wicket . PageParameters ; import org . apache . wicket . markup . html . WebPage ; import org . apache . wicket . markup . html . basic . Label ; import org . apache . wicket . markup . html . navigation . paging . PagingNavigator ; import org . apache . wicket . markup . repeater . Item ; import org . apache . wicket . markup . repeater . data . DataView ; import org . apache . wicket . markup . repeater . data . IDataProvider ; import org . apache . wicket . model . AbstractReadOnlyModel ; import org . apache . wicket . model . IModel ; import org . apache . wicket . model . LoadableDetachableModel ; import org . apache . wicket . model . Model ; import org . apache . wicket . spring . injection . annot . SpringBean ; import java . util . Iterator ; public class HomePage extends WebPage { private static final long serialVersionUID = 1L ; private static final transient Log LOG = LogFactory . getLog ( HomePage . class ) ; @ SpringBean private IncidentService incidentService ; public HomePage ( final PageParameters parameters ) { LOG . debug ( "" + incidentService . toString ( ) ) ; add ( new Label ( "message" , "" ) ) ; final DataView dataView = new DataView ( "simple" , new IncidentProvider ( ) ) { public void populateItem ( final Item item ) { final Incident incident = ( Incident ) item . getModelObject ( ) ; item . add ( new Label ( "incidentId" , String . valueOf ( incident . getIncidentId ( ) ) ) ) ; item . add ( new Label ( "incidentDate" , String . valueOf ( incident . getIncidentDate ( ) ) ) ) ; item . add ( new Label ( "incidentRef" , incident . getIncidentRef ( ) ) ) ; item . add ( new Label ( "givenName" , incident . getGivenName ( ) ) ) ; item . add ( new Label ( "familyName" , incident . getFamilyName ( ) ) ) ; item . add ( new Label ( "summary" , incident . getSummary ( ) ) ) ; item . add ( new Label ( "details" , incident . getDetails ( ) ) ) ; item . add ( new Label ( "email" , incident . getEmail ( ) ) ) ; item . add ( new Label ( "phone" , incident . getPhone ( ) ) ) ; item . add ( new Label ( "creationUser" , incident . getCreationUser ( ) ) ) ; item . add ( | |
2,615 | <s> package com . mcbans . firestar . mcbans ; import java . util . ArrayList ; import org . bukkit . entity . Player ; public class BukkitPermissions { private BukkitInterface MCBans ; private ArrayList < String > banView = new ArrayList < String > ( ) ; private ArrayList < String > joinView = new ArrayList < String > ( ) ; private ArrayList < String > altsView = new ArrayList < String > ( ) ; private ArrayList < String > kickView = new ArrayList < String > ( ) ; public BukkitPermissions ( Settings cf , BukkitInterface p ) { MCBans = p ; } | |
2,616 | <s> package com . asakusafw . dmdl . thundergate ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . nio . charset . Charset ; import java . util . Collections ; import java . util . List ; import java . util . Properties ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . utils . collections . Lists ; public class MainTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void simple ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-encoding" , "ASCII" ) ; Collections . addAll ( arguments , "-includes" , "" ) ; Collections . addAll ( arguments , "-excludes" , "DENIED" ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; assertThat ( conf . getJdbcDriver ( ) , is ( "" ) ) ; assertThat ( conf . getJdbcUrl ( ) , is ( "" ) ) ; assertThat ( conf . getJdbcUser ( ) , is ( "asakusa" ) ) ; assertThat ( conf . getJdbcPassword ( ) , is ( "asakusapw" ) ) ; assertThat ( conf . getDatabaseName ( ) , is ( "asakusadb" ) ) ; assertThat ( conf . getEncoding ( ) , is ( Charset . forName ( "ASCII" ) ) ) ; assertThat ( conf . getOutput ( ) , is ( output ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "NOT_ACCEPT" ) , is ( false ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "DENIED" ) , is ( false ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "" ) , is ( false ) ) ; } @ Test public void encoding_empty ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; assertThat ( conf . getEncoding ( ) , is ( Charset . forName ( "UTF-8" ) ) ) ; } @ Test public void matcher_empty ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-encoding" , "ASCII" ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "NOT_ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "" ) , is ( false ) ) ; } @ Test public void matcher_only_includes ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-encoding" , "ASCII" ) ; Collections . addAll ( arguments , "-includes" , "" ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "NOT_ACCEPT" ) , is ( false ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "DENIED" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "" ) , is ( false ) ) ; } @ Test public void matcher_only_excludes ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-encoding" , "ASCII" ) ; Collections . addAll ( arguments , "-excludes" , "DENIED" ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "NOT_ACCEPT" ) , is ( true ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "DENIED" ) , is ( false ) ) ; assertThat ( conf . getMatcher ( ) . acceptModel ( "" ) , is ( false ) ) ; } @ Test public void with_cache ( ) throws Exception { List < String > arguments = Lists . create ( ) ; File jdbc = jdbc ( ) ; File output = folder . newFolder ( "output" ) . getCanonicalFile ( ) . getAbsoluteFile ( ) ; Collections . addAll ( arguments , "-jdbc" , jdbc . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-output" , output . getAbsolutePath ( ) ) ; Collections . addAll ( arguments , "-encoding" , "ASCII" ) ; Collections . addAll ( arguments , "-includes" , "" ) ; Collections . addAll ( arguments , "-excludes" , "DENIED" ) ; Collections . addAll ( arguments , "-sid_column" , "SID" ) ; Collections . addAll ( arguments , "" , "" ) ; Collections . addAll ( arguments , "" , "" ) ; Collections . addAll ( arguments , "" , "\"1\"" ) ; Configuration conf = Main . loadConfigurationFromArguments ( arguments . toArray ( new String [ | |
2,617 | <s> package net . sf . sveditor . core . docs ; import java . io . File ; import java . util . Set ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; public class DocGenConfig { private Set < Tuple < SVDBDeclCacheItem , ISVDBIndex > > fPackages ; | |
2,618 | <s> package net . sf . sveditor . core . tests . parser ; import java . io . ByteArrayOutputStream ; import java . io . File ; import java . io . IOException ; import java . io . PrintStream ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . SVDBFSFileSystemProvider ; import net . sf . sveditor . core | |
2,619 | <s> package org . rubypeople . rdt . internal . ui . text ; import org . eclipse . core . runtime . Preferences ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . ListenerList ; import org . eclipse . jface . util . PropertyChangeEvent ; public class PreferencesAdapter implements IPreferenceStore { private class PropertyChangeListener implements Preferences . IPropertyChangeListener { public void propertyChange ( Preferences . PropertyChangeEvent event ) { firePropertyChangeEvent ( event . getProperty ( ) , event . getOldValue ( ) , event . getNewValue ( ) ) ; } } private ListenerList fListeners = new ListenerList ( ) ; private PropertyChangeListener fListener = new PropertyChangeListener ( ) ; private Preferences fPreferences ; private boolean fSilent ; public PreferencesAdapter ( ) { this ( new Preferences ( ) ) ; } public PreferencesAdapter ( Preferences preferences ) { fPreferences = preferences ; } public void addPropertyChangeListener ( IPropertyChangeListener listener ) { if ( fListeners . size ( ) == 0 ) fPreferences . addPropertyChangeListener ( fListener ) ; fListeners . add ( listener ) ; } public void removePropertyChangeListener ( IPropertyChangeListener listener ) { fListeners . remove ( listener ) ; if ( fListeners . size ( ) == 0 ) fPreferences . removePropertyChangeListener ( fListener ) ; } public boolean contains ( String name ) { return fPreferences . contains ( name ) ; } public void firePropertyChangeEvent ( String name , Object oldValue , Object newValue ) { if ( ! fSilent ) { PropertyChangeEvent event = new PropertyChangeEvent ( this , name , oldValue , newValue ) ; Object [ ] listeners = fListeners . getListeners ( ) ; for ( int i = 0 ; i < listeners . length ; i ++ ) ( ( IPropertyChangeListener ) listeners [ i ] ) . propertyChange ( event ) ; } } public boolean getBoolean ( String name ) { return fPreferences . getBoolean ( name ) ; } public boolean getDefaultBoolean ( String name ) { return fPreferences . getDefaultBoolean ( name ) ; } public double getDefaultDouble ( String name ) { return fPreferences . getDefaultDouble ( name ) ; } public float getDefaultFloat ( String name ) { return fPreferences . getDefaultFloat ( name ) ; } public int getDefaultInt ( String name ) { return fPreferences . getDefaultInt ( name ) ; } public long getDefaultLong ( String name ) { return fPreferences . getDefaultLong ( name ) ; } public String getDefaultString ( String name ) { return fPreferences . getDefaultString ( name ) ; } public double getDouble ( String name ) { return fPreferences . getDouble ( name ) ; } public float getFloat ( String name ) { return fPreferences . getFloat ( name ) ; } public int getInt ( String name ) { return fPreferences . getInt ( name ) ; } public long getLong ( String name ) { return fPreferences . getLong ( name ) ; } public String getString ( String name ) { return fPreferences . getString ( name ) ; } public boolean isDefault ( String name ) { return fPreferences . isDefault ( name ) ; } public boolean needsSaving ( ) { return fPreferences . needsSaving ( ) ; } public void putValue ( String name , String value ) { | |
2,620 | <s> package org . rubypeople . rdt . core ; import org . eclipse . core . runtime . IPath ; public interface ILoadpathEntry { int CPE_LIBRARY = 1 ; int CPE_PROJECT = 2 ; int CPE_SOURCE = 3 ; int CPE_VARIABLE = 4 ; int CPE_CONTAINER = 5 ; | |
2,621 | <s> package com . sun . phobos . script . javascript ; import org . mozilla . javascript . * ; public final class JSAdapter implements Function { private JSAdapter ( Scriptable obj ) { setAdaptee ( obj ) ; } public static void init ( Context cx , Scriptable scope , boolean sealed ) throws RhinoException { JSAdapter obj = new JSAdapter ( cx . newObject ( scope ) ) ; obj . setParentScope ( scope ) ; obj . setPrototype ( getFunctionPrototype ( scope ) ) ; obj . isPrototype = true ; ScriptableObject . defineProperty ( scope , "JSAdapter" , obj , ScriptableObject . DONTENUM ) ; } public String getClassName ( ) { return "JSAdapter" ; } public Object get ( String name , Scriptable start ) { Function func = getAdapteeFunction ( GET_PROP ) ; if ( func != null ) { return call ( func , new Object [ ] { name } ) ; } else { start = getAdaptee ( ) ; return start . get ( name , start ) ; } } public Object get ( int index , Scriptable start ) { Function func = getAdapteeFunction ( GET_PROP ) ; if ( func != null ) { return call ( func , new Object [ ] { new Integer ( index ) } ) ; } else { start = getAdaptee ( ) ; return start . get ( index , start ) ; } } public boolean has ( String name , Scriptable start ) { Function func = getAdapteeFunction ( HAS_PROP ) ; if ( func != null ) { Object res = call ( func , new Object [ ] { name } ) ; return Context . toBoolean ( res ) ; } else { start = getAdaptee ( ) ; return start . has ( name , start ) ; } } public boolean has ( int index , Scriptable start ) { Function func = getAdapteeFunction ( HAS_PROP ) ; if ( func != null ) { Object res = call ( func , new Object [ ] { new Integer ( index ) } ) ; return Context . toBoolean ( res ) ; } else { start = getAdaptee ( ) ; return start . has ( index , start ) ; } } public void put ( String name , Scriptable start , Object value ) { if ( start == this ) { Function | |
2,622 | <s> package com . asakusafw . compiler . directio ; import java . lang . reflect . Type ; import java . text . MessageFormat ; import java . util . BitSet ; import java . util . List ; import java . util . Set ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . runtime . stage . directio . StringTemplate . Format ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . vocabulary . directio . DirectFileOutputDescription ; public final class OutputPattern { static final int CHAR_BRACE_OPEN = '{' ; static final int CHAR_BRACE_CLOSE = '}' ; static final int CHAR_BLOCK_OPEN = '[' ; static final int CHAR_BLOCK_CLOSE = ']' ; static final int CHAR_WILDCARD = '*' ; static final int CHAR_SEPARATE_IN_BLOCK = ':' ; static final int CHAR_VARIABLE_START = '$' ; static final BitSet CHAR_MAP_META = new BitSet ( ) ; static { CHAR_MAP_META . set ( 0 , 0x20 ) ; CHAR_MAP_META . set ( '\\' ) ; CHAR_MAP_META . set ( '*' ) ; CHAR_MAP_META . set ( '?' ) ; CHAR_MAP_META . set ( '#' ) ; CHAR_MAP_META . set ( '|' ) ; CHAR_MAP_META . set ( '{' ) ; CHAR_MAP_META . set ( '}' ) ; CHAR_MAP_META . set ( '[' ) ; CHAR_MAP_META . set ( ']' ) ; } private static final Pattern PATTERN_ORDER = Pattern . compile ( "\\s*(" + "(\\w+)" + "|" + "(\\+\\s*(\\w+))" + "|" + "(-\\s*(\\w+))" + "|" + "" + "|" + "" + ")\\s*" ) ; private static final int [ ] ORDER_GROUP_INDEX = { 2 , 4 , 6 , 8 , 10 } ; private static final boolean [ ] ASC_MAP = { true , true , false , true , false } ; private OutputPattern ( ) { return ; } public static List < CompiledResourcePattern > compileResourcePattern ( String pattern , DataClass dataType ) { if ( pattern == null ) { throw new IllegalArgumentException ( "" ) ; } if ( dataType == null ) { throw new IllegalArgumentException ( "" ) ; } List < CompiledResourcePattern > results = Lists . create ( ) ; Cursor cursor = new Cursor ( pattern ) ; while ( cursor . isEof ( ) == false ) { if ( cursor . isLiteral ( ) ) { String literal = cursor . consumeLiteral ( ) ; results . add ( new CompiledResourcePattern ( literal ) ) ; } else if ( cursor . isPlaceHolder ( ) ) { Formatted ph = cursor . consumePlaceHolder ( ) ; DataClass . Property property = findProperty ( dataType , ( String ) ph . original ) ; if ( property == null ) { cursor . rewind ( ) ; throw new IllegalArgumentException ( MessageFormat . format ( "" , cursor , ph . original ) ) ; } String argument = ph . formatString ; Format format = findFormat ( property , argument ) ; if ( format == null ) { cursor . rewind ( ) ; throw new IllegalArgumentException ( MessageFormat . format ( "" , cursor , argument == null ? "" : argument ) ) ; } try { format . check ( property . getType ( ) , argument ) ; } catch ( IllegalArgumentException e ) { cursor . rewind ( ) ; throw new IllegalArgumentException ( MessageFormat . format ( "" , cursor , argument == null ? "" : argument ) , e ) ; } results . add ( new CompiledResourcePattern ( property , format , argument ) ) ; } else if ( cursor . isRandomNumber ( ) ) { Formatted rand = cursor . consumeRandomNumber ( ) ; RandomNumber source = ( RandomNumber ) rand . original ; results . add ( new CompiledResourcePattern ( source , Format . NATURAL , null ) ) ; } else if ( cursor . isWildcard ( ) ) { cursor . consumeWildcard ( ) ; results . add ( new CompiledResourcePattern ( ) ) ; } else { throw new IllegalArgumentException ( MessageFormat . format ( "" , cursor ) ) ; } } return results ; } public static List < CompiledOrder > compileOrder ( List < String > orders , DataClass dataType ) { if ( orders == null ) { throw new IllegalArgumentException ( "" ) ; } if ( dataType == null ) { throw new IllegalArgumentException ( "" ) ; } Set < String > saw = Sets . create ( ) ; List < CompiledOrder > results = Lists . create ( ) ; for ( String order : orders ) { boolean asc = false ; String name = null ; Matcher matcher = PATTERN_ORDER . matcher ( order . trim ( ) ) ; if ( matcher . matches ( ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , order ) ) ; } for ( int i = 0 ; i < ORDER_GROUP_INDEX . length ; i ++ ) { int groupIndex = ORDER_GROUP_INDEX [ i ] ; if ( matcher . group ( groupIndex ) != null ) { asc = ASC_MAP [ i ] ; name = matcher . group ( groupIndex ) ; break ; } } assert name != null ; DataClass . Property property = findProperty ( dataType , name ) ; if ( property == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , order , name ) ) ; } if ( saw . contains ( property . getName ( ) ) ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , order , name ) ) ; } saw . add ( property . getName ( ) ) ; results . add ( new CompiledOrder ( property , asc ) ) ; } return results ; } private static Property findProperty ( DataClass dataType , String name ) { assert dataType != null ; assert name != null ; return dataType . findProperty ( name ) ; } private static Format findFormat ( Property property , String argument ) { if ( argument == null ) { return Format . NATURAL ; } Type type = property . getType ( ) ; if ( type == DateOption . class ) { return Format . DATE ; } if ( type == DateTimeOption . class ) { return Format . DATETIME ; } return null ; } private static final class Cursor { private final char [ ] cbuf ; private int lastSegmentPosition ; private int position ; Cursor ( String value ) { assert value != null ; this . cbuf = value . | |
2,623 | <s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . net . URI ; import java . util . List ; import java . util . ServiceLoader ; public class SpiVerifyRuleProvider implements VerifyRuleProvider { private final List < VerifyRuleProvider > elements ; public SpiVerifyRuleProvider ( ClassLoader serviceClassLoader ) { if ( serviceClassLoader == null ) { throw new IllegalArgumentException ( "" ) ; } this . elements = Util . loadService ( | |
2,624 | <s> package org . rubypeople . rdt . internal . debug . core . commands ; import java . io . IOException ; import org . rubypeople . rdt . internal . debug . core . DebuggerNotFoundException ; import org . rubypeople . rdt . internal . debug . core . parsing . SuspensionReader ; public class ClassicDebuggerConnection | |
2,625 | <s> package org . rubypeople . rdt . internal . core . parser ; import java . util . Map ; import java . util . StringTokenizer ; import org . eclipse . core . resources . IMarker ; import org . rubypeople . rdt . core . RubyCore ; public class AbstractTaskParser { protected boolean fCaseSensitive = false ; protected String [ ] fTags ; protected int [ ] fPriorities ; public AbstractTaskParser ( Map < String , String > preferences ) { super ( ) ; String caseSensitive = getString ( preferences , RubyCore . COMPILER_TASK_CASE_SENSITIVE , RubyCore . ENABLED ) ; if ( caseSensitive . equals ( RubyCore . ENABLED ) ) fCaseSensitive = true ; String tags = getString ( preferences , RubyCore . COMPILER_TASK_TAGS , RubyCore . DEFAULT_TASK_TAGS ) ; String priorities = getString ( preferences , RubyCore . COMPILER_TASK_PRIORITIES , RubyCore . DEFAULT_TASK_PRIORITIES ) ; fTags = tokenize ( tags , "," ) ; fPriorities = convertPriorities ( tokenize ( priorities , "," ) ) ; } protected String getString ( Map < String , String > preferences , String key , String def ) { if ( preferences == null ) return def ; String answer = preferences . get ( key ) ; if ( answer == null ) return def ; return answer ; } protected int [ ] convertPriorities ( String [ ] stringPriorities ) { int priorities [ ] = new int [ stringPriorities . length ] ; for ( int i = 0 ; i < stringPriorities . length ; i ++ ) { String priority = stringPriorities [ i ] ; if ( priority . | |
2,626 | <s> package org . rubypeople . rdt . internal . core ; import org . rubypeople . rdt . core . IRubyElement ; public class RubyGlobal extends RubyField { public RubyGlobal | |
2,627 | <s> package org . oddjob . jmx . handlers ; import java . io . Serializable ; import java . lang . reflect . UndeclaredThrowableException ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanException ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . Notification ; import javax . management . NotificationListener ; import javax . management . ReflectionException ; import javax . swing . ImageIcon ; import org . oddjob . Iconic ; import org . oddjob . images . IconEvent ; import org . oddjob . images . IconHelper ; import org . oddjob . images . IconListener ; import org . oddjob . jmx . RemoteOperation ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . ClientInterfaceHandlerFactory ; import org . oddjob . jmx . client . ClientSideToolkit ; import org . oddjob . jmx . client . HandlerVersion ; import org . oddjob . jmx . client . SimpleHandlerResolver ; import org . oddjob . jmx . client . Synchronizer ; import org . oddjob . jmx . server . JMXOperationPlus ; import org . oddjob . jmx . server . ServerInterfaceHandler ; import org . oddjob . jmx . server . ServerInterfaceHandlerFactory ; import org . oddjob . jmx . server . ServerSideToolkit ; public class IconicHandlerFactory implements ServerInterfaceHandlerFactory < Iconic , Iconic > { public static final HandlerVersion VERSION = new HandlerVersion ( 3 , 0 ) ; public static final String ICON_CHANGED_NOTIF_TYPE = "" ; static final JMXOperationPlus < Notification [ ] > SYNCHRONIZE = new JMXOperationPlus < Notification [ ] > ( "" , "" , Notification [ ] . class , MBeanOperationInfo . INFO ) ; static final JMXOperationPlus < ImageIcon > ICON_FOR = new JMXOperationPlus < ImageIcon > ( "" , "" , ImageIcon . class , MBeanOperationInfo . INFO ) . addParam ( "iconId" , String . class , "The icon id." ) ; public Class < Iconic > interfaceClass ( ) { return Iconic . class ; } public MBeanAttributeInfo [ ] getMBeanAttributeInfo ( ) { return new MBeanAttributeInfo [ 0 ] ; } public MBeanOperationInfo [ ] getMBeanOperationInfo ( ) { return | |
2,628 | <s> package com . asakusafw . compiler . flow . stage ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . apache . hadoop . io . RawComparator ; import org . apache . hadoop . io . WritableComparator ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Arrangement ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Segment ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Term ; import com . asakusafw . runtime . flow . SegmentedWritable ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . IfStatement ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; public class ShuffleGroupingComparatorEmitter { static final Logger LOG = LoggerFactory . getLogger ( ShuffleGroupingComparatorEmitter . class ) ; private FlowCompilingEnvironment environment ; public ShuffleGroupingComparatorEmitter ( FlowCompilingEnvironment environment ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; this . environment = environment ; } public Name emit ( ShuffleModel model , Name keyTypeName ) throws IOException { Precondition . checkMustNotBeNull ( model , "model" ) ; Precondition . checkMustNotBeNull ( keyTypeName , "keyTypeName" ) ; LOG . debug ( "" , model . getStageBlock ( ) ) ; Engine engine = new Engine ( environment , model , keyTypeName ) ; CompilationUnit source = engine . generate ( ) ; environment . emit ( source ) ; Name packageName = source . getPackageDeclaration ( ) . getName ( ) ; SimpleName simpleName = source . getTypeDeclarations ( ) . get ( 0 ) . getName ( ) ; Name name = environment . getModelFactory ( ) . newQualifiedName ( packageName , simpleName ) ; LOG . debug ( "" , model . getStageBlock ( ) , name ) ; return name ; } private static class Engine { private ShuffleModel model ; private ModelFactory factory ; private ImportBuilder importer ; private Type keyType ; public Engine ( FlowCompilingEnvironment environment , ShuffleModel model , Name keyTypeName ) { assert environment != null ; assert model != null ; assert keyTypeName != null ; this . model = model ; this . factory = environment . getModelFactory ( ) ; Name packageName = environment . getStagePackageName ( model . getStageBlock ( ) . getStageNumber ( ) ) ; this . importer = new ImportBuilder ( factory , factory . newPackageDeclaration ( packageName ) , ImportBuilder . Strategy . TOP_LEVEL ) ; this . keyType = importer . resolve ( factory . newNamedType ( keyTypeName ) ) ; } public CompilationUnit generate ( ) { TypeDeclaration type = createType ( ) ; return factory . newCompilationUnit ( importer . getPackageDeclaration ( ) , importer . toImportDeclarations ( ) , Collections . singletonList ( type ) , Collections . < Comment > emptyList ( ) ) ; } private TypeDeclaration createType ( ) { SimpleName name = factory . newSimpleName ( Naming . getShuffleGroupingComparatorClass ( ) ) ; importer . resolvePackageMember ( name ) ; List < TypeBodyDeclaration > members = Lists . create ( ) ; members . add ( createCompareBytes ( ) ) ; members . add | |
2,629 | <s> package org . rubypeople . rdt . internal . debug . ui . rubyvms ; import java . io . File ; import java . io . IOException ; import java . text . MessageFormat ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . DirectoryDialog ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Text ; import org . rubypeople . rdt . internal . ui . dialogs . StatusDialog ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ComboDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IStringButtonAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringButtonDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringDialogField ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . IVMInstallType ; import org . rubypeople . rdt . launching . VMStandin ; public class AddVMDialog extends StatusDialog { protected IStatus [ ] allStatus = new IStatus [ 2 ] ; protected IVMInstall fEditedVM ; private StringButtonDialogField fRubyVMRoot ; private StringDialogField fVMName ; private StringDialogField fVMArgs ; private IVMInstallType fSelectedVMType ; private IVMInstallType [ ] fVMTypes ; private ComboDialogField fVMTypeCombo ; private VMLibraryBlock fLibraryBlock ; private IStatus [ ] fStati ; private int fPrevIndex = - 1 ; private IAddVMDialogRequestor fRequestor ; public AddVMDialog ( IAddVMDialogRequestor requestor , Shell shell , IVMInstallType [ ] vmInstallTypes , IVMInstall editedVM ) { super ( shell ) ; setShellStyle ( getShellStyle ( ) | SWT . RESIZE ) ; fRequestor = requestor ; fStati = new IStatus [ 5 ] ; for ( int i = 0 ; i < fStati . length ; i ++ ) { fStati [ i ] = new StatusInfo ( ) ; } fVMTypes = vmInstallTypes ; fSelectedVMType = editedVM != null ? editedVM . getVMInstallType ( ) : vmInstallTypes [ 0 ] ; fEditedVM = editedVM ; } protected void setSystemLibraryStatus ( IStatus status ) { fStati [ 3 ] = status ; } protected IStatus validateInterpreterLocationText ( ) { String locationName = fRubyVMRoot . getText ( ) ; IStatus s = null ; File file = null ; if ( locationName . length ( ) == 0 ) { s = new StatusInfo ( IStatus . INFO , RubyVMMessages . addVMDialog_enterLocation ) ; } else { file = new File ( locationName ) ; if ( ! file . exists ( ) ) { s = new StatusInfo ( IStatus . ERROR , RubyVMMessages . addVMDialog_locationNotExists ) ; } else { final IStatus [ ] temp = new IStatus [ 1 ] ; final File tempFile = file ; Runnable r = new Runnable ( ) { public void run ( ) { temp [ 0 ] = getVMType ( ) . validateInstallLocation ( tempFile ) ; } } ; BusyIndicator . showWhile ( getShell ( ) . getDisplay ( ) , r ) ; s = temp [ 0 ] ; } } if ( s . isOK ( ) ) { if ( file . getName ( ) . equals ( "bin" ) ) { file = file . getParentFile ( ) ; } fLibraryBlock . setHomeDirectory ( file ) ; String name = fVMName . getText ( ) ; if ( name == null || name . trim ( ) . length ( ) == 0 ) { try { String genName = null ; IPath path = new Path ( file . getCanonicalPath ( ) ) ; int segs = path . segmentCount ( ) ; if ( segs == 1 ) { genName = path . segment ( 0 ) ; } else if ( segs >= 2 ) { genName = path . lastSegment ( ) ; } if ( genName != null ) { fVMName . setText ( genName ) ; } } catch ( IOException e ) { } } } else { fLibraryBlock . setHomeDirectory ( null ) ; } fLibraryBlock . restoreDefaultLibraries ( ) ; return s ; } private IVMInstallType getVMType ( ) { return fSelectedVMType ; } protected void setButtonLayoutData ( Button button ) { super . setButtonLayoutData ( button ) ; } protected void browseForInstallLocation ( ) { DirectoryDialog dialog = new DirectoryDialog ( getShell ( ) ) ; dialog . setFilterPath ( fRubyVMRoot . getText ( ) ) ; dialog . setMessage ( RubyVMMessages . addVMDialog_pickJRERootDialog_message ) ; String newPath = dialog . open ( ) ; if ( newPath != null ) { fRubyVMRoot . setText ( newPath ) ; } } protected void okPressed ( ) { doOkPressed ( ) ; super . okPressed ( ) ; } private void doOkPressed ( ) { if ( fEditedVM == null ) { IVMInstall vm = new VMStandin ( fSelectedVMType , createUniqueId ( fSelectedVMType ) ) ; setFieldValuesToVM ( vm ) ; fRequestor . vmAdded ( vm ) ; } else { setFieldValuesToVM ( fEditedVM ) ; } } public void create ( ) { super . create ( ) ; fVMName . setFocus ( ) ; selectVMType ( ) ; } private String createUniqueId ( IVMInstallType vmType ) { String id = null ; do { id = String . valueOf ( System . currentTimeMillis ( ) ) ; } while ( vmType . findVMInstall ( id ) != null ) ; return id ; } private void selectVMType ( ) { for ( int i = 0 ; i < fVMTypes . length ; i ++ ) { if ( fSelectedVMType == fVMTypes [ i ] ) { fVMTypeCombo . selectItem ( i ) ; return ; } } } private void updateVMType ( ) { int selIndex = fVMTypeCombo . getSelectionIndex ( ) ; if ( selIndex == fPrevIndex ) { return ; } fPrevIndex = selIndex ; if ( selIndex >= 0 && selIndex < fVMTypes . length ) { fSelectedVMType = fVMTypes [ selIndex ] ; } setRubyVMLocationStatus ( validateInterpreterLocationText ( ) ) ; fLibraryBlock . initializeFrom ( fEditedVM , fSelectedVMType ) ; updateStatusLine ( ) ; } private void setRubyVMLocationStatus ( IStatus status ) { fStati [ 1 ] = status ; } protected void updateStatusLine ( ) { IStatus max = null ; for ( int i = 0 ; i < fStati . length ; i ++ ) { IStatus curr = fStati [ i ] ; if ( curr . matches ( IStatus . ERROR ) ) { updateStatus ( curr ) ; return ; } if ( max == null || curr . getSeverity ( ) > max . getSeverity ( ) ) { max = curr ; } } updateStatus ( max ) ; } protected Control createDialogArea ( Composite ancestor ) { createDialogFields ( ) ; Composite parent = ( Composite ) super . createDialogArea ( ancestor ) ; ( ( GridLayout ) parent . getLayout ( ) ) . numColumns = 3 ; fVMTypeCombo . doFillIntoGrid ( parent , 3 ) ; ( ( GridData ) fVMTypeCombo . getComboControl ( null ) . getLayoutData ( ) ) . widthHint = convertWidthInCharsToPixels ( 50 ) ; Label l = new Label ( parent , SWT . NONE ) ; l . setText ( RubyVMMessages . enterRubyInstallLocation ) ; GridData gd = new GridData ( GridData . FILL_HORIZONTAL ) ; gd . horizontalSpan = 3 ; l . setLayoutData ( gd ) ; fRubyVMRoot . doFillIntoGrid ( parent , 3 ) ; fVMName . doFillIntoGrid ( parent , 3 ) ; fVMArgs . doFillIntoGrid ( parent , 3 ) ; ( ( GridData ) | |
2,630 | <s> package br . com . caelum . vraptor . dash . hibernate . stats ; import br . com . caelum . vraptor . Path ; import br . com . caelum . vraptor . Resource ; import br . com . caelum | |
2,631 | <s> package com . asakusafw . compiler . flow . processor . operator ; import javax . annotation . Generated ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . operator . Update ; @ Generated ( "" ) public class UpdateFlowFactory { public static final class Simple implements Operator { public final Source < Ex1 > out ; Simple ( Source < Ex1 > model ) { OperatorDescription . Builder builder = new OperatorDescription . Builder ( Update . class ) ; builder . declare ( UpdateFlow . class , UpdateFlowImpl . class , "simple" ) ; builder . declareParameter ( Ex1 . class ) ; builder . addInput ( "model" , Ex1 . class ) ; builder . addOutput ( "out" , Ex1 . class ) ; FlowElementResolver resolver = builder . toResolver ( ) ; resolver . resolveInput ( "model" , model ) ; this . out = resolver . resolveOutput ( "out" ) ; } } public UpdateFlowFactory . Simple simple ( Source < Ex1 > model ) { return new UpdateFlowFactory . Simple ( model ) ; } public static final class WithParameter implements Operator { public final Source | |
2,632 | <s> package de . fuberlin . wiwiss . d2rq . engine ; import org . openjena . atlas . io . IndentedWriter ; import com . hp . hpl . jena . sparql . algebra . Op ; import com . hp . hpl . jena . sparql . algebra . op . OpExt ; import com . hp . hpl . jena . sparql . algebra . op . OpNull ; import com . hp . hpl . jena . sparql . algebra . op . OpTable ; import com . hp . hpl . jena . sparql . engine . ExecutionContext ; import com . hp . hpl . jena . sparql . engine . QueryIterator ; import com . hp . hpl . jena . sparql . engine . binding . Binding ; import com . hp . hpl . jena . sparql . engine . iterator . QueryIterRepeatApply ; import com . hp . hpl . jena . sparql . serializer . SerializationContext ; import com . hp . hpl . jena . sparql . util . NodeIsomorphismMap ; import de . fuberlin . wiwiss . d2rq . algebra . NodeRelation ; public class OpTableSQL extends OpExt { public static Op create ( NodeRelation table ) { if ( table . baseRelation ( ) . condition ( ) . isFalse ( ) ) { return OpNull . create ( ) ; } return new OpTableSQL ( table ) ; } private final NodeRelation table ; public OpTableSQL ( NodeRelation table ) { super ( "sql" ) ; this . table = table ; } public NodeRelation table ( ) { return table ; } @ Override public QueryIterator eval ( QueryIterator input , final ExecutionContext execCxt ) { return new QueryIterRepeatApply ( input , execCxt ) { @ Override protected QueryIterator nextStage ( Binding binding ) { return QueryIterTableSQL . create ( table . extendWith ( binding ) , execCxt ) ; } } ; } | |
2,633 | <s> package com . pogofish . jadt . samples . ast . data ; import java . util . List ; public abstract class Expression { private Expression ( ) { } public static final Expression _Add ( Expression left , Expression right ) { return new Add ( left , right ) ; } public static final Expression _Variable ( String name ) { return new Variable ( name ) ; } public static final Expression _IntLiteral ( int value ) { return new IntLiteral ( value ) ; } public static final Expression _LongLiteral ( long value ) { return new LongLiteral ( value ) ; } public static interface MatchBlock < ResultType > { ResultType _case ( Add x ) ; ResultType _case ( Variable x ) ; ResultType _case ( IntLiteral x ) ; ResultType _case ( LongLiteral x ) ; } public static abstract class MatchBlockWithDefault < ResultType > implements MatchBlock < ResultType > { @ Override public ResultType _case ( Add x ) { return _default ( x ) ; } @ Override public ResultType _case ( Variable x ) { return _default ( x ) ; } @ Override public ResultType _case ( IntLiteral x ) { return _default ( x ) ; } @ Override public ResultType _case ( LongLiteral x ) { return _default ( x ) ; } protected abstract ResultType _default ( Expression x ) ; } public static interface SwitchBlock { void _case ( Add x ) ; void _case ( Variable x ) ; void _case ( IntLiteral x ) ; void _case ( LongLiteral x ) ; } public static abstract class SwitchBlockWithDefault implements SwitchBlock { @ Override public void _case ( Add x ) { _default ( x ) ; } @ Override public void _case ( Variable x ) { _default ( x ) ; } @ Override public void _case ( IntLiteral x ) { _default ( x ) ; } @ Override public void _case ( LongLiteral x ) { _default ( x ) ; } protected abstract void _default ( Expression x ) ; } public static final class Add extends Expression { public final Expression left ; public final Expression right ; public Add ( Expression left , Expression right ) { this . left = left ; this . right = right ; } @ Override public < ResultType > ResultType match ( MatchBlock < ResultType > matchBlock ) { return matchBlock . _case ( this ) ; } @ Override public void _switch ( SwitchBlock switchBlock ) { switchBlock . _case ( this ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( left == null ) ? 0 : left . hashCode ( ) ) ; result = prime * result + ( ( right == null ) ? 0 : right . 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 ; Add other = ( Add ) | |
2,634 | <s> package net . ggtools . grand . ui . actions ; import org . eclipse . jface . action . Action ; import org . eclipse . | |
2,635 | <s> package com . asakusafw . bulkloader . transfer ; import java . io . Closeable ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . Arrays ; import java . util . Properties ; import java . util . zip . ZipEntry ; import java . util . zip . ZipInputStream ; import java . util . zip . ZipOutputStream ; import org . apache . commons . io . input . CountingInputStream ; import org . apache . commons . io . output . CountingOutputStream ; import org . apache . hadoop . io . InputBuffer ; import org . apache . hadoop . io . OutputBuffer ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . runtime . io . util . ZipEntryInputStream ; import com . asakusafw . runtime . io . util . ZipEntryOutputStream ; public final class FileList { static final Log LOG = new Log ( FileList . class ) ; static final String FIRST_ENTRY_NAME = "" ; static final String LAST_ENTRY_NAME = "" ; public static FileProtocol content ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return new FileProtocol ( FileProtocol . Kind . CONTENT , name , null ) ; } public static FileList . Reader createReader ( InputStream input ) throws IOException { if ( input == null ) { throw new IllegalArgumentException ( "" ) ; } LOG . debugMessage ( "" ) ; return new Reader ( input ) ; } public static FileList . Writer createWriter ( OutputStream output , boolean compress ) throws IOException { if ( output == null ) { throw new IllegalArgumentException ( "" ) ; } LOG . debugMessage ( "" ) ; return new Writer ( output , compress ) ; } private FileList ( ) { return ; } public static class Reader implements Closeable { private final CountingInputStream counter ; private final ZipInputStream input ; private FileProtocol current ; private final InputBuffer buffer = new InputBuffer ( ) ; private boolean sawNext ; private boolean sawEof ; Reader ( InputStream input ) throws IOException { assert input != null ; this . counter = new CountingInputStream ( input ) ; this . input = new ZipInputStream ( counter ) ; ZipEntry first = this . input . getNextEntry ( ) ; if ( first == null || first . getName ( ) . equals ( FIRST_ENTRY_NAME ) == false ) { throw new IOException ( "" ) ; } } public boolean next ( ) throws IOException { while ( sawEof == false ) { ZipEntry entry = input . getNextEntry ( ) ; if ( entry == null ) { throw new IOException ( "" ) ; } LOG . debugMessage ( "" , entry . getName ( ) ) ; if ( entry . getName ( ) . equals ( LAST_ENTRY_NAME ) ) { sawEof = true ; sawNext = false ; consume ( ) ; return false ; } if ( entry . isDirectory ( ) ) { continue ; } LOG . debugMessage ( "opening {0}" , entry . getName ( ) ) ; restoreExtra ( entry ) ; sawNext = true ; return true ; } return false ; } private void consume ( ) throws IOException { byte [ ] buf = new byte [ 1024 ] ; int rest = 0 ; while ( true ) { int read = counter . read ( buf ) ; if ( read < 0 ) { break ; } rest += read ; } LOG . debugMessage ( "" , rest ) ; } private void restoreExtra ( ZipEntry entry ) throws IOException { assert entry != null ; byte [ ] extra = entry . getExtra ( ) ; if ( extra == null ) { throw new IOException ( MessageFormat . format ( "" , entry . getName ( ) ) ) ; } buffer . reset ( extra , extra | |
2,636 | <s> package com . asakusafw . yaess . core . task ; import java . io . IOException ; import java . util . Set ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitor ; import com . asakusafw . yaess . core . ExecutionScript ; import com . asakusafw . yaess . core . ExecutionScriptHandler ; import com . asakusafw . yaess . core . Job ; public class ScriptJob < T extends ExecutionScript > extends Job { private final ExecutionScriptHandler < ? super T > handler ; private final T script ; public ScriptJob ( T script , ExecutionScriptHandler < ? super T > handler ) { if ( script == null ) { throw new IllegalArgumentException ( "" ) ; } if ( handler == null ) { throw new IllegalArgumentException ( "" ) ; } this . handler = handler ; this . script | |
2,637 | <s> package org . rubypeople . rdt . internal . ui . preferences . formatter ; import java . util . Iterator ; import java . util . Map ; import org . rubypeople . rdt . internal . ui . preferences . formatter . ProfileManager . CustomProfile ; public class ProfileVersioner { public static final int VERSION_1 = 1 ; public static final int CURRENT_VERSION = VERSION_1 ; public static void updateAndComplete ( CustomProfile profile ) { final Map oldSettings = profile . getSettings ( ) ; Map newSettings = updateAndComplete ( oldSettings , profile . getVersion ( ) ) ; profile . setVersion ( CURRENT_VERSION ) ; profile . setSettings ( newSettings ) ; } public static Map updateAndComplete ( Map oldSettings , int version ) { final Map newSettings = ProfileManager . getDefaultSettings ( ) ; switch ( version ) { case VERSION_1 : default : for ( final Iterator iter = oldSettings . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { | |
2,638 | <s> package com . asakusafw . compiler . fileio . flow ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . vocabulary . external . FileExporterDescription ; public class Out4ExporterDesc extends FileExporterDescription { @ Override public Class < ? > getModelType ( ) { return | |
2,639 | <s> package org . rubypeople . rdt . core . search ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . rubypeople . rdt . core . IParent ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . Openable ; import org . rubypeople . rdt . internal . core . index . EntryResult ; import org . rubypeople . rdt . internal . core . search . HandleFactory ; import org . rubypeople . rdt . internal . core . search . indexing . IIndexConstants ; import org . rubypeople . rdt . internal . core . search . indexing . InternalSearchDocument ; public abstract class SearchDocument extends InternalSearchDocument { private static HandleFactory factory = new HandleFactory ( ) ; private IRubyScript script ; private String documentPath ; private SearchParticipant participant ; public SearchDocument ( String documentPath , SearchParticipant participant ) { this . documentPath = documentPath ; this . participant = participant ; } public void addIndexEntry ( char [ ] category , char [ ] key ) { super . addIndexEntry ( | |
2,640 | <s> package net . sf . sveditor . core . db ; public class SVDBProgramDecl extends SVDBModIfcDecl { public SVDBProgramDecl ( ) { super ( "" | |
2,641 | <s> package org . rubypeople . rdt . ui . text . ruby ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . CompletionProposal ; import org . rubypeople . rdt . internal . ui . text | |
2,642 | <s> package net . ggtools . grand . ui . widgets ; import java . util . Map ; import java . util . Properties ; import net . ggtools . grand . ui . widgets . property . PropertyEditor ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . FillLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; public class PropertyEditionDialog extends Dialog { private PropertyEditor propertyEditor ; private Map propertiesToLoad ; public PropertyEditionDialog ( final Shell parentShell ) { super ( parentShell ) ; setShellStyle ( getShellStyle ( ) | SWT . RESIZE ) ; } @ Override protected Control createDialogArea ( final Composite parent ) { final Composite composite = ( Composite ) super . createDialogArea ( parent ) ; | |
2,643 | <s> package org . oddjob . script ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import javax . script . ScriptException ; public class ScriptRunner { private final String resultVariable ; private Map < String , Object > beans = new HashMap < String , Object > ( ) ; public ScriptRunner ( String resultVariable ) { this . resultVariable = resultVariable ; } public void addBeans ( Map < String , Object > dictionary ) { for ( Iterator < String > i = dictionary . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String key = ( String | |
2,644 | <s> package org . rubypeople . rdt . internal . debug . core . commands ; import java . io . IOException ; import java . io . PrintWriter ; import java . net . Socket ; import org . rubypeople . rdt . debug . core . RdtDebugCorePlugin ; import org . rubypeople . rdt . internal . debug . core . DebuggerNotFoundException ; import org . rubypeople . rdt . internal . debug . core . parsing . AbstractReadStrategy ; import org . rubypeople . rdt . internal . debug . core . parsing . MultiReaderStrategy ; import org . rubypeople . rdt . internal . debug . core . parsing . SuspensionReader ; import org . xmlpull . v1 . XmlPullParser ; import org . xmlpull . v1 . XmlPullParserException ; import org . xmlpull . v1 . XmlPullParserFactory ; public abstract class AbstractDebuggerConnection { private int commandPort ; private Socket commandSocket ; private PrintWriter writer ; private AbstractReadStrategy commandReadStrategy ; private String host ; public AbstractDebuggerConnection ( int port ) { this ( "localhost" , port ) ; } public AbstractDebuggerConnection ( String host , int port ) { super ( ) ; this . host = host ; this . commandPort = port ; } public abstract void connect ( ) throws DebuggerNotFoundException , IOException ; public abstract SuspensionReader start ( ) throws DebuggerNotFoundException , IOException ; public abstract boolean isStarted ( ) ; protected AbstractReadStrategy sendCommand ( AbstractCommand command ) throws DebuggerNotFoundException , IOException { if ( ! isCommandPortConnected ( ) ) { throw new IllegalStateException ( command + "" ) ; } RdtDebugCorePlugin . debug ( "" + command . getCommand ( ) ) ; getWriter ( ) . println ( command . getCommand ( ) ) ; return getCommandReadStrategy ( ) ; } public AbstractReadStrategy getCommandReadStrategy ( ) { return commandReadStrategy ; } protected void createCommandConnection ( ) throws DebuggerNotFoundException , IOException { getSocket ( ) ; XmlPullParser xpp = createXpp ( commandSocket ) ; commandReadStrategy = new MultiReaderStrategy ( xpp ) ; } public boolean isCommandPortConnected ( ) { return commandSocket != null ; } protected Socket getSocket ( ) throws IOException , DebuggerNotFoundException { if ( commandSocket == null ) { commandSocket = acquireSocket ( host , commandPort ) ; if ( commandSocket == null ) { throw new DebuggerNotFoundException ( "" + commandPort ) ; } } return commandSocket ; } protected static Socket acquireSocket ( String host , int port ) throws IOException { Socket socket = null ; int tryCount = 50 ; for ( int i = 0 ; i < tryCount ; i ++ ) { try { socket = new Socket ( host , port ) ; break ; } catch ( IOException e ) { try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e1 ) { } } } | |
2,645 | <s> package net . sf . sveditor . core . db . search ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; import org . eclipse . core . runtime . NullProgressMonitor ; public class SVDBFindNamedPackage { private ISVDBIndexIterator fIndexIt ; private ISVDBFindNameMatcher fMatcher ; public SVDBFindNamedPackage ( ISVDBIndexIterator index_it , ISVDBFindNameMatcher matcher ) { fIndexIt = index_it ; fMatcher = matcher ; } public SVDBFindNamedPackage ( ISVDBIndexIterator index_it ) { this ( index_it , SVDBFindDefaultNameMatcher . getDefault ( ) ) ; } public List < | |
2,646 | <s> package org . rubypeople . rdt . internal . ui . browsing ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Comparator ; import java . util . Iterator ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . action . IMenuListener ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . IStatusLineManager ; import org . eclipse . jface . action . IToolBarManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . util . TransferDragSourceListener ; import org . eclipse . jface . util . TransferDropTargetListener ; import org . eclipse . jface . viewers . DecoratingLabelProvider ; import org . eclipse . jface . viewers . IContentProvider ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . IOpenListener ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . OpenEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . search . ui . IContextMenuConstants ; import org . eclipse . search . ui . ISearchResultView ; import org . eclipse . search . ui . ISearchResultViewPart ; import org . eclipse . swt . SWT ; import org . eclipse . swt . dnd . DND ; import org . eclipse . swt . dnd . Transfer ; import org . eclipse . swt . events . KeyAdapter ; import org . eclipse . swt . events . KeyEvent ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Display ; import org . eclipse . swt . widgets . Menu ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IFileEditorInput ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IPartListener2 ; import org . eclipse . ui . ISelectionListener ; import org . eclipse . ui . IViewSite ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchPartReference ; import org . eclipse . ui . IWorkbenchPartSite ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . IWorkingSetManager ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . actions . ActionContext ; import org . eclipse . ui . actions . ActionGroup ; import org . eclipse . ui . part . IShowInSource ; import org . eclipse . ui . part . ResourceTransfer ; import org . eclipse . ui . part . ShowInContext ; import org . eclipse . ui . part . ViewPart ; import org . eclipse . ui . texteditor . ITextEditor ; import org . eclipse . ui . views . navigator . LocalSelectionTransfer ; import org . osgi . framework . Bundle ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . CompositeActionGroup ; import org . rubypeople . rdt . internal . ui . actions . NewWizardsActionGroup ; import org . rubypeople . rdt . internal . ui . dnd . DelegatingDropAdapter ; import org . rubypeople . rdt . internal . ui . dnd . RdtViewerDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . ResourceTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . SelectionTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . SelectionTransferDropAdapter ; import org . rubypeople . rdt . internal . ui . viewsupport . AppearanceAwareLabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . DecoratingRubyLabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . ProblemTableViewer ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyElementImageProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyUILabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . StatusBarUpdater ; import org . rubypeople . rdt . internal . ui . workingsets . WorkingSetFilterActionGroup ; import org . rubypeople . rdt . ui . IWorkingCopyManager ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . RubyElementLabelProvider ; import org . rubypeople . rdt . ui . RubyElementLabels ; import org . rubypeople . rdt . ui . RubyElementSorter ; import org . rubypeople . rdt . ui . StandardRubyElementContentProvider ; import org . rubypeople . rdt . ui . actions . BuildActionGroup ; import org . rubypeople . rdt . ui . actions . CCPActionGroup ; import org . rubypeople . rdt . ui . actions . CustomFiltersActionGroup ; import org . rubypeople . rdt . ui . actions . OpenEditorActionGroup ; import org . rubypeople . rdt . ui . actions . OpenViewActionGroup ; import org . rubypeople . rdt . ui . actions . RubySearchActionGroup ; abstract class RubyBrowsingPart extends ViewPart implements ISelectionListener , IMenuListener { private static final String TAG_SELECTED_ELEMENTS = "" ; private static final String TAG_SELECTED_ELEMENT = "" ; private static final String TAG_SELECTED_ELEMENT_PATH = "" ; private StructuredViewer fViewer ; private IMemento fMemento ; private RubyUILabelProvider fLabelProvider ; protected IWorkbenchPart fPreviousSelectionProvider ; protected Object fPreviousSelectedElement ; private ILabelProvider fTitleProvider ; private WorkingSetFilterActionGroup fWorkingSetFilterActionGroup ; private boolean fHasWorkingSetFilter = true ; private boolean fHasCustomFilter = true ; private OpenEditorActionGroup fOpenEditorGroup ; protected CompositeActionGroup fActionGroups ; private ToggleLinkingAction fToggleLinkingAction ; private CustomFiltersActionGroup fCustomFiltersActionGroup ; private boolean fLinkingEnabled ; private boolean fProcessSelectionEvents = true ; private RubyElementTypeComparator fTypeComparator ; private IPartListener2 fPartListener = new IPartListener2 ( ) { public void partActivated ( IWorkbenchPartReference ref ) { } public void partBroughtToTop ( IWorkbenchPartReference ref ) { } public void partInputChanged ( IWorkbenchPartReference ref ) { } public void partClosed ( IWorkbenchPartReference ref ) { } public void partDeactivated ( IWorkbenchPartReference ref ) { } public void partOpened ( IWorkbenchPartReference ref ) { } public void partVisible ( IWorkbenchPartReference ref ) { if ( ref != null && ref . getId ( ) == getSite ( ) . getId ( ) ) { fProcessSelectionEvents = true ; IWorkbenchPage page = getSite ( ) . getWorkbenchWindow ( ) . getActivePage ( ) ; if ( page != null ) selectionChanged ( page . getActivePart ( ) , page . getSelection ( ) ) ; } } public void partHidden ( IWorkbenchPartReference ref ) { if ( ref != null && ref . getId ( ) == getSite ( ) . getId ( ) ) fProcessSelectionEvents = false ; } } ; private CCPActionGroup fCCPActionGroup ; private BuildActionGroup fBuildActionGroup ; public RubyBrowsingPart ( ) { super ( ) ; initLinkingEnabled ( ) ; } protected void createActions ( ) { fActionGroups = new CompositeActionGroup ( new ActionGroup [ ] { new NewWizardsActionGroup ( this . getSite ( ) ) , fOpenEditorGroup = new OpenEditorActionGroup ( this ) , new OpenViewActionGroup ( this ) , fCCPActionGroup = new CCPActionGroup ( this ) , fBuildActionGroup = new BuildActionGroup ( this ) , new RubySearchActionGroup ( this ) } ) ; if ( fHasWorkingSetFilter ) { String viewId = getConfigurationElement ( ) . getAttribute ( "id" ) ; Assert . isNotNull ( viewId ) ; IPropertyChangeListener workingSetListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { doWorkingSetChanged ( event ) ; } } ; fWorkingSetFilterActionGroup = new WorkingSetFilterActionGroup ( getSite ( ) , workingSetListener ) ; fViewer . addFilter ( fWorkingSetFilterActionGroup . getWorkingSetFilter ( ) ) ; } if ( fHasCustomFilter ) fCustomFiltersActionGroup = new CustomFiltersActionGroup ( this , fViewer ) ; fToggleLinkingAction = new ToggleLinkingAction ( this ) ; } protected void addFilters ( ) { } protected void addKeyListener ( ) { fViewer . getControl ( ) . addKeyListener ( new KeyAdapter ( ) { public void keyReleased ( KeyEvent event ) { handleKeyReleased ( event ) ; } } ) ; } protected void handleKeyReleased ( KeyEvent event ) { if ( event . stateMask != 0 ) return ; int key = event . keyCode ; if ( key == SWT . F5 ) { IAction action = fBuildActionGroup . getRefreshAction ( ) ; if ( action . isEnabled ( ) ) action . run ( ) ; } } protected void initDragAndDrop ( ) { int ops = DND . DROP_COPY | DND . DROP_MOVE | DND . DROP_LINK ; Transfer [ ] dropTransfers = new Transfer [ ] { LocalSelectionTransfer . getInstance ( ) } ; TransferDropTargetListener [ ] dropListeners = new TransferDropTargetListener [ ] { new SelectionTransferDropAdapter ( fViewer ) } ; fViewer . addDropSupport ( ops | DND . DROP_DEFAULT , dropTransfers , new DelegatingDropAdapter ( dropListeners ) ) ; Transfer [ ] dragTransfers = new Transfer [ ] { LocalSelectionTransfer . getInstance ( ) , ResourceTransfer . getInstance ( ) } ; TransferDragSourceListener [ ] dragListeners = new TransferDragSourceListener [ ] { new SelectionTransferDragAdapter ( fViewer ) , new ResourceTransferDragAdapter ( fViewer ) } ; fViewer . addDragSupport ( ops , dragTransfers , new RdtViewerDragAdapter ( fViewer , dragListeners ) ) ; } protected void createContextMenu ( ) { MenuManager menuManager = new MenuManager ( "#PopupMenu" ) ; menuManager . setRemoveAllWhenShown ( true ) ; menuManager . addMenuListener ( this ) ; Menu contextMenu = menuManager . createContextMenu ( fViewer . getControl ( ) ) ; fViewer . getControl ( ) . setMenu ( contextMenu ) ; getSite ( ) . registerContextMenu ( menuManager , fViewer ) ; } private void doWorkingSetChanged ( PropertyChangeEvent event ) { String property = event . getProperty ( ) ; if ( IWorkingSetManager . CHANGE_WORKING_SET_NAME_CHANGE . equals ( property ) ) updateTitle ( ) ; else if ( IWorkingSetManager . CHANGE_WORKING_SET_CONTENT_CHANGE . equals ( property ) ) { updateTitle ( ) ; fViewer . getControl ( ) . setRedraw ( false ) ; fViewer . refresh ( ) ; fViewer . getControl ( ) . setRedraw ( true ) ; } } protected void hookViewerListeners ( ) { fViewer . addOpenListener ( new IOpenListener ( ) { public void open ( OpenEvent event ) { IAction open = fOpenEditorGroup . getOpenAction ( ) ; if ( open . | |
2,647 | <s> package com . asakusafw . compiler . flow . testing . external ; import com . asakusafw . compiler . flow . testing . model . ExSummarized2 ; import com . asakusafw | |
2,648 | <s> package org . rubypeople . rdt . internal . debug . core ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . debug . core . model . IRubyExceptionBreakpoint ; import org . rubypeople . rdt . debug . core . model . IRubyStackFrame ; import org . rubypeople . rdt . internal . debug . core . model . RubyStackFrame ; import | |
2,649 | <s> package $ { package } . jobflow ; import $ { package } . modelgen . dmdl . csv . AbstractItemInfoCsvInputDescription ; public class ItemInfoFromCsv extends AbstractItemInfoCsvInputDescription { @ Override public | |
2,650 | <s> package net . sf . sveditor . core . db . index . plugin_lib ; import java . io . IOException ; import java . io . InputStream ; import java . net . URL ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . ISVDBFileSystemChangeListener ; import net . sf . sveditor . core . db . index . ISVDBFileSystemProvider ; import net . sf . sveditor . core . db . index . SVDBLibIndex ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . log . LogFactory ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . Platform ; import org . osgi . framework . Bundle ; import org . osgi . framework . Version ; public class SVDBPluginLibIndex extends SVDBLibIndex implements ISVDBFileSystemProvider { private Bundle fBundle ; private String fPluginNS ; private String fRootFile ; private long fBundleVersion = - 1 ; public SVDBPluginLibIndex ( String project , String plugin_ns , String root , ISVDBIndexCache cache ) { super ( project , "plugin:/" + plugin_ns + "/" + root , null , cache , null ) ; fLog = LogFactory . getLogHandle ( "" ) ; fRootFile = root ; fPluginNS = plugin_ns ; fBundle = Platform . getBundle ( fPluginNS ) ; fLog . debug ( "RootFile: " + fRootFile + " Root: " + getBaseLocation ( ) ) ; setFileSystemProvider ( this ) ; } public String getTypeID ( ) { return SVDBPluginLibIndexFactory . TYPE ; } @ Override protected void discoverRootFiles ( IProgressMonitor monitor ) { clearFilesList ( ) ; clearIncludePaths ( ) ; addFile ( getBaseLocation ( ) ) ; addIncludePath ( getResolvedBaseLocationDir ( ) ) ; } public boolean isDir ( String path ) { if ( path . startsWith ( "plugin:/" ) ) { URL entry ; String leaf = path . substring ( ( "plugin:/" + fPluginNS ) . length ( ) ) ; return ( ( entry = fBundle . getEntry ( leaf ) ) != null && entry . getPath ( ) . endsWith ( "/" ) ) ; } else { return false ; } } public List < String > getFiles ( String path ) { return new ArrayList < String > ( ) ; } public void addMarker ( String path , String type , int lineno , String msg ) { } public void clearMarkers ( String path ) { } public void closeStream ( InputStream in | |
2,651 | <s> package com . asakusafw . compiler . windgate ; import java . io . IOException ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import java . util . SortedSet ; import java . util . TreeMap ; import java . util . TreeSet ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . JavaName ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . flow . jobflow . CompiledStage ; import com . asakusafw . compiler . flow . mapreduce . parallel . ParallelSortClientEmitter ; import com . asakusafw . compiler . flow . mapreduce . parallel . ResolvedSlot ; import com . asakusafw . compiler . flow . mapreduce . parallel . Slot ; import com . asakusafw . compiler . flow . mapreduce . parallel . SlotResolver ; import com . asakusafw . runtime . stage . input . TemporaryInputFormat ; import com . asakusafw . runtime . stage . output . TemporaryOutputFormat ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . vocabulary . external . ExporterDescription ; import com . asakusafw . vocabulary . external . ImporterDescription ; import com . asakusafw . vocabulary . flow . graph . InputDescription ; import com . asakusafw . vocabulary . flow . graph . OutputDescription ; import com . asakusafw . vocabulary . windgate . Constants ; import com . asakusafw . vocabulary . windgate . WindGateExporterDescription ; import com . asakusafw . vocabulary . windgate . WindGateImporterDescription ; import com . asakusafw . windgate . core . DriverScript ; import com . asakusafw . windgate . core . GateScript ; import com . asakusafw . windgate . core . ProcessScript ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; public class WindGateIoProcessor extends ExternalIoDescriptionProcessor { static final Logger LOG = LoggerFactory . getLogger ( WindGateIoProcessor . class ) ; public static final String MODULE_NAME = "windgate" ; private static final String CMD_PROCESS = "" ; private static final String CMD_FINALIZE = "" ; private static final String OPT_IMPORT = "import" ; private static final String OPT_EXPORT = "export" ; private static final String PATTERN_SCRIPT_LOCATION = "" ; static final String OPT_BEGIN = "begin" ; static final String OPT_END = "end" ; static final String OPT_ONESHOT = "oneshot" ; @ Override public Class < ? extends ImporterDescription > getImporterDescriptionType ( ) { return WindGateImporterDescription . class ; } @ Override public Class < ? extends ExporterDescription > getExporterDescriptionType ( ) { return WindGateExporterDescription . class ; } @ Override public boolean validate ( List < InputDescription > inputs , List < OutputDescription > outputs ) { LOG . debug ( "" , getEnvironment ( ) . getBatchId ( ) , getEnvironment ( ) . getFlowId ( ) ) ; boolean valid = true ; for ( InputDescription input : inputs ) { WindGateImporterDescription desc = extract ( input ) ; try { if ( desc . getDriverScript ( ) == null ) { throw new IllegalStateException ( MessageFormat . format ( "" , desc . getClass ( ) . getName ( ) ) ) ; } } catch ( IllegalStateException e ) { getEnvironment ( ) . error ( "" , input . getName ( ) , getEnvironment ( ) . getBatchId ( ) , getEnvironment ( ) . getFlowId ( ) , e . getMessage ( ) ) ; valid = false ; } } for ( OutputDescription output : outputs ) { WindGateExporterDescription desc = extract ( output ) ; try { if ( desc . getDriverScript ( ) == null ) { throw new IllegalStateException ( MessageFormat . format ( "" , desc . getClass ( ) . getName ( ) ) ) ; } } catch ( IllegalStateException e ) { getEnvironment ( ) . error ( "" , output . getName ( ) , getEnvironment ( ) . getBatchId ( ) , getEnvironment ( ) . getFlowId ( ) , e . getMessage ( ) ) ; valid = false ; } } return valid ; } @ Override public SourceInfo getInputInfo ( InputDescription description ) { Set < Location > locations = Collections . singleton ( getInputLocation ( description ) ) ; return new SourceInfo ( locations , TemporaryInputFormat . class ) ; } @ Override public List < CompiledStage > emitEpilogue ( IoContext context ) throws IOException { if ( context . getOutputs ( ) . isEmpty ( ) ) { return Collections . emptyList ( ) ; } LOG . debug ( "" , getEnvironment ( ) . getBatchId ( ) , getEnvironment ( ) . getFlowId ( ) ) ; List < Slot > slots = Lists . create ( ) ; for ( Output output : context . getOutputs ( ) ) { Slot slot = toSlot ( output ) ; slots . add ( slot ) ; } List < ResolvedSlot > resolved = new SlotResolver ( getEnvironment ( ) ) . resolve ( slots ) ; if ( getEnvironment ( ) . hasError ( ) ) { return Collections . emptyList ( ) ; } ParallelSortClientEmitter emitter = new ParallelSortClientEmitter ( getEnvironment ( ) ) ; CompiledStage stage = emitter . emit ( MODULE_NAME , resolved , getEnvironment ( ) . getEpilogueLocation ( MODULE_NAME ) ) ; return Collections . singletonList ( stage ) ; } private Slot toSlot ( Output output ) { assert output != null ; String name = normalize ( output . getDescription ( ) . getName | |
2,652 | <s> package test . modelgen . table . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import javax . annotation . Generated ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "" , columns = { "TEMP_SID" } , primary = { "TEMP_SID" } ) @ SuppressWarnings ( "deprecation" ) public class TempImportTarget1Df implements Writable { @ Property ( name = "TEMP_SID" ) private LongOption tempSid = new LongOption ( ) ; public long getTempSid ( ) { return this . tempSid . get ( ) ; } public void setTempSid ( long tempSid ) { this . tempSid . modify ( tempSid ) ; } public LongOption getTempSidOption ( ) { return this . tempSid ; } public void setTempSidOption ( LongOption tempSid ) { this . tempSid . copyFrom ( tempSid ) ; } public void copyFrom ( TempImportTarget1Df source ) { this . tempSid . copyFrom ( source . tempSid ) ; } @ Override public void write ( DataOutput out ) throws IOException { tempSid . write ( out ) ; } @ Override public void readFields ( DataInput in ) throws IOException { tempSid . readFields ( in ) ; } @ Override public int hashCode ( ) { int prime = 31 ; | |
2,653 | <s> package com . asakusafw . runtime . directio ; import java . util . Map ; public class DirectDataSourceProfile { private final String id ; private final Class < ? extends AbstractDirectDataSource > targetClass ; private final String path ; private final Map < String , String > attributes ; public DirectDataSourceProfile ( String id , Class < ? extends AbstractDirectDataSource > targetClass , String path , Map < String , String > attributes ) { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } if ( targetClass == null ) { throw new IllegalArgumentException ( "" ) ; } if ( path == null ) { throw new IllegalArgumentException ( "" ) ; } if ( attributes == null ) { throw new IllegalArgumentException ( "" ) ; } this . id = id ; this | |
2,654 | <s> package com . sun . tools . hat . internal . server ; import com . google . common . base . Function ; import com . google . common . collect . Collections2 ; import com . google . common . collect . ImmutableMultimap ; import com . google . common . collect . ImmutableMultiset ; import com . google . common . collect . ImmutableSet ; import com . google . common . collect . ImmutableSetMultimap ; import com . google . common . collect . Iterables ; import com . google . common . collect . Multimaps ; import com . google . common . collect . Ordering ; import com . sun . tools . hat . internal . model . JavaClass ; import com . sun . tools . hat . internal . model . JavaHeapObject ; import com . sun . tools . hat . internal . model . Snapshot ; import com . sun . tools . hat . internal . util . Misc ; import java . util . Arrays ; import java . util . Collection ; import java . util . Comparator ; public class HistogramQuery extends QueryHandler { private enum Sorters implements Function < JavaClass , Comparable < ? > > , Comparator < JavaClass > { BY_NAME { @ Override public String apply ( JavaClass clazz ) { return clazz . getName ( ) ; } } ; private final Ordering < JavaClass > ordering ; private Sorters ( ) { ordering = Ordering . natural ( ) . onResultOf ( this ) ; } @ Override public int compare ( JavaClass lhs , JavaClass rhs ) { return ordering . compare ( lhs , rhs ) ; } } private static abstract class MetricsProvider { private final JavaClass [ ] classes ; protected MetricsProvider ( JavaClass [ ] classes ) { this . classes = classes ; } public abstract int getCount ( JavaClass clazz ) ; public abstract long getSize ( JavaClass clazz ) ; public int getRefCount ( JavaClass clazz ) { throw new UnsupportedOperationException ( ) ; } public Function < JavaClass , Integer > getCountMethod ( ) { return new Function < JavaClass , Integer > ( ) { public Integer apply ( JavaClass clazz ) { return getCount ( clazz ) ; } } ; } public Function < JavaClass , Long > getSizeMethod ( ) { return new Function < JavaClass , Long > ( ) { public Long apply ( JavaClass clazz ) { return getSize ( clazz ) ; } } ; } public Function < JavaClass , Integer > getRefCountMethod ( ) { return new Function < JavaClass , Integer > ( ) { public Integer apply ( JavaClass clazz ) { return getRefCount ( clazz ) ; } } ; } public JavaClass [ ] getClasses ( ) { return classes . clone ( ) ; } public boolean hasRefCount ( ) { return false ; } } private static class GlobalMetricsProvider extends MetricsProvider { public GlobalMetricsProvider ( Snapshot snapshot ) { super ( snapshot . getClassesArray ( ) ) ; } @ Override public int getCount ( JavaClass clazz ) { return clazz . getInstancesCount ( false ) ; } @ Override public long getSize ( JavaClass clazz ) { return clazz . getTotalInstanceSize ( ) ; } } private static class RefereeMetricsProvider extends MetricsProvider { private enum GetClass implements Function < JavaHeapObject , JavaClass > { INSTANCE ; @ Override public JavaClass apply ( JavaHeapObject obj ) { return obj . getClazz ( ) ; } } final ImmutableMultimap < JavaClass , JavaHeapObject > referrers ; final ImmutableMultiset < JavaClass > references ; private RefereeMetricsProvider ( ImmutableMultimap < JavaClass , JavaHeapObject > referrers , ImmutableMultiset < JavaClass > references ) { super ( referrers . keySet ( ) . toArray ( new JavaClass [ 0 ] ) ) ; this . referrers = referrers ; this . references = references ; } public static RefereeMetricsProvider make ( JavaClass referee , Collection < JavaClass > referrers ) { ImmutableSet < JavaHeapObject > instances = Misc . getInstances ( referee , false , referrers ) ; return new RefereeMetricsProvider ( Multimaps . index ( Misc . getReferrers ( instances ) , GetClass . INSTANCE ) , getReferences ( instances ) . keys ( ) ) ; } @ Override public int getCount ( JavaClass clazz ) { return referrers . get ( clazz ) . size ( ) ; } @ Override public long getSize ( JavaClass clazz ) { Collection < JavaHeapObject > subset = referrers . get ( clazz ) ; if ( ! clazz . isArray ( ) ) { return ( long ) clazz . getInstanceSize ( ) * subset . size ( ) ; } long size = 0 ; for ( JavaHeapObject instance : subset ) { size += instance . getSize ( ) ; } return size ; } @ Override public int getRefCount ( JavaClass clazz ) { return references . count ( clazz ) ; } @ Override public boolean hasRefCount ( ) { return true ; } private static ImmutableMultimap < JavaClass , JavaHeapObject > getReferences ( Iterable < JavaHeapObject > instances ) { ImmutableSetMultimap . Builder < JavaClass , JavaHeapObject > builder = ImmutableSetMultimap . builder ( ) ; for ( JavaHeapObject instance : instances ) { for ( JavaHeapObject referrer : instance . getReferers ( ) ) { builder . put ( referrer . getClazz ( ) , instance ) ; } } return builder . build ( ) ; } } public void run ( ) { ClassResolver resolver = new ClassResolver ( snapshot , false ) ; JavaClass referee = resolver . apply ( Iterables . getOnlyElement ( params . get ( "referee" ) , null ) ) ; Collection < JavaClass > referrers = Collections2 . transform ( params . get ( "referrer" ) , resolver ) ; MetricsProvider metrics ; if ( referee == null ) { metrics = new GlobalMetricsProvider ( snapshot ) ; } else { metrics = RefereeMetricsProvider . make ( referee , referrers ) ; } Comparator < JavaClass > comparator ; if ( query . equals ( "count" ) ) { comparator = Ordering . natural ( ) . reverse ( ) . onResultOf ( metrics . getCountMethod ( ) ) ; } else if ( query . equals ( "class" ) ) { comparator = Sorters . BY_NAME ; } else if ( query . equals ( "size" ) || ! metrics . hasRefCount ( ) ) { comparator = Ordering . natural ( ) . reverse ( ) . onResultOf ( metrics . getSizeMethod ( ) ) ; } else { comparator = Ordering . natural ( ) . reverse ( ) . onResultOf ( metrics . getRefCountMethod ( ) ) ; } JavaClass [ ] classes = metrics . getClasses ( ) ; Arrays . sort ( classes , comparator ) ; startHtml ( "" ) ; printBreadcrumbs ( query , referee , referrers ) ; out . println ( "" ) ; out . println ( "" ) ; out . println ( "</p>" ) ; | |
2,655 | <s> package org . rubypeople . rdt . refactoring . core . pushdown ; import org . eclipse . osgi . util . NLS ; public class Messages extends NLS { private static final String BUNDLE_NAME = "" ; public static String MethodDownPusher_Constructors ; public static String MethodDownPusher_Methods ; public static String | |
2,656 | <s> package com . asakusafw . compiler . flow . processor ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . flow . RendezvousProcessor ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; import com . asakusafw . vocabulary . operator . MasterCheck ; @ TargetOperator ( MasterCheck . class ) public class MasterCheckFlowProcessor extends RendezvousProcessor { @ Override public | |
2,657 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Annotation ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class PackageDeclarationImpl extends ModelRoot implements PackageDeclaration { private Javadoc javadoc ; private List < ? extends Annotation > annotations ; private Name name ; @ Override public Javadoc getJavadoc ( ) { return this . javadoc ; } public void setJavadoc ( Javadoc javadoc ) { this . javadoc = javadoc ; } @ Override public List < ? extends Annotation > getAnnotations ( ) { return this . annotations ; } public void setAnnotations ( List < ? extends Annotation > annotations ) { Util . notNull ( annotations , | |
2,658 | <s> package org . rubypeople . rdt . internal . ui . text . correction ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . text . ruby . IInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . IProblemLocation ; public class HashSyntaxCorrectionProposal extends CUCorrectionProposal { private static final String NAME = "" ; private IInvocationContext context ; private IProblemLocation problem ; public HashSyntaxCorrectionProposal ( IInvocationContext context , IProblemLocation problem , int relevance ) { super ( NAME , context . getRubyScript ( ) , relevance , RubyUI . getSharedImages ( ) . getImage ( org . rubypeople . rdt . ui . ISharedImages . IMG_OBJS_CORRECTION_CHANGE ) ) ; this . context = context ; this . problem = problem ; } @ Override protected void addEdits ( IDocument document , TextEdit editRoot ) throws CoreException { String src = getRubyScript ( ) . getSource ( ) ; ArrayNode covering = ( ArrayNode ) problem . getCoveringNode ( context . getASTRoot ( ) ) ; List < Node > children = covering . childNodes ( ) ; for ( int i = 0 ; i < children . size ( ) ; i += 2 ) { if ( children . size ( ) <= ( 1 + 1 ) ) break ; Node key = children . get ( i ) ; if ( | |
2,659 | <s> package com . asakusafw . compiler . flow . processor . operator ; import java . util . Arrays ; import java . util . List ; import javax . annotation . Generated ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . flow . graph . OperatorHelper ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . operator . MasterCheck ; @ Generated ( "" ) public class MasterCheckFlowFactory { public static final class Simple implements Operator { public final Source < Ex1 > found ; public final Source < Ex1 > missed ; Simple ( Source < Ex2 > master , Source < Ex1 > model ) { OperatorDescription . Builder builder = new OperatorDescription . Builder ( MasterCheck . class ) ; builder . declare ( MasterCheckFlow . class , MasterCheckFlowImpl . class , "simple" ) ; builder . declareParameter ( Ex2 . class ) ; builder . declareParameter ( Ex1 . class ) ; builder . addInput ( "master" , Ex2 . class , new ShuffleKey ( Arrays . asList ( new String [ ] { "string" } ) , Arrays . asList ( new ShuffleKey . Order [ ] { } ) ) ) ; builder . addInput ( "model" , Ex1 . class , new ShuffleKey ( Arrays . asList ( new String [ ] { "string" } ) , Arrays . asList ( new ShuffleKey . Order [ ] { } ) ) ) ; builder . addOutput ( "found" , Ex1 . class ) ; builder . addOutput ( "missed" , Ex1 . class ) ; builder . addAttribute ( FlowBoundary . SHUFFLE ) ; FlowElementResolver resolver = builder . toResolver ( ) ; resolver . resolveInput ( "master" , master ) ; resolver . resolveInput ( "model" , model ) ; this . found = resolver . resolveOutput ( "found" ) ; this . missed = resolver . resolveOutput ( "missed" ) ; } } public MasterCheckFlowFactory . Simple simple ( Source < Ex2 > master , Source < Ex1 > model ) { return new MasterCheckFlowFactory . Simple ( master , model ) ; } public static final class Selection implements Operator { public final Source < Ex1 > found ; public final Source < Ex1 > missed ; Selection ( Source < Ex2 > master , Source < Ex1 > model ) { OperatorDescription . Builder builder0 = new OperatorDescription . Builder ( MasterCheck . class ) ; builder0 . declare ( MasterCheckFlow . class , MasterCheckFlowImpl . class , "selection" ) ; builder0 . declareParameter ( Ex2 . class ) ; builder0 . declareParameter ( Ex1 . class ) ; builder0 . addInput ( "master" , Ex2 . class , new ShuffleKey ( Arrays . asList ( new String [ ] { "string" } ) , Arrays . asList ( new ShuffleKey . Order [ ] { } ) ) ) ; builder0 . addInput ( "model" , Ex1 . class , new ShuffleKey ( Arrays . asList ( new String [ ] { "string" } ) , Arrays . asList ( new ShuffleKey | |
2,660 | <s> package org . rubypeople . rdt . internal . ti ; public class ReferenceTypeGuess implements ITypeGuess { private Variable other ; public | |
2,661 | <s> package com . asakusafw . compiler . flow . join ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . runtime . flow . join . JoinResource ; import com . asakusafw . runtime . flow . join . LookUpKey ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . ClassDeclaration ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; public final class JoinResourceEmitter { static final Logger LOG = LoggerFactory . getLogger ( JoinResourceEmitter . class ) ; private final FlowCompilingEnvironment environment ; private final ModelFactory factory ; private final ImportBuilder importer ; private final JoinResourceDescription resource ; private JoinResourceEmitter ( FlowCompilingEnvironment environment , JoinResourceDescription resource ) { assert environment != null ; assert resource != null ; this . environment = environment ; this . factory = environment . getModelFactory ( ) ; Name packageName = environment . getResourcePackage ( "join" ) ; this . importer = new ImportBuilder ( factory , factory . newPackageDeclaration ( packageName ) , ImportBuilder . Strategy . TOP_LEVEL ) ; this . resource = resource ; } public static Name emit ( FlowCompilingEnvironment environment , JoinResourceDescription resource ) throws IOException { Precondition . checkMustNotBeNull ( environment , "environment" ) ; Precondition . checkMustNotBeNull ( resource , "resource" ) ; JoinResourceEmitter emitter = new JoinResourceEmitter ( environment , resource ) ; return emitter . emit ( ) ; } private Name emit ( ) throws IOException { LOG . info ( "" , resource ) ; CompilationUnit source = generate ( ) ; environment . emit ( source ) ; Name packageName = source . getPackageDeclaration ( ) . getName ( ) ; SimpleName simpleName = source . getTypeDeclarations ( ) . get ( 0 ) . getName ( ) ; Name name = environment . getModelFactory ( ) . newQualifiedName ( packageName , simpleName ) ; LOG . debug ( "" , resource , name ) ; return name ; } private CompilationUnit generate ( ) { ClassDeclaration type = createType ( ) ; return factory . newCompilationUnit ( importer . getPackageDeclaration ( ) , importer . toImportDeclarations ( ) , Collections . singletonList ( type ) , Collections . < Comment > emptyList ( ) ) ; } private ClassDeclaration createType ( ) { SimpleName name = environment . createUniqueName ( "Join" ) ; importer . resolvePackageMember ( name ) ; List < TypeBodyDeclaration > members = createMembers ( ) ; return factory . newClassDeclaration ( new JavadocBuilder ( factory ) . linkType ( importer . toType ( resource . getMasterDataClass ( ) . getType ( ) ) ) . text ( "-UNK-" ) . linkType ( importer . toType ( resource . getTransactionDataClass ( ) . getType ( ) ) ) . text ( "" ) . toJavadoc ( ) , new AttributeBuilder ( factory ) . Public ( ) . toAttributes ( ) , name , importer . resolve ( new TypeBuilder ( factory , Models . toType ( factory , JoinResource . class ) ) . parameterize ( resource . getMasterDataClass ( ) . getType ( ) , resource . getTransactionDataClass ( ) . getType ( ) ) . toType ( ) ) , Collections . < Type > emptyList ( ) , members ) ; } private List < TypeBodyDeclaration > createMembers ( ) { List < | |
2,662 | <s> package org . rubypeople . rdt . internal . ui . util ; import java . util . Vector ; public class StringMatcher { protected String fPattern ; protected int fLength ; protected boolean fIgnoreWildCards ; protected boolean fIgnoreCase ; protected boolean fHasLeadingStar ; protected boolean fHasTrailingStar ; protected String fSegments [ ] ; protected int fBound = 0 ; protected static final char fSingleWildCard = ' ' ; public static class Position { int start ; int end ; public Position ( int start , int end ) { this . start = start ; this . end = end ; } public int getStart ( ) { return start ; } public int getEnd ( ) { return end ; } } public StringMatcher ( String pattern , boolean ignoreCase , boolean ignoreWildCards ) { if ( pattern == null ) throw new IllegalArgumentException ( ) ; fIgnoreCase = ignoreCase ; fIgnoreWildCards = ignoreWildCards ; fPattern = pattern ; fLength = pattern . length ( ) ; if ( fIgnoreWildCards ) { parseNoWildCards ( ) ; } else { parseWildCards ( ) ; } } public StringMatcher . Position find ( String text , int start , int end ) { if ( text == null ) throw new IllegalArgumentException ( ) ; int tlen = text . length ( ) ; if ( start < 0 ) start = 0 ; if ( end > tlen ) end = tlen ; if ( end < 0 || start >= end ) return null ; if ( fLength == 0 ) return new Position ( start , start ) ; if ( fIgnoreWildCards ) { int x = posIn ( text , start , end ) ; if ( x < 0 ) return null ; return new Position ( x , x + fLength ) ; } int segCount = fSegments . length ; if ( segCount == 0 ) return new Position ( start , end ) ; int curPos = start ; int matchStart = - 1 ; int i ; for ( i = 0 ; i < segCount && curPos < end ; ++ i ) { String current = fSegments [ i ] ; int nextMatch = regExpPosIn ( text , curPos , end , current ) ; if ( nextMatch < 0 ) return null ; if ( i == 0 ) matchStart = nextMatch ; curPos = nextMatch + current . length ( ) ; } if ( i < segCount ) return null ; return new Position ( matchStart , curPos ) ; } public boolean match ( String text ) { if ( null == text ) throw new IllegalArgumentException ( ) ; return match ( text , 0 , text . length ( ) ) ; } public boolean match ( String text , int start , int end ) { if ( null == text ) throw new IllegalArgumentException ( ) ; if ( start > end ) return false ; if ( fIgnoreWildCards ) return ( end - start == fLength ) && fPattern . regionMatches ( fIgnoreCase , 0 , text , start , fLength ) ; int segCount = fSegments . length ; if ( segCount == 0 && ( fHasLeadingStar || fHasTrailingStar ) ) return true ; if ( start == end ) return fLength == 0 ; if ( fLength == 0 ) return start == end ; int tlen = text . length ( ) ; if ( start < 0 ) start = 0 ; if ( end > tlen ) end = tlen ; int tCurPos = start ; int bound = end - fBound ; if ( bound < 0 ) return false ; int i = 0 ; String current = fSegments [ i ] ; int segLength = current . length ( ) ; if ( ! fHasLeadingStar ) { if ( ! regExpRegionMatches ( text , start , current , 0 , segLength ) ) { return false ; } ++ i ; tCurPos = tCurPos + segLength ; } while ( i < segCount ) { current = fSegments [ i ] ; int currentMatch ; int k = current . indexOf ( fSingleWildCard ) ; if ( k < 0 ) { currentMatch = textPosIn ( text , tCurPos , end , current ) ; if ( currentMatch < 0 ) return false ; } else { currentMatch = regExpPosIn ( text , tCurPos , end , current ) ; if ( currentMatch < 0 ) return false ; } tCurPos = currentMatch + current . length ( ) ; i ++ ; } if ( ! fHasTrailingStar && tCurPos != end ) { int clen = current . length ( ) ; return regExpRegionMatches ( text , end - clen , current , 0 , clen ) ; } return i == segCount ; } private void parseNoWildCards ( ) { fSegments = new String [ 1 ] ; fSegments [ 0 ] = fPattern ; fBound = fLength ; } private void parseWildCards ( ) { if ( fPattern . startsWith ( "*" ) ) fHasLeadingStar = true ; if ( fPattern . endsWith ( "*" ) ) { if ( fLength > 1 && fPattern . charAt ( fLength - 2 ) != '\\' ) { fHasTrailingStar = true ; } } Vector temp = new Vector ( ) ; int pos = 0 ; StringBuffer buf = new StringBuffer ( ) ; while ( pos < fLength ) { char c = fPattern . charAt ( pos ++ ) ; switch ( c ) { case '\\' : if ( pos >= fLength ) { buf . append ( c ) ; } else { char next = fPattern . charAt ( pos ++ ) ; if ( next == '*' || next == '?' || next == '\\' ) { buf . append ( next ) ; } else { buf . append ( c ) ; buf . append ( next ) ; } } break ; case '*' : if ( buf . length ( ) > 0 ) { temp . addElement ( buf . toString ( ) ) ; fBound | |
2,663 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . io . BufferedReader ; import java . io . FileReader ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . operation . IRunnableContext ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . source . IAnnotationModel ; import org . eclipse . ui . internal . editors . text . WorkspaceOperationRunner ; import org . eclipse . ui . texteditor . AbstractDocumentProvider ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal | |
2,664 | <s> package com . asakusafw . runtime . io ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . io . StringReader ; import java . io . StringWriter ; import java . math . BigDecimal ; import org . junit . Before ; import org . junit . Test ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . DoubleOption ; import com . asakusafw . runtime . value . FloatOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . ShortOption ; import com . asakusafw . runtime . value . StringOption ; @ SuppressWarnings ( "deprecation" ) public class TsvEmitterTest { private static final String LONG_STRING = "" ; private final StringWriter buffer = new StringWriter ( ) ; private TsvEmitter emitter ; @ Before public void setUp ( ) throws Exception { emitter = new TsvEmitter ( buffer ) ; } private RecordParser parser ( ) throws IOException { emitter . close ( ) ; return new TsvParser ( new StringReader ( buffer . toString ( ) ) ) ; } @ Test public void emitBoolean ( ) throws Exception { BooleanOption value = new BooleanOption ( ) ; value . modify ( true ) ; emitter . emit ( value ) ; value . modify ( false ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; value . modify ( false ) ; emitter . emit ( value ) ; value . modify ( true ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; value . setNull ( ) ; emitter . emit ( value ) ; value . modify ( true ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; emitter . close ( ) ; RecordParser parser = parser ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( false ) ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( false ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( true ) ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( false ) ) ; } @ Test public void emitByte ( ) throws Exception { ByteOption value = new ByteOption ( ) ; value . modify ( ( byte ) 0 ) ; emitter . emit ( value ) ; value . modify ( ( byte ) 10 ) ; emitter . emit ( value ) ; value . modify ( ( byte ) - 10 ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; value . setNull ( ) ; emitter . emit ( value ) ; value . modify ( Byte . MAX_VALUE ) ; emitter . emit ( value ) ; value . modify ( Byte . MIN_VALUE ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; emitter . close ( ) ; RecordParser parser = parser ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) 0 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) 10 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) - 10 ) ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( Byte . MAX_VALUE ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( Byte . MIN_VALUE ) ) ; assertThat ( parser . next ( ) , is ( false ) ) ; } @ Test public void emitShort ( ) throws Exception { ShortOption value = new ShortOption ( ) ; value . modify ( ( short ) 0 ) ; emitter . emit ( value ) ; value . modify ( ( short ) 10 ) ; emitter . emit ( value ) ; value . modify ( ( short ) - 10 ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; value . setNull ( ) ; emitter . emit ( value ) ; value . modify ( Short . MAX_VALUE ) ; emitter . emit ( value ) ; value . modify ( Short . MIN_VALUE ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; emitter . close ( ) ; RecordParser parser = parser ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( short ) 0 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( short ) 10 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( short ) - 10 ) ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( Short . MAX_VALUE ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( Short . MIN_VALUE ) ) ; assertThat ( parser . next ( ) , is ( false ) ) ; } @ Test public void emitInt ( ) throws Exception { IntOption value = new IntOption ( ) ; value . modify ( 0 ) ; emitter . emit ( value ) ; value . modify ( 10 ) ; emitter . emit ( value ) ; value . modify ( - 10 ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; value . setNull ( ) ; emitter . emit ( value ) ; value . modify ( Integer . MAX_VALUE ) ; emitter . emit ( value ) ; value . modify ( Integer . MIN_VALUE ) ; emitter . emit ( value ) ; emitter . endRecord ( ) ; emitter . close ( ) ; RecordParser parser = parser ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( 0 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( 10 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( - 10 ) ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( true ) ) ; parser . fill ( value ) ; | |
2,665 | <s> package com . asakusafw . runtime . stage ; import static com . asakusafw . runtime . stage . StageConstants . * ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . io . NullWritable ; import org . apache . hadoop . io . RawComparator ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . mapreduce . InputFormat ; import org . apache . hadoop . mapreduce . Job ; import org . apache . hadoop . mapreduce . Mapper ; import org . apache . hadoop . mapreduce . OutputFormat ; import org . apache . hadoop . mapreduce . Partitioner ; import org . apache . hadoop . mapreduce . Reducer ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . runtime . stage . input . StageInputDriver ; import com . asakusafw . runtime . stage . input . StageInputFormat ; import com . asakusafw . runtime . stage . input . StageInputMapper ; import com . asakusafw . runtime . stage . output . LegacyBridgeOutputCommitter ; import com . asakusafw . runtime . stage . output . StageOutputDriver ; import com . asakusafw . runtime . stage . output . StageOutputFormat ; import com . asakusafw . runtime . stage . resource . StageResourceDriver ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . runtime . util . VariableTable . RedefineStrategy ; public abstract class AbstractStageClient extends BaseStageClient { public static final String METHOD_STAGE_OUTPUT_PATH = "" ; public static final String METHOD_STAGE_INPUTS = "" ; public static final String METHOD_STAGE_OUTPUTS = "" ; public static final String METHOD_STAGE_RESOURCES = "" ; public static final String METHOD_SHUFFLE_KEY_CLASS = "" ; public static final String METHOD_SHUFFLE_VALUE_CLASS = "" ; public static final String METHOD_PARTITIONER_CLASS = "" ; public static final String METHOD_COMBINER_CLASS = "" ; public static final String METHOD_SORT_COMPARATOR_CLASS = "" ; public static final String METHOD_GROUPING_COMPARATOR_CLASS = "" ; public static final String METHOD_REDUCER_CLASS = "" ; static final Log LOG = LogFactory . getLog ( AbstractStageClient . class ) ; protected void configureStage ( Job job , VariableTable variables ) { return ; } protected abstract List < StageInput > getStageInputs ( ) ; protected abstract String getStageOutputPath ( ) ; protected List < StageOutput > getStageOutputs ( ) { return Collections . emptyList ( ) ; } protected List < StageResource > getStageResources ( ) { return Collections . emptyList ( ) ; } protected Class < ? extends Writable > getShuffleKeyClassOrNull ( ) { return null ; } protected Class < ? extends Writable > getShuffleValueClassOrNull ( ) { return null ; } @ SuppressWarnings ( "rawtypes" ) protected Class < ? extends Partitioner > getPartitionerClassOrNull ( ) { return null ; } @ SuppressWarnings ( "rawtypes" ) protected Class < ? extends Reducer > getCombinerClassOrNull ( ) { return null ; } @ SuppressWarnings ( "rawtypes" ) protected Class < ? extends RawComparator > getSortComparatorClassOrNull ( ) { return null ; } @ SuppressWarnings ( "rawtypes" ) protected Class < ? extends RawComparator > getGroupingComparatorClassOrNull ( ) { return null ; } @ SuppressWarnings ( "rawtypes" ) protected Class < ? extends Reducer > getReducerClassOrNull ( ) { return null ; } @ Override protected int execute ( String [ ] args ) throws Exception { Configuration conf = getConf ( ) ; conf . set ( StageConstants . PROP_BATCH_ID , getBatchId ( ) ) ; conf . set ( StageConstants . PROP_FLOW_ID , getFlowId ( ) ) ; Job job = createJob ( conf ) ; return submit ( job ) ; } public Job createJob ( Configuration conf ) throws IOException { if ( conf == null ) { throw new IllegalArgumentException ( "" ) ; } Job job = new Job ( conf ) ; VariableTable variables = getPathParser ( job . getConfiguration ( ) ) ; configureJobInfo ( job , variables ) ; configureStageInput ( job , variables ) ; configureStageOutput ( job , variables ) ; configureShuffle ( job , variables ) ; configureStageResource ( job , variables ) ; configureStage ( job , variables | |
2,666 | <s> package net . bioclipse . opentox . test ; import java . net . URI ; import java . util . List ; import net . bioclipse . cdk . business . CDKManager ; import net . bioclipse . cdk . domain . CDKMolecule ; import net . bioclipse . cdk . domain . ICDKMolecule ; import net . bioclipse . core . business . BioclipseException ; import net . bioclipse . core . domain . IStringMatrix ; import net . bioclipse . core . tests . AbstractManagerTest ; import net . bioclipse . inchi . InChI ; import net . bioclipse . managers . business . IBioclipseManager ; import net . bioclipse . opentox . business . IOpentoxManager ; import org . junit . Assert ; import org . junit . Test ; public abstract class AbstractOpentoxManagerPluginTest extends AbstractManagerTest { private CDKManager cdk = new CDKManager ( ) ; private final static String TEST_ACCOUNT = "guest" ; private final static String TEST_ACCOUNT_PWD = "guest" ; private final static String TEST_SERVER_OT = "" ; private final static String TEST_SERVER_ONT = "" ; protected static IOpentoxManager opentox ; @ Test public void testAuthentication ( ) throws Exception { opentox . logout ( ) ; Assert . assertNull ( opentox . getToken ( ) ) ; opentox . login ( TEST_ACCOUNT , TEST_ACCOUNT_PWD ) ; String token = opentox . getToken ( ) ; Assert . assertNotNull ( token ) ; Assert . assertNotSame ( 0 , token . length ( ) ) ; opentox . logout ( ) ; Assert . assertNull ( opentox . getToken ( ) ) ; } @ Test public void testSearchDescriptors ( ) throws Exception { IStringMatrix descriptors = opentox . searchDescriptors ( TEST_SERVER_ONT , "LogP" ) ; Assert . assertNotNull ( descriptors ) ; Assert . assertNotSame ( 0 , descriptors . getRowCount ( ) ) ; } @ Test public void testSearchModels ( ) throws Exception { IStringMatrix models = opentox . searchModels ( TEST_SERVER_ONT , "ToxTree" ) ; Assert . assertNotNull ( models ) ; Assert . assertNotSame ( 0 , models . getRowCount ( ) ) ; } @ Test public void testSearchDataSets ( ) throws Exception { IStringMatrix models = opentox . searchDataSets ( TEST_SERVER_ONT , "EPA" ) ; Assert . assertNotNull ( models ) ; Assert . assertNotSame ( 0 , models . getRowCount ( ) ) ; } @ Test public void testListDatasets ( ) throws Exception { List < String > sets = opentox . listDataSets ( TEST_SERVER_OT ) ; Assert . assertNotNull ( sets ) ; Assert . assertNotSame ( 0 , sets . size ( ) ) ; } @ Test public void testListAlgorithms ( ) throws Exception { List < String > algos = opentox . listAlgorithms ( TEST_SERVER_ONT ) ; Assert . assertNotNull ( algos ) ; Assert . assertNotSame ( 0 , algos . size ( ) ) ; } @ Test public void testGetAlgorithmsInfo ( ) throws Exception { List < String > algos = opentox . listAlgorithms ( TEST_SERVER_ONT ) ; Assert . assertNotNull ( algos ) ; Assert . assertNotSame ( 0 , algos . size ( ) ) ; String algo = algos . get ( 0 ) ; opentox . getAlgorithmInfo ( TEST_SERVER_ONT , algo ) ; } @ Test public void testGetAlgorithmsInfos ( ) throws Exception { List < String > algos = opentox . listAlgorithms ( TEST_SERVER_ONT ) ; Assert . assertNotNull ( algos ) ; Assert . assertNotSame ( 0 , algos . size ( ) ) ; opentox . getAlgorithmInfo ( TEST_SERVER_ONT , algos ) ; } @ Test public void testSearchInChI ( ) throws Exception { List < String > hits = opentox . search ( TEST_SERVER_OT , "" ) ; Assert . assertNotNull ( hits ) ; Assert . assertNotSame ( 0 , hits . size ( ) ) ; } @ Test public void testSearchMolecule ( ) throws BioclipseException { ICDKMolecule mol = cdk . fromSMILES ( "C" ) ; mol . setProperty ( CDKMolecule . INCHI_OBJECT , new InChI ( "" , "" ) ) ; List < String > hits = opentox . search ( TEST_SERVER_OT , mol ) ; Assert . assertNotNull ( hits ) ; Assert . assertNotSame ( 0 , hits . size ( ) ) ; } @ Test public void testListDescriptors ( ) throws Exception { IStringMatrix descriptors = opentox . listDescriptors ( TEST_SERVER_ONT ) ; Assert . assertNotNull ( descriptors ) ; Assert . assertNotSame ( 0 , descriptors . getRowCount ( ) ) ; } @ Test public void | |
2,667 | <s> package org . rubypeople . rdt . internal . corext . refactoring . nls . changes ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . ltk . core . refactoring . Change ; import org . eclipse . ltk . core . refactoring . RefactoringStatus ; import org . rubypeople . rdt . core . IRubyModelStatusConstants ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . refactoring . base . RDTChange ; import org . rubypeople . rdt . internal . corext . util . IOCloser ; import org . rubypeople . rdt . refactoring . core . Messages ; public class DeleteFileChange extends RDTChange { private IPath fPath ; private String fSource ; public DeleteFileChange ( IFile file ) { Assert . isNotNull ( file , "file" ) ; fPath = file . getFullPath ( ) . removeFirstSegments ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFullPath ( ) . segmentCount ( ) ) ; } public RefactoringStatus isValid ( IProgressMonitor pm ) throws CoreException { return isValid ( pm , READ_ONLY | DIRTY ) ; } public Change perform ( IProgressMonitor pm ) throws CoreException { try { pm . beginTask ( Messages . deleteFile_deleting_resource , 1 ) ; IFile file = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( fPath ) ; Assert . isNotNull ( file ) ; Assert . isTrue ( file . exists ( ) ) ; Assert . isTrue ( ! file . isReadOnly ( ) ) ; fSource = getSource ( file ) ; CreateFileChange undo = createUndoChange ( file , fPath , file . getModificationStamp ( ) , fSource ) ; file . delete ( true , true , pm ) ; return undo ; } finally { pm . done ( ) ; } } private String getSource ( IFile file ) throws CoreException { String encoding = null ; try { encoding = file . | |
2,668 | <s> package org . rubypeople . rdt . refactoring . util ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . Document ; import org . eclipse . text . edits . MalformedTreeException ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . internal . formatter . OldCodeFormatter ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class HsrFormatter { public static String format ( String document , String replaceText , int replaceStartOffset , int replaceEndOffset ) { StringBuilder docStringBuilder = new StringBuilder ( document ) ; docStringBuilder . delete ( replaceStartOffset , replaceEndOffset ) ; return format ( docStringBuilder . toString ( ) , replaceText , replaceStartOffset ) ; } public static String format ( String document , String insertText , int insertOffset ) { if ( insertText . length ( ) == 0 ) return insertText ; String lineDelimiter = "n" ; if ( document . length ( ) == 0 ) return formatString ( insertText , lineDelimiter ) ; StringBuilder docStringBuilder = new StringBuilder ( document ) ; insertText = lineDelimiter + insertText + lineDelimiter ; if ( insertOffset == document . length ( ) ) { docStringBuilder . append ( insertText ) ; } else { docStringBuilder . insert ( insertOffset , insertText ) ; } int end = insertOffset + insertText . length ( ) - 1 ; insertOffset += lineDelimiter . length ( ) ; int linesToSort = getLineCount ( docStringBuilder . toString ( ) , insertOffset , end , lineDelimiter ) ; int lnNr = getLnNr ( docStringBuilder . toString ( ) , insertOffset - 1 , lineDelimiter ) ; document = docStringBuilder . toString ( ) ; String formattedDocument = formatString ( document , lineDelimiter ) ; String text = getSubstring ( formattedDocument , lnNr , linesToSort , lineDelimiter ) ; return text ; } private static String formatString ( String code , String lineDelimiter ) { Document doc = new Document ( code ) ; try { getFormatter ( ) . format ( 0 , code , 0 , code . length ( ) , 0 , lineDelimiter ) . apply ( doc ) ; return doc . get ( ) ; } catch ( MalformedTreeException e ) { e . printStackTrace ( ) ; } catch ( BadLocationException e ) { e . printStackTrace ( ) ; } return "" ; } private static OldCodeFormatter getFormatter ( ) { if ( RubyPlugin . getDefault ( ) != null ) { return RubyPlugin . getDefault ( ) . getCodeFormatter ( ) ; } Map < String , String > options = new HashMap < String , String > ( ) ; options . put | |
2,669 | <s> package com . asakusafw . yaess . basic ; import java . io . File ; import java . io . IOException ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . ExecutionLock ; import com . asakusafw . yaess . core . ExecutionLock . Scope ; import com . asakusafw . yaess . core . | |
2,670 | <s> package org . rubypeople . rdt . refactoring . core . inlineclass ; import org . eclipse . osgi . util . NLS ; public class Messages extends NLS { | |
2,671 | <s> package com . asakusafw . dmdl . directio . sequencefile . driver ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . semantics . Trait ; public class SequenceFileFormatTrait implements Trait < SequenceFileFormatTrait > { private final AstNode originalAst ; private final Configuration configuration ; public SequenceFileFormatTrait ( AstNode originalAst , Configuration configuration ) { if ( configuration == null ) { throw new IllegalArgumentException ( "" ) ; } this . originalAst = originalAst ; this . configuration = configuration ; } | |
2,672 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import org . eclipse . core . resources . IMarker ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . Position ; import org . eclipse . ui . texteditor . IMarkerUpdater ; import org . eclipse . ui . texteditor . MarkerUtilities ; public class RubyBreakpointMarkerUpdater implements IMarkerUpdater { private final static String [ ] ATTRIBUTES = { IMarker . LINE_NUMBER } ; public String getMarkerType ( ) { return "" ; } public String [ ] getAttribute ( ) { return ATTRIBUTES ; } public boolean updateMarker ( IMarker marker , IDocument document , Position position | |
2,673 | <s> package net . sf . sveditor . core . templates ; import java . util . HashMap ; import java . util . Map ; public class TemplateParameterProvider implements ITemplateParameterProvider { private Map < String , String > fTagMap ; public TemplateParameterProvider ( ) { fTagMap = new HashMap < String , String > ( ) ; } public TemplateParameterProvider ( Map < String , String > init ) { this ( ) ; fTagMap . putAll ( init ) ; } public TemplateParameterProvider ( TemplateParameterProvider init ) { this ( ) ; fTagMap . putAll ( init . fTagMap ) ; } public boolean providesParameter ( String id ) { return fTagMap . containsKey ( id ) ; } | |
2,674 | <s> package $ { package } . jobflow ; import $ { package } . modelgen . dmdl . csv . AbstractItemInfoCsvImporterDescription ; public class ItemInfoFromCsv extends AbstractItemInfoCsvImporterDescription { @ Override public String getProfileName ( ) { return "asakusa" ; } @ Override public String getPath | |
2,675 | <s> package org . rubypeople . rdt . internal . ui . util ; import junit . framework . TestCase ; import org . rubypeople . rdt . internal . ui . util . StringMatcher . Position ; public class StringMatcherTest extends TestCase { public void testStartAfterEnd ( ) { String pattern = "Ch*r" ; StringMatcher matcher = new StringMatcher ( pattern , true , false ) ; assertNull ( matcher . find ( "Cheerios" , 3 , 1 ) ) ; assertFalse ( matcher . match ( "Cheerios" , 3 , 1 ) ) ; } public void testNullPattern ( ) { try { new StringMatcher ( null , true , false ) ; fail ( "" ) ; } catch ( IllegalArgumentException e ) { assertTrue ( true ) ; } } public void testFindWithNullText ( ) { StringMatcher matcher = new StringMatcher ( "*" , true , false ) ; try { matcher . find ( null , 0 , 0 ) ; fail ( "" ) ; } catch ( IllegalArgumentException e ) { assertTrue ( true ) ; } } public void testMatchWithNullText ( ) { StringMatcher matcher = new StringMatcher ( "*" , true , false ) ; try { matcher . match ( null ) ; fail ( "" ) ; } catch ( IllegalArgumentException e ) { assertTrue ( true ) ; } } public void testMatchWithStartAndEndWithNullText ( ) { StringMatcher matcher = new StringMatcher ( "*" , true , false ) ; try { matcher . match ( null , 0 , 0 ) ; fail ( "" ) ; } catch ( IllegalArgumentException e ) { assertTrue ( true ) ; } } public void testFindWithEmptyTextString ( ) { String pattern = "Ch*r" ; StringMatcher matcher = new StringMatcher ( pattern , true , false ) ; assertNull ( matcher . find ( "" , 0 , "" . length ( ) ) ) ; pattern = "*" ; matcher = new StringMatcher ( pattern , true , false ) ; assertNull ( matcher . find ( "" , 0 , "" . length ( ) ) ) ; pattern = "?" ; matcher = new StringMatcher ( pattern , true , false ) ; assertNull ( matcher . find ( "" , 0 , "" . length ( ) ) ) ; } public void testFindWithEmptyPattern ( ) { String pattern = "" ; StringMatcher matcher = new StringMatcher ( pattern , false , false ) ; String text = "cheerios" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNotNull ( pos ) ; assertEquals ( 0 , pos . getStart ( ) ) ; assertEquals ( 0 , pos . getEnd ( ) ) ; } public void testFindIgnoringCase ( ) { String pattern = "Ch*r" ; StringMatcher matcher = new StringMatcher ( pattern , true , false ) ; String text = "cheerios" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNotNull ( pos ) ; assertEquals ( 0 , pos . getStart ( ) ) ; assertEquals ( 5 , pos . getEnd ( ) ) ; } public void testMatchIgnoringCase ( ) { String pattern = "Ch*ios" ; StringMatcher matcher = new StringMatcher ( pattern , true , false ) ; assertTrue ( matcher . match ( "cheerios" ) ) ; assertTrue ( matcher . match ( "Cheerios" ) ) ; assertFalse ( matcher . match ( "cheeris" ) ) ; } public void testMatchNotIgnoringCase ( ) { String pattern = "Ch*ios" ; StringMatcher matcher = new StringMatcher ( pattern , false , false ) ; assertFalse ( matcher . match ( "cheerios" ) ) ; assertTrue ( matcher . match ( "Cheerios" ) ) ; assertFalse ( matcher . match ( "cheeris" ) ) ; } public void testFindNotIgnoringCase ( ) { String pattern = "Ch*r" ; StringMatcher matcher = new StringMatcher ( pattern , false , false ) ; String text = "Cheerios" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNotNull ( pos ) ; assertEquals ( 0 , pos . getStart ( ) ) ; assertEquals ( 5 , pos . getEnd ( ) ) ; text = "cheerios" ; pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNull ( pos ) ; } public void testFindStarInPatternIgnoringWildcards ( ) { String pattern = "Ch*r" ; StringMatcher matcher = new StringMatcher ( pattern , false , true ) ; String text = "Cheerios" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNull ( pos ) ; text = "Ch*ris" ; pos = matcher . find ( text , 0 , text . length ( ) ) ; assertEquals ( 0 , pos . getStart ( ) ) ; assertEquals ( 4 , pos . getEnd ( ) ) ; } public void testFindQuestionMarkInPatternIgnoringWildcards ( ) { String pattern = "Ch?r" ; StringMatcher matcher = new StringMatcher ( pattern , false , true ) ; String text = "Cher" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; assertNull ( pos ) ; text = "Ch?r" ; pos = matcher . find ( text , 0 , text . length ( ) ) ; assertEquals ( 0 , pos . getStart ( ) ) ; assertEquals ( 4 , pos . getEnd ( ) ) ; } public void testFindWithSingleCharWildcard ( ) { String pattern = "Chr?s" ; StringMatcher matcher = new StringMatcher ( pattern , false , false ) ; String text = "Chris" ; Position pos = matcher . find ( text , 0 , text . length ( ) ) ; | |
2,676 | <s> package com . asakusafw . utils . java . parser . javadoc ; import static com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocTokenKind . * ; import static org . junit . Assert . * ; import java . util . EnumSet ; import java . util . List ; import org . junit . Test ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocToken ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocTokenKind ; public class JavadocScannerUtilTest extends JavadocTestRoot { @ Test public void testLookaheadTokens ( ) { DefaultJavadocScanner scanner = scanner ( "" ) ; { List < JavadocToken > tokens = JavadocScannerUtil . lookaheadTokens ( scanner , 0 , 0 ) ; assertTextSequence ( tokens ) ; } { List < JavadocToken > tokens = JavadocScannerUtil . lookaheadTokens ( scanner , 0 , 1 ) ; assertTextSequence ( tokens , "a" ) ; } { List < JavadocToken > tokens = JavadocScannerUtil . lookaheadTokens ( scanner , 0 , 3 ) ; assertTextSequence ( tokens , "a" , " " , "b" ) ; } { List < JavadocToken > tokens = JavadocScannerUtil . lookaheadTokens ( scanner , 4 , 3 ) ; assertTextSequence ( tokens , "c" , " " , "d" ) ; } { List < JavadocToken > tokens = JavadocScannerUtil . lookaheadTokens ( scanner , 46 , 100 ) ; assertTextSequence ( tokens , "x" , " " , "y" , " " , "z" ) ; } } @ Test public void testCountWhileVoid ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . noneOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . noneOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 3 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . noneOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 5 ) ; assertEquals ( 0 , count ) ; } } @ Test public void testCountWhileSingle ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 3 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 1 ) ; assertEquals ( 2 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 2 ) ; assertEquals ( 1 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 3 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( IDENTIFIER ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( IDENTIFIER ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 3 ) ; assertEquals ( 1 , count ) ; } } @ Test public void testCountWhileMulti ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK , IDENTIFIER ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 4 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK , IDENTIFIER , QUESTION ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 8 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( QUESTION , WHITE_SPACES ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( QUESTION , WHITE_SPACES ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 4 ) ; assertEquals ( 5 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . allOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countWhile ( set , scanner , 0 ) ; assertEquals ( scanner . getTokens ( ) . size ( ) , count ) ; } } @ Test public void testCountUntilVoid ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . noneOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( scanner . getTokens ( ) . size ( ) , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . noneOf ( JavadocTokenKind . class ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 5 ) ; assertEquals ( scanner . getTokens ( ) . size ( ) - 5 , count ) ; } } @ Test public void testCountUntilSingle ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . of ( ASTERISK ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( 0 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( IDENTIFIER ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( 3 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( QUESTION ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( 4 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( WHITE_SPACES ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( 8 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( AT ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 5 ) ; assertEquals ( 5 , count ) ; } } @ Test public void testCountUntilMulti ( ) { DefaultJavadocScanner scanner = scanner ( "kinds.txt" ) ; { EnumSet < JavadocTokenKind > set = EnumSet . of ( IDENTIFIER , AT ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 0 ) ; assertEquals ( 3 , count ) ; } { EnumSet < JavadocTokenKind > set = EnumSet . of ( IDENTIFIER , AT ) ; int count = JavadocScannerUtil . countUntil ( set , scanner , 5 ) ; assertEquals ( 5 , count ) ; } } @ Test public void testCountUntilBlockEnd ( ) { { DefaultJavadocScanner scanner = string ( "" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 0 ) ; assertEquals ( EOF , scanner . lookahead ( count ) . getKind ( ) ) ; } { DefaultJavadocScanner scanner = string ( "" + "@stop" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 0 ) ; assertEquals ( AT , scanner . lookahead ( count ) . getKind ( ) ) ; assertEquals ( "stop" , scanner . lookahead ( count + 1 ) . getText ( ) ) ; } { DefaultJavadocScanner scanner = string ( "n" + "" + " * @stop" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 0 ) ; assertEquals ( AT , scanner . lookahead ( count ) . getKind ( ) ) ; assertEquals ( "stop" , scanner . lookahead ( count + 1 ) . getText ( ) ) ; } { DefaultJavadocScanner scanner = string ( "n" + "" + "" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 0 ) ; assertEquals ( AT , scanner . lookahead ( count ) . getKind ( ) ) ; assertEquals ( "stop" , scanner . lookahead ( count + 1 ) . getText ( ) ) ; } { DefaultJavadocScanner scanner = string ( "n" + "" + " * @dummyn" + " * }n" + " * @stop" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 0 ) ; assertEquals ( AT , scanner . lookahead ( count ) . getKind ( ) ) ; assertEquals ( "stop" , scanner . lookahead ( count + 1 ) . getText ( ) ) ; } { DefaultJavadocScanner scanner = string ( "n" + " * @startn" + "" + " * @dummyn" + " * }n" + " * @stop" ) ; int count = JavadocScannerUtil . countUntilBlockEnd ( scanner , 6 ) ; assertEquals ( AT , scanner . lookahead ( 6 + count ) . getKind ( ) ) ; assertEquals ( "stop" , scanner . lookahead ( 6 + count + 1 ) . getText ( ) ) ; } } @ Test public void testCountUntilCommentEnd ( ) { { DefaultJavadocScanner scanner = string ( "*/" ) ; int count = JavadocScannerUtil . countUntilCommentEnd ( scanner , true , 0 ) ; assertEquals ( 0 , count ) ; } { DefaultJavadocScanner scanner = string ( "*/ /* */" ) ; int count = JavadocScannerUtil . countUntilCommentEnd ( scanner , true , 0 ) ; assertEquals ( 0 , count ) ; } { DefaultJavadocScanner scanner = string ( "*****/ /* */" ) ; int count = JavadocScannerUtil . countUntilCommentEnd ( scanner , true , 0 ) ; assertEquals ( 4 , count ) ; } { DefaultJavadocScanner scanner = string ( "*****/ /* */" ) ; int count = JavadocScannerUtil . countUntilCommentEnd ( scanner , false , 0 ) ; assertEquals ( 4 , count ) ; } { DefaultJavadocScanner scanner = string ( "" ) ; int count = JavadocScannerUtil . countUntilCommentEnd ( scanner , true , 0 ) ; assertEquals ( 11 , count | |
2,677 | <s> package net . sf . sveditor . core . db . expr ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBInsideExpr extends SVDBExpr { public SVDBExpr fLhs ; public List < SVDBExpr > fValueRangeList ; public SVDBInsideExpr ( ) { this ( null ) ; } public SVDBInsideExpr ( SVDBExpr lhs ) { super ( SVDBItemType . InsideExpr ) ; fLhs = lhs ; fValueRangeList = new ArrayList < SVDBExpr > ( ) ; } | |
2,678 | <s> package com . asakusafw . windgate . core . resource ; import java . io . IOException ; import java . util . Collections ; import com . asakusafw . windgate . core . ParameterList ; import com . asakusafw . windgate . core . ProfileContext ; public class MockResourceProvider extends ResourceProvider { ResourceProfile configuredProfile ; public MockResourceProvider ( ) { return ; } public MockResourceProvider ( String name ) { configure ( createProfile ( name ) ) ; } public static ResourceProfile createProfile ( String name ) { assert name != null ; return new ResourceProfile ( name , MockResourceProvider . class , ProfileContext . system ( MockResourceProvider . class . getClassLoader ( ) ) , | |
2,679 | <s> package org . rubypeople . rdt . internal . compiler . util ; public final class HashtableOfObjectToInt implements Cloneable { public Object [ ] keyTable ; public int [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfObjectToInt ( ) { this ( 13 ) ; } public HashtableOfObjectToInt ( int size ) { this . elementSize = 0 ; this . threshold = size ; int extraRoom = ( int ) ( size * 1.75f ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new Object [ extraRoom ] ; this . valueTable = new int [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfObjectToInt result = ( HashtableOfObjectToInt ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new Object [ length ] ; System . arraycopy ( this . keyTable , 0 , result . keyTable , 0 , length ) ; length = this . valueTable . length ; result . valueTable = new int [ length ] ; System . arraycopy ( this . valueTable , 0 , result . valueTable , 0 , length ) ; return result ; } public boolean containsKey ( Object key ) { int length | |
2,680 | <s> package com . sun . tools . hat . internal . model ; public class JavaInt extends JavaValue { public final int value ; public JavaInt ( int value ) { this . value = value ; } | |
2,681 | <s> package com . pogofish . jadt . checker ; import static com . pogofish . jadt . ast . ASTConstants . NO_COMMENTS ; import static com . pogofish . jadt . ast . ASTConstants . NO_IMPORTS ; import static com . pogofish . jadt . errors . SemanticError . _ConstructorDataTypeConflict ; import static com . pogofish . jadt . errors . SemanticError . _DuplicateArgName ; import static com . pogofish . jadt . errors . SemanticError . _DuplicateConstructor ; import static com . pogofish . jadt . errors . SemanticError . _DuplicateDataType ; import static com . pogofish . jadt . errors . SemanticError . _DuplicateModifier ; import static com . pogofish . jadt . util . Util . list ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertTrue ; import java . util . List ; import org . junit . Test ; import com . pogofish . jadt . ast . Annotation ; import com . pogofish . jadt . ast . Arg ; import com . pogofish . jadt . ast . ArgModifier ; import com . pogofish . jadt . ast . Constructor ; import com . pogofish . jadt . ast . DataType ; import com . pogofish . jadt . ast . Doc ; import com . pogofish . jadt . ast . Optional ; import com . pogofish . jadt . ast . Pkg ; import com . pogofish . jadt . ast . PrimitiveType ; import com . pogofish . jadt . ast . RefType ; import com . pogofish . jadt . ast . Type ; import com . pogofish . jadt . errors . SemanticError ; import com . pogofish . jadt . util . Util ; public class CheckerTest { private static final Optional < RefType > NO_EXTENDS = Optional . < RefType > _None ( ) ; private static final | |
2,682 | <s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import org . eclipse . osgi . util . NLS ; public final class CallHierarchyMessages extends NLS { private static final String BUNDLE_NAME = "" ; private CallHierarchyMessages ( ) { } public static String HistoryDropDownAction_clearhistory_label ; public static String ToggleCallModeAction_callers_label ; public static String ToggleCallModeAction_callers_tooltip ; public static String ToggleCallModeAction_callers_description ; public static String ToggleCallModeAction_callees_label ; public static String ToggleCallModeAction_callees_tooltip ; public static String ToggleCallModeAction_callees_description ; public static String HistoryDropDownAction_tooltip ; public static String HistoryAction_description ; public static String HistoryAction_tooltip ; public static String HistoryListDialog_title ; public static String HistoryListDialog_label ; public static String HistoryListDialog_remove_button ; public static String HistoryListAction_label ; public static String ToggleOrientationAction_vertical_label ; public static String ToggleOrientationAction_vertical_description ; public static String ToggleOrientationAction_vertical_tooltip ; public static String ToggleOrientationAction_horizontal_label ; public static String ToggleOrientationAction_horizontal_tooltip ; public static String ToggleOrientationAction_horizontal_description ; public static String ToggleOrientationAction_automatic_label ; public static String ToggleOrientationAction_automatic_tooltip ; public static String ToggleOrientationAction_automatic_description ; public static String ToggleOrientationAction_single_label ; public static String ToggleOrientationAction_single_tooltip ; public static String ToggleOrientationAction_single_description ; public static String ShowFilterDialogAction_text ; public static String FiltersDialog_filter ; public static String FiltersDialog_filterOnNames ; public static String FiltersDialog_filterOnNamesSubCaption ; public static String FiltersDialog_maxCallDepth ; public static String FiltersDialog_messageMaxCallDepthInvalid ; public static String CallHierarchyContentProvider_searchError_title ; public static String CallHierarchyContentProvider_searchError_message ; public static String CallHierarchyLabelProvider_root ; public static String CallHierarchyLabelProvider_searchCanceled ; public static String CallHierarchyLabelProvider_noMethodSelected ; public static String CallHierarchyLabelProvider_updatePending ; public static String CallHierarchyLabelProvider_matches ; public static String CallHierarchyViewPart_empty ; public static String CallHierarchyViewPart_callsToMethod ; public static String CallHierarchyViewPart_callsFromMethod ; public static String FocusOnSelectionAction_focusOnSelection_text ; public static String FocusOnSelectionAction_focusOnSelection_description ; public static String FocusOnSelectionAction_focusOnSelection_tooltip ; public static String FocusOnSelectionAction_focusOn_text ; public static String RefreshAction_text ; public static String RefreshAction_tooltip ; public static String SearchScopeActionGroup_searchScope ; public static String SearchScopeActionGroup_hierarchy_text ; public static String SearchScopeActionGroup_hierarchy_tooltip ; public static String SearchScopeActionGroup_project_text ; public static String SearchScopeActionGroup_project_tooltip ; public static String SearchScopeActionGroup_workingset_tooltip ; public | |
2,683 | <s> package $ { package } . jobflow ; import $ { package } . modelgen . table . model . SalesDetail ; import com . asakusafw . vocabulary . bulkloader . DbImporterDescription ; public class SalesDetailFromJdbc extends DbImporterDescription { @ Override public String getTargetName | |
2,684 | <s> package com . mcbans . firestar . mcbans . pluginInterface ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . log . LogLevels ; import com . mcbans . firestar . mcbans . org . json . JSONException ; import com . mcbans . firestar . mcbans . org . json . JSONObject ; import com . mcbans . firestar . mcbans . request . JsonHandler ; import org . bukkit . ChatColor ; import java . util . HashMap ; public class Lookup implements Runnable { private BukkitInterface MCBans ; private String PlayerName ; private String PlayerAdmin ; public Lookup ( BukkitInterface p , String playerName , String playerAdmin ) { MCBans = p ; PlayerName = playerName ; PlayerAdmin = playerAdmin ; } @ Override public void run ( ) { while ( MCBans . notSelectedServer ) { try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } MCBans . log ( PlayerAdmin + "" + PlayerName + "!" ) ; HashMap < String , String > url_items = new HashMap < String , String > ( ) ; JsonHandler webHandle = new JsonHandler ( MCBans ) ; url_items . put ( "player" , PlayerName ) ; url_items . put ( "admin" , PlayerAdmin ) ; url_items . put ( "exec" , "playerLookup" ) ; JSONObject result = webHandle . hdl_jobj ( url_items ) ; try { MCBans . broadcastPlayer ( PlayerAdmin , "Player " + ChatColor . DARK_AQUA + PlayerName + ChatColor . WHITE + " has " + ChatColor . DARK_RED + result . getString ( "total" ) + " ban(s)" + ChatColor . WHITE + " and " + ChatColor . BLUE + result . getString ( "reputation" ) + " REP" | |
2,685 | <s> package com . asakusafw . windgate . core . resource ; import java . io . IOException ; import java . util . Iterator ; public class MockSourceDriver < T > implements SourceDriver < T > { final String name ; private Iterable < ? extends T > source ; private Iterator < ? extends T > iterator ; private boolean canGet ; private T nextResult ; public MockSourceDriver ( String name ) { this . name | |
2,686 | <s> package com . asakusafw . testtools . inspect ; import static org . junit . Assert . * ; import org . junit . Test ; import test . modelgen . model . AllTypesWNoerr ; import com . asakusafw . modelgen . source . MySqlDataType ; import com . asakusafw . testtools . ColumnInfo ; import com . asakusafw . testtools . NullValueCondition ; import com . asakusafw . testtools . inspect . Cause . Type ; public class CauseTest { private static final String MSG1 = "msg1" ; private static final String MSG2 = "msg2" ; private static AllTypesWNoerr expect = new AllTypesWNoerr ( ) ; private static AllTypesWNoerr actual = new AllTypesWNoerr ( ) ; private static ColumnInfo columnInfo = new ColumnInfo ( "TBL1" , "COL1" , "CMT" , MySqlDataType . CHAR , 5 , 0 , 0 , true , false , null , NullValueCondition . NORMAL ) ; private static Cause cause1 = new Cause ( Type . COLUMN_VALUE_MISSMATCH , MSG1 , expect , actual ) ; ; private static Cause cause2 = new Cause ( Type . CONDITION_NOW_ON_INVALID_COLUMN , MSG2 , expect , actual , expect . getCBigintOption ( ) , actual . getCCharOption ( ) , columnInfo ) ; ; @ Test public void testGetType ( ) { assertEquals ( Type . COLUMN_VALUE_MISSMATCH , cause1 . getType ( ) ) ; assertEquals ( Type . CONDITION_NOW_ON_INVALID_COLUMN , cause2 . getType ( ) ) ; } @ Test public void testGetMessage ( ) { assertTrue ( cause1 . getMessage ( ) . contains ( MSG1 ) ) ; assertTrue ( cause2 . getMessage ( ) | |
2,687 | <s> package net . sf . sveditor . ui . svt . editor ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . text . DocumentEvent ; import org . eclipse . jface . text . IDocumentListener ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorSite ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . editors . text . TextEditor ; import org . eclipse . ui . forms . IManagedForm ; import org . eclipse . ui . forms . editor . FormEditor ; import org . eclipse . ui . forms . editor . IFormPage ; public class TextEditorPage extends TextEditor implements IFormPage { private SVTEditor fEditor ; private Control fPartControl ; private int fIndex ; private boolean fIsActive ; private boolean fIsDirty ; public TextEditorPage ( ) { setPartName ( "Source" ) ; } @ Override public void init ( IEditorSite site , IEditorInput input ) throws PartInitException { super . init ( site , input ) ; getDocumentProvider ( ) . getDocument ( input ) . addDocumentListener ( documentListener ) ; } @ Override public void doSave ( IProgressMonitor progressMonitor ) { System . out . println ( "doSave" ) ; super . doSave ( progressMonitor ) ; } public void initialize ( FormEditor editor ) { fEditor = ( SVTEditor ) editor ; } public FormEditor getEditor ( ) { return fEditor ; } public IManagedForm getManagedForm ( ) { return null ; } public void setActive ( boolean active ) { fIsActive = active ; } public boolean isActive ( ) { return fIsActive ; } @ Override public boolean isDirty ( ) { return fIsDirty ; } public boolean canLeaveThePage ( ) { return true ; } public void createPartControl ( Composite parent ) { super . createPartControl ( parent ) ; Control children [ ] = parent . getChildren ( ) ; fPartControl | |
2,688 | <s> package org . oddjob . framework ; import org . apache . commons . beanutils . DynaProperty ; import org . oddjob . arooa . reflect . ArooaNoPropertyException ; import org . oddjob . arooa . reflect . BeanOverview ; public class WrapDynaBeanOverview implements BeanOverview { private WrapDynaClass dynaClass ; public WrapDynaBeanOverview ( WrapDynaClass dynaClass ) { this . dynaClass = dynaClass ; } public String [ ] getProperties ( ) { DynaProperty [ ] properties = dynaClass . getDynaProperties ( ) ; String [ ] names = new String [ properties . length ] ; for ( int i = 0 ; i < properties . length ; ++ i ) { names [ i ] = properties [ i ] . getName ( ) ; } return names ; } public Class < ? > getPropertyType ( String property ) throws ArooaNoPropertyException { DynaProperty dynaProperty = dynaClass . getDynaProperty ( property ) ; if ( dynaProperty == null ) { throw new ArooaNoPropertyException | |
2,689 | <s> package de . fuberlin . wiwiss . d2rq . engine ; import java . util . ArrayList ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . sparql . algebra . Op ; import com . hp . hpl . jena . sparql . algebra . TransformCopy ; import com . hp . hpl . jena . sparql . algebra . op . OpBGP ; import com . hp . hpl . jena . sparql . algebra . op . OpFilter ; import com . hp . hpl . jena . sparql . expr . Expr ; import com . hp . hpl . jena . sparql . expr . ExprList ; import de . fuberlin . wiwiss . d2rq . algebra . NodeRelation ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; import de . fuberlin . wiwiss . d2rq . optimizer . expr . TransformExprToSQLApplyer ; public class TransformOpBGP extends TransformCopy { private final static Log log = LogFactory . getLog ( TransformOpBGP . class ) ; private final Mapping mapping ; private final boolean useAllOptimizations ; private final boolean transformFilters ; public TransformOpBGP ( Mapping mapping , boolean transformFilters ) { this . mapping = mapping ; this . transformFilters = transformFilters ; this . useAllOptimizations = mapping . configuration ( ) . getUseAllOptimizations ( ) ; } @ Override public Op transform ( OpBGP opBGP ) { if ( transformFilters ) { return opBGP ; } return createOpD2RQ ( opBGP , new ExprList ( ) ) ; } @ Override public Op transform ( OpFilter opFilter , Op subOp ) { if ( ! transformFilters || ! ( opFilter . getSubOp ( ) instanceof OpBGP ) ) { return super . transform ( opFilter , subOp ) ; } return createOpD2RQ ( ( OpBGP ) subOp , opFilter . getExprs ( ) ) ; } public Op createOpD2RQ ( OpBGP opBGP , ExprList filters ) { List < NodeRelation > tables = new GraphPatternTranslator ( opBGP . getPattern ( ) . getList ( ) , mapping . compiledPropertyBridges ( ) , useAllOptimizations ) . translate ( ) ; if ( useAllOptimizations ) { log . debug ( "" + tables . size ( ) ) ; ExprList copy = new ExprList ( filters ) ; for ( Expr filter : copy ) { tables = applyFilter ( tables , filter , filters ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "" + tables . size ( ) ) ; } } Op op = OpUnionTableSQL . create ( tables ) ; if ( ! filters . isEmpty ( ) ) { op = OpFilter . filter ( filters , op ) ; } return op ; } private List < NodeRelation > applyFilter ( List < NodeRelation | |
2,690 | <s> package org . springframework . samples . petclinic ; import javax . persistence . Basic ; import javax . persistence . Column ; import javax . persistence . Entity ; import javax . persistence . FetchType ; import javax . persistence . GeneratedValue ; import javax . persistence . GenerationType ; import javax . persistence . Id ; import javax . persistence . ManyToOne ; import javax . persistence . Table ; import org . hibernate . annotations . Index ; import org . joda . time . LocalDate ; import org . springframework . format . annotation . DateTimeFormat ; import org . springframework . format . annotation . DateTimeFormat . ISO ; @ Entity @ Table ( name = "visits" ) public class Visit implements BaseEntity { @ DateTimeFormat ( iso = ISO . DATE ) @ Basic @ Column ( name = "visit_date" ) private LocalDate date ; @ Basic private String description ; @ Id @ GeneratedValue ( strategy = GenerationType . IDENTITY ) private Integer id ; @ ManyToOne ( fetch = FetchType . EAGER ) @ Index ( name = "" ) private Pet pet ; public Visit | |
2,691 | <s> package org . rubypeople . rdt . refactoring . preview ; import org . eclipse . osgi . util . NLS ; public class Messages extends NLS { private static final String BUNDLE_NAME = "" ; public static String RubyTextEditChangePreviewViewer_OriginalSource ; public static String RubyTextEditChangePreviewViewer_RefactoredSource ; static { NLS . initializeMessages | |
2,692 | <s> package net . sf . sveditor . core . objects ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; public class ObjectsTreeNode { private String fName ; private ObjectsTreeNode fParent ; private SVDBDeclCacheItem fItemDecl ; private List < ObjectsTreeNode > fChildren ; public static String MODULES_NODE = "Modules" ; public static String INTERFACES_NODE = "Interfaces" ; public static String PACKAGES_NODE = "Packages" ; public static String ROOT_PKG = "root" ; public ObjectsTreeNode ( ObjectsTreeNode parent , String name ) { fName = name ; fParent = parent ; fChildren = new ArrayList < ObjectsTreeNode > ( ) ; } public ObjectsTreeNode ( ObjectsTreeNode parent , String | |
2,693 | <s> package net . sf . sveditor . core . content_assist ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . IFieldItemAttr ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBFunction ; import net . sf . sveditor . core . db . SVDBInterfaceDecl ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBModIfcInst ; import net . sf . sveditor . core . db . SVDBModportDecl ; import net . sf . sveditor . core . db . SVDBModportItem ; import net . sf . sveditor . core . db . SVDBModportPortsDecl ; import net . sf . sveditor . core . db . SVDBModportSimplePort ; import net . sf . sveditor . core . db . SVDBModportSimplePortsDecl ; import net . sf . sveditor . core . db . SVDBPackageDecl ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . SVDBTypeInfo ; import net . sf . sveditor . core . db . SVDBTypeInfoEnum ; import net . sf . sveditor . core . db . SVDBTypeInfoEnumerator ; import net . sf . sveditor . core . db . expr . SVDBExpr ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; import net . sf . sveditor . core . db . search . SVDBFindByName ; import net . sf . sveditor . core . db . search . SVDBFindByNameInClassHierarchy ; import net . sf . sveditor . core . db . search . SVDBFindByNameInScopes ; import net . sf . sveditor . core . db . search . SVDBFindByNameMatcher ; import net . sf . sveditor . core . db . search . SVDBFindContentAssistNameMatcher ; import net . sf . sveditor . core . db . search . SVDBFindDefaultNameMatcher ; import net . sf . sveditor . core . db . search . SVDBFindIncludedFile ; import net . sf . sveditor . core . db . search . SVDBFindNamedModIfcClassIfc ; import net . sf . sveditor . core . db . search . SVDBFindSuperClass ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBStmt ; import net . sf . sveditor . core . db . stmt . SVDBTypedefStmt ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; import net . sf . sveditor . core . db . utils . SVDBSearchUtils ; import net . sf . sveditor . core . expr_utils . SVContentAssistExprVisitor ; import net . sf . sveditor . core . expr_utils . SVExprContext ; import net . sf . sveditor . core . expr_utils . SVExprContext . ContextType ; import net . sf . sveditor . core . expr_utils . SVExprScanner ; import net . sf . sveditor . core . expr_utils . SVExprUtilsParser ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . parser . SVParseException ; import net . sf . sveditor . core . scanutils . IBIDITextScanner ; import org . eclipse . core . runtime . NullProgressMonitor ; public abstract class AbstractCompletionProcessor implements ILogLevel { protected List < SVCompletionProposal > fCompletionProposals ; protected LogHandle fLog ; public AbstractCompletionProcessor ( ) { fCompletionProposals = new ArrayList < SVCompletionProposal > ( ) ; } protected abstract ISVDBIndexIterator getIndexIterator ( ) ; protected abstract SVDBFile getSVDBFile ( ) ; protected void addProposal ( SVCompletionProposal p ) { boolean found = false ; synchronized ( fCompletionProposals ) { for ( SVCompletionProposal p_t : fCompletionProposals ) { if ( p_t . equals ( p ) ) { found = true ; break ; } } if ( ! found ) { fCompletionProposals . add ( p ) ; } } } public List < SVCompletionProposal > getCompletionProposals ( ) { return fCompletionProposals ; } public void computeProposals ( IBIDITextScanner scanner , SVDBFile active_file , int lineno ) { computeProposals ( scanner , active_file , lineno , - 1 ) ; } public void computeProposals ( IBIDITextScanner scanner , SVDBFile active_file , int lineno , int linepos ) { SVExprScanner expr_scan = new SVExprScanner ( ) ; synchronized ( fCompletionProposals ) { fCompletionProposals . clear ( ) ; } fLog . debug ( LEVEL_MID , "" + active_file . getFilePath ( ) + ":" + lineno + ":" + linepos ) ; ISVDBScopeItem src_scope = SVDBSearchUtils . findActiveScope ( active_file , lineno ) ; if ( src_scope != null ) { fLog . debug ( LEVEL_MID , "src_scope: " + src_scope . getType ( ) + " " + SVDBItem . getName ( src_scope ) ) ; } SVExprContext ctxt = expr_scan . extractExprContext ( scanner , false ) ; fLog . debug ( LEVEL_MID , "ctxt: type=" + ctxt . fType + " trigger=" + ctxt . fTrigger + " root=" + ctxt . fRoot + " leaf=" + ctxt . fLeaf + " start=" + ctxt . fStart ) ; if ( ctxt . fTrigger != null ) { if ( ctxt . fTrigger . equals ( "`" ) ) { findMacroItems ( ctxt , getIndexIterator ( ) ) ; } else if ( ctxt . fRoot != null && ( ctxt . fTrigger . equals ( "=" ) || ctxt . fTrigger . equals ( "." ) || ctxt . fTrigger . equals ( "::" ) || ctxt . fTrigger . equals ( ":" ) ) ) { if ( ctxt . fTrigger . equals ( "." ) || ctxt . fTrigger . equals ( "::" ) ) { SVDBExpr expr = null ; SVExprUtilsParser parser = new SVExprUtilsParser ( ctxt ) ; try { expr = parser . parsers ( ) . exprParser ( ) . expression ( ) ; } catch ( SVParseException e ) { fLog . debug ( LEVEL_MID , "" , e ) ; return ; } SVContentAssistExprVisitor v = new SVContentAssistExprVisitor ( src_scope , SVDBFindDefaultNameMatcher . getDefault ( ) , getIndexIterator ( ) ) ; ISVDBItemBase item = null ; if ( expr != null ) { item = v . findTypeItem ( expr ) ; } if ( item == null ) { fLog . debug ( LEVEL_MID , "" ) ; return ; } fLog . debug ( LEVEL_MID , "Item: " + item . getType ( ) + " " + SVDBItem . getName ( item ) ) ; findTriggeredProposals ( ctxt , src_scope , item ) ; } else if ( ctxt . fTrigger . equals ( "=" ) ) { SVDBExpr expr = null ; SVExprUtilsParser parser = new SVExprUtilsParser ( ctxt ) ; try { expr = parser . parsers ( ) . exprParser ( ) . expression ( ) ; } catch ( SVParseException e ) { fLog . debug ( LEVEL_MID , "" , e ) ; return ; } SVContentAssistExprVisitor v = new SVContentAssistExprVisitor ( src_scope , SVDBFindDefaultNameMatcher . getDefault ( ) , getIndexIterator ( ) ) ; ISVDBItemBase item = null ; if ( expr != null ) { try { item = v . findTypeItem ( expr ) ; } catch ( RuntimeException e ) { } } if ( item == null ) { fLog . debug ( LEVEL_MID , "" ) ; } fLog . debug ( LEVEL_MID , "Item: " + ( ( item != null ) ? ( item . getType ( ) + " " + SVDBItem . getName ( item ) ) : "null" ) ) ; findAssignTriggeredProposals ( ctxt , src_scope , item ) ; } else if ( ctxt . fTrigger . equals ( ":" ) ) { if ( ctxt . fRoot | |
2,694 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . Arrays ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . viewers . ArrayContentProvider ; import org . eclipse . jface . viewers . DoubleClickEvent ; import org . eclipse . jface . viewers . IDoubleClickListener ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . viewers . ListViewer ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . Composite ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . util . SelectionUtil ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; public class LoadpathContainerSelectionPage extends WizardPage { private static final String DIALOGSTORE_SECTION = "" ; private static final String DIALOGSTORE_CONTAINER_IDX = "index" ; private static class LoadpathContainerLabelProvider extends LabelProvider { public String getText ( Object element ) { return ( ( LoadpathContainerDescriptor ) element ) . getName ( ) ; } } private static class LoadpathContainerSorter extends ViewerSorter { } private ListViewer fListViewer ; private LoadpathContainerDescriptor [ ] fContainers ; private IDialogSettings fDialogSettings ; protected LoadpathContainerSelectionPage ( LoadpathContainerDescriptor [ ] containerPages ) { super ( "" ) ; setTitle ( NewWizardMessages . LoadpathContainerSelectionPage_title ) ; setDescription ( NewWizardMessages . LoadpathContainerSelectionPage_description ) ; setImageDescriptor ( RubyPluginImages . DESC_WIZBAN_ADD_LIBRARY ) ; fContainers = containerPages ; IDialogSettings settings = RubyPlugin . getDefault ( ) . getDialogSettings ( ) ; fDialogSettings = settings . getSection | |
2,695 | <s> package net . sf . sveditor . core . svf_scanner ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . scanutils . ITextScanner ; public class SVFScanner { private LogHandle fLog ; private ITextScanner fScanner ; private List < String > fIncludePaths ; private Map < String , String > fDefineMap ; private List < String > fFilePaths ; private List < String > fLibPaths ; private Set < String > fSrcExtensions ; private List < String > fIncludedArgFiles ; public static final Map < String , Integer > fIgnoredSwitches ; public static final Set < String > fSupportedSwitches ; public static final Set < String > fRecognizedSwitches ; static { fIgnoredSwitches = new HashMap < String , Integer > ( ) ; fIgnoredSwitches . put ( "-nowarn" , 1 ) ; fIgnoredSwitches . put ( "-time" , 0 ) ; fIgnoredSwitches . put ( "-version" , 0 ) ; fIgnoredSwitches . put ( "-32" , 0 ) ; fIgnoredSwitches . put ( "-64" , 0 ) ; fIgnoredSwitches . put ( "-work" , 1 ) ; fIgnoredSwitches . put ( "-error" , 1 ) ; fIgnoredSwitches . put ( "-warning" , 1 ) ; fIgnoredSwitches . put ( "-note" , 1 ) ; fIgnoredSwitches . put ( "-suppress" , 1 ) ; fIgnoredSwitches . put ( "-msglimit" , 1 ) ; fIgnoredSwitches . put ( "-compat" , 0 ) ; fIgnoredSwitches . put ( "-ccflags" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-coveropt" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-coverfec" , 0 ) ; fIgnoredSwitches . put ( "-nocoverfec" , 0 ) ; fIgnoredSwitches . put ( "-coverudp" , 0 ) ; fIgnoredSwitches . put ( "-covershort" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-covercells" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 1 ) ; fIgnoredSwitches . put ( "" , 1 ) ; fIgnoredSwitches . put ( "" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-maxudprows" , 1 ) ; fIgnoredSwitches . put ( "-maxfecrows" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-dpiheader" , 1 ) ; fIgnoredSwitches . put ( "-E" , 1 ) ; fIgnoredSwitches . put ( "-Epretty" , 1 ) ; fIgnoredSwitches . put ( "-Edebug" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-nofsmsingle" , 0 ) ; fIgnoredSwitches . put ( "-fsmsingle" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-fsmverbose" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-fsmxassign" , 0 ) ; fIgnoredSwitches . put ( "-gen_xml" , 2 ) ; fIgnoredSwitches . put ( "-hazards" , 0 ) ; fIgnoredSwitches . put ( "-incr" , 0 ) ; fIgnoredSwitches . put ( "-L" , 1 ) ; fIgnoredSwitches . put ( "-Lf" , 1 ) ; fIgnoredSwitches . put ( "-l" , 1 ) ; fIgnoredSwitches . put ( "-libmap" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-line" , 1 ) ; fIgnoredSwitches . put ( "-lint" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-modelsimini" , 1 ) ; fIgnoredSwitches . put ( "-modelsimini" , 1 ) ; fIgnoredSwitches . put ( "-mfcu" , 0 ) ; fIgnoredSwitches . put ( "-nocheck" , 0 ) ; fIgnoredSwitches . put ( "-nodebug" , 0 ) ; fIgnoredSwitches . put ( "-nodbgsym" , 0 ) ; fIgnoredSwitches . put ( "-noincr" , 0 ) ; fIgnoredSwitches . put ( "-nologo" , 0 ) ; fIgnoredSwitches . put ( "-nopsl" , 0 ) ; fIgnoredSwitches . put ( "-novopt" , 0 ) ; fIgnoredSwitches . put ( "-nowarn" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-O0" , 0 ) ; fIgnoredSwitches . put ( "-O1" , 0 ) ; fIgnoredSwitches . put ( "-O4" , 0 ) ; fIgnoredSwitches . put ( "-O5" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-permissive" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-pslext" , 0 ) ; fIgnoredSwitches . put ( "-pslfile" , 1 ) ; fIgnoredSwitches . put ( "-quiet" , 0 ) ; fIgnoredSwitches . put ( "-refresh" , 0 ) ; fIgnoredSwitches . put ( "-scdpiheader" , 1 ) ; fIgnoredSwitches . put ( "-sfcu" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-source" , 0 ) ; fIgnoredSwitches . put ( "-sv" , 0 ) ; fIgnoredSwitches . put ( "-sv05compat" , 0 ) ; fIgnoredSwitches . put ( "-sv09compat" , 0 ) ; fIgnoredSwitches . put ( "-oldsv" , 0 ) ; fIgnoredSwitches . put ( "-timescale" , 1 ) ; fIgnoredSwitches . put ( "" , 1 ) ; fIgnoredSwitches . put ( "-u" , 0 ) ; fIgnoredSwitches . put ( "-v" , 1 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fIgnoredSwitches . put ( "-mixedsvvh" , 1 ) ; fIgnoredSwitches . put ( "-vopt" , 0 ) ; fIgnoredSwitches . put ( "-vmake" , 0 ) ; fIgnoredSwitches . put ( "" , 0 ) ; fSupportedSwitches = new HashSet < String > ( ) ; fSupportedSwitches . add ( "+define+" ) ; fSupportedSwitches . add ( "-DEF" ) ; fSupportedSwitches . add ( "-define" ) ; fSupportedSwitches . add ( "+incdir+" ) ; fSupportedSwitches . add ( "-IN" ) ; fSupportedSwitches . add ( "-incdir" ) ; fSupportedSwitches . add ( "-y" ) ; fSupportedSwitches . add ( "-v" ) ; fSupportedSwitches . add ( "-f" ) ; fSupportedSwitches . add ( "-file" ) ; fRecognizedSwitches = new HashSet < String > ( ) ; fRecognizedSwitches . addAll ( fIgnoredSwitches . keySet ( ) ) ; fRecognizedSwitches . addAll ( fSupportedSwitches ) ; } public SVFScanner ( ) { fIncludePaths = new ArrayList < String > ( ) ; fDefineMap = new HashMap < String , String > ( ) ; fFilePaths = new ArrayList < String > ( ) ; fLibPaths = new ArrayList < String > ( ) ; fIncludedArgFiles = new ArrayList < String > ( ) ; fSrcExtensions = new HashSet < String > ( ) ; fSrcExtensions . add ( ".sv" ) ; fSrcExtensions . add ( ".v" ) ; fSrcExtensions . add ( ".vl" ) ; fSrcExtensions . add ( ".vlog" ) ; fLog = LogFactory . getLogHandle ( "" ) ; } public List < String > getIncludePaths ( ) { return fIncludePaths ; } public List < String > getFilePaths ( ) { return fFilePaths ; } public List < String > getLibPaths ( ) { return fLibPaths ; } public Set < String > getSrcExts ( ) { return fSrcExtensions ; } public List < String > getArgFilePaths ( ) { return fIncludedArgFiles ; } public Map < String , String > getDefineMap ( ) { return fDefineMap ; } public void scan ( ITextScanner scanner ) throws Exception { fScanner = scanner ; StringBuilder tmp = new StringBuilder ( ) ; int ch ; while ( ( ch = fScanner . skipWhite ( fScanner . get_ch ( ) ) ) != - 1 ) { if ( ch == '+' ) { tmp . setLength ( 0 ) ; tmp . append ( ( char ) ch ) ; while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ch != '=' && ! Character . isWhitespace ( ch ) ) { tmp . append ( ( char ) ch ) ; if ( ch == '+' ) { break ; } } fLog . debug ( "key=" + tmp . toString ( ) ) ; if ( tmp . toString ( ) . equals ( "+define+" ) ) { String key , val ; tmp . setLength ( 0 ) ; while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ! Character . isWhitespace ( ch ) && ch != '=' ) { tmp . append ( ( char ) ch ) ; } key = tmp . toString ( ) ; if ( ch == '=' ) { tmp . setLength ( 0 ) ; ch = fScanner . get_ch ( ) ; if ( ch == '"' ) { val = fScanner . readString ( ch ) ; } else { tmp . append ( ( char ) ch ) ; while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ! Character . isWhitespace ( ch ) ) { tmp . append ( ( char ) ch ) ; } val = tmp . toString ( ) ; } } else { val = "" ; } if ( fDefineMap . containsKey ( key ) ) { fDefineMap . remove ( key ) ; } fDefineMap . put ( key , val ) ; } else if ( tmp . toString ( ) . equals ( "+incdir+" ) ) { ch = fScanner . skipWhite ( fScanner . get_ch ( ) ) ; tmp . setLength ( 0 ) ; tmp . append ( ( char ) ch ) ; do { while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ! Character . isWhitespace ( ch ) ) { tmp . append ( ( char ) ch ) ; } fIncludePaths . add ( tmp . toString ( ) ) ; } while ( ch == '+' ) ; fScanner . unget_ch ( ch ) ; } else { fLog . debug ( "" + tmp . toString ( ) ) ; while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ! Character . isWhitespace ( ch ) ) { } fScanner . unget_ch ( ch ) ; } } else if ( ch == '-' ) { String key = null , val = null ; tmp . setLength ( 0 ) ; tmp . append ( ( char ) ch ) ; while ( ( ch = fScanner . get_ch ( ) ) != - 1 && ! Character . isWhitespace ( ch ) ) { tmp . append ( ( char ) ch ) ; } key = tmp . toString ( ) ; if ( fIgnoredSwitches . containsKey ( key ) ) { int ignore_arg_count = fIgnoredSwitches . get ( key ) ; for ( int i = 0 ; i < ignore_arg_count ; i ++ ) { while ( ( ch = fScanner . get_ch ( ) ) != - 1 && Character . isWhitespace ( ch ) ) { } fScanner . unget_ch ( | |
2,696 | <s> package handson . springbatch ; import java . util . List ; import org . slf4j . Logger ; import org . | |
2,697 | <s> package org . rubypeople . rdt . internal . ui . text ; import com . ibm . icu . text . BreakIterator ; import java . text . CharacterIterator ; import org . eclipse . jface . text . Assert ; public class RubyBreakIterator extends BreakIterator { protected static abstract class Run { protected int length ; public Run ( ) { init ( ) ; } protected boolean consume ( char ch ) { if ( isValid ( ch ) ) { length ++ ; return true ; } return false ; } protected abstract boolean isValid ( char ch ) ; protected void init ( ) { length = 0 ; } } static final class Whitespace extends Run { protected boolean isValid ( char ch ) { return Character . isWhitespace ( ch ) && ch != '\n' && ch != '\r' ; } } static final class LineDelimiter extends Run { private char fState ; private static final char INIT = '\0' ; private static final char EXIT = '\1' ; protected void init ( ) { super . init ( ) ; fState = INIT ; } protected boolean consume ( char ch ) { if ( ! isValid ( ch ) || fState == EXIT ) return false ; if ( fState == INIT ) { fState = ch ; length ++ ; return true ; } else if ( fState != ch ) { fState = EXIT ; length ++ ; return true ; } else { return false ; } } protected boolean isValid ( char ch ) { return ch == '\n' || ch == '\r' ; } } static final class Identifier extends Run { protected boolean isValid ( char ch ) { return Character . isJavaIdentifierPart ( ch ) ; } } static final class CamelCaseIdentifier extends Run { private static final int S_INIT = 0 ; private static final int S_LOWER = 1 ; private static final int S_ONE_CAP = 2 ; private static final int S_ALL_CAPS = 3 ; private static final int S_EXIT = 4 ; private static final int S_EXIT_MINUS_ONE = 5 ; private static final int K_INVALID = 0 ; private static final int K_LOWER = 1 ; private static final int K_UPPER = 2 ; private static final int K_OTHER = 3 ; private int fState ; private final static int [ ] [ ] MATRIX = new int [ ] [ ] { { S_EXIT , S_LOWER , S_ONE_CAP , S_LOWER } , { S_EXIT , S_LOWER , S_EXIT , S_LOWER } , { S_EXIT , S_LOWER , S_ALL_CAPS , S_LOWER } , { S_EXIT , S_EXIT_MINUS_ONE , S_ALL_CAPS , S_LOWER } , } ; protected void init ( ) { super . init ( ) ; fState = S_INIT ; } protected boolean consume ( char ch ) { int kind = getKind ( ch ) ; fState = MATRIX [ fState ] [ kind ] ; switch ( fState ) { case S_LOWER : case S_ONE_CAP : case S_ALL_CAPS : length ++ ; return true ; case S_EXIT : return false ; case S_EXIT_MINUS_ONE : length -- ; return false ; default : Assert . isTrue ( false ) ; return false ; } } private int getKind ( char ch ) { if ( Character . isUpperCase ( ch ) ) return K_UPPER ; if ( Character . isLowerCase ( ch ) ) return K_LOWER ; if ( Character . isJavaIdentifierPart ( ch ) ) return K_OTHER ; return K_INVALID ; } protected | |
2,698 | <s> package org . rubypeople . rdt . internal . debug . ui . console ; import java . io . File ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . ui . console . IConsole ; import org . eclipse . debug . ui . console . IConsoleLineTracker ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IRegion ; import org . eclipse . ui . console . IHyperlink ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople | |
2,699 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . ParameterizedType ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class ParameterizedTypeImpl extends ModelRoot implements ParameterizedType { private Type type ; private List < ? extends Type > typeArguments ; @ Override public Type getType ( ) { return this . type ; } public void setType ( Type type ) { Util . notNull ( type , "type" ) ; this . type = type ; } @ Override public List < ? extends Type > getTypeArguments ( ) { return this . typeArguments ; } public void setTypeArguments ( List < ? extends Type > typeArguments ) { Util . notNull ( typeArguments , "" ) ; Util . notContainNull ( typeArguments , "" ) ; Util . notEmpty ( typeArguments |