id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
600 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . KeyEvent ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . INewWizard ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . corext . buildpath . LoadpathModifier ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; 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 . ITreeListAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . TreeListDialogField ; import org . rubypeople . rdt . ui . actions . AbstractOpenWizardAction ; public class SourceContainerWorkbookPage extends BuildPathBasePage { private class OpenBuildPathWizardAction extends AbstractOpenWizardAction implements IPropertyChangeListener { private final BuildPathWizard fWizard ; private final List fSelectedElements ; public OpenBuildPathWizardAction ( BuildPathWizard wizard ) { fWizard = wizard ; addPropertyChangeListener ( this ) ; fSelectedElements = fFoldersList . getSelectedElements ( ) ; } protected INewWizard createWizard ( ) throws CoreException { return fWizard ; } public void propertyChange ( PropertyChangeEvent event ) { if ( event . getProperty ( ) . equals ( IAction . RESULT ) ) { if ( event . getNewValue ( ) . equals ( Boolean . TRUE ) ) { finishWizard ( ) ; } else { fWizard . cancel ( ) ; } } } protected void finishWizard ( ) { List insertedElements = fWizard . getInsertedElements ( ) ; refresh ( insertedElements , fWizard . getRemovedElements ( ) , fWizard . getModifiedElements ( ) ) ; if ( insertedElements . isEmpty ( ) ) { fFoldersList . postSetSelection ( new StructuredSelection ( fSelectedElements ) ) ; } } } private static AddSourceFolderWizard newSourceFolderWizard ( CPListElement element , List existingElements , boolean newFolder ) { CPListElement [ ] existing = ( CPListElement [ ] ) existingElements . toArray ( new CPListElement [ existingElements . size ( ) ] ) ; AddSourceFolderWizard wizard = new AddSourceFolderWizard ( existing , element , false , newFolder , newFolder , newFolder ? CPListElement . isProjectSourceFolder ( existing , element . getRubyProject ( ) ) : false , newFolder ) ; wizard . setDoFlushChange ( false ) ; return wizard ; } private static AddSourceFolderWizard newLinkedSourceFolderWizard ( CPListElement element , List existingElements , boolean newFolder ) { CPListElement [ ] existing = ( CPListElement [ ] ) existingElements . toArray ( new CPListElement [ existingElements . size ( ) ] ) ; AddSourceFolderWizard wizard = new AddSourceFolderWizard ( existing , element , true , newFolder , newFolder , newFolder ? CPListElement . isProjectSourceFolder ( existing , element . getRubyProject ( ) ) : false , newFolder ) ; wizard . setDoFlushChange ( false ) ; return wizard ; } private static EditFilterWizard newEditFilterWizard ( CPListElement element , List existingElements ) { CPListElement [ ] existing = ( CPListElement [ ] ) existingElements . toArray ( new CPListElement [ existingElements . size ( ) ] ) ; EditFilterWizard result = new EditFilterWizard ( existing , element ) ; result . setDoFlushChange ( false ) ; return result ; } private ListDialogField fClassPathList ; private IRubyProject fCurrJProject ; private Control fSWTControl ; private TreeListDialogField fFoldersList ; private final int IDX_ADD = 0 ; private final int IDX_ADD_LINK = 1 ; private final int IDX_EDIT = 3 ; private final int IDX_REMOVE = 4 ; public SourceContainerWorkbookPage ( ListDialogField classPathList ) { fClassPathList = classPathList ; fSWTControl = null ; SourceContainerAdapter adapter = new SourceContainerAdapter ( ) ; String [ ] buttonLabels ; buttonLabels = new String [ ] { NewWizardMessages . SourceContainerWorkbookPage_folders_add_button , NewWizardMessages . SourceContainerWorkbookPage_folders_link_source_button , null , NewWizardMessages . SourceContainerWorkbookPage_folders_edit_button , NewWizardMessages . SourceContainerWorkbookPage_folders_remove_button } ; fFoldersList = new TreeListDialogField ( adapter , buttonLabels , new CPListLabelProvider ( ) ) ; fFoldersList . setDialogFieldListener ( adapter ) ; fFoldersList . setLabelText ( NewWizardMessages . SourceContainerWorkbookPage_folders_label ) ; fFoldersList . setViewerSorter ( new CPListElementSorter ( ) ) ; fFoldersList . enableButton ( IDX_EDIT , false ) ; } public void init ( IRubyProject jproject ) { fCurrJProject = jproject ; updateFoldersList ( ) ; } private void updateFoldersList ( ) { ArrayList folders = new ArrayList ( ) ; List cpelements = fClassPathList . getElements ( ) ; for ( int i = 0 ; i < cpelements . size ( ) ; i ++ ) { CPListElement cpe = ( CPListElement ) cpelements . get ( i ) ; if ( cpe . getEntryKind ( ) == ILoadpathEntry . CPE_SOURCE ) { folders . add ( cpe ) ; } } fFoldersList . setElements ( folders ) ; for ( int i = 0 ; i < folders . size ( ) ; i ++ ) { CPListElement cpe = ( CPListElement ) folders . get ( i ) ; IPath [ ] ePatterns = ( IPath [ ] ) cpe . getAttribute ( CPListElement . EXCLUSION ) ; IPath [ ] iPatterns = ( IPath [ ] ) cpe . getAttribute ( CPListElement . INCLUSION ) ; if ( ePatterns . length > 0 || iPatterns . length > 0 ) { fFoldersList . expandElement ( cpe , 3 ) ; } } } public Control getControl ( Composite parent ) { PixelConverter converter = new PixelConverter ( parent ) ; Composite composite = new Composite ( parent , SWT . NONE ) ; | |
601 | <s> package org . rubypeople . rdt . internal . ui . viewsupport ; import org . eclipse . jface . viewers . DecoratingLabelProvider ; import org . eclipse . jface . viewers . IColorProvider ; import org . eclipse . swt . graphics . Color ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . ui . ProblemsLabelDecorator ; public class DecoratingRubyLabelProvider extends DecoratingLabelProvider implements IColorProvider { public DecoratingRubyLabelProvider ( RubyUILabelProvider labelProvider ) { this ( labelProvider , true ) ; } public DecoratingRubyLabelProvider ( RubyUILabelProvider labelProvider , boolean errorTick ) { super ( labelProvider , PlatformUI . getWorkbench ( ) . getDecoratorManager ( ) . getLabelDecorator ( ) ) ; | |
602 | <s> package org . apache . camel . example . reportincident . model ; import org . apache . commons . lang . builder . ToStringBuilder ; import org . apache . commons . lang . builder . ToStringStyle ; public abstract | |
603 | <s> package org . oddjob . jmx . handlers ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . MBeanParameterInfo ; import org . oddjob . Resetable ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . HandlerVersion ; import org . oddjob . jmx . client . VanillaHandlerResolver ; import org . oddjob . jmx . server . ServerAllOperationsHandler ; import org . oddjob . jmx . server . ServerInterfaceHandler ; import org . oddjob . jmx . server . ServerInterfaceHandlerFactory ; import org . oddjob . jmx . server . ServerSideToolkit ; public class ResetableHandlerFactory implements ServerInterfaceHandlerFactory < Resetable , Resetable > { public static final HandlerVersion VERSION = new HandlerVersion ( 1 , 0 ) ; public Class < Resetable > interfaceClass ( ) { return Resetable . class ; } public MBeanAttributeInfo [ ] getMBeanAttributeInfo ( ) { return new MBeanAttributeInfo [ 0 ] ; } public MBeanOperationInfo [ ] getMBeanOperationInfo ( ) { return new MBeanOperationInfo [ ] { new MBeanOperationInfo ( "softReset" , "" , new MBeanParameterInfo [ 0 ] , Void . TYPE . getName ( ) | |
604 | <s> package hudson . jbpm . model ; import java . util . List ; import org . jbpm . taskmgmt . exe . TaskInstance ; import hudson . Extension ; import hudson . jbpm . PluginImpl ; import hudson . widgets . Widget ; @ Extension public class | |
605 | <s> package org . rubypeople . rdt . internal . debug . core . model ; import org . eclipse . debug . core . model . DebugElement ; import org . eclipse . debug . core . model . IDebugTarget ; public class RubyDebugElement extends DebugElement { public | |
606 | <s> package com . asakusafw . windgate . core . resource ; import java . io . Closeable ; import java . io . IOException ; import com . asakusafw . windgate . file . resource . Preparable ; public | |
607 | <s> package com . asakusafw . bulkloader . common ; import java . io . IOException ; import java . util . Collection ; import java . util . concurrent . ArrayBlockingQueue ; import java . util . concurrent . BlockingQueue ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . atomic . AtomicBoolean ; import java . util . concurrent . atomic . AtomicReference ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; public final class MultiThreadedCopier < T > { static final long POLL_BREAK_INTERVAL = 100L ; private final BlockingQueue < T > outputChannel ; private final BlockingQueue < T > buffer ; private final ModelInput < T > input ; private final OutputTask < T > task ; private MultiThreadedCopier ( ModelInput < T > input , ModelOutput < T > output , Collection < T > working ) { assert input != null ; assert output != null ; assert working != null ; this . outputChannel = new ArrayBlockingQueue < T > ( working . size ( ) + 1 ) ; this . buffer = new ArrayBlockingQueue < T > ( working . size ( ) + 1 , false , working ) ; this . input = input ; this . task = new OutputTask < T > ( outputChannel , buffer , output ) ; this . task . setDaemon ( true ) ; } public static < T > long copy ( ModelInput < T > input , ModelOutput < T > output , Collection < T > working ) throws IOException , InterruptedException { if ( input == null ) { throw new IllegalArgumentException ( "" ) ; } if ( output == null ) { throw new IllegalArgumentException ( "" ) ; } if ( working == null ) { throw new IllegalArgumentException ( "" ) ; } if ( working . isEmpty ( ) ) { throw new IllegalArgumentException ( "" ) ; } return new MultiThreadedCopier < T > ( input , output , working ) . process ( ) ; } private long process ( ) throws IOException , InterruptedException { task . start ( ) ; while ( true ) { T model = takeBuffer ( ) ; if ( input . readTo ( model ) == false ) { break ; } outputChannel . put ( model ) ; } task . finished . set ( true ) ; task . join ( ) ; checkException ( ) ; return task . count ; } private T takeBuffer ( ) throws IOException , InterruptedException { while ( true ) { T model = buffer . poll ( POLL_BREAK_INTERVAL , TimeUnit . MILLISECONDS ) ; if ( model == null ) { if ( task . finished . get ( ) ) { throw new IllegalStateException ( ) ; } checkException ( ) ; } else { return model ; } } } private void checkException ( ) throws InterruptedException , IOException { Throwable exception = task . occurred . get ( ) ; if ( exception != null ) { if ( exception instanceof InterruptedException ) { throw ( InterruptedException ) exception ; } | |
608 | <s> package org . rubypeople . rdt . internal . ui . text . spelling ; import java . util . Locale ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . ui . texteditor . spelling . ISpellingProblemCollector ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellChecker ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellEventListener ; public class TextSpellingEngine extends SpellingEngine { | |
609 | <s> package com . asakusafw . compiler . testing ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . net . MalformedURLException ; import java . net . URL ; import java . net . URLClassLoader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . List ; import java . util . jar . JarFile ; import java . util . zip . ZipInputStream ; import org . junit . Assume ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . compiler . flow . FlowCompilerOptions ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . flow . processor . flow . UpdateFlowSimple ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . testing . flow . DuplicateFragments ; import com . asakusafw . compiler . testing . flow . StraightFragments ; import com . asakusafw . compiler . testing . flow . StraightRendezvousFragments ; import com . asakusafw . compiler . util . tester . CompilerTester ; import com . asakusafw . compiler . util . tester . HadoopDriver ; import com . asakusafw . compiler . util . tester . CompilerTester . TestInput ; import com . asakusafw . compiler . util . tester . CompilerTester . TestOutput ; import com . asakusafw . runtime . value . ValueOption ; public class DirectFlowCompilerTest { @ Rule public CompilerTester tester = new CompilerTester ( ) ; @ Test public void folderLibraryPath ( ) throws Exception { File file = extract ( "example.jar" ) ; Class < ? > aClass = load ( file , "" ) ; File library = DirectFlowCompiler . toLibraryPath ( aClass ) ; assertThat ( library , not ( nullValue ( ) ) ) ; assertThat ( file . getCanonicalFile ( ) , is ( library . getCanonicalFile ( ) ) ) ; } @ Test public void folderLibraryPathWithInner ( ) throws Exception { File file = extract ( "example.jar" ) ; Class < ? > aClass = load ( file , "" ) ; File library = DirectFlowCompiler . toLibraryPath ( aClass ) ; assertThat ( library , not ( nullValue ( ) ) ) ; assertThat ( file . getCanonicalFile ( ) , is ( library . getCanonicalFile ( ) ) ) ; } @ Test public void jarLibraryPath ( ) throws Exception { File file = copy ( "example.jar" ) ; Class < ? > aClass = load ( file , "" ) ; File library = DirectFlowCompiler . toLibraryPath ( aClass ) ; assertThat ( library , not ( nullValue ( ) ) ) ; assertThat ( file . getCanonicalFile ( ) , is ( library . getCanonicalFile ( ) ) ) ; } @ Test public void jarLibraryPathWithInner ( ) throws Exception { File file = copy ( "example.jar" ) ; Class < ? > aClass = load ( file , "" ) ; File library = DirectFlowCompiler . toLibraryPath ( aClass ) ; assertThat ( library , not ( nullValue ( ) ) ) ; assertThat ( file . getCanonicalFile ( ) , is ( library . getCanonicalFile ( ) ) ) ; } @ Test public void zipLibraryPath ( ) throws Exception { File file = copy ( "example.zip" ) ; Class < ? > aClass = load ( file , "" ) ; File library = DirectFlowCompiler . toLibraryPath ( aClass ) ; assertThat ( library , not ( nullValue ( ) ) ) ; assertThat ( file . getCanonicalFile ( ) , is ( library . getCanonicalFile ( ) ) ) ; } @ Test public void simpleCompile ( ) throws Exception { List < File > classpath = Arrays . asList ( new File [ ] { DirectFlowCompiler . toLibraryPath ( ValueOption . class ) , DirectFlowCompiler . toLibraryPath ( Ex1 . class ) , } ) ; TestInput < Ex1 > in = tester . input ( Ex1 . class , "ex1" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "ex1" ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setSid ( 0 ) ; ex1 . setValue ( 100 ) ; in . add ( ex1 ) ; JobflowInfo info = DirectFlowCompiler . compile ( tester . analyzeFlow ( new UpdateFlowSimple ( in . flow ( ) , out . flow ( ) ) ) , "simple" , "simple" , "com.example" , Location . fromPath ( HadoopDriver . RUNTIME_WORK_ROOT , '/' ) , tester . framework ( ) . getWork ( "build" ) , classpath , getClass ( ) . getClassLoader ( ) , FlowCompilerOptions . load ( System . getProperties ( ) ) ) ; assertThat ( tester . run ( info ) , is ( true ) ) ; List < Ex1 > results = out . toList ( ) ; assertThat ( results . size ( ) , is ( 1 ) ) ; assertThat ( results . get ( 0 ) . getValue ( ) , is ( 101 ) ) ; } @ Test public void straightFragmentsCompile ( ) throws Exception { List < File > classpath = Arrays . asList ( new File [ ] { DirectFlowCompiler . toLibraryPath ( ValueOption . class ) , DirectFlowCompiler . toLibraryPath ( Ex1 . class ) , } ) ; TestInput < Ex1 > in = tester . input ( Ex1 . class , "ex1" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "ex1" ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setSid ( 0 ) ; ex1 . setValue ( 0 ) ; in . add ( ex1 ) ; ex1 . setSid ( 1 ) ; ex1 . setValue ( 100 ) ; in . add ( ex1 ) ; JobflowInfo info = DirectFlowCompiler . compile ( tester . analyzeFlow ( new StraightFragments ( in . flow ( ) , out . flow ( ) ) ) , "simple" , "simple" , "com.example" , Location . fromPath ( HadoopDriver . RUNTIME_WORK_ROOT , '/' ) , tester . framework ( ) . getWork ( "build" ) , classpath , getClass ( ) . getClassLoader ( ) , FlowCompilerOptions . load ( System . getProperties ( ) ) ) ; assertThat ( tester . run ( info ) , is ( true ) ) ; List < Ex1 > results = out . toList ( new Comparator < Ex1 > ( ) { @ Override public int compare ( Ex1 o1 , Ex1 o2 ) { return o1 . getSidOption ( ) . compareTo ( o2 . getSidOption ( ) ) ; } } ) ; assertThat ( results . size ( ) , is ( 2 ) ) ; assertThat ( results . get ( 0 ) . getValue ( ) , is ( 1 ) ) ; assertThat ( results . get ( 1 ) . getValue ( ) , is ( 100 ) ) ; } @ Test public void duplicateCompile ( ) throws Exception { List < File > classpath = Arrays . asList ( new File [ ] { DirectFlowCompiler . toLibraryPath ( ValueOption . class ) , DirectFlowCompiler . toLibraryPath ( Ex1 . class ) , } ) ; TestInput < Ex1 > in = tester . input ( Ex1 . class , "ex1" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "ex1" ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setStringAsString ( "Hello" ) ; ex1 . setSid ( 0 ) ; ex1 . setValue ( 100 ) ; in . add ( ex1 ) ; JobflowInfo info = DirectFlowCompiler . compile ( tester . analyzeFlow ( new DuplicateFragments ( in . flow ( ) , out . flow ( ) ) ) , "simple" , "simple" , "com.example" , Location . fromPath ( HadoopDriver . RUNTIME_WORK_ROOT , '/' ) , tester . framework ( ) . getWork ( "build" ) , classpath , getClass ( ) . getClassLoader ( ) , FlowCompilerOptions . load ( System . getProperties ( ) ) ) ; assertThat ( tester . run ( info ) , is ( true ) ) ; List < Ex1 > results = out . toList ( ) ; assertThat ( results . size ( ) , is ( 2 ) ) ; assertThat ( results . get ( 0 ) . getValue ( ) , is ( 102 ) ) ; assertThat ( results . get ( 1 ) . getValue ( ) , is ( 102 ) ) ; } @ Test public void straightRendezvousFragmentsCompile ( ) throws Exception { List < File > classpath = Arrays . asList ( new File [ ] { DirectFlowCompiler . toLibraryPath ( ValueOption . class ) , DirectFlowCompiler . toLibraryPath ( Ex1 . class ) , } ) ; TestInput < Ex1 > in = tester . input ( Ex1 . class , "ex1" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "ex1" ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setSid ( 0 ) ; ex1 . setValue ( 10 ) ; in . add ( ex1 ) ; ex1 . setSid ( 1 ) ; ex1 . setValue ( 20 ) ; in . add ( ex1 ) ; JobflowInfo info = DirectFlowCompiler . compile ( tester . analyzeFlow ( new StraightRendezvousFragments ( in . flow ( ) , out . flow ( ) ) ) , "simple" , "simple" , "com.example" , Location . fromPath ( HadoopDriver . RUNTIME_WORK_ROOT , '/' ) , tester . framework ( ) . getWork ( "build" ) , classpath , getClass ( ) . getClassLoader ( ) , FlowCompilerOptions . load ( System . getProperties ( ) ) ) ; assertThat ( tester . run ( info ) , is ( true ) ) ; List < Ex1 > results = out . toList ( ) ; assertThat ( results . size ( ) , is ( 1 ) ) ; assertThat ( results . get ( 0 ) . getValue ( ) , is ( 31 ) ) ; } @ Test public void compileWithSubmoduleJar ( ) throws Exception { List < File > classpath = Arrays . asList ( new File [ ] { DirectFlowCompiler . toLibraryPath ( ValueOption . class ) , DirectFlowCompiler . toLibraryPath ( Ex1 . class ) , } ) ; File jar = copy ( "" ) ; ClassLoader cl = new URLClassLoader ( new URL [ ] { jar . toURI ( ) . toURL ( ) } , getClass ( ) . getClassLoader ( ) ) ; TestInput < Ex1 > in = tester . input ( Ex1 . class , "ex1" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "ex1" ) ; JobflowInfo info = DirectFlowCompiler . compile ( tester . analyzeFlow ( new UpdateFlowSimple ( in . flow ( ) , out . flow ( ) ) ) , "simple" , "simple" , "com.example" , Location . fromPath ( HadoopDriver . RUNTIME_WORK_ROOT , '/' ) , tester . framework ( ) . | |
610 | <s> package com . asakusafw . thundergate . runtime . property ; public final class PathConstants { public static final String PATH_IMPORTER = "" ; public static final String PATH_EXPORTER = "" ; public static final | |
611 | <s> package net . sf . sveditor . core . templates ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; public class FSInStreamProvider implements ITemplateInStreamProvider { public InputStream openStream ( String path ) | |
612 | <s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . TempImportTarget2 ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class TempImportTarget2ModelInput implements ModelInput < TempImportTarget2 > { private final RecordParser parser ; public TempImportTarget2ModelInput ( RecordParser parser ) { if ( parser == null ) { throw new IllegalArgumentException ( ) ; } this . parser = parser ; } @ Override public boolean readTo ( TempImportTarget2 model ) throws | |
613 | <s> package de . fuberlin . wiwiss . d2rq . nodes ; import java . util . Collections ; import junit . framework . TestCase ; import com . hp . hpl . jena . datatypes . xsd . XSDDatatype ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . rdf . model . AnonId ; import com . hp . hpl . jena . rdf . model . ResourceFactory ; import com . hp . hpl . jena . vocabulary . RDF ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . expr . AttributeExpr ; import de . fuberlin . wiwiss . d2rq . expr . Equality ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . expr . SQLExpression ; import de . fuberlin . wiwiss . d2rq . map . TranslationTable ; import de . fuberlin . wiwiss . d2rq . sql . SQL ; import de . fuberlin . wiwiss . d2rq . values . BlankNodeID ; import de . fuberlin . wiwiss . d2rq . values . Pattern ; import de . fuberlin . wiwiss . d2rq . values . Translator ; public class NodeSetTest extends TestCase { private final static Attribute table1foo = SQL . parseAttribute ( "table1.foo" ) ; private final static Attribute table1bar = SQL . parseAttribute ( "table1.bar" ) ; private final static Attribute alias1foo = SQL . parseAttribute ( "" ) ; private final static BlankNodeID fooBlankNodeID = new BlankNodeID ( "Foo" , Collections . singletonList ( table1foo ) ) ; private final static BlankNodeID fooBlankNodeID2 = new BlankNodeID ( "Foo" , Collections . singletonList ( alias1foo ) ) ; private final static BlankNodeID barBlankNodeID = new BlankNodeID ( "Bar" , Collections . singletonList ( table1foo ) ) ; private final static Pattern pattern1 = new Pattern ( "" ) ; private final static Pattern pattern1aliased = new Pattern ( "" ) ; private final static Pattern pattern2 = new Pattern ( "" ) ; private final static Pattern pattern3 = new Pattern ( "" ) ; private final static Expression expression1 = SQLExpression . create ( "" ) ; private final static Expression expression2 = SQLExpression . create ( "" ) ; private NodeSetConstraintBuilder nodes ; public void setUp ( ) { nodes = new NodeSetConstraintBuilder ( ) ; } public void testInitiallyNotEmpty ( ) { assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitToURIsNotEmpty ( ) { nodes . limitToURIs ( ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitToLiteralsNotEmpty ( ) { nodes . limitToLiterals ( null , null ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitToBlankNodes ( ) { nodes . limitToBlankNodes ( ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitToFixedNodeNotEmpty ( ) { nodes . limitTo ( RDF . Nodes . type ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitToEmptySetIsEmpty ( ) { nodes . limitToEmptySet ( ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testLimitValuesToConstantNotEmpty ( ) { nodes . limitValues ( "foo" ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitValuesToAttributeNotEmpty ( ) { nodes . limitValuesToAttribute ( table1foo ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitValuesToPatternNotEmpty ( ) { nodes . limitValuesToPattern ( pattern1 ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitValuesToBlankNodeIDNotEmpty ( ) { nodes . limitValuesToBlankNodeID ( fooBlankNodeID ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testLimitValuesToExpressionNotEmpty ( ) { nodes . limitValuesToExpression ( expression1 ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testURIsAndLiteralsEmpty ( ) { nodes . limitToURIs ( ) ; nodes . limitToLiterals ( null , null ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testURIsAndBlanksEmpty ( ) { nodes . limitToURIs ( ) ; nodes . limitToBlankNodes ( ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testBlanksAndLiteralsEmpty ( ) { nodes . limitToBlankNodes ( ) ; nodes . limitToLiterals ( null , null ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentFixedBlanksEmpty ( ) { nodes . limitTo ( Node . createAnon ( new AnonId ( "foo" ) ) ) ; nodes . limitTo ( Node . createAnon ( new AnonId ( "bar" ) ) ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentFixedURIsEmpty ( ) { nodes . limitTo ( RDF . Nodes . type ) ; nodes . limitTo ( RDF . Nodes . Property ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentFixedLiteralsEmpty ( ) { nodes . limitTo ( Node . createLiteral ( "foo" ) ) ; nodes . limitTo ( Node . createLiteral ( "bar" ) ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentTypeFixedLiteralsEmpty ( ) { nodes . limitTo ( Node . createURI ( "" ) ) ; nodes . limitTo ( Node . createLiteral ( "" ) ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentConstantsEmpty ( ) { nodes . limitValues ( "foo" ) ; nodes . limitValues ( "bar" ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testFixedAndConstantEmpty ( ) { nodes . limitTo ( Node . createURI ( "" ) ) ; nodes . limitValues ( "foo" ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testFixedAndConstantNotEmpty ( ) { nodes . limitTo ( Node . createURI ( "" ) ) ; nodes . limitValues ( "" ) ; assertFalse ( nodes . isEmpty ( ) ) ; } public void testDifferentLanguagesEmpty ( ) { nodes . limitToLiterals ( "en" , null ) ; nodes . limitToLiterals ( "de" , null ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentLanguagesFixedEmpty ( ) { nodes . limitTo ( Node . createLiteral ( "foo" , "de" , null ) ) ; nodes . limitTo ( Node . createLiteral ( "foo" , "en" , null ) ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentDatatypesEmpty ( ) { nodes . limitToLiterals ( null , XSDDatatype . XSDstring ) ; nodes . limitToLiterals ( null , XSDDatatype . XSDinteger ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testDifferentDatatypesFixedEmpty ( ) { nodes . limitTo ( Node . createLiteral ( "42" , null , XSDDatatype . XSDstring ) ) ; nodes . limitTo ( Node . createLiteral ( "42" , null , XSDDatatype . XSDinteger ) ) ; assertTrue ( nodes . isEmpty ( ) ) ; } public void testSameAttributeTwiceNotEmpty ( ) { nodes . limitValuesToAttribute ( | |
614 | <s> package com . asakusafw . dmdl . java . emitter . driver ; import java . util . Collections ; import java . util . List ; import com . asakusafw . dmdl . java . emitter . EmitContext ; import com . asakusafw . dmdl . java . spi . JavaDataModelDriver ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . ModelSymbol ; import com . asakusafw . dmdl . semantics . trait . ProjectionsTrait ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Type ; public class ProjectionDriver extends JavaDataModelDriver { @ Override public List < Type > getInterfaces | |
615 | <s> package org . rubypeople . rdt . refactoring . core . encapsulatefield ; import org . eclipse . osgi . util . NLS ; public class Messages extends NLS { private static final String BUNDLE_NAME = "" ; public static String EncapsulateFieldConditionChecker_AlreadyExists ; public static String | |
616 | <s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . rubypeople . rdt . ui . PreferenceConstants ; class SmartTypingConfigurationBlock extends AbstractConfigurationBlock { public SmartTypingConfigurationBlock ( OverlayPreferenceStore store ) { super ( store ) ; store . addKeys ( createOverlayStoreKeys ( ) ) ; } private OverlayPreferenceStore . OverlayKey [ ] createOverlayStoreKeys ( ) { return new OverlayPreferenceStore . OverlayKey [ ] { new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_CLOSE_STRINGS ) , new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_CLOSE_BRACKETS ) , new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_CLOSE_BRACES ) , new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_END_STATEMENTS ) } ; } public Control createControl ( Composite parent ) { ScrolledPageContent scrolled = new ScrolledPageContent ( parent , SWT . H_SCROLL | SWT . V_SCROLL ) ; scrolled . setExpandHorizontal ( true ) ; scrolled . setExpandVertical ( true ) ; Composite control = new Composite ( scrolled , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; control . setLayout ( layout ) ; Composite composite ; composite = createSubsection ( control , null , PreferencesMessages . SmartTypingConfigurationBlock_autoclose_title ) ; addAutoclosingSection ( composite ) ; scrolled . setContent ( control ) ; final Point size = control . computeSize ( SWT . DEFAULT , SWT . DEFAULT ) ; scrolled . setMinSize ( size . x , size . y ) ; return scrolled ; } private void addAutoclosingSection ( Composite composite ) { GridLayout layout = new GridLayout ( | |
617 | <s> package net . sf . sveditor . core . db . index ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Set ; import java . util . regex . Pattern ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . SVFileUtils ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . ISVDBFileFactory ; 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 . SVDBFile ; import net . sf . sveditor . core . db . SVDBInclude ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . SVDBMarker . MarkerKind ; import net . sf . sveditor . core . db . SVDBMarker . MarkerType ; import net . sf . sveditor . core . db . SVDBPackageDecl ; import net . sf . sveditor . core . db . SVDBPreProcCond ; import net . sf . sveditor . core . db . SVDBPreProcObserver ; import net . sf . sveditor . core . db . SVDBTypeInfoEnum ; import net . sf . sveditor . core . db . SVDBTypeInfoEnumerator ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . db . refs . ISVDBRefFinder ; import net . sf . sveditor . core . db . refs . ISVDBRefMatcher ; import net . sf . sveditor . core . db . refs . SVDBFileRefCollector ; import net . sf . sveditor . core . db . refs . SVDBRefCacheEntry ; import net . sf . sveditor . core . db . refs . SVDBRefCacheItem ; import net . sf . sveditor . core . db . refs . SVDBRefFinder ; import net . sf . sveditor . core . db . refs . SVDBRefItem ; import net . sf . sveditor . core . db . search . ISVDBFindNameMatcher ; import net . sf . sveditor . core . db . search . SVDBSearchResult ; import net . sf . sveditor . core . db . stmt . SVDBTypedefStmt ; import net . sf . sveditor . core . log . ILogHandle ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . core . log . ILogLevelListener ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . preproc . SVPreProcDirectiveScanner ; import net . sf . sveditor . core . preproc . SVPreProcessor ; import net . sf . sveditor . core . scanner . FileContextSearchMacroProvider ; import net . sf . sveditor . core . scanner . IPreProcMacroProvider ; import net . sf . sveditor . core . scanner . SVFileTreeMacroProvider ; import net . sf . sveditor . core . scanner . SVPreProcDefineProvider ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . SubProgressMonitor ; public abstract class AbstractSVDBIndex implements ISVDBIndex , ISVDBRefFinder , ISVDBFileSystemChangeListener , ILogLevelListener , ILogLevel { private static final int IndexState_AllInvalid = 0 ; private static final int IndexState_RootFilesDiscovered = ( IndexState_AllInvalid + 1 ) ; private static final int IndexState_FilesPreProcessed = ( IndexState_RootFilesDiscovered + 1 ) ; private static final int IndexState_FileTreeValid = ( IndexState_FilesPreProcessed + 1 ) ; private static final int IndexState_AllFilesParsed = ( IndexState_FileTreeValid + 1 ) ; public String fProjectName ; private String fBaseLocation ; private String fResolvedBaseLocation ; private String fBaseLocationDir ; private SVDBBaseIndexCacheData fIndexCacheData ; private boolean fCacheDataValid ; protected Set < String > fMissingIncludes ; protected List < Tuple < String , List < String > > > fDeferredPkgCacheFiles ; private ISVDBIncludeFileProvider fIncludeFileProvider ; private List < ISVDBIndexChangeListener > fIndexChangeListeners ; protected static Pattern fWinPathPattern ; protected LogHandle fLog ; private ISVDBFileSystemProvider fFileSystemProvider ; protected boolean fLoadUpToDate ; private ISVDBIndexCache fCache ; private SVDBIndexConfig fConfig ; private Set < String > fFileDirs ; private int fMaxIndexThreads = 0 ; protected boolean fDebugEn ; protected boolean fInWorkspaceOk ; private int fIndexState ; protected boolean fAutoRebuildEn ; protected boolean fIsDirty ; static { fWinPathPattern = Pattern . compile ( "\\\\" ) ; } protected AbstractSVDBIndex ( String project ) { fIndexChangeListeners = new ArrayList < ISVDBIndexChangeListener > ( ) ; fProjectName = project ; fLog = LogFactory . getLogHandle ( getLogName ( ) ) ; fLog . addLogLevelListener ( this ) ; fDebugEn = fLog . isEnabled ( ) ; fMissingIncludes = new HashSet < String > ( ) ; fMaxIndexThreads = SVCorePlugin . getMaxIndexThreads ( ) ; fAutoRebuildEn = true ; fFileDirs = new HashSet < String > ( ) ; fDeferredPkgCacheFiles = new ArrayList < Tuple < String , List < String > > > ( ) ; } public AbstractSVDBIndex ( String project , String base_location , ISVDBFileSystemProvider fs_provider , ISVDBIndexCache cache , SVDBIndexConfig config ) { this ( project ) ; fBaseLocation = base_location ; fCache = cache ; fConfig = config ; setFileSystemProvider ( fs_provider ) ; fInWorkspaceOk = ( base_location . startsWith ( "" ) ) ; fAutoRebuildEn = true ; } public void logLevelChanged ( ILogHandle handle ) { fDebugEn = handle . isEnabled ( ) ; } public void setEnableAutoRebuild ( boolean en ) { fAutoRebuildEn = en ; } public boolean isDirty ( ) { return fIsDirty ; } protected abstract String getLogName ( ) ; @ SuppressWarnings ( "unchecked" ) protected boolean checkCacheValid ( ) { boolean valid = true ; String version = SVCorePlugin . getVersion ( ) ; if ( fDebugEn ) { fLog . debug ( "" + fIndexCacheData . getVersion ( ) + " version=" + version ) ; } if ( fIndexCacheData . getVersion ( ) == null || ! fIndexCacheData . getVersion ( ) . equals ( version ) ) { valid = false ; return valid ; } if ( fConfig != null ) { if ( fConfig . containsKey ( ISVDBIndexFactory . KEY_GlobalDefineMap ) ) { Map < String , String > define_map = ( Map < String , String > ) fConfig . get ( ISVDBIndexFactory . KEY_GlobalDefineMap ) ; if ( define_map . size ( ) != fIndexCacheData . getGlobalDefines ( ) . size ( ) ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MID , "" ) ; } valid = false ; } else { for ( Entry < String , String > e : define_map . entrySet ( ) ) { if ( fIndexCacheData . getGlobalDefines ( ) . containsKey ( e . getKey ( ) ) ) { if ( ! fIndexCacheData . getGlobalDefines ( ) . get ( e . getKey ( ) ) . equals ( e . getValue ( ) ) ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MID , "" + e . getKey ( ) + "" ) ; } valid = false ; break ; } } else { if ( fDebugEn ) { fLog . debug ( LEVEL_MID , "" + e . getKey ( ) + "" ) ; } valid = false ; break ; } } } } else if ( fIndexCacheData . getGlobalDefines ( ) . size ( ) > 0 ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MID , "" ) ; } valid = false ; } } if ( fCache . getFileList ( ) . size ( ) > 0 ) { for ( String path : fCache . getFileList ( ) ) { long fs_timestamp = fFileSystemProvider . getLastModifiedTime ( path ) ; long cache_timestamp = fCache . getLastModified ( path ) ; if ( fs_timestamp != cache_timestamp ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "" + path + ": file=" + fs_timestamp + " cache=" + cache_timestamp ) ; } valid = false ; break ; } } } else { if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "Cache " + getBaseLocation ( ) + "" ) ; } SVDBIndexFactoryUtils . setBaseProperties ( fConfig , this ) ; valid = false ; } if ( getCacheData ( ) . getMissingIncludeFiles ( ) . size ( ) > 0 && valid ) { if ( fDebugEn ) { fLog . debug ( "" ) ; } for ( String path : getCacheData ( ) . getMissingIncludeFiles ( ) ) { SVDBSearchResult < SVDBFile > res = findIncludedFile ( path ) ; if ( res != null ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "Cache " + getBaseLocation ( ) + "" + path ) ; } valid = false ; break ; } } } if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "" + getBaseLocation ( ) + " is " + ( ( valid ) ? "valid" : "invalid" ) ) ; } return valid ; } @ SuppressWarnings ( "unchecked" ) public void init ( IProgressMonitor monitor ) { SubProgressMonitor m ; monitor . beginTask ( "" + getBaseLocation ( ) , 100 ) ; m = new SubProgressMonitor ( monitor , 1 ) ; fIndexCacheData = createIndexCacheData ( ) ; fCacheDataValid = fCache . init ( m , fIndexCacheData ) ; if ( fCacheDataValid ) { fCacheDataValid = checkCacheValid ( ) ; } if ( fCacheDataValid ) { if ( fDebugEn ) { fLog . debug ( "" ) ; } fIndexState = IndexState_FileTreeValid ; if ( fIndexCacheData . getDeclCacheMap ( ) != null ) { for ( Entry < String , List < SVDBDeclCacheItem > > e : fIndexCacheData . getDeclCacheMap ( ) . entrySet ( ) ) { for ( SVDBDeclCacheItem i : e . getValue ( ) ) { i . init ( this ) ; } } } if ( fIndexCacheData . getPackageCacheMap ( ) != null ) { for ( Entry < String , List < SVDBDeclCacheItem > > e : fIndexCacheData . getPackageCacheMap ( ) . entrySet ( ) ) { for ( SVDBDeclCacheItem i : e . getValue ( ) ) { i . init ( this ) ; } } } if ( fIndexCacheData . getReferenceCacheMap ( ) != null ) { for ( Entry < String , SVDBRefCacheEntry > e : fIndexCacheData . getReferenceCacheMap ( ) . entrySet ( ) ) { e . getValue ( ) . setFilename ( e . getKey ( ) ) ; } } for ( String f : fCache . getFileList ( ) ) { addFileDir ( f ) ; } } else { if ( fDebugEn ) { fLog . debug ( "Cache " + getBaseLocation ( ) + " is invalid" ) ; } invalidateIndex ( m , "" , true ) ; } fIndexCacheData . setVersion ( SVCorePlugin . getVersion ( ) ) ; if ( fConfig != null && fConfig . containsKey ( ISVDBIndexFactory . KEY_GlobalDefineMap ) ) { Map < String , String > define_map = ( Map < String , String > ) fConfig . get ( ISVDBIndexFactory . KEY_GlobalDefineMap ) ; fIndexCacheData . clearGlobalDefines ( ) ; for ( String key : define_map . keySet ( ) ) { fIndexCacheData . setGlobalDefine ( key , define_map . get ( key ) ) ; } } monitor . done ( ) ; } public synchronized void loadIndex ( IProgressMonitor monitor ) { ensureIndexState ( monitor , IndexState_AllFilesParsed ) ; } public synchronized boolean isLoaded ( ) { return ( fIndexState >= IndexState_AllFilesParsed ) ; } public synchronized boolean isFileListLoaded ( ) { return ( fIndexState >= IndexState_FileTreeValid ) ; } public synchronized void ensureIndexState ( IProgressMonitor super_monitor , int state ) { SubProgressMonitor monitor = new SubProgressMonitor ( super_monitor , 1 ) ; monitor . beginTask ( "" + getBaseLocation ( ) , 4 ) ; if ( fIndexState < IndexState_RootFilesDiscovered && state >= IndexState_RootFilesDiscovered ) { if ( fDebugEn ) { fLog . debug ( "" + fIndexState ) ; } SubProgressMonitor m = new SubProgressMonitor ( monitor , 1 ) ; discoverRootFiles ( m ) ; fCache . sync ( ) ; fIndexState = IndexState_RootFilesDiscovered ; fIsDirty = false ; } if ( fIndexState < IndexState_FilesPreProcessed && state >= IndexState_FilesPreProcessed ) { if ( fDebugEn ) { fLog . debug ( "" + fIndexState ) ; } SubProgressMonitor m = new SubProgressMonitor ( monitor , 1 ) ; preProcessFiles ( m ) ; fIndexState = IndexState_FilesPreProcessed ; fIsDirty = false ; } if ( fIndexState < IndexState_FileTreeValid && state >= IndexState_FileTreeValid ) { if ( fDebugEn ) { fLog . debug ( "" + fIndexState ) ; } SubProgressMonitor m = new SubProgressMonitor ( monitor , 1 ) ; buildFileTree ( m ) ; fIndexState = IndexState_FileTreeValid ; propagateAllMarkers ( ) ; notifyIndexRebuilt ( ) ; fIsDirty = false ; } if ( fIndexState < IndexState_AllFilesParsed && state >= IndexState_AllFilesParsed ) { if ( fCacheDataValid ) { SubProgressMonitor m = new SubProgressMonitor ( monitor , 1 ) ; fCache . initLoad ( m ) ; m . done ( ) ; } else { parseFiles ( monitor ) ; } fIndexState = IndexState_AllFilesParsed ; fIsDirty = false ; synchronized ( fDeferredPkgCacheFiles ) { for ( Tuple < String , List < String > > e : fDeferredPkgCacheFiles ) { if ( e . second ( ) . size ( ) > 0 ) { fLog . debug ( "" + e . first ( ) + " not located" ) ; for ( String pkg : e . second ( ) ) { fLog . debug ( " Package: " + pkg ) ; } } } } } monitor . done ( ) ; } protected void parseFiles ( IProgressMonitor monitor ) { final List < String > paths = new ArrayList < String > ( ) ; fLog . debug ( LEVEL_MAX , "parseFiles" ) ; synchronized ( fCache ) { paths . addAll ( fCache . getFileList ( ) ) ; } final SubProgressMonitor m = new SubProgressMonitor ( monitor , 1 ) ; m . beginTask ( "" , paths . size ( ) ) ; int num_threads = Math . min ( fMaxIndexThreads , paths . size ( ) / 16 ) ; if ( fMaxIndexThreads <= 1 || num_threads <= 1 ) { parseFilesJob ( paths , m ) ; } else { Thread threads [ ] = new Thread [ num_threads ] ; for ( int i = 0 ; i < threads . length ; i ++ ) { threads [ i ] = new Thread ( new Runnable ( ) { public void run ( ) { parseFilesJob ( paths , m ) ; } } , "parse_" + getBaseLocation ( ) + "_" + i ) ; threads [ i ] . setPriority ( Thread . MAX_PRIORITY ) ; threads [ i ] . start ( ) ; } join_threads ( threads ) ; } m . done ( ) ; } protected void parseFilesJob ( List < String > paths , IProgressMonitor monitor ) { while ( true ) { String path = null ; synchronized ( paths ) { if ( paths . size ( ) > 0 ) { path = paths . remove ( 0 ) ; } } if ( path == null ) { break ; } SVDBFile ret ; synchronized ( fCache ) { ret = fCache . getFile ( new NullProgressMonitor ( ) , path ) ; } if ( ret == null ) { SVDBFileTree ft_root ; synchronized ( fCache ) { ft_root = fCache . getFileTree ( new NullProgressMonitor ( ) , path ) ; } if ( ft_root == null ) { try { throw new Exception ( ) ; } catch ( Exception e ) { fLog . error ( "File Path \"" + path + "" + getBaseLocation ( ) , e ) ; for ( String p : getFileList ( new NullProgressMonitor ( ) ) ) { fLog . error ( "path: " + p ) ; } } } if ( ft_root != null ) { IPreProcMacroProvider mp = createMacroProvider ( ft_root ) ; processFile ( ft_root , mp ) ; } synchronized ( fCache ) { ret = fCache . getFile ( new NullProgressMonitor ( ) , path ) ; } } synchronized ( monitor ) { monitor . worked ( 1 ) ; } } } protected void invalidateIndex ( IProgressMonitor monitor , String reason , boolean force ) { if ( fDebugEn ) { if ( fAutoRebuildEn || force ) { fLog . debug ( LEVEL_MIN , "" + ( ( reason == null ) ? "" : reason ) ) ; } else { fLog . debug ( LEVEL_MIN , "" + ( ( reason == null ) ? "" : reason ) + "" ) ; } } if ( fAutoRebuildEn || force ) { fIndexState = IndexState_AllInvalid ; fCacheDataValid = false ; fIndexCacheData . clear ( ) ; fCache . clear ( monitor ) ; fMissingIncludes . clear ( ) ; fDeferredPkgCacheFiles . clear ( ) ; } else { fIsDirty = true ; } } public void rebuildIndex ( IProgressMonitor monitor ) { invalidateIndex ( monitor , "" , true ) ; } public ISVDBIndexCache getCache ( ) { return fCache ; } public SVDBIndexConfig getConfig ( ) { return fConfig ; } protected SVDBBaseIndexCacheData getCacheData ( ) { return fIndexCacheData ; } public void setFileSystemProvider ( ISVDBFileSystemProvider fs_provider ) { if ( fFileSystemProvider != null && fs_provider != fFileSystemProvider ) { fFileSystemProvider . removeFileSystemChangeListener ( this ) ; } fFileSystemProvider = fs_provider ; if ( fFileSystemProvider != null ) { fFileSystemProvider . init ( getResolvedBaseLocationDir ( ) ) ; fFileSystemProvider . addFileSystemChangeListener ( this ) ; } } public ISVDBFileSystemProvider getFileSystemProvider ( ) { return fFileSystemProvider ; } public void fileChanged ( String path ) { synchronized ( fCache ) { if ( fCache . getFileList ( ) . contains ( path ) ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "" + path ) ; } fCache . setFile ( path , null ) ; fCache . setLastModified ( path , getFileSystemProvider ( ) . getLastModifiedTime ( path ) ) ; } } } public void fileRemoved ( String path ) { synchronized ( fCache ) { if ( fCache . getFileList ( ) . contains ( path ) ) { invalidateIndex ( new NullProgressMonitor ( ) , "File Removed" , false ) ; } } } public void fileAdded ( String path ) { File f = new File ( path ) ; File p = f . getParentFile ( ) ; if ( fDebugEn ) { fLog . debug ( LEVEL_MIN , "fileAdded: " + path ) ; } if ( fFileDirs . contains ( p . getPath ( ) ) ) { invalidateIndex ( new NullProgressMonitor ( ) , "File Added" , false ) ; } } public String getBaseLocation ( ) { return fBaseLocation ; } public String getProject ( ) { return fProjectName ; } public String getResolvedBaseLocation ( ) { if ( fResolvedBaseLocation == null ) { fResolvedBaseLocation = SVDBIndexUtil . expandVars ( fBaseLocation , fProjectName , fInWorkspaceOk ) ; } return fResolvedBaseLocation ; } public String getResolvedBaseLocationDir ( ) { if ( fBaseLocationDir == null ) { String base_location = getResolvedBaseLocation ( ) ; if ( fDebugEn ) { fLog . debug ( "" + base_location ) ; } if ( fFileSystemProvider . isDir ( base_location ) ) { if ( fDebugEn ) { fLog . debug ( "" + base_location + " is_dir" ) ; } fBaseLocationDir = base_location ; } else { if ( fDebugEn ) { fLog . debug ( "" + base_location + " not_dir" ) ; } fBaseLocationDir = SVFileUtils . getPathParent ( base_location ) ; if ( fDebugEn ) { fLog . debug ( "" + base_location + ": " + fBaseLocationDir ) ; } } } return fBaseLocationDir ; } public void setGlobalDefine ( String key , String val ) { if ( fDebugEn ) { fLog . debug ( LEVEL_MID , "" + key + ", " + val + ")" ) ; } fIndexCacheData . setGlobalDefine ( key , val ) ; if ( ! fIndexCacheData . getGlobalDefines ( ) . containsKey ( key ) || ! fIndexCacheData . getGlobalDefines ( ) . get ( key ) . equals ( val ) ) { rebuildIndex ( new NullProgressMonitor ( ) ) ; } } public void clearGlobalDefines ( ) { fIndexCacheData . clearGlobalDefines ( ) ; } protected void clearDefines ( ) { fIndexCacheData . clearDefines ( ) ; } protected void addDefine ( String key , String val ) { fIndexCacheData . addDefine ( key , val ) ; } protected void clearIncludePaths ( ) { fIndexCacheData . clearIncludePaths ( ) ; } protected void addIncludePath ( String path ) { fIndexCacheData . addIncludePath ( path ) ; } public Iterable < String > getFileList ( IProgressMonitor monitor ) { ensureIndexState ( monitor , IndexState_FileTreeValid ) ; return fCache . getFileList ( ) ; } public SVDBFile findFile ( IProgressMonitor monitor , String path ) { String r_path = path ; SVDBFile ret = null ; ensureIndexState ( monitor , IndexState_FileTreeValid ) ; for ( String fmt : new String [ ] { null , ISVDBFileSystemProvider . PATHFMT_WORKSPACE , ISVDBFileSystemProvider . PATHFMT_FILESYSTEM } ) { if ( fmt != null ) { r_path = fFileSystemProvider . resolvePath ( path , fmt ) ; } synchronized ( fCache ) { ret = fCache . getFile ( monitor , r_path ) ; } if ( ret != null ) { break ; } } if ( ret == null ) { SVDBFileTree ft_root ; synchronized ( fCache ) { ft_root = fCache . getFileTree ( monitor , path ) ; } if ( ft_root != null ) { IPreProcMacroProvider mp = createMacroProvider ( ft_root ) ; processFile ( ft_root , mp ) ; synchronized ( fCache ) { ret = fCache . getFile ( monitor , path ) ; } } else { } } return ret ; } public SVDBFile findPreProcFile ( IProgressMonitor monitor , String path ) { String r_path = path ; SVDBFile file = null ; ensureIndexState ( monitor , IndexState_FileTreeValid ) ; for ( String fmt : new String [ ] { null , ISVDBFileSystemProvider . PATHFMT_WORKSPACE , ISVDBFileSystemProvider . PATHFMT_FILESYSTEM } ) { if ( fmt != null ) { r_path = fFileSystemProvider . resolvePath ( path , fmt ) ; } file = fCache . getPreProcFile ( new NullProgressMonitor ( ) , r_path ) ; if ( file != null ) { break ; } } return file ; } public synchronized List < SVDBMarker > getMarkers ( String path ) { findFile ( path ) ; return fCache . getMarkers ( path ) ; } protected void addFile ( String path ) { synchronized ( fCache ) { fCache . addFile ( path ) ; fCache . setLastModified ( path , getFileSystemProvider ( ) . getLastModifiedTime ( path ) ) ; } addFileDir ( path ) ; } protected void addFileDir ( String file_path ) { File f = new File ( file_path ) ; File p = f . getParentFile ( ) ; if ( p != null && ! fFileDirs . contains ( p . getPath ( ) ) ) { fFileDirs . add ( p . getPath ( ) ) ; } } protected void clearFilesList ( ) { fCache . clear ( new NullProgressMonitor ( ) ) ; fFileDirs . clear ( ) ; } protected void propagateAllMarkers ( ) { Set < String > file_list = fCache . getFileList ( ) ; for ( String path : file_list ) { if ( path != null ) { propagateMarkers ( path ) ; } } } protected void propagateMarkers ( String path ) { List < SVDBMarker > ml = fCache . getMarkers ( path ) ; getFileSystemProvider ( ) . clearMarkers ( path ) ; if ( ml != null ) { for ( SVDBMarker m : ml ) { String type = null ; switch ( m . getMarkerType ( ) ) { case Info : type = ISVDBFileSystemProvider . MARKER_TYPE_INFO ; break ; case Warning : type = ISVDBFileSystemProvider . MARKER_TYPE_WARNING ; break ; case Error : type = ISVDBFileSystemProvider . MARKER_TYPE_ERROR ; break ; } getFileSystemProvider ( ) . addMarker ( path , type , m . getLocation ( ) . getLine ( ) , m . getMessage ( ) ) ; } } } protected SVDBBaseIndexCacheData createIndexCacheData ( ) { return new SVDBBaseIndexCacheData ( getBaseLocation ( ) ) ; } protected abstract void discoverRootFiles ( IProgressMonitor monitor ) ; protected void preProcessFiles ( final IProgressMonitor monitor ) { final List < String > paths = new ArrayList < String > ( ) ; synchronized ( fCache ) { paths . addAll ( fCache . getFileList ( ) ) ; } monitor . beginTask ( "" , paths . size ( ) ) ; int num_threads = Math . min ( fMaxIndexThreads , paths . size ( ) / 16 ) ; if ( fMaxIndexThreads <= 1 || num_threads <= 1 ) { preProcessFilesJob ( paths , monitor ) ; } else { Thread threads [ ] = new Thread [ num_threads ] ; for ( int i = 0 ; i < threads . length ; i ++ ) { threads [ i ] = new Thread ( new Runnable ( ) { public void run ( ) { preProcessFilesJob ( paths , monitor ) ; } } ) ; threads [ i ] . start ( ) ; } join_threads ( threads ) ; } monitor . done ( ) ; } private void join_threads ( Thread threads [ ] ) { for ( int i = 0 ; i < threads . length ; i ++ ) { if ( threads [ i ] . isAlive ( ) ) { try { threads [ i ] . join ( ) ; } catch ( InterruptedException e ) { } } } } protected void preProcessFilesJob ( List < String > paths , IProgressMonitor monitor ) { while ( true ) { String path = null ; synchronized ( paths ) { if ( paths . size ( ) > 0 ) { path = paths . remove ( 0 ) ; } } if ( path == null ) { break ; } SubProgressMonitor m = null ; synchronized ( monitor ) { m = new SubProgressMonitor ( monitor , 1 ) ; m . beginTask ( "Process " + path , 1 ) ; } SVDBFile file = processPreProcFile ( path ) ; synchronized ( fCache ) { fCache . setPreProcFile ( path , file ) ; fCache . setLastModified ( path , fFileSystemProvider . getLastModifiedTime ( path ) ) ; } synchronized ( monitor ) { m . done ( ) ; } } } protected void buildFileTree ( final IProgressMonitor monitor ) { final List < String > paths = new ArrayList < String > ( ) ; paths . addAll ( getCache ( ) . getFileList ( ) ) ; final List < String > missing_includes = new ArrayList < String > ( ) ; fLog . debug ( LEVEL_MAX , "" ) ; monitor . beginTask ( "" , paths . size ( ) ) ; int num_threads = Math . min ( fMaxIndexThreads , paths . size ( ) / 16 ) ; if ( fMaxIndexThreads <= 1 || num_threads <= 1 ) { buildFileTreeJob ( paths , missing_includes , monitor ) ; } else { Thread threads [ ] = new Thread [ num_threads ] ; for ( int i = 0 ; i < threads . length ; i ++ ) { threads [ i ] = new Thread ( new Runnable ( ) { public void run ( ) { buildFileTreeJob ( paths , missing_includes , monitor ) ; } } , "file_tree-" + getBaseLocation ( ) + "-" + i ) ; threads [ i ] . start ( ) ; } boolean threads_alive = true ; while ( threads_alive ) { threads_alive = false ; for ( int i = 0 ; i < threads . length ; i ++ ) { if ( threads [ i ] . isAlive ( ) ) { try { threads [ i ] . join ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; threads_alive = true ; } } } } } getCacheData ( ) . clearMissingIncludeFiles ( ) ; for ( String path : missing_includes ) { getCacheData ( ) . addMissingIncludeFile ( path ) ; } monitor . done ( ) ; } protected void buildFileTreeJob ( List < String > paths , List < String > missing_includes , IProgressMonitor monitor ) { while ( true ) { String path = null ; synchronized ( paths ) { if ( paths . size ( ) > 0 ) { path = paths . remove ( 0 ) ; } } if ( path == null ) { break ; } synchronized ( fCache ) { if ( fCache . getFileTree ( new NullProgressMonitor ( ) , path ) != null ) { continue ; } } SVDBFile pp_file ; synchronized ( fCache ) { pp_file = fCache . getPreProcFile ( new NullProgressMonitor ( ) , path ) ; } if ( pp_file == null ) { fLog . error ( "" + path + "\" from cache" ) ; } else { SVDBFileTree ft_root = new SVDBFileTree ( ( SVDBFile ) pp_file . duplicate ( ) ) ; Set < String > included_files = new HashSet < String > ( ) ; Map < String , SVDBFileTree > working_set = new HashMap < String , SVDBFileTree > ( ) ; buildPreProcFileMap ( null , ft_root , missing_includes , included_files , working_set ) ; } } } protected void buildPreProcFileMap ( SVDBFileTree parent , SVDBFileTree root , List < String > missing_includes , Set < String > included_files , Map < String , SVDBFileTree > working_set ) { SVDBFileTreeUtils ft_utils = new SVDBFileTreeUtils ( ) ; if ( fDebugEn ) { fLog . debug ( "setFileTree " + root . getFilePath ( ) ) ; } if ( ! working_set . containsKey ( root . getFilePath ( ) ) ) { working_set . put ( root . getFilePath ( ) , root ) ; } synchronized ( fCache ) { if ( ! working_set . containsKey ( root . getFilePath ( ) ) ) { System . out . println ( "FileTree " + root . getFilePath ( ) + "" ) ; } fCache . setFileTree ( root . getFilePath ( ) , root ) ; } if ( parent != null ) { root . getIncludedByFiles ( ) . add ( parent . getFilePath ( ) ) ; } synchronized ( root ) { ft_utils . resolveConditionals ( root , new SVPreProcDefineProvider ( createPreProcMacroProvider ( root , working_set ) ) ) ; } List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; included_files . add ( root . getFilePath ( ) ) ; addPreProcFileIncludeFiles ( root , root . getSVDBFile ( ) , markers , missing_includes , included_files , working_set ) ; synchronized ( fCache ) { fCache . setFileTree ( root . getFilePath ( ) , root ) ; fCache . setMarkers ( root . getFilePath ( ) , markers ) ; } } private void addPreProcFileIncludeFiles ( SVDBFileTree root , ISVDBScopeItem scope , List < SVDBMarker > markers , List < String > missing_includes , Set < String > included_files , Map < String , SVDBFileTree > working_set ) { for ( int i = 0 ; i < scope . getItems ( ) . size ( ) ; i ++ ) { ISVDBItemBase it = scope . getItems ( ) . get ( i ) ; if ( it . getType ( ) == SVDBItemType . Include ) { if ( fDebugEn ) { fLog . debug ( "" + ( ( ISVDBNamedItem ) it ) . getName ( ) ) ; } SVDBSearchResult < SVDBFile > f = findIncludedFileGlobal ( ( ( ISVDBNamedItem ) it ) . getName ( ) ) ; if ( f != null ) { if ( fDebugEn ) { fLog . debug ( "" + ( ( ISVDBNamedItem ) it ) . getName ( ) + "\" in index \"" + f . getIndex ( ) . getBaseLocation ( ) + "\"" ) ; } String file_path = f . getItem ( ) . getFilePath ( ) ; if ( fDebugEn ) { fLog . debug ( "" + file_path + "" + root . getFilePath ( ) + "\"" ) ; } SVDBFileTree ft = new SVDBFileTree ( ( SVDBFile ) f . getItem ( ) . duplicate ( ) ) ; root . addIncludedFile ( ft . getFilePath ( ) ) ; if ( fDebugEn ) { fLog . debug ( " Now has " + ft . getIncludedFiles ( ) . size ( ) + "" ) ; } if ( ! included_files . contains ( f . getItem ( ) . getFilePath ( ) ) ) { buildPreProcFileMap ( root , ft , missing_includes , included_files , working_set ) ; } } else { String missing_path = ( ( ISVDBNamedItem ) it ) . getName ( ) ; if ( fDebugEn ) { fLog . debug ( "" + missing_path + "" + root . getFilePath ( ) + ")" ) ; } synchronized ( missing_includes ) { if ( ! missing_includes . contains ( missing_path ) ) { missing_includes . add ( missing_path ) ; } } SVDBFileTree ft = new SVDBFileTree ( SVDBItem . getName ( it ) ) ; root . addIncludedFile ( ft . getFilePath ( ) ) ; ft . getIncludedByFiles ( ) . add ( root . getFilePath ( ) ) ; SVDBMarker err = new SVDBMarker ( MarkerType . Error , MarkerKind . MissingInclude , "" + ( ( ISVDBNamedItem ) it ) . getName ( ) + "\"" ) ; err . setLocation ( it . getLocation ( ) ) ; markers . add ( err ) ; } } else if ( it instanceof ISVDBScopeItem ) { addPreProcFileIncludeFiles ( root , ( ISVDBScopeItem ) it , markers , missing_includes , included_files , working_set ) ; } } } public SVDBSearchResult < SVDBFile > findIncludedFile ( String path ) { SVDBFile file = null ; if ( fDebugEn ) { fLog . debug ( "" + path ) ; } if ( fDebugEn ) { fLog . debug ( "" ) ; } for ( String inc_dir : fIndexCacheData . getIncludePaths ( ) ) { String inc_path = resolvePath ( inc_dir + "/" + path , fInWorkspaceOk ) ; if ( fDebugEn ) { fLog . debug ( "" + inc_path + "\"" ) ; } if ( ( file = fCache . getPreProcFile ( new NullProgressMonitor ( ) , inc_path ) ) != null ) { if ( fDebugEn ) { fLog . debug ( "" + inc_path + "" ) ; } break ; } } if ( file != null ) { if ( fDebugEn ) { fLog . debug ( "" ) ; } return new SVDBSearchResult < SVDBFile > ( file , this ) ; } for ( String inc_dir : fIndexCacheData . getIncludePaths ( ) ) { String inc_path = resolvePath ( inc_dir + "/" + path , fInWorkspaceOk ) ; if ( fFileSystemProvider . fileExists ( inc_path ) ) { if ( fDebugEn ) { fLog . debug ( "" + inc_path + "\"" ) ; } file = processPreProcFile ( inc_path ) ; addFile ( inc_path ) ; fCache . setPreProcFile ( inc_path , file ) ; fCache . setLastModified ( inc_path , fFileSystemProvider . getLastModifiedTime ( inc_path ) ) ; break ; } else { if ( fDebugEn ) { fLog . debug ( "" + inc_path + "" ) ; } } } if ( file != null ) { if ( fDebugEn ) { fLog . debug ( "" ) ; } return new SVDBSearchResult < SVDBFile > ( file , this ) ; } String res_path = resolvePath ( path , fInWorkspaceOk ) ; if ( fFileSystemProvider . fileExists ( res_path ) ) { SVDBFile pp_file = null ; if ( ( pp_file = processPreProcFile ( res_path ) ) != null ) { if ( fDebugEn ) { fLog . debug ( "" + path + "\"" ) ; } addFile ( res_path ) ; return new SVDBSearchResult < SVDBFile > ( pp_file , this ) ; } } return null ; } protected String resolvePath ( String path_orig , boolean in_workspace_ok ) { String path = path_orig ; String norm_path = null ; if ( fDebugEn ) { fLog . debug ( "" + path_orig ) ; } if ( path . startsWith ( ".." ) ) { if ( fDebugEn ) { fLog . debug ( "" ) ; } if ( ( norm_path = resolveRelativePath ( getResolvedBaseLocationDir ( ) , path ) ) == null ) { for ( String inc_path : fIndexCacheData . getIncludePaths ( ) ) { if ( fDebugEn ) { fLog . debug ( " Check: " + inc_path + " ; " + path ) ; } if ( ( norm_path = resolveRelativePath ( inc_path , path ) ) != null ) { break ; } } } else { if ( fDebugEn ) { fLog . debug ( "norm_path=" + norm_path ) ; } } } else { if ( path . equals ( "." ) ) { path = getResolvedBaseLocationDir ( ) ; } else if ( path . startsWith ( "." ) ) { path = getResolvedBaseLocationDir ( ) + "/" + path . substring ( 2 ) ; } else { if ( ! fFileSystemProvider . fileExists ( path ) ) { String imp_path = getResolvedBaseLocationDir ( ) + "/" + path ; if ( fFileSystemProvider . fileExists ( imp_path ) ) { path = imp_path ; } } } norm_path = normalizePath ( path ) ; } if ( norm_path != null && ! norm_path . startsWith ( "" ) && in_workspace_ok ) { IWorkspaceRoot ws_root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IFile file = ws_root . getFileForLocation ( new Path ( norm_path ) ) ; if ( file != null && file . exists ( ) ) { norm_path = "" + file . getFullPath ( ) . toOSString ( ) ; } } return ( norm_path != null ) ? norm_path : path_orig ; } private String resolveRelativePath ( String base , String path ) { String norm_path = normalizePath ( base + "/" + path ) ; if ( fDebugEn ) { fLog . debug ( "" + norm_path + "" + getResolvedBaseLocationDir ( ) ) ; } if ( fFileSystemProvider . fileExists ( norm_path ) ) { return norm_path ; } else if ( getBaseLocation ( ) . startsWith ( "" ) ) { String base_loc = getResolvedBaseLocationDir ( ) ; if ( fDebugEn ) { fLog . debug ( "" + base_loc ) ; } base_loc = base_loc . substring ( "" . length ( ) ) ; if ( fDebugEn ) { fLog . debug ( "" + base_loc ) ; } IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IContainer base_dir = null ; try { base_dir = root . getFolder ( new Path ( base_loc ) ) ; } catch ( IllegalArgumentException e ) { } if ( base_dir == null ) { if ( base_loc . length ( ) > 0 ) { base_dir = root . getProject ( base_loc . substring ( 1 ) ) ; } } if ( fDebugEn ) { fLog . debug ( "base_dir=" + base_dir ) ; } if ( base_dir != null && base_dir . exists ( ) ) { IPath base_dir_p = base_dir . getLocation ( ) ; if ( base_dir_p != null ) { File path_f_t = new File ( base_dir_p . toFile ( ) , path ) ; try { if ( path_f_t . exists ( ) ) { if ( fDebugEn ) { fLog . debug ( "" + path_f_t . getCanonicalPath ( | |
618 | <s> package com . asakusafw . compiler . flow . testing . external ; import java . util . Collections ; import java . util . Set ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . compiler . testing | |
619 | <s> package de . fuberlin . wiwiss . d2rq . server ; import org . joseki . DatasetDesc ; import org . joseki . Request ; import org . joseki . Response ; import com . hp . hpl . jena . query . Dataset ; public class D2RQDatasetDesc extends DatasetDesc { private AutoReloadableDataset dataset ; public D2RQDatasetDesc ( AutoReloadableDataset dataset ) { super ( null ) ; this . dataset = dataset ; } @ Override public Dataset acquireDataset ( Request request , Response response ) { | |
620 | <s> package com . asakusafw . dmdl . thundergate . driver ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . apache . hadoop . io . Text ; import org . junit . Before ; import org . junit . Test ; import com . asakusafw . dmdl . thundergate . GeneratorTesterRoot ; import com . asakusafw . thundergate . runtime . cache . ThunderGateCacheSupport ; public class CacheSupportEmitterTest extends GeneratorTesterRoot { @ Before public void setUp ( ) throws Exception { emitDrivers . add ( new CacheSupportEmitter ( ) ) ; } @ Test public void cache ( ) { ModelLoader loaded = generateJava ( "cache" ) ; ModelWrapper model = loaded . newModel ( "Model" ) ; assertThat ( model . unwrap ( ) , is ( instanceOf ( ThunderGateCacheSupport . class ) ) ) ; ThunderGateCacheSupport support = ( ThunderGateCacheSupport ) model . unwrap ( ) ; model . set ( "sid" , 100L ) ; assertThat ( support . __tgc__SystemId ( ) , is ( 100L ) ) ; assertThat ( support . __tgc__TimestampColumn ( ) , is ( "" ) ) ; assertThat ( support . __tgc__Deleted ( ) , is ( false ) ) ; } @ Test public void cache_no ( ) { ModelLoader loaded = generateJava ( "cache_no" ) ; ModelWrapper model = loaded . newModel ( "Model" ) ; assertThat ( model . unwrap ( ) , not ( instanceOf ( ThunderGateCacheSupport . class ) ) ) ; } @ Test public void cache_delete ( ) { ModelLoader loaded = generateJava ( "cache_delete" ) ; ModelWrapper model = loaded . newModel ( "Model" ) ; assertThat ( model . unwrap ( ) , is ( instanceOf ( ThunderGateCacheSupport . class ) ) ) ; ThunderGateCacheSupport support = ( ThunderGateCacheSupport ) model . unwrap ( ) ; model . set ( "" , new Text ( "Y" ) ) ; assertThat ( support . __tgc__Deleted ( ) , is ( true ) ) ; model . set | |
621 | <s> package org . oddjob . jmx . server ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . Notification ; import javax . management . ObjectName ; import junit . framework . TestCase ; import org . oddjob . Helper ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . MockClientHandlerResolver ; public class OddjobMBeanToolkitTest extends TestCase { private class OurServerSession extends MockServerSession { @ Override public ObjectName nameFor ( Object object ) { return OddjobMBeanFactory . objectName ( 0 ) ; } } private class OurServerContext extends MockServerContext { OurSIMF simf = new OurSIMF ( ) ; @ Override public ServerModel getModel ( ) { return new MockServerModel ( ) { @ Override public ServerInterfaceManagerFactory getInterfaceManagerFactory ( ) { return new ServerInterfaceManagerFactoryImpl ( new ServerInterfaceHandlerFactory < ? , ? > [ ] { simf } ) ; } } ; } } private interface Gold { } private class OurSIMF extends MockServerInterfaceHandlerFactory < Object , Gold > { ServerSideToolkit toolkit ; @ Override public ServerInterfaceHandler createServerHandler ( Object target , ServerSideToolkit toolkit ) { this . toolkit = toolkit ; return new MockServerInterfaceHandler ( ) ; } @ Override public Class < Object > interfaceClass ( ) { return Object . class ; } @ Override public ClientHandlerResolver < Gold > clientHandlerFactory ( ) { return new MockClientHandlerResolver < Gold > ( ) ; } @ Override public MBeanAttributeInfo [ ] getMBeanAttributeInfo ( ) { return new MBeanAttributeInfo [ 0 ] ; } @ Override public MBeanNotificationInfo [ ] getMBeanNotificationInfo ( ) { return new MBeanNotificationInfo [ 0 ] ; } @ Override public | |
622 | <s> package org . rubypeople . rdt . internal . core . search . matching ; import java . io . IOException ; import org . rubypeople . rdt . core . Flags ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . core . index . EntryResult ; import org . rubypeople . rdt . internal . core . index . Index ; import org . rubypeople . rdt . internal . core . search . indexing . IIndexConstants ; import org . rubypeople . rdt . internal . core . util . CharOperation ; public class TypeDeclarationPattern extends RubySearchPattern implements IIndexConstants { public char [ ] simpleName ; public char [ ] pkg ; public char [ ] [ ] enclosingTypeNames ; public char typeSuffix ; public int modifiers ; public boolean secondary = false ; protected static char [ ] [ ] CATEGORIES = { TYPE_DECL } ; static PackageNameSet internedPackageNames = new PackageNameSet ( 1001 ) ; static class PackageNameSet { public char [ ] [ ] names ; public int elementSize ; public int threshold ; PackageNameSet ( int size ) { this . elementSize = 0 ; this . threshold = size ; int extraRoom = ( int ) ( size * 1.5f ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . names = new char [ extraRoom ] [ ] ; } char [ ] add ( char [ ] name ) { int length = names . length ; int index = CharOperation . hashCode ( name ) % length ; char [ ] current ; while ( ( current = names [ index ] ) != null ) { if ( CharOperation . equals ( current , name ) ) return current ; if ( ++ index == length ) index = 0 ; } names [ index ] = name ; if ( ++ elementSize > threshold ) rehash ( ) ; return name ; } void rehash ( ) { PackageNameSet newSet = new PackageNameSet ( elementSize * 2 ) ; char [ ] current ; for ( int i = names . length ; -- i >= 0 ; ) if ( ( current = names [ i ] ) != null ) newSet . add ( current ) ; this . names = newSet . names ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } } public static char [ ] createIndexKey ( int modifiers , char [ ] typeName , char [ ] packageName , char [ ] [ ] enclosingTypeNames , boolean secondary ) { int typeNameLength = typeName == null ? 0 : typeName . length ; int packageLength = packageName == null ? 0 : packageName . length ; int enclosingNamesLength = 0 ; if ( enclosingTypeNames != null ) { for ( int i = 0 , length = enclosingTypeNames . length ; i < length ; ) { enclosingNamesLength += enclosingTypeNames [ i ] . length ; if ( ++ i < length ) enclosingNamesLength += 2 ; } } int resultLength = typeNameLength + packageLength + enclosingNamesLength + 5 ; if ( secondary ) resultLength += 2 ; char [ ] result = new char [ resultLength ] ; int pos = 0 ; if ( typeNameLength | |
623 | <s> package com . melloware . jintellitype ; import java . util . Properties ; @ SuppressWarnings ( "" ) public final class Main { private Main ( ) { } public static void main ( String [ ] argv ) { System . out . println ( "" + getProjectVersion ( ) + "\"" ) ; System . out . println ( " " ) ; System . out . println ( "" + System . getProperty ( "java.version" ) + "\"" + " (build " + System . getProperty ( "" ) + ")" + " from " + System . getProperty ( "java.vendor" ) ) ; System . out . println ( "" + System . getProperty ( "os.name" ) + "\"" + " version " + System . getProperty ( "os.version" ) + " on " + System . getProperty ( "os.arch" ) ) ; System . out . println ( | |
624 | <s> package org . rubypeople . rdt . refactoring . nodewrapper ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . DAsgnNode ; import org . jruby . ast . DVarNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class LocalNodeWrapper implements INodeWrapper { public static final int INVALID_ID = - 1 ; public static final int LOCAL_ASGN_VAR_NODE = 1 ; public static final int LOCAL_VAR_NODE = 2 ; public static final int D_VAR_NODE = 3 ; public static final int D_ASGN_NODE = 4 ; public static final Class [ ] LOCAL_NODES_CLASSES = { LocalAsgnNode . class , LocalVarNode . class , DVarNode . class , DAsgnNode . class } ; private Node wrappedNode ; private int nodeType ; private Node valueNode ; private String name ; private int id ; public LocalNodeWrapper ( Node node ) { id = INVALID_ID ; if ( NodeUtil . nodeAssignableFrom ( node , LocalVarNode . class ) ) { id = ( ( LocalVarNode ) node ) . getIndex ( ) ; name = ( ( LocalVarNode ) node ) . getName ( ) ; nodeType = LOCAL_VAR_NODE ; } else if ( NodeUtil . nodeAssignableFrom ( node , LocalAsgnNode . class ) ) { LocalAsgnNode localAsgnNode = ( LocalAsgnNode ) node ; id = localAsgnNode . getIndex ( ) ; name = localAsgnNode . getName ( ) ; nodeType = LOCAL_ASGN_VAR_NODE ; valueNode = localAsgnNode . getValueNode ( ) ; } else if ( NodeUtil . nodeAssignableFrom ( node , DAsgnNode . class ) ) { DAsgnNode dAsgnNode = ( DAsgnNode ) node ; name = dAsgnNode . getName ( ) ; nodeType = D_ASGN_NODE ; valueNode = dAsgnNode . getValueNode ( ) ; } else if ( NodeUtil . nodeAssignableFrom ( node , DVarNode . class ) ) { DVarNode dVarNode = ( DVarNode ) node ; name = dVarNode . getName ( ) ; nodeType = D_VAR_NODE ; } wrappedNode = node ; } public Node getWrappedNode ( ) { return wrappedNode ; } public boolean hasValidId ( ) { return id != INVALID_ID ; } public int getId ( ) { return id ; } public int getNodeType | |
625 | <s> package org . rubypeople . rdt . internal . ui . preferences . formatter ; import java . util . Map ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . MarginPainter ; import org . eclipse . jface . text . source . SourceViewer ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . graphics . Font ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . texteditor . AbstractDecoratedTextEditorPreferenceConstants ; import org . eclipse . ui . texteditor . ChainedPreferenceStore ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubySourceViewer ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . internal . ui . text . SimpleRubySourceViewerConfiguration ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . RubyTextTools ; public abstract class RubyPreview { private final class RubySourcePreviewerUpdater { final IPropertyChangeListener fontListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { if ( event . getProperty ( ) . equals ( PreferenceConstants . EDITOR_TEXT_FONT ) ) { final Font font = JFaceResources . getFont ( PreferenceConstants . EDITOR_TEXT_FONT ) ; fSourceViewer . getTextWidget ( ) . setFont ( font ) ; if ( fMarginPainter != null ) { fMarginPainter . initialize ( ) ; } } } } ; final IPropertyChangeListener propertyListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { if ( fViewerConfiguration . affectsTextPresentation ( event ) ) { fViewerConfiguration . handlePropertyChangeEvent ( event ) ; fSourceViewer . invalidateTextPresentation ( ) ; } } } ; public RubySourcePreviewerUpdater ( ) { JFaceResources . getFontRegistry ( ) . addListener ( fontListener ) ; fPreferenceStore . addPropertyChangeListener ( propertyListener ) ; fSourceViewer . getTextWidget ( ) . addDisposeListener ( new DisposeListener ( ) { public void widgetDisposed ( DisposeEvent e ) { JFaceResources . getFontRegistry ( ) . removeListener ( fontListener ) ; fPreferenceStore . removePropertyChangeListener ( propertyListener ) ; } } ) ; } } protected final SimpleRubySourceViewerConfiguration fViewerConfiguration ; protected final Document fPreviewDocument ; protected final SourceViewer fSourceViewer ; protected final IPreferenceStore fPreferenceStore ; protected final MarginPainter fMarginPainter ; protected Map fWorkingValues ; private int fTabSize = 0 ; public RubyPreview ( Map workingValues , Composite parent ) { RubyTextTools tools = RubyPlugin . getDefault ( ) . getRubyTextTools ( ) ; fPreviewDocument = new Document ( ) ; fWorkingValues = workingValues ; tools . setupRubyDocumentPartitioner ( fPreviewDocument , IRubyPartitions . RUBY_PARTITIONING ) ; IPreferenceStore [ ] chain = { RubyPlugin . getDefault ( ) . getCombinedPreferenceStore ( ) } ; fPreferenceStore = new ChainedPreferenceStore ( chain ) ; fSourceViewer = new RubySourceViewer ( parent , null , null , false , SWT . READ_ONLY | SWT . V_SCROLL | SWT . H_SCROLL | SWT . BORDER , fPreferenceStore ) ; fViewerConfiguration = new SimpleRubySourceViewerConfiguration ( tools . getColorManager ( ) , fPreferenceStore , null , IRubyPartitions . RUBY_PARTITIONING , true ) ; fSourceViewer . configure ( fViewerConfiguration ) ; fSourceViewer . getTextWidget ( ) . setFont ( JFaceResources . getFont ( PreferenceConstants . EDITOR_TEXT_FONT ) ) ; fMarginPainter = new MarginPainter ( fSourceViewer ) ; final RGB rgb = PreferenceConverter . getColor ( fPreferenceStore , AbstractDecoratedTextEditorPreferenceConstants . EDITOR_PRINT_MARGIN_COLOR ) ; fMarginPainter . setMarginRulerColor ( tools . getColorManager ( ) . getColor ( rgb ) ) ; fSourceViewer . addPainter ( fMarginPainter ) ; new RubySourcePreviewerUpdater ( ) ; fSourceViewer . setDocument ( fPreviewDocument ) ; } public Control getControl ( ) { return fSourceViewer . getControl ( ) ; } public StyledText getTextWidget ( ) { return fSourceViewer . getTextWidget ( ) ; } public void update ( ) { if ( fWorkingValues == null ) { fPreviewDocument . set ( "" ) ; return ; } final String value = ( String ) fWorkingValues . get ( DefaultCodeFormatterConstants . FORMATTER_LINE_SPLIT ) ; final int lineWidth = getPositiveIntValue ( value , 0 ) ; fMarginPainter . setMarginRulerColumn ( lineWidth ) ; final int tabSize = getPositiveIntValue ( | |
626 | <s> package com . asakusafw . testdriver . excel ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . Calendar ; public class Simple { public Integer number ; public String text ; | |
627 | <s> package net . sf . sveditor . core . db ; public interface IFieldItemAttr { int FieldAttr_Local = ( 1 << 0 ) ; int FieldAttr_Protected = ( 1 << 1 ) ; int FieldAttr_Rand = ( 1 << 2 ) ; int FieldAttr_Randc = ( 1 << 3 ) ; int FieldAttr_Static = ( 1 << 4 ) ; int FieldAttr_Virtual = ( 1 << 5 ) ; int FieldAttr_Automatic = ( 1 << 6 ) ; int FieldAttr_Extern = ( 1 << 7 ) ; int FieldAttr_Const = ( 1 << 8 ) ; int FieldAttr_DPI = ( 1 << 9 ) ; int FieldAttr_Pure = ( 1 << 10 | |
628 | <s> package com . asakusafw . testdriver . testing . io ; import java . io . IOException ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; import com . asakusafw . testdriver . testing . model . Variety ; public final class VarietyOutput implements ModelOutput < Variety > { private final RecordEmitter emitter ; public VarietyOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( Variety model ) throws IOException { emitter . emit ( model . getPIntOption ( ) ) ; emitter . emit ( model . getPLongOption ( ) ) ; emitter . emit ( model . getPByteOption ( ) ) ; emitter . emit | |
629 | <s> package org . rubypeople . rdt . refactoring . signatureprovider ; import java . util . Collection ; import org . rubypeople . rdt . refactoring . exception . UnknownMethodNameException ; | |
630 | <s> package org . rubypeople . rdt . refactoring . ui . pages ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . FillLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Widget ; import org . rubypeople . rdt . refactoring . | |
631 | <s> package org . rubypeople . eclipse . shams . resources ; import java . net . URI ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . Path ; public class ShamFolder extends ShamContainer implements IFolder { public ShamFolder ( String aPathString ) { super ( new Path ( aPathString ) ) ; } public ShamFolder ( IPath aPath ) { super ( aPath ) ; } public void setDefaultCharset ( String charset , IProgressMonitor monitor ) throws CoreException { } public int getType ( ) { return FOLDER ; } public void create ( boolean force , boolean local , IProgressMonitor monitor ) throws CoreException { | |
632 | <s> package org . rubypeople . rdt . internal . ti ; import java . util . Iterator ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . ArgumentNode ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . CallNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . Colon2Node ; import org . jruby . ast . FCallNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . VCallNode ; import org . jruby . ast . types . INameNode ; public class TypeInferenceHelper { private TypeInferenceHelper ( ) { } private static TypeInferenceHelper staticInstance = new TypeInferenceHelper ( ) ; public static TypeInferenceHelper Instance ( ) { return staticInstance ; } public String getVarName ( Node node ) { if ( node instanceof INameNode ) { return ( ( INameNode ) node ) . getName ( ) ; } return null ; } public int getArgIndex ( ListNode listNode , String argName ) { int argNumber = 0 ; for ( Iterator iter = listNode . childNodes ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { if ( ( ( ArgumentNode ) iter . next ( ) ) . getName ( ) . equals ( argName ) ) { return argNumber ; } argNumber ++ ; } return - 1 ; } public String getTypeNodeName ( Node node ) { if ( node instanceof ClassNode ) { return ( ( Colon2Node ) ( ( ClassNode ) node ) . getCPath ( ) ) . getName ( ) ; } if ( node instanceof ModuleNode ) { return ( ( Colon2Node ) ( ( ModuleNode ) node ) . | |
633 | <s> package fi . koku . services . utility . authorizationinfo . v1 . impl ; import java . util . ArrayList ; import java . util . List ; import fi . koku . services . utility . authorizationinfo . v1 . AuthorizationInfoService ; import fi . koku . services . utility . authorizationinfo . v1 . Constants ; import fi . koku . services . utility . authorizationinfo . v1 . model . Group ; import fi . koku . services . utility . authorizationinfo . v1 . model . OrgUnit ; import fi . koku . services . utility . authorizationinfo . v1 . model . Registry ; import fi . koku . services . utility . authorizationinfo . v1 . model . Role ; import fi . koku . services . utility . authorizationinfo | |
634 | <s> package fi . koku . services . entity . customer . v1 ; import java . net . URL ; import javax . xml . namespace . QName ; import javax . xml . ws . BindingProvider ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class CustomerServiceFactory { private String uid ; private String pwd ; private String endpointBaseUrl ; private final URL wsdlLocation = getClass ( ) . getClassLoader ( ) . getResource ( "" ) ; private static Logger log = LoggerFactory . getLogger ( CustomerServiceFactory . class ) ; public CustomerServiceFactory ( String uid , String pwd , String endpointBaseUrl ) { this . uid = uid ; this . pwd = pwd ; this . endpointBaseUrl = endpointBaseUrl ; } public CustomerServicePortType getCustomerService ( ) { if ( wsdlLocation == null ) log . error ( "" ) ; CustomerService service = new CustomerService ( wsdlLocation , new QName ( "" , "" ) ) ; CustomerServicePortType | |
635 | <s> package com . asakusafw . testtools . inspect ; import static org . junit . Assert . * ; import java . sql . Connection ; import java . util . ArrayList ; import java . util . Calendar ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . apache . hadoop . io . Writable ; import org . junit . Test ; import test . modelgen . model . AllTypesWNoerr ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . testtools . RowMatchingCondition ; import com . asakusafw . testtools . TestDataHolder ; import com . asakusafw . testtools . db . DbUtils ; import com . asakusafw . testtools . excel . ExcelUtils ; import com . asakusafw . testtools . inspect . Cause . Type ; public class DefaultInspectorTest { private static final String TEST_FILE = "" ; private static final String TEST_FILE_NULL_NORMAL = "" ; private static final String TEST_FILE_NULL_OK = "" ; private static final String TEST_FILE_NULL_NG = "" ; private static final String TEST_FILE_NOT_NULL_OK = "" ; private static final String TEST_FILE_NOT_NULL_NG = "" ; private static final String TEST_FILE_INSPECT_NONE = "" ; private static final String TEST_FILE_INSPECT_NOW = "" ; private static final String TEST_FILE_INSPECT_TODAY = "" ; private static final String TEST_FILE_INSPECT_PARTIAL = "" ; private static final String TEST_FILE_INSPECT_PARTIAL2 = "" ; private static final int ROWNS_IN_TEST_FILE = 34 ; private TestDataHolder dataHolder ; private void initDataHolder ( String filename ) throws Exception { ExcelUtils excelUtils = new ExcelUtils ( filename ) ; dataHolder = excelUtils . getTestDataHolder ( ) ; Connection conn = null ; try { conn = DbUtils . getConnection ( ) ; dataHolder . storeToDatabase ( conn , true ) ; dataHolder . loadFromDatabase ( conn ) ; } finally { DbUtils . closeQuietly ( conn ) ; } } @ Test public void testNormal ( ) throws Exception { initDataHolder ( TEST_FILE ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , 0 , inspector . getCauses ( ) . size ( ) ) ; } @ Test public void testNullExcepctList ( ) throws Exception { initDataHolder ( TEST_FILE ) ; List < Writable > expect = dataHolder . getExpect ( ) ; expect . clear ( ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , ROWNS_IN_TEST_FILE , inspector . getCauses ( ) . size ( ) ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . NO_EXPECT_RECORD , cause . getType ( ) ) ; } dataHolder . setRowMatchingCondition ( RowMatchingCondition . PARTIAL ) ; inspector . clear ( ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , 0 , inspector . getCauses ( ) . size ( ) ) ; dataHolder . setRowMatchingCondition ( RowMatchingCondition . PARTIAL ) ; inspector . clear ( ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , 0 , inspector . getCauses ( ) . size ( ) ) ; } @ Test public void testNullActualList ( ) throws Exception { initDataHolder ( TEST_FILE ) ; List < Writable > actual = dataHolder . getActual ( ) ; actual . clear ( ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , ROWNS_IN_TEST_FILE , inspector . getCauses ( ) . size ( ) ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . NO_ACTUAL_RECORD , cause . getType ( ) ) ; } dataHolder . setRowMatchingCondition ( RowMatchingCondition . PARTIAL ) ; inspector . clear ( ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , ROWNS_IN_TEST_FILE , inspector . getCauses ( ) . size ( ) ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . NO_ACTUAL_RECORD , cause . getType ( ) ) ; } dataHolder . setRowMatchingCondition ( RowMatchingCondition . NONE ) ; inspector . clear ( ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , 0 , inspector . getCauses ( ) . size ( ) ) ; } @ Test public void testDuplicatedRecords ( ) throws Exception { initDataHolder ( TEST_FILE ) ; dataHolder . sort ( ) ; List < Writable > expect = dataHolder . getExpect ( ) ; List < Writable > actual = dataHolder . getActual ( ) ; expect . set ( 5 , expect . get ( 4 ) ) ; actual . set ( 10 , actual . get ( 9 ) ) ; actual . set ( 11 , actual . get ( 9 ) ) ; expect . set ( 15 , expect . get ( 16 ) ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; assertEquals ( "" , 4 , inspector . getCauses ( ) . size ( ) ) ; Set < String > actualTags = new HashSet < String > ( ) ; Set < String > expectTags = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; AllTypesWNoerr actualModelObject = ( AllTypesWNoerr ) cause . getActual ( ) ; AllTypesWNoerr expectModelObject = ( AllTypesWNoerr ) cause . getExpect ( ) ; if ( actualModelObject == null ) { assertEquals ( "-UNK-" , Type . DUPLICATEED_KEY_IN_EXPECT_RECORDS , cause . getType ( ) ) ; assertNotNull ( "" , expectModelObject ) ; expectTags . add ( expectModelObject . getCTagAsString ( ) ) ; } if ( expectModelObject == null ) { assertEquals ( "-UNK-" , Type . DUPLICATEED_KEY_IN_ACTUALT_RECORDS , cause . getType ( ) ) ; assertNotNull ( "" , actualModelObject ) ; actualTags . add ( actualModelObject . getCTagAsString ( ) ) ; } } assertEquals ( "" , 2 , expectTags . size ( ) ) ; assertEquals ( "" , 1 , actualTags . size ( ) ) ; assertTrue ( "-UNK-" , expectTags . contains ( ( ( AllTypesWNoerr ) expect . get ( 4 ) ) . getCTagAsString ( ) ) ) ; assertTrue ( "-UNK-" , expectTags . contains ( ( ( AllTypesWNoerr ) expect . get ( 16 ) ) . getCTagAsString ( ) ) ) ; assertTrue ( "-UNK-" , actualTags . contains ( ( ( AllTypesWNoerr ) actual . get ( 9 ) ) . getCTagAsString ( ) ) ) ; } @ Test public void testLackOfExpectRecord ( ) throws Exception { initDataHolder ( TEST_FILE ) ; dataHolder . sort ( ) ; List < Writable > expect = dataHolder . getExpect ( ) ; List < String > removedRecordTags = new ArrayList < String > ( ) ; int [ ] removeIndexs = { ( expect . size ( ) - 1 ) , ( expect . size ( ) - 2 ) , 19 , 18 , 15 , 1 , 0 } ; for ( int index : removeIndexs ) { removedRecordTags . add ( ( ( AllTypesWNoerr ) expect . get ( index ) ) . getCTagAsString ( ) ) ; expect . remove ( index ) ; } DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . NO_EXPECT_RECORD , cause . getType ( ) ) ; AllTypesWNoerr model = ( AllTypesWNoerr ) cause . getActual ( ) ; String tag = model . getCTagAsString ( ) ; assertTrue ( "" , removedRecordTags . contains ( tag ) ) ; removedRecordTags . remove ( tag ) ; } assertEquals ( "" , 7 , inspector . getCauses ( ) . size ( ) ) ; assertTrue ( "" , removedRecordTags . size ( ) == 0 ) ; } @ Test public void testLackOfActualRecord ( ) throws Exception { initDataHolder ( TEST_FILE ) ; dataHolder . sort ( ) ; List < Writable > actual = dataHolder . getActual ( ) ; List < String > removedRecordTags = new ArrayList < String > ( ) ; int [ ] removeIndexs = { ( actual . size ( ) - 1 ) , ( actual . size ( ) - 2 ) , 15 , 11 , 6 , 2 , 0 } ; for ( int index : removeIndexs ) { removedRecordTags . add ( ( ( AllTypesWNoerr ) actual . get ( index ) ) . getCTagAsString ( ) ) ; actual . remove ( index ) ; } DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . NO_ACTUAL_RECORD , cause . getType ( ) ) ; AllTypesWNoerr model = ( AllTypesWNoerr ) cause . getExpect ( ) ; String tag = model . getCTagAsString ( ) ; assertTrue ( "" , removedRecordTags . contains ( tag ) ) ; removedRecordTags . remove ( tag ) ; } assertEquals ( "" , 7 , inspector . getCauses ( ) . size ( ) ) ; assertTrue ( "" , removedRecordTags . size ( ) == 0 ) ; } @ Test public void testNullNormal ( ) throws Exception { initDataHolder ( TEST_FILE_NULL_NORMAL ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; Set < String > actualErrorSet = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . COLUMN_VALUE_MISSMATCH , cause . getType ( ) ) ; AllTypesWNoerr expect = ( AllTypesWNoerr ) cause . getExpect ( ) ; AllTypesWNoerr actual = ( AllTypesWNoerr ) cause . getActual ( ) ; String ctag = expect . getCTagAsString ( ) ; String columnName = cause . getColumnInfo ( ) . getColumnName ( ) ; actualErrorSet . add ( ctag + ":" + columnName ) ; if ( "3" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "4" . equals ( ctag ) ) { assertTrue ( "-UNK-NULL" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } } Set < String > expectErrorSet = new HashSet < String > ( ) ; expectErrorSet . add ( "3:C_BIGINT" ) ; expectErrorSet . add ( "3:C_INT" ) ; expectErrorSet . add ( "3:C_SMALLINT" ) ; expectErrorSet . add ( "3:C_TINYINT" ) ; expectErrorSet . add ( "3:C_CHAR" ) ; expectErrorSet . add ( "3:C_DATETIME" ) ; expectErrorSet . add ( "3:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "3:C_VCHAR" ) ; expectErrorSet . add ( "4:C_BIGINT" ) ; expectErrorSet . add ( "4:C_INT" ) ; expectErrorSet . add ( "4:C_SMALLINT" ) ; expectErrorSet . add ( "4:C_TINYINT" ) ; expectErrorSet . add ( "4:C_CHAR" ) ; expectErrorSet . add ( "4:C_DATETIME" ) ; expectErrorSet . add ( "4:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "4:C_VCHAR" ) ; assertTrue ( "" , expectErrorSet . equals ( actualErrorSet ) ) ; } @ Test public void testNullOk ( ) throws Exception { initDataHolder ( TEST_FILE_NULL_OK ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; Set < String > actualErrorSet = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . COLUMN_VALUE_MISSMATCH , cause . getType ( ) ) ; AllTypesWNoerr expect = ( AllTypesWNoerr ) cause . getExpect ( ) ; AllTypesWNoerr actual = ( AllTypesWNoerr ) cause . getActual ( ) ; String ctag = expect . getCTagAsString ( ) ; String columnName = cause . getColumnInfo ( ) . getColumnName ( ) ; actualErrorSet . add ( ctag + ":" + columnName ) ; if ( "3" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } } Set < String > expectErrorSet = new HashSet < String > ( ) ; expectErrorSet . add ( "3:C_BIGINT" ) ; expectErrorSet . add ( "3:C_INT" ) ; expectErrorSet . add ( "3:C_SMALLINT" ) ; expectErrorSet . add ( "3:C_TINYINT" ) ; expectErrorSet . add ( "3:C_CHAR" ) ; expectErrorSet . add ( "3:C_DATETIME" ) ; expectErrorSet . add ( "3:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "3:C_VCHAR" ) ; assertTrue ( "" , expectErrorSet . equals ( actualErrorSet ) ) ; } @ Test public void testNullNg ( ) throws Exception { initDataHolder ( TEST_FILE_NULL_NG ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; Set < String > actualErrorSet = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . COLUMN_VALUE_MISSMATCH , cause . getType ( ) ) ; AllTypesWNoerr expect = ( AllTypesWNoerr ) cause . getExpect ( ) ; AllTypesWNoerr actual = ( AllTypesWNoerr ) cause . getActual ( ) ; String ctag = expect . getCTagAsString ( ) ; String columnName = cause . getColumnInfo ( ) . getColumnName ( ) ; actualErrorSet . add ( ctag + ":" + columnName ) ; if ( "2" . equals ( ctag ) ) { assertTrue ( "-UNK-NULL" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "3" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "4" . equals ( ctag ) ) { assertTrue ( "-UNK-NULL" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } } Set < String > expectErrorSet = new HashSet < String > ( ) ; expectErrorSet . add ( "2:C_BIGINT" ) ; expectErrorSet . add ( "2:C_INT" ) ; expectErrorSet . add ( "2:C_SMALLINT" ) ; expectErrorSet . add ( "2:C_TINYINT" ) ; expectErrorSet . add ( "2:C_CHAR" ) ; expectErrorSet . add ( "2:C_DATETIME" ) ; expectErrorSet . add ( "2:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "2:C_VCHAR" ) ; expectErrorSet . add ( "3:C_BIGINT" ) ; expectErrorSet . add ( "3:C_INT" ) ; expectErrorSet . add ( "3:C_SMALLINT" ) ; expectErrorSet . add ( "3:C_TINYINT" ) ; expectErrorSet . add ( "3:C_CHAR" ) ; expectErrorSet . add ( "3:C_DATETIME" ) ; expectErrorSet . add ( "3:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "3:C_VCHAR" ) ; expectErrorSet . add ( "4:C_BIGINT" ) ; expectErrorSet . add ( "4:C_INT" ) ; expectErrorSet . add ( "4:C_SMALLINT" ) ; expectErrorSet . add ( "4:C_TINYINT" ) ; expectErrorSet . add ( "4:C_CHAR" ) ; expectErrorSet . add ( "4:C_DATETIME" ) ; expectErrorSet . add ( "4:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "4:C_VCHAR" ) ; assertTrue ( "" , expectErrorSet . equals ( actualErrorSet ) ) ; } @ Test public void testNotNullOk ( ) throws Exception { initDataHolder ( TEST_FILE_NOT_NULL_OK ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; Set < String > actualErrorSet = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . COLUMN_VALUE_MISSMATCH , cause . getType ( ) ) ; AllTypesWNoerr expect = ( AllTypesWNoerr ) cause . getExpect ( ) ; AllTypesWNoerr actual = ( AllTypesWNoerr ) cause . getActual ( ) ; String ctag = expect . getCTagAsString ( ) ; String columnName = cause . getColumnInfo ( ) . getColumnName ( ) ; actualErrorSet . add ( ctag + ":" + columnName ) ; if ( "1" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "2" . equals ( ctag ) ) { assertTrue ( "-UNK-NULL" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "3" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } else if ( "4" . equals ( ctag ) ) { assertTrue ( "-UNK-NULL" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCIntOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCCharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDateOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertTrue ( "-UNK-NULL" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCDecimal255Option ( ) . isNull ( ) ) ; } } Set < String > expectErrorSet = new HashSet < String > ( ) ; expectErrorSet . add ( "4:C_BIGINT" ) ; expectErrorSet . add ( "4:C_INT" ) ; expectErrorSet . add ( "4:C_SMALLINT" ) ; expectErrorSet . add ( "4:C_TINYINT" ) ; expectErrorSet . add ( "4:C_CHAR" ) ; expectErrorSet . add ( "4:C_DATETIME" ) ; expectErrorSet . add ( "4:C_DATE" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "" ) ; expectErrorSet . add ( "4:C_VCHAR" ) ; assertTrue ( "" , expectErrorSet . equals ( actualErrorSet ) ) ; } @ Test public void testNotNullNg ( ) throws Exception { initDataHolder ( TEST_FILE_NOT_NULL_NG ) ; DefaultInspector inspector = new DefaultInspector ( ) ; inspector . setColumnInfos ( dataHolder . getColumnInfos ( ) ) ; inspector . setStartTime ( System . currentTimeMillis ( ) ) ; inspector . inspect ( dataHolder ) ; Set < String > actualErrorSet = new HashSet < String > ( ) ; for ( Cause cause : inspector . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; assertEquals ( "-UNK-" , Type . COLUMN_VALUE_MISSMATCH , cause . getType ( ) ) ; AllTypesWNoerr expect = ( AllTypesWNoerr ) cause . getExpect ( ) ; AllTypesWNoerr actual = ( AllTypesWNoerr ) cause . getActual ( ) ; String ctag = expect . getCTagAsString ( ) ; String columnName = cause . getColumnInfo ( ) . getColumnName ( ) ; actualErrorSet . add ( ctag + ":" + columnName ) ; if ( "1" . equals ( ctag ) ) { assertFalse ( "-UNK-NULL-UNK-" , actual . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCIntOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCSmallintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCTinyintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCCharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCVcharOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDateOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDatetimeOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal200Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , actual . getCDecimal255Option ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCBigintOption ( ) . isNull ( ) ) ; assertFalse ( "-UNK-NULL-UNK-" , expect . getCIntOption ( ) . isNull ( ) | |
636 | <s> package com . aptana . rdt . internal . core . gems ; import java . io . File ; import java . util . HashSet ; import java . util . Set ; import org . eclipse . core . runtime . IProgressMonitor ; import junit . framework . TestCase ; import com . aptana . rdt . core . gems . Gem ; public class GemManagerTest extends TestCase { public void testRemoteGemCacheCompressedToLogicalGems ( ) throws Exception { GemManager manager = new GemManager ( ) { protected Set < Gem > loadRemoteGems | |
637 | <s> package com . pogofish . jadt . parser ; import java . util . List ; 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 . Expression ; import com . pogofish . jadt . ast . Imprt ; import com . pogofish . jadt . ast . JavaComment ; import com . pogofish . jadt . ast . Literal ; import com . pogofish . jadt . ast . Pkg ; import com . pogofish . jadt . ast . PrimitiveType ; import com . pogofish . jadt . ast . RefType ; import com . pogofish . jadt . ast . Tuple ; import com . pogofish . jadt . ast . Type ; import com . pogofish . jadt . errors . SyntaxError ; public abstract class BaseTestParserImpl implements ParserImpl { public BaseTestParserImpl ( ) { super ( ) ; } @ Override public List < String > typeArguments ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public String typeArgument ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public Type type ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public Imprt singleImport ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public PrimitiveType shortType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void rparen ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public RefType refType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void rbracket ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void rangle ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public PrimitiveType primitiveType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public Pkg pkg ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public String packageName ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public String packageSpec ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public List < JavaComment > packageKeyword ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void lparen ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public PrimitiveType longType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void lbracket ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public void langle ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public PrimitiveType intType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public List < Imprt > imports ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public List < JavaComment > importKeyword ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public String identifier ( String expected ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public String getSrcInfo ( ) { throw new RuntimeException ( "" ) ; } @ Override public PrimitiveType floatType ( ) throws Exception { throw new RuntimeException ( "" ) ; } @ Override public ArgModifier finalKeyword ( ) throws Exception { throw new RuntimeException ( | |
638 | <s> package net . sf . sveditor . core . tests . index . libIndex ; import java . io . ByteArrayOutputStream ; import java . io . File ; 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 . SVDBItem ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . SVDBArgFileIndexFactory ; import net . sf . sveditor . core . db . index . SVDBIndexRegistry ; import net . sf . sveditor . core . tests . SVCoreTestsPlugin ; import net . sf . sveditor . core . tests . TestIndexCacheFactory ; import net . sf . sveditor . core . tests . utils . BundleUtils ; import net . sf . sveditor . core . tests . utils . TestUtils ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . Path ; public class WSArgFileIndexChanges extends TestCase { @ Override protected void tearDown ( ) throws Exception { SVDBIndexRegistry rgy = SVCorePlugin . getDefault ( ) . getSVDBIndexRegistry ( ) ; rgy . save_state ( ) ; } public void testArgFileChange ( ) { File tmpdir = TestUtils . createTempDir ( ) ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; try { int_testArgFileChange ( tmpdir ) ; } catch ( RuntimeException e ) { throw e ; } finally { TestUtils . delete ( tmpdir ) ; } } private void int_testArgFileChange ( File tmpdir ) { BundleUtils utils = new BundleUtils ( SVCoreTestsPlugin . getDefault ( ) . getBundle ( ) ) ; final IProject project_dir = TestUtils . createProject ( "project" ) ; utils . copyBundleDirToWS ( "" , project_dir ) ; File db = new File ( tmpdir , "db" ) ; if ( db . exists | |
639 | <s> package com . asakusafw . testdriver . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . net . URI ; import java . net . URISyntaxException ; import java . util . Arrays ; import org . junit . Test ; import com . asakusafw . testdriver . core . MockImporterPreparator . Desc ; @ Deprecated public class TestDataPreparatorTest extends SpiTestRoot { @ Test public void simple ( ) throws Exception { TestDataPreparator prep = new TestDataPreparator ( new MockDataModelAdapter ( String . class ) , new MockSourceProvider ( ) . add ( uri ( "testing:src" ) , "" ) , new MockImporterPreparator ( ) . wrap ( ) , new MockExporterRetriever ( ) . wrap ( ) ) ; Desc desc = MockImporterPreparator . create ( ) ; prep . prepare ( desc . getModelType ( ) , desc , uri ( "testing:src" ) ) ; assertThat ( desc . lines , is ( Arrays . asList ( "" ) ) ) ; } @ Test public void spi ( ) throws Exception { register ( DataModelAdapter . class , MockDataModelAdapter . class ) ; register ( DataModelSourceProvider . class , MockSourceProvider . class ) ; ClassLoader loader = register ( ImporterPreparator . class , MockImporterPreparator . class ) ; TestDataPreparator prep = new TestDataPreparator ( loader ) ; Desc desc = MockImporterPreparator . create ( ) ; prep . prepare ( desc . getModelType ( ) , desc , uri ( "" ) ) ; assertThat ( desc . lines , is ( Arrays . asList ( "MOCK" ) ) ) ; } @ Test ( expected = IOException . class ) public void unknown_type ( ) throws Exception { TestDataPreparator prep = new TestDataPreparator ( new MockDataModelAdapter ( Integer . class ) , new MockSourceProvider ( ) . add ( uri ( "testing:src" ) , "" ) , new MockImporterPreparator ( ) . wrap ( ) , new MockExporterRetriever ( ) . wrap ( ) ) ; Desc desc = MockImporterPreparator . create ( ) ; prep . prepare ( desc . getModelType ( ) , desc , uri ( | |
640 | <s> package org . rubypeople . rdt . internal . corext . util ; import java . text . MessageFormat ; public class Messages { public static String format ( String message , Object object ) { | |
641 | <s> package org . rubypeople . rdt . debug . core . tests ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IMarkerDelta ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . debug . core . DebugException ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . model . IBreakpoint ; import org . eclipse . debug . core . model . IDebugTarget ; import org . eclipse . debug . core . model . IMemoryBlock ; import org . eclipse . debug . core . model . IProcess ; import org . eclipse . debug . core . model . IThread ; import org . rubypeople . rdt . internal . debug . core | |
642 | <s> package com . asakusafw . windgate . core . resource ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import com . asakusafw . windgate . core . GateProfile ; import com . asakusafw . windgate . core . ProcessScript ; import com . asakusafw . windgate . core . WindGateCoreLogger ; import com . asakusafw . windgate . core . WindGateLogger ; public class DriverRepository implements DriverFactory { static final WindGateLogger WGLOG = new WindGateCoreLogger ( GateProfile . class ) ; private final Map < String , ResourceMirror > resources ; public DriverRepository ( Iterable < ? extends ResourceMirror > resources ) { if ( resources == null ) { throw new IllegalArgumentException ( "" ) ; } HashMap < String , ResourceMirror > map = new HashMap < String , ResourceMirror > ( ) ; for ( ResourceMirror resource : resources ) { map . put ( resource . getName ( ) , resource ) ; } this . resources = Collections . unmodifiableMap ( map ) ; } @ Override public < T > SourceDriver < T > createSource ( ProcessScript < T > script ) throws IOException { if ( script == null ) { throw new IllegalArgumentException ( "" ) ; } String name = script . getSourceScript ( ) . getResourceName ( ) ; ResourceMirror resource = resources . get ( name ) ; if ( resource == null ) { WGLOG . error ( "E04001" , script . getName ( ) , name ) ; throw new IOException ( MessageFormat . format ( "" , name , script . getName ( ) ) ) ; } return resource . createSource ( script ) ; } @ Override | |
643 | <s> package com . lmax . disruptor ; public final class BatchConsumer < T extends AbstractEntry > implements Consumer { private final ConsumerBarrier < T > consumerBarrier ; private final BatchHandler < T > handler ; private ExceptionHandler exceptionHandler = new FatalExceptionHandler ( ) ; public long p1 , p2 , p3 , p4 , p5 , p6 , p7 ; private volatile boolean running = true ; public long p8 , p9 , p10 , p11 , p12 , p13 , p14 ; private volatile long sequence = RingBuffer . INITIAL_CURSOR_VALUE ; public long p15 , p16 , p17 , p18 , p19 , p20 ; public BatchConsumer ( final ConsumerBarrier < T > consumerBarrier , final BatchHandler < T > handler ) { this . consumerBarrier = consumerBarrier ; this . handler = handler ; } public BatchConsumer ( final ConsumerBarrier < T > consumerBarrier , final SequenceTrackingHandler < T > entryHandler ) { this . consumerBarrier = consumerBarrier ; this . handler = entryHandler ; entryHandler . setSequenceTrackerCallback ( new SequenceTrackerCallback ( ) ) ; } @ Override public long getSequence ( ) { return sequence ; } | |
644 | <s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . ui . IElementFactory ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IPersistableElement ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyCore ; public class PersistableRubyElementFactory implements IElementFactory , IPersistableElement { private static final String KEY = "elementID" ; private static final String FACTORY_ID = "" ; private IRubyElement fElement ; public PersistableRubyElementFactory ( ) { } public PersistableRubyElementFactory ( | |
645 | <s> package com . asakusafw . compiler . operator . model ; import org . apache . hadoop . io . Text ; import com . asakusafw . compiler . operator . io . MockKeyInput ; import com . asakusafw . compiler . operator . io . MockKeyOutput ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . value . StringOption ; @ DataModelKind ( "DMDL" ) @ ModelInputLocation ( MockKeyInput . class ) @ | |
646 | <s> package com . asakusafw . cleaner . common ; import com . asakusafw . cleaner . exception . CleanerSystemException ; import com . asakusafw . cleaner . log . Log ; import com . asakusafw . cleaner . log . LogInitializer ; public final class CleanerInitializer { private CleanerInitializer ( ) { return ; } public static boolean initLocalFileCleaner ( String [ ] properties ) { return initialize ( properties , true , false ) ; } public static boolean initDFSCleaner ( String [ ] properties ) { return initialize ( properties , false , true ) ; } private static boolean initialize ( String [ ] properties , boolean doLocalCleanPropCheck , boolean doDFSCleanPropCheck ) { try { ConfigurationLoader . init ( properties , doLocalCleanPropCheck , doDFSCleanPropCheck ) ; } catch ( CleanerSystemException e ) { if ( initLog ( ) ) { Log . log ( e . getCause ( ) , e . getClazz ( ) , e . getMessageId ( ) , e . getMessageArgs ( ) ) ; return false ; } else { printPropLoadError ( properties , e ) ; | |
647 | <s> package org . rubypeople . rdt . refactoring . core . pullup ; import org . rubypeople . rdt . refactoring . core . RubyRefactoring ; import org . rubypeople . rdt . refactoring . ui . pages . MethodUpPullerSelectionPage ; public class PullUpRefactoring extends RubyRefactoring { public static final String NAME = "Pull up" ; public PullUpRefactoring ( ) { super ( NAME ) ; MethodUpPuller upPuller | |
648 | <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 . Text ; import org . apache . hadoop . io . Writable ; 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 . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "" , columns = { "SID" , "VERSION_NO" , "" , "" , "PURCHASE_NO" , "" , "TRADE_TYPE" , "TRADE_NO" , "LINE_NO" , "" , "STORE_CODE" , "BUYER_CODE" , "" , "SELLER_CODE" , "TENANT_CODE" , "" , "" , "" , "" , "" , "ACCOUNT_CODE" , "" , "CUTOFF_DATE" , "PAYOUT_DATE" , "" , "CUTOFF_FLAG" , "PAYOUT_FLAG" , "DISPOSE_NO" , "DISPOSE_DATE" } , primary = { "SID" } ) @ SuppressWarnings ( "deprecation" ) public class PurchaseTran implements Writable { @ Property ( name = "SID" ) private LongOption sid = new LongOption ( ) ; @ Property ( name = "VERSION_NO" ) private LongOption versionNo = new LongOption ( ) ; @ Property ( name = "" ) private DateTimeOption rgstDatetime = new DateTimeOption ( ) ; @ Property ( name = "" ) private DateTimeOption updtDatetime = new DateTimeOption ( ) ; @ Property ( name = "PURCHASE_NO" ) private StringOption purchaseNo = new StringOption ( ) ; @ Property ( name = "" ) private StringOption purchaseType = new StringOption ( ) ; @ Property ( name = "TRADE_TYPE" ) private StringOption tradeType = new StringOption ( ) ; @ Property ( name = "TRADE_NO" ) private StringOption tradeNo = new StringOption ( ) ; @ Property ( name = "LINE_NO" ) private LongOption lineNo = new LongOption ( ) ; @ Property ( name = "" ) private DateOption deliveryDate = new DateOption ( ) ; @ Property ( name = "STORE_CODE" ) private StringOption storeCode = new StringOption ( ) ; @ Property ( name = "BUYER_CODE" ) private StringOption buyerCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption purchaseTypeCode = new StringOption ( ) ; @ Property ( name = "SELLER_CODE" ) private StringOption sellerCode = new StringOption ( ) ; @ Property ( name = "TENANT_CODE" ) private StringOption tenantCode = new StringOption ( ) ; @ Property ( name = "" ) private LongOption netPriceTotal = new LongOption ( ) ; @ Property ( name = "" ) private LongOption sellingPriceTotal = new LongOption ( ) ; @ Property ( name = "" ) private StringOption shipmentStoreCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption shipmentSalesTypeCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption deductionCode = new StringOption ( ) ; @ Property ( name = "ACCOUNT_CODE" ) private StringOption accountCode = new StringOption ( ) ; @ Property ( name = "" ) private DateOption ownershipDate = new DateOption ( ) ; @ Property ( name = "CUTOFF_DATE" ) private DateOption cutoffDate = new DateOption ( ) ; @ Property ( name = "PAYOUT_DATE" ) private DateOption payoutDate = new DateOption ( ) ; @ Property ( name = "" ) private StringOption ownershipFlag = new StringOption ( ) ; @ Property ( name = "CUTOFF_FLAG" ) private StringOption cutoffFlag = new StringOption ( ) ; @ Property ( name = "PAYOUT_FLAG" ) private StringOption payoutFlag = new StringOption ( ) ; @ Property ( name = "DISPOSE_NO" ) private StringOption disposeNo = new StringOption ( ) ; @ Property ( name = "DISPOSE_DATE" ) private DateOption disposeDate = new DateOption ( ) ; public long getSid ( ) { return this . sid . get ( ) ; } public void setSid ( long sid ) { this . sid . modify ( sid ) ; } public LongOption getSidOption ( ) { return this . sid ; } public void setSidOption ( LongOption sid ) { this . sid . copyFrom ( sid ) ; } public long getVersionNo ( ) { return this . versionNo . get ( ) ; } public void setVersionNo ( long versionNo ) { this . versionNo . modify ( versionNo ) ; } public LongOption getVersionNoOption ( ) { return this . versionNo ; } public void setVersionNoOption ( LongOption versionNo ) { this . versionNo . copyFrom ( versionNo ) ; } public DateTime getRgstDatetime ( ) { return this . rgstDatetime . get ( ) ; } public void setRgstDatetime ( DateTime rgstDatetime ) { this . rgstDatetime . modify ( rgstDatetime ) ; } public DateTimeOption getRgstDatetimeOption ( ) { return this . rgstDatetime ; } public void setRgstDatetimeOption ( DateTimeOption rgstDatetime ) { this . rgstDatetime . copyFrom ( rgstDatetime ) ; } public DateTime getUpdtDatetime ( ) { return this . updtDatetime . get ( ) ; } public void setUpdtDatetime ( DateTime updtDatetime ) { this . updtDatetime . modify ( updtDatetime ) ; } public DateTimeOption getUpdtDatetimeOption ( ) { return this . updtDatetime ; } public void setUpdtDatetimeOption ( DateTimeOption updtDatetime ) { this . updtDatetime . copyFrom ( updtDatetime ) ; } public Text getPurchaseNo ( ) { return this . purchaseNo . get ( ) ; } public void setPurchaseNo ( Text purchaseNo ) { this . purchaseNo . modify ( purchaseNo ) ; } public String getPurchaseNoAsString ( ) { return this . purchaseNo . getAsString ( ) ; } public void setPurchaseNoAsString ( String purchaseNo ) { this . purchaseNo . modify ( purchaseNo ) ; } public StringOption getPurchaseNoOption ( ) { return this . purchaseNo ; } public void setPurchaseNoOption ( StringOption purchaseNo ) { this . purchaseNo . copyFrom ( purchaseNo ) ; } public Text getPurchaseType ( ) { return this . purchaseType . get ( ) ; } public void setPurchaseType ( Text purchaseType ) { this . purchaseType . modify ( purchaseType ) ; } public String getPurchaseTypeAsString ( ) { return this . purchaseType . getAsString ( ) ; } public void setPurchaseTypeAsString ( String purchaseType ) { this . purchaseType . modify ( purchaseType ) ; } public StringOption getPurchaseTypeOption ( ) { return this . purchaseType ; } public void setPurchaseTypeOption ( StringOption purchaseType ) { this . purchaseType . copyFrom ( purchaseType ) ; } public Text getTradeType ( ) { return this . tradeType . get ( ) ; } public void setTradeType ( Text tradeType ) { this . tradeType . modify ( tradeType ) ; } public String getTradeTypeAsString ( ) { return this . tradeType . getAsString ( ) ; } public void setTradeTypeAsString ( String tradeType ) { this . tradeType . modify ( tradeType ) ; } public StringOption getTradeTypeOption ( ) { return this . tradeType ; } public void setTradeTypeOption ( StringOption tradeType ) { this . tradeType . copyFrom ( tradeType ) ; } public Text getTradeNo ( ) { return this . tradeNo . get ( ) ; } public void setTradeNo ( Text tradeNo ) { this . tradeNo . modify ( tradeNo ) ; } public String getTradeNoAsString ( ) { return this . tradeNo . getAsString ( ) ; } public void setTradeNoAsString ( String tradeNo ) { this . tradeNo . modify ( tradeNo ) ; } public StringOption getTradeNoOption ( ) { return this . tradeNo ; } public void setTradeNoOption ( StringOption tradeNo ) { this . tradeNo . copyFrom ( tradeNo ) ; } public long getLineNo ( ) { return this . lineNo . get ( ) ; } public void setLineNo ( long lineNo ) { this . lineNo . modify ( lineNo ) ; } public LongOption getLineNoOption ( ) { return this . lineNo ; } public void setLineNoOption ( LongOption lineNo ) { this . lineNo . copyFrom ( lineNo ) ; } public Date getDeliveryDate ( ) { return this . deliveryDate . get ( ) ; } public void setDeliveryDate ( Date deliveryDate ) { this . deliveryDate . modify ( deliveryDate ) ; } public DateOption getDeliveryDateOption ( ) { return this . deliveryDate ; } public void setDeliveryDateOption ( DateOption deliveryDate ) { this . deliveryDate . copyFrom ( deliveryDate ) ; } public Text getStoreCode ( ) { return this . storeCode . get ( ) ; } public void setStoreCode ( Text storeCode ) { this . storeCode . modify ( storeCode ) ; } public String getStoreCodeAsString ( ) { return this . storeCode . getAsString ( ) ; } public void setStoreCodeAsString ( String storeCode ) { this . storeCode . modify ( storeCode ) ; } public StringOption getStoreCodeOption ( ) { return this . storeCode ; } public void setStoreCodeOption ( StringOption storeCode ) { this . storeCode . copyFrom ( storeCode ) ; } public Text getBuyerCode ( ) { return this . buyerCode . get ( ) ; } public void setBuyerCode ( Text buyerCode ) { this . buyerCode . modify ( buyerCode ) ; } public String getBuyerCodeAsString ( ) { return this . buyerCode . getAsString ( ) ; } public void setBuyerCodeAsString ( String buyerCode ) { this . buyerCode . modify ( buyerCode ) ; } public StringOption getBuyerCodeOption ( ) { return this . buyerCode ; } public void setBuyerCodeOption ( StringOption buyerCode ) { this . buyerCode . copyFrom ( buyerCode ) ; } public Text getPurchaseTypeCode ( ) { return this . purchaseTypeCode . get ( ) ; } public void setPurchaseTypeCode ( Text purchaseTypeCode ) { this . purchaseTypeCode . modify ( purchaseTypeCode ) ; } public String getPurchaseTypeCodeAsString ( ) { return this . purchaseTypeCode . getAsString ( ) ; } public void setPurchaseTypeCodeAsString ( String purchaseTypeCode ) { this . purchaseTypeCode . modify ( purchaseTypeCode ) ; } public StringOption getPurchaseTypeCodeOption ( ) { return this . purchaseTypeCode ; } public void setPurchaseTypeCodeOption ( StringOption purchaseTypeCode ) { this . purchaseTypeCode . copyFrom ( purchaseTypeCode ) ; } public Text getSellerCode ( ) { return this . sellerCode . get ( ) ; } public void setSellerCode ( Text sellerCode ) { this . sellerCode . modify ( sellerCode ) ; } public String getSellerCodeAsString ( ) { return this . sellerCode . getAsString ( ) ; } public void setSellerCodeAsString ( String sellerCode ) { this . sellerCode . modify ( sellerCode ) ; } public StringOption getSellerCodeOption ( ) { return this . sellerCode ; } public void setSellerCodeOption ( StringOption sellerCode ) { this . sellerCode . copyFrom ( sellerCode ) ; } public Text getTenantCode ( ) { return this . tenantCode . get ( ) ; } public void setTenantCode ( Text tenantCode ) { this . tenantCode . modify ( tenantCode ) ; } public String getTenantCodeAsString ( ) { return this . tenantCode . getAsString ( ) ; } public void setTenantCodeAsString ( String tenantCode ) { this . tenantCode . modify ( tenantCode ) ; } public StringOption getTenantCodeOption ( ) { return this . tenantCode ; } public void setTenantCodeOption ( StringOption tenantCode ) { this . tenantCode . copyFrom ( tenantCode ) ; } public long getNetPriceTotal ( ) { return this . netPriceTotal . get ( ) ; } public void setNetPriceTotal ( long netPriceTotal ) { this . netPriceTotal . modify ( netPriceTotal ) ; } public LongOption getNetPriceTotalOption ( ) { return this . netPriceTotal ; } public void setNetPriceTotalOption ( LongOption netPriceTotal ) { this . netPriceTotal . copyFrom ( netPriceTotal ) ; } public long getSellingPriceTotal ( ) { return this . sellingPriceTotal . get ( ) ; } public void setSellingPriceTotal ( long sellingPriceTotal ) { this . sellingPriceTotal . modify ( sellingPriceTotal ) ; } public LongOption getSellingPriceTotalOption ( ) { return this . sellingPriceTotal ; } public void setSellingPriceTotalOption ( LongOption sellingPriceTotal ) { this . sellingPriceTotal . copyFrom ( sellingPriceTotal ) ; } public Text getShipmentStoreCode ( ) { return this . shipmentStoreCode . get ( ) ; } public void setShipmentStoreCode ( Text shipmentStoreCode ) { this . shipmentStoreCode . modify ( shipmentStoreCode ) ; } public String getShipmentStoreCodeAsString ( ) { return this . shipmentStoreCode . getAsString ( ) ; } public void setShipmentStoreCodeAsString ( String shipmentStoreCode ) { this . shipmentStoreCode . modify ( shipmentStoreCode ) ; } public StringOption getShipmentStoreCodeOption ( ) { return this . shipmentStoreCode ; } public void setShipmentStoreCodeOption ( StringOption shipmentStoreCode ) { this . shipmentStoreCode . copyFrom ( shipmentStoreCode ) ; } public Text getShipmentSalesTypeCode ( ) { return this . shipmentSalesTypeCode . get ( ) ; } public void setShipmentSalesTypeCode ( Text shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . modify ( shipmentSalesTypeCode ) ; } public String getShipmentSalesTypeCodeAsString ( ) { return this . shipmentSalesTypeCode . getAsString ( ) ; } public void setShipmentSalesTypeCodeAsString ( String shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . modify ( shipmentSalesTypeCode ) ; } public StringOption getShipmentSalesTypeCodeOption ( ) { return this . shipmentSalesTypeCode ; } public void setShipmentSalesTypeCodeOption ( StringOption shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . copyFrom ( shipmentSalesTypeCode ) ; } public Text getDeductionCode ( ) { return this . deductionCode . get ( ) ; } public void setDeductionCode ( Text deductionCode ) { this . deductionCode . modify ( deductionCode ) ; } public String getDeductionCodeAsString ( ) { return this . deductionCode . getAsString ( ) ; } public void setDeductionCodeAsString ( String deductionCode ) { this . deductionCode . modify ( deductionCode ) ; } public StringOption getDeductionCodeOption ( ) { return this . deductionCode ; } public void setDeductionCodeOption ( StringOption deductionCode ) { this . deductionCode . copyFrom ( deductionCode ) ; } public Text getAccountCode ( ) { return this . accountCode . get ( ) ; } public void setAccountCode ( Text accountCode ) { this . accountCode . modify ( accountCode ) ; } public String getAccountCodeAsString ( ) { return this . accountCode . getAsString ( ) ; } public void setAccountCodeAsString ( String accountCode ) { this . accountCode . modify ( accountCode ) ; } public StringOption getAccountCodeOption ( ) { return this . accountCode ; } public void setAccountCodeOption ( StringOption accountCode ) { this . accountCode . copyFrom ( accountCode ) ; } public Date getOwnershipDate ( ) { return this . ownershipDate . get ( ) ; } public void setOwnershipDate ( Date ownershipDate ) { this . ownershipDate . modify ( ownershipDate ) ; } public DateOption getOwnershipDateOption ( ) { return this . ownershipDate ; } public void setOwnershipDateOption ( DateOption ownershipDate ) { this . ownershipDate . copyFrom ( ownershipDate ) ; } public Date getCutoffDate ( ) { return this . cutoffDate . get ( ) ; } public void setCutoffDate ( Date cutoffDate ) { this . cutoffDate . modify ( cutoffDate ) ; } public DateOption getCutoffDateOption ( ) { return this . cutoffDate ; } public void setCutoffDateOption ( DateOption cutoffDate ) { this . cutoffDate . copyFrom ( cutoffDate ) ; } public Date getPayoutDate ( ) { return this . payoutDate . get ( ) ; } public void setPayoutDate ( Date payoutDate ) { this . payoutDate . modify ( payoutDate ) ; } public DateOption getPayoutDateOption ( ) { return this . payoutDate ; } public void setPayoutDateOption ( DateOption payoutDate ) { this . payoutDate . copyFrom ( payoutDate ) ; } public Text getOwnershipFlag ( ) { return this . ownershipFlag . get ( ) ; } public void setOwnershipFlag ( Text ownershipFlag ) { this . ownershipFlag . modify ( ownershipFlag ) ; } public String getOwnershipFlagAsString ( ) { return this . ownershipFlag . getAsString ( ) ; } public void setOwnershipFlagAsString ( String ownershipFlag ) { this . ownershipFlag . modify ( ownershipFlag ) ; } public StringOption getOwnershipFlagOption ( ) { return this . ownershipFlag ; } public void setOwnershipFlagOption ( StringOption ownershipFlag ) { this . ownershipFlag . copyFrom ( ownershipFlag ) ; } public Text getCutoffFlag ( ) { return this . cutoffFlag . get ( ) ; } public void setCutoffFlag ( Text cutoffFlag ) { this . cutoffFlag . modify ( cutoffFlag ) ; } public String getCutoffFlagAsString ( ) { return this . cutoffFlag . getAsString ( ) ; } public void setCutoffFlagAsString ( String cutoffFlag ) { this . cutoffFlag . modify ( cutoffFlag ) ; } public StringOption getCutoffFlagOption ( ) { return this . cutoffFlag ; } public void setCutoffFlagOption ( StringOption cutoffFlag ) { this . cutoffFlag . copyFrom ( cutoffFlag ) ; } public Text getPayoutFlag ( ) { return this . payoutFlag . get ( ) ; } public void setPayoutFlag ( Text payoutFlag ) { this . payoutFlag . modify ( payoutFlag ) ; } public String getPayoutFlagAsString ( ) { return this . payoutFlag . getAsString ( ) ; } public void setPayoutFlagAsString ( String payoutFlag ) { this . payoutFlag . modify ( payoutFlag ) ; } public StringOption getPayoutFlagOption ( ) { return this . payoutFlag ; } public void setPayoutFlagOption ( StringOption payoutFlag ) { this . payoutFlag . copyFrom ( payoutFlag ) ; } public Text getDisposeNo ( ) { return this . disposeNo . get ( ) ; } public void setDisposeNo ( Text disposeNo ) { this . disposeNo . modify ( disposeNo ) ; } public String getDisposeNoAsString ( ) { return this . disposeNo . getAsString ( ) ; } public void setDisposeNoAsString ( String disposeNo ) { this . disposeNo . modify ( disposeNo ) ; } public StringOption getDisposeNoOption ( ) { return this . disposeNo ; } public void setDisposeNoOption ( StringOption disposeNo ) { this . disposeNo . copyFrom ( disposeNo ) ; } public Date getDisposeDate ( ) { return this . disposeDate . get ( ) ; } public void setDisposeDate ( Date disposeDate ) { this . disposeDate . modify ( disposeDate ) ; } public DateOption getDisposeDateOption ( ) { return this . disposeDate ; } public void setDisposeDateOption ( DateOption disposeDate ) { this . disposeDate . copyFrom ( disposeDate ) ; } public void copyFrom ( PurchaseTran source ) { this . sid . copyFrom ( source . sid ) ; this . versionNo . copyFrom ( source . versionNo ) ; this . rgstDatetime . copyFrom ( source . rgstDatetime ) ; this . updtDatetime . copyFrom ( source . updtDatetime ) ; this . purchaseNo . copyFrom ( source . purchaseNo ) ; this . purchaseType . copyFrom ( source . purchaseType ) ; this . tradeType . copyFrom ( source . tradeType ) ; this . tradeNo . copyFrom ( source . tradeNo ) ; this . lineNo . copyFrom ( source . lineNo ) ; this . deliveryDate . copyFrom ( source . deliveryDate ) ; this . storeCode . copyFrom ( source . storeCode ) ; this . buyerCode . copyFrom ( source . buyerCode ) ; this . purchaseTypeCode . copyFrom ( source . purchaseTypeCode ) ; this . sellerCode . copyFrom ( source . sellerCode ) ; this . tenantCode . copyFrom ( source . tenantCode ) ; this . netPriceTotal . copyFrom ( source . netPriceTotal ) ; this . sellingPriceTotal . copyFrom ( source . sellingPriceTotal ) ; this . shipmentStoreCode . copyFrom ( source . shipmentStoreCode ) ; this . shipmentSalesTypeCode . copyFrom ( source . shipmentSalesTypeCode ) ; this . deductionCode . copyFrom ( source . deductionCode ) ; this . accountCode . copyFrom ( source . accountCode ) ; this . ownershipDate . copyFrom ( source . ownershipDate ) ; this . cutoffDate . copyFrom ( source . cutoffDate ) ; this . payoutDate . copyFrom ( source . payoutDate ) ; this . ownershipFlag . copyFrom ( source . ownershipFlag ) ; this . cutoffFlag . copyFrom ( source . cutoffFlag ) ; this . payoutFlag . copyFrom ( source . payoutFlag ) ; this . disposeNo . copyFrom ( source . disposeNo ) ; this . disposeDate . copyFrom ( source . disposeDate ) ; } @ Override public void write ( DataOutput out ) throws IOException { sid . write ( out ) ; versionNo . write ( out ) ; rgstDatetime . write ( out ) ; updtDatetime . write ( out ) ; purchaseNo . write ( out ) ; purchaseType . write ( out ) ; tradeType . write ( out ) ; tradeNo . write ( out ) ; lineNo . write ( out ) ; deliveryDate . write ( out ) ; storeCode . write ( out ) ; buyerCode . write ( out ) ; purchaseTypeCode . write ( out ) ; sellerCode . write ( out ) ; tenantCode . write ( out ) ; netPriceTotal . write ( out ) ; sellingPriceTotal . write ( out ) ; shipmentStoreCode . write ( out ) ; shipmentSalesTypeCode . write ( out ) ; deductionCode . write ( out ) ; accountCode . write ( out ) ; ownershipDate . write ( out ) ; cutoffDate . write ( out ) ; payoutDate . write ( out ) ; ownershipFlag . write ( out ) ; cutoffFlag . write ( out ) ; payoutFlag . write ( out ) ; disposeNo . write ( out ) ; disposeDate . write ( out ) ; } @ Override public void readFields ( DataInput in ) throws IOException { sid . readFields ( in ) ; versionNo . readFields ( in ) ; rgstDatetime . readFields ( in ) ; updtDatetime . readFields ( in ) ; purchaseNo . readFields ( in ) ; purchaseType . readFields ( in ) ; tradeType . readFields ( in ) ; tradeNo . readFields ( in ) ; lineNo . readFields ( in ) ; deliveryDate . readFields ( in ) ; storeCode . readFields ( in ) ; buyerCode . readFields ( in ) ; purchaseTypeCode . readFields ( in | |
649 | <s> package net . sf . sveditor . core . docs . model ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; enum SymbolType { CLASS , PKG , CLASS_MEMBER } ; public class SymbolTableEntry { private String symbol ; private String pkgName ; private String className ; private String memberName ; private String topicType ; private String file ; private SymbolType symbolType ; private boolean isDocumented ; private ISVDBIndex svdbIndex ; private SVDBDeclCacheItem declCacheItem ; private DocFile docFile ; public static SymbolTableEntry createPkgEntry ( String pkgName , ISVDBIndex svdbIndex , String file , SVDBDeclCacheItem declCacheItem ) { String symbolName = pkgName ; SymbolTableEntry result = new SymbolTableEntry ( symbolName , SymbolType . PKG ) ; result . setPkgName ( pkgName ) ; result . setSvdbIndex ( svdbIndex ) ; result . setFile ( file ) ; result . setDeclCacheItem ( declCacheItem ) ; return result ; } public static SymbolTableEntry createClassEntry ( String pkgName , String className , ISVDBIndex svdbIndex , String file , SVDBDeclCacheItem declCacheItem ) { String symbolName = String . format ( "%s::%s" , pkgName , className ) ; SymbolTableEntry result = new SymbolTableEntry ( symbolName , SymbolType . CLASS ) ; result . setPkgName ( pkgName ) ; result . setClassName ( className ) ; result . setSvdbIndex ( svdbIndex ) ; result . setFile ( file ) ; result . setDeclCacheItem ( declCacheItem ) ; return | |
650 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . util . Collection ; import java . util . Iterator ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . text . ITextOperationTarget ; import org . eclipse . jface . text . source . ISourceViewer ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . internal . ui . text . ruby . CompletionProposalCategory ; import org . rubypeople . rdt . internal . ui . text . ruby . CompletionProposalComputerRegistry ; public final class SpecificContentAssistExecutor { private final CompletionProposalComputerRegistry fRegistry ; public SpecificContentAssistExecutor ( CompletionProposalComputerRegistry registry ) { Assert . isNotNull ( registry ) ; fRegistry = registry ; } public void invokeContentAssist ( final ITextEditor editor , String categoryId ) { Collection < CompletionProposalCategory > categories = fRegistry . getProposalCategories ( ) ; boolean [ ] inclusionState = new boolean [ categories . size ( ) ] ; boolean [ ] separateState = new boolean [ categories . size ( ) ] ; int i = 0 ; for ( Iterator < CompletionProposalCategory > it = categories . iterator ( ) ; it . hasNext ( ) ; i ++ ) { CompletionProposalCategory cat = it . next ( ) ; inclusionState [ i ] = cat . isIncluded ( ) ; cat . setIncluded ( cat . getId ( ) . equals ( categoryId ) ) ; | |
651 | <s> package com . asakusafw . compiler . flow . processor ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . compiler . flow . LinePartProcessor ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; import com . asakusafw . vocabulary . operator . Extend ; @ TargetOperator ( Extend . class ) public class ExtendFlowProcessor extends LinePartProcessor { @ Override public void emitLinePart ( Context context ) { FlowElementPortDescription input = context . getInputPort ( Extend . ID_INPUT ) ; FlowElementPortDescription output = context . getOutputPort ( Extend . ID_OUTPUT ) ; DataObjectMirror | |
652 | <s> package com . asakusafw . compiler . operator . io ; import java . io . IOException ; import com . asakusafw . compiler . operator . model . MockKeyValue2 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class MockKeyValue2Output implements ModelOutput < MockKeyValue2 > { private final RecordEmitter emitter ; public MockKeyValue2Output ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( MockKeyValue2 model ) | |
653 | <s> package org . oddjob . jmx . server ; import javax . management . Notification ; import javax . management . ObjectName ; import javax . swing . ImageIcon ; import junit . framework . TestCase ; import org . oddjob . Iconic ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . registry . MockBeanRegistry ; import org . oddjob . arooa . registry . ServerId ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . images . IconEvent ; import org . oddjob . images . IconHelper ; import org . oddjob . images . IconListener ; import org . oddjob . jmx . handlers . IconicHandlerFactory ; import org . oddjob . util . MockThreadManager ; public class IconicInfoTest extends TestCase { private class OurHierarchicalRegistry extends MockBeanRegistry { @ Override public String getIdFor ( Object component ) { assertNotNull ( component ) ; return "x" ; } } private class OurServerSession extends MockServerSession { ArooaSession session = new StandardArooaSession ( ) ; @ Override public ObjectName nameFor ( Object object ) { return OddjobMBeanFactory . objectName ( 0 ) ; } @ Override public ArooaSession getArooaSession ( ) { return session ; } } private class MyIconic | |
654 | <s> package org . rubypeople . rdt . internal . core ; import org . rubypeople . rdt . core . IRubyElement ; class RubyElementInfo { protected IRubyElement [ ] children ; protected boolean isStructureKnown = false ; static Object [ ] NO_NON_RUBY_RESOURCES = new Object [ ] { } ; protected RubyElementInfo ( ) { this . children = RubyElement . NO_ELEMENTS ; } public void addChild ( IRubyElement child ) { if ( this . children == RubyElement . NO_ELEMENTS ) { setChildren ( new IRubyElement [ ] { child } ) ; } else { if ( ! includesChild ( child ) ) { setChildren ( growAndAddToArray ( this . children , child ) ) ; } } } public Object clone ( ) { try { return super . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new Error ( | |
655 | <s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import java . util . Date ; import junit . framework . TestCase ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . standard . StandardFragmentParser ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . Schedule ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . units . DayOfWeek ; public class DayOfWeekScheduleTest extends TestCase { public void testFromAndTo ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setFrom ( DayOfWeek . Days . TUESDAY ) ; schedule . setTo ( DayOfWeek . Days . WEDNESDAY ) ; Date now1 = DateHelper . parseDateTime ( "" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "2004-02-10" ) , DateHelper . parseDateTime ( "2004-02-12" ) ) ; Interval result = schedule . nextDue ( new ScheduleContext ( now1 ) ) ; assertEquals ( expected , result ) ; } public void testAfter ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setFrom ( DayOfWeek . Days . TUESDAY ) ; schedule . setTo ( DayOfWeek . Days . WEDNESDAY ) ; Date now1 = DateHelper . parseDateTime ( "" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "2004-02-17" ) , DateHelper . parseDateTime ( "2004-02-19" ) ) ; Interval result = schedule . nextDue ( new ScheduleContext ( now1 ) ) ; assertEquals ( expected , result ) ; } public void testOverBoundry ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setFrom ( DayOfWeek . Days . FRIDAY ) ; schedule . setTo ( DayOfWeek . Days . MONDAY ) ; Date now1 = DateHelper . parseDateTime ( "" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "2004-02-13" ) , DateHelper . parseDateTime ( "2004-02-17" ) ) ; Interval result1 = schedule . nextDue ( new ScheduleContext ( now1 ) ) ; assertEquals ( expected , result1 ) ; Date now2 = DateHelper . parseDateTime ( "" ) ; Interval result2 = schedule . nextDue ( new ScheduleContext ( now2 ) ) ; assertEquals ( expected , result2 ) ; Date now3 = DateHelper . parseDateTime ( "" ) ; Interval result3 = schedule . nextDue ( new ScheduleContext ( now3 ) ) ; assertEquals ( expected , result3 ) ; } public void testWithTime ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setOn ( DayOfWeek . Days . FRIDAY ) ; DailySchedule time = new DailySchedule ( ) ; time . setAt ( "10:00" ) ; schedule . setRefinement ( time ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDate ( "2005-11-01" ) ) ; Interval nextDue = schedule . nextDue ( context ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , nextDue ) ; } public void testDefaultFrom ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setTo ( DayOfWeek . Days . TUESDAY ) ; Interval result = schedule . nextDue ( new ScheduleContext ( DateHelper . parseDate ( "2006-03-03" ) ) ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; result = schedule . nextDue ( new ScheduleContext ( DateHelper . parseDate ( "2006-03-07" ) ) ) ; assertEquals ( expected , result ) ; } public void testDefaultTo ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setFrom ( DayOfWeek . Days . TUESDAY ) ; Interval result = schedule . nextDue ( new ScheduleContext ( DateHelper . parseDate ( "2006-03-06" ) ) ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; result = schedule . nextDue ( new ScheduleContext ( DateHelper . parseDate ( "2006-03-12" ) ) ) ; assertEquals ( expected , result ) ; } public void testInclusive ( ) throws ParseException { WeeklySchedule schedule = new WeeklySchedule ( ) ; schedule . setTo ( DayOfWeek . Days . TUESDAY ) ; Interval result = schedule . nextDue ( new ScheduleContext ( DateHelper . parseDate ( "" ) ) ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testWithOverMidnightTime ( ) throws ParseException { WeeklySchedule test = new WeeklySchedule ( ) ; test . setOn ( DayOfWeek . Days . WEDNESDAY ) ; DailySchedule time = new DailySchedule ( ) ; time . setFrom ( "23:00" ) ; time . setTo ( "01:00" ) ; test . setRefinement ( time ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = test . nextDue ( context ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextDue ( context ) ; assertEquals ( expected , result ) ; } public void testOnExample ( ) throws ArooaParseException , ParseException { OddjobDescriptorFactory df = new OddjobDescriptorFactory ( ) ; ArooaDescriptor descriptor = df . createDescriptor ( getClass ( ) . getClassLoader ( ) ) ; StandardFragmentParser parser = new StandardFragmentParser ( descriptor ) ; parser . parse ( new XMLConfiguration ( "" , getClass ( | |
656 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jface . operation . IRunnableContext ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . forms . events . HyperlinkAdapter ; import org . eclipse . ui . forms . events . HyperlinkEvent ; import org . eclipse . ui . forms . widgets . FormText ; import org . eclipse . ui . forms . widgets . FormToolkit ; import org . eclipse . ui . forms . widgets . TableWrapData ; import org . eclipse . ui . forms . widgets . TableWrapLayout ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . buildpath . ILoadpathInformationProvider ; import org . rubypeople . rdt . internal . corext . buildpath . IPackageExplorerActionListener ; import org . rubypeople . rdt . internal . corext . buildpath . PackageExplorerActionEvent ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . preferences . ScrolledPageContent ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . DialogPackageExplorerActionGroup . DialogExplorerActionContext ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierQueries . ICreateFolderQuery ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierQueries . IInclusionExclusionQuery ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierQueries . ILinkToQuery ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierQueries . IRemoveLinkedFolderQuery ; public final class HintTextGroup implements ILoadpathInformationProvider , IPackageExplorerActionListener { private final static int [ ] ACTION_ORDER = { ILoadpathInformationProvider . CREATE_FOLDER , ILoadpathInformationProvider . CREATE_LINK , ILoadpathInformationProvider . EDIT_FILTERS , ILoadpathInformationProvider . EXCLUDE , ILoadpathInformationProvider . INCLUDE , ILoadpathInformationProvider . UNEXCLUDE , ILoadpathInformationProvider . UNINCLUDE , ILoadpathInformationProvider . CREATE_OUTPUT , ILoadpathInformationProvider . ADD_SEL_SF_TO_BP , ILoadpathInformationProvider . REMOVE_FROM_BP , ILoadpathInformationProvider . ADD_SEL_LIB_TO_BP , ILoadpathInformationProvider . ADD_LIB_TO_BP , ILoadpathInformationProvider . ADD_JAR_TO_BP } ; private Composite fTopComposite ; private DialogPackageExplorerActionGroup fActionGroup ; private DialogPackageExplorer fPackageExplorer ; private IRunnableContext fRunnableContext ; private IRubyProject fCurrJProject ; private List fNewFolders ; private HashMap fImageMap ; private final NewSourceContainerWorkbookPage fPage ; public HintTextGroup ( DialogPackageExplorer packageExplorer , IRunnableContext runnableContext , NewSourceContainerWorkbookPage page ) { fPackageExplorer = packageExplorer ; fRunnableContext = runnableContext ; fPage = page ; fCurrJProject = null ; fNewFolders = new ArrayList ( ) ; fImageMap = new HashMap ( ) ; } public Composite createControl ( Composite parent ) { fTopComposite = new Composite ( parent , SWT . NONE ) ; fTopComposite . setFont ( parent . getFont ( ) ) ; GridData gridData = new GridData ( GridData . FILL_BOTH ) ; PixelConverter converter = new PixelConverter ( parent ) ; gridData . heightHint = converter . convertHeightInCharsToPixels ( 12 ) ; GridLayout gridLayout = new GridLayout ( ) ; gridLayout . marginWidth = 0 ; gridLayout . marginHeight = 0 ; fTopComposite . setLayout ( gridLayout ) ; fTopComposite . setLayoutData ( gridData ) ; fTopComposite . setData ( null ) ; fTopComposite . addDisposeListener ( new DisposeListener ( ) { public void widgetDisposed ( DisposeEvent e ) { Collection collection = fImageMap . values ( ) ; Iterator iterator = collection . iterator ( ) ; while ( iterator . hasNext ( ) ) { Image image = ( Image ) iterator . next ( ) ; image . dispose ( ) ; } } } ) ; return fTopComposite ; } private Shell getShell ( ) { return RubyPlugin . getActiveWorkbenchShell ( ) ; } public void setRubyProject ( IRubyProject jProject ) { fCurrJProject = jProject ; } public void setActionGroup ( DialogPackageExplorerActionGroup actionGroup ) { fActionGroup = actionGroup ; } private FormText createFormText ( Composite parent , String text ) { FormToolkit toolkit = new FormToolkit ( getShell ( ) . getDisplay ( ) ) ; try { FormText formText = toolkit . createFormText ( parent , true ) ; formText . setFont ( parent . getFont ( ) ) ; try { formText . setText ( text , true , false ) ; } catch ( IllegalArgumentException e ) { formText . setText ( e . getMessage ( ) , false , false ) ; RubyPlugin . log ( e ) ; } formText . marginHeight = 2 ; formText . marginWidth = 0 ; formText . setBackground ( null ) ; formText . setLayoutData ( new TableWrapData ( TableWrapData . FILL_GRAB ) ) ; return formText ; } finally { toolkit . dispose ( ) ; } } private void createLabel ( Composite parent , String text , final LoadpathModifierAction action , final IRunnableContext context ) { FormText formText = createFormText ( parent , text ) ; Image image = ( Image ) fImageMap . get ( action . getId ( ) ) ; if ( image == null ) { image = action . getImageDescriptor ( ) . createImage ( ) ; fImageMap . put ( action . getId ( ) , image ) ; } formText . setImage ( "defaultImage" , image ) ; formText . addHyperlinkListener ( new HyperlinkAdapter ( ) { public void linkActivated ( HyperlinkEvent e ) { try { context . run ( false , false , action . getOperation ( ) ) ; } catch ( InvocationTargetException err ) { ExceptionHandler . handle ( err , getShell ( ) , Messages . format ( NewWizardMessages . HintTextGroup_Exception_Title , action . getName ( ) ) , err . getMessage ( ) ) ; } catch ( InterruptedException err ) { } } } ) ; } public IStructuredSelection getSelection ( ) { return fPackageExplorer . getSelection ( ) ; } public void setSelection ( List elements ) { fPackageExplorer . setSelection ( elements ) ; } public IRubyProject getRubyProject ( ) { return fCurrJProject ; } public void handleResult ( List resultElements , CoreException exception , int actionType ) { if ( exception != null ) { ExceptionHandler . handle ( exception , getShell ( ) , Messages . format ( NewWizardMessages . HintTextGroup_Exception_Title_refresh , fActionGroup . getAction ( actionType ) . getName ( ) ) , exception . getLocalizedMessage ( ) ) ; return ; } switch ( actionType ) { case CREATE_FOLDER : handleFolderCreation ( resultElements ) ; break ; case CREATE_LINK : handleFolderCreation ( resultElements ) ; break ; case EDIT_FILTERS : defaultHandle ( resultElements , false ) ; break ; case ADD_SEL_SF_TO_BP : case ADD_SEL_LIB_TO_BP : case ADD_JAR_TO_BP : case ADD_LIB_TO_BP : handleAddToCP ( resultElements ) ; break ; case REMOVE_FROM_BP : handleRemoveFromBP ( resultElements , false ) ; break ; case INCLUDE : defaultHandle ( resultElements , true ) ; break ; case EXCLUDE : defaultHandle ( resultElements , false ) ; break ; case UNINCLUDE : defaultHandle ( resultElements , false ) ; break ; case UNEXCLUDE : defaultHandle ( resultElements , true ) ; break ; case RESET : defaultHandle ( resultElements , false ) ; break ; case RESET_ALL : handleResetAll ( ) ; break ; default : break ; } } private void defaultHandle ( List result , boolean forceRebuild ) { try { fPackageExplorer . setSelection ( result ) ; if ( forceRebuild ) { fActionGroup . refresh ( new DialogExplorerActionContext ( result , fCurrJProject ) ) ; } } catch ( RubyModelException e ) { ExceptionHandler . handle ( e , getShell ( ) , NewWizardMessages . HintTextGroup_Exception_Title_refresh , e . getLocalizedMessage ( ) ) ; } } private void handleFolderCreation ( List result ) { if ( result . size ( ) == 1 ) { fNewFolders . add ( result . get ( 0 ) ) ; fPackageExplorer . setSelection ( result ) ; } } private void handleAddToCP ( List result ) { try { if ( containsRubyProject ( result ) ) { fPackageExplorer . setSelection ( result ) ; fActionGroup . refresh ( new DialogExplorerActionContext ( result , fCurrJProject ) ) ; } else fPackageExplorer . setSelection ( result ) ; } catch ( RubyModelException e ) { ExceptionHandler . handle ( e , getShell ( ) , NewWizardMessages . HintTextGroup_Exception_Title_refresh , e . getLocalizedMessage ( ) ) ; } } private void handleRemoveFromBP ( List result , boolean forceRebuild | |
657 | <s> package net . sf . sveditor . ui . search ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . index . SVDBIndexListIterator ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import net . sf . sveditor . core . db . project . SVDBProjectManager ; import net . sf . sveditor . core . db . search . SVDBSearchSpecification ; import net . sf . sveditor . core . db . search . SVDBSearchType ; import net . sf . sveditor . core . db . search . SVDBSearchUsage ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . Status ; import org . eclipse . jface . dialogs . DialogPage ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . search . ui . ISearchPage ; import org . eclipse . search . ui . ISearchPageContainer ; import org . eclipse . search . ui . ISearchQuery ; import org . eclipse . search . ui . NewSearchUI ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; 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 . Combo ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . eclipse . ui . IWorkingSet ; public class SVSearchPage extends DialogPage implements ISearchPage { private Combo fSearchExprCombo ; private Button fCaseSensitiveButton ; private Button fSearchForTypeButton ; private Button fSearchForMethodButton ; private Button fSearchForPackageButton ; private Button fSearchForFieldButton ; private ISearchPageContainer fContainer ; private Button fLimitToDeclarationsButton ; private Button fLimitToReferencesButton ; private Button fLimitToAllButton ; private LogHandle fLog ; private List < SearchSettings > fSearchHistory ; private SearchSettings fCurrentSearch ; private static final String PAGE_NAME = "SvSearchPage" ; private class SearchSettings { public String fSearchExpr ; public SVDBSearchType fSearchFor ; public SVDBSearchUsage fLimitTo ; public boolean fCaseSensitive ; public SearchSettings ( ) { fSearchExpr = "" ; fSearchFor = SVDBSearchType . Type ; fLimitTo = SVDBSearchUsage . Declaration ; fCaseSensitive = false ; } public void store ( IDialogSettings s ) { s . put ( PREF_CASE_SENSITIVE , fCaseSensitive ) ; s . put ( PREF_SEARCH_FOR , fSearchFor . name ( ) ) ; s . put ( PREF_LIMIT_TO , fLimitTo . name ( ) ) ; s . put ( PREF_PATTERN , fSearchExpr ) ; } public void load ( IDialogSettings s ) { fCaseSensitive = s . getBoolean ( PREF_CASE_SENSITIVE ) ; String search_for = s . get ( PREF_SEARCH_FOR ) ; if ( search_for == null ) { search_for = "" ; } if ( search_for . equals ( SVDBSearchType . Type . name ( ) ) ) { fSearchFor = SVDBSearchType . Type ; } else if ( search_for . equals ( SVDBSearchType . Method . name ( ) ) ) { fSearchFor = SVDBSearchType . Method ; } else if ( search_for . equals ( SVDBSearchType . Package . name ( ) ) ) { fSearchFor = SVDBSearchType . Package ; } else if ( search_for . equals ( SVDBSearchType . Field . name ( ) ) ) { fSearchFor = SVDBSearchType . Field ; } else { fSearchFor = SVDBSearchType . Type ; } String limit_to = s . get ( PREF_LIMIT_TO ) ; if ( limit_to == null ) { limit_to = "" ; } if ( limit_to . equals ( SVDBSearchUsage . Declaration . name ( ) ) ) { fLimitTo = SVDBSearchUsage . Declaration ; } else if ( limit_to . equals ( SVDBSearchUsage . Reference . name ( ) ) ) { fLimitTo = SVDBSearchUsage . Reference ; } else if ( limit_to . equals ( SVDBSearchUsage . All . name ( ) ) ) { fLimitTo = SVDBSearchUsage . All ; } else { fLimitTo = SVDBSearchUsage . Declaration ; } fSearchExpr = s . get ( PREF_PATTERN ) ; } public void apply ( ) { fCaseSensitiveButton . setSelection ( fCaseSensitive ) ; fSearchExprCombo . setText ( fSearchExpr ) ; fSearchForTypeButton . setSelection ( false ) ; fSearchForMethodButton . setSelection ( false ) ; fSearchForPackageButton . setSelection ( false ) ; fSearchForFieldButton . setSelection ( false ) ; switch ( fSearchFor ) { case Type : fSearchForTypeButton . setSelection ( true ) ; break ; case Field : fSearchForFieldButton . setSelection ( true ) ; break ; case Method : fSearchForMethodButton . setSelection ( true ) ; break ; case Package : fSearchForPackageButton . setSelection ( true ) ; break ; } fLimitToDeclarationsButton . setSelection ( false ) ; fLimitToReferencesButton | |
658 | <s> package com . asakusafw . compiler . fileio . operator ; import javax . annotation . Generated ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . | |
659 | <s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . graphics . Rectangle ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Layout ; class TabFolderLayout extends Layout { protected Point computeSize ( Composite composite , int wHint , int hHint , boolean flushCache ) { if ( wHint != SWT . DEFAULT && hHint != SWT . DEFAULT ) return new Point ( wHint , hHint ) ; Control [ ] children = composite . getChildren ( ) ; int count = children . length ; int maxWidth = 0 , maxHeight = 0 ; for ( int i = 0 ; i < count ; i ++ ) { Control child = children [ i ] ; Point pt = child . computeSize ( SWT . DEFAULT , SWT . DEFAULT , flushCache ) ; maxWidth = Math . max ( maxWidth , pt . x ) ; maxHeight = Math . max ( maxHeight , pt . y ) ; } if ( wHint != SWT . DEFAULT ) maxWidth = wHint ; if ( hHint != SWT . DEFAULT ) maxHeight = hHint ; | |
660 | <s> package org . rubypeople . rdt . refactoring . tests . core . encapsulatefield . conditionchecks ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . rubypeople . rdt . refactoring . core . encapsulatefield . EncapsulateFieldConditionChecker ; import org . rubypeople . rdt . refactoring . core . encapsulatefield . EncapsulateFieldConfig ; import org . rubypeople . rdt . refactoring . core . encapsulatefield . FieldEncapsulator ; import org . rubypeople . rdt . refactoring | |
661 | <s> package org . oddjob . scheduling ; import java . util . Collection ; import java . util . List ; import java . util . concurrent . Callable ; import java . util . concurrent . ExecutionException ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Future ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . TimeoutException ; public class MockExecutorService implements ExecutorService { @ Override public boolean awaitTermination ( long timeout , TimeUnit unit ) throws InterruptedException { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public < T > List < Future < T > > invokeAll ( Collection < ? extends Callable < T > > tasks ) throws InterruptedException { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public < T > List < Future < T > > invokeAll ( Collection < ? extends Callable < T > > tasks , long timeout , TimeUnit unit ) throws InterruptedException { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public < T > T invokeAny ( Collection < ? extends Callable < T > > tasks ) throws InterruptedException , ExecutionException { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public < T > T invokeAny ( Collection < ? extends Callable < T > > tasks , long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public boolean isShutdown ( ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public boolean isTerminated ( ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public void shutdown ( ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public List < Runnable > shutdownNow ( ) { throw new RuntimeException ( "" | |
662 | <s> package com . asakusafw . testdriver . file ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . apache . hadoop . conf . Configurable ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . mapreduce . Job ; import org . apache . hadoop . mapreduce . TaskAttemptContext ; import org . apache . hadoop . mapreduce . TaskAttemptID ; import org . apache . hadoop . mapreduce . lib . input . FileInputFormat ; import org . apache . hadoop . mapreduce . lib . output . FileOutputFormat ; import org . apache . hadoop . util . ReflectionUtils ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . testdriver . core . BaseExporterRetriever ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . ExporterRetriever ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . hadoop . ConfigurationFactory ; import com . asakusafw . vocabulary . external . FileExporterDescription ; @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public class FileExporterRetriever extends BaseExporterRetriever < FileExporterDescription > { static final Logger LOG = LoggerFactory . getLogger ( FileExporterRetriever . class ) ; private final ConfigurationFactory configurations ; public FileExporterRetriever ( ) { this ( ConfigurationFactory . getDefault ( ) ) ; } public FileExporterRetriever ( ConfigurationFactory configurations ) { if ( configurations == null ) { throw new IllegalArgumentException ( "" ) ; } this . configurations = configurations ; } @ Override public void truncate ( FileExporterDescription description , TestContext context ) throws IOException { LOG . info ( "" , description ) ; VariableTable variables = createVariables ( context ) ; Configuration config = configurations . newInstance ( ) ; String resolved = variables . parse ( description . getPathPrefix ( ) , false ) ; Path path = new Path ( resolved ) ; FileSystem fs = path . getFileSystem ( config ) ; Path output = path . getParent ( ) ; Path target ; if ( output == null ) { LOG . warn ( "" , path | |
663 | <s> package com . asakusafw . compiler . fileio . flow ; import com . asakusafw . compiler . fileio . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . compiler . fileio . operator . ExOperatorFactory ; import com . asakusafw . compiler . fileio . operator . ExOperatorFactory . Update ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . | |
664 | <s> package com . asakusafw . testdriver . windgate ; import com . asakusafw . vocabulary . windgate . WindGateImporterDescription ; import com . asakusafw . windgate . core . DriverScript ; public class MockImporterDescription extends WindGateImporterDescription { private final Class < ? > modelType ; private final String profileName ; private final DriverScript driverScript ; MockImporterDescription ( Class < ? > modelType , String profileName , DriverScript driverScript ) { this . modelType = modelType ; this . profileName = profileName ; this . driverScript = driverScript ; } @ Override public Class < ? > getModelType | |
665 | <s> package net . sf . sveditor . ui . editor ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . DefaultIndentLineAutoEditStrategy ; import org . eclipse . jface . text . DocumentCommand ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITypedRegion ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . TextUtilities ; public class SVMultiLineCommentAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { private final String fPartitioning ; public SVMultiLineCommentAutoIndentStrategy ( String partitioning ) { fPartitioning = partitioning ; } private IRegion findPrefixRange ( IDocument doc , IRegion line ) throws BadLocationException { int lineOffset = line . getOffset ( ) ; int lineEnd = lineOffset + line . getLength ( ) ; int indentEnd = findEndOfWhiteSpace ( doc , lineOffset , lineEnd ) ; if ( ( indentEnd < lineEnd ) && ( doc . getChar ( indentEnd ) == '*' ) ) { indentEnd ++ ; while ( ( indentEnd < lineEnd ) && Character . isWhitespace ( doc . getChar ( indentEnd ) ) ) { indentEnd ++ ; } } return new Region ( lineOffset , indentEnd - lineOffset ) ; } private boolean isCommentClosed ( IDocument doc , int offset ) { try { if ( ( doc . getLineOfOffset ( offset ) + 1 ) >= doc . getNumberOfLines ( ) ) { return false ; } IRegion line = doc . getLineInformation ( doc . getLineOfOffset ( offset ) + 1 ) ; ITypedRegion partition = TextUtilities . getPartition ( doc , fPartitioning , offset , false ) ; int partitionEnd = partition . getOffset ( ) + partition . getLength ( ) ; if ( line . getOffset ( ) >= partitionEnd ) { return true ; } if ( doc . getLength ( ) == partitionEnd ) { return false ; } String comment = doc . get ( partition . getOffset ( ) , partition . getLength ( | |
666 | <s> package org . oddjob . framework ; import java . util . ArrayList ; import java . util . List ; import javax . inject . Inject ; import junit . framework . TestCase ; import org . oddjob . FailedToStopException ; import org . oddjob . IconSteps ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . StateSteps ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . images . IconHelper ; import org . oddjob . state . JobState ; public class SimpleJobTest extends TestCase { public static class OurJob extends SimpleJob { List < String > results = new ArrayList < String > ( ) ; public void setConstantAttribute ( String value ) { results . add ( "" + value ) ; } public void setRuntimeAttribute ( String value ) { results . add ( "" + value ) ; } public void setElementProperty ( Object value ) { results . add ( "" + value ) ; } @ Inject public void setClassLoader ( ClassLoader classLoader ) { results . add ( "" + ( classLoader == null ? "null" : "ClassLoader" ) ) ; } @ Override protected int execute ( ) throws Throwable { results . add ( "Executing." ) ; return 0 ; } @ Override protected void onInitialised ( ) { super . onInitialised ( ) ; results . add ( "" ) ; } @ Override protected void onDestroy ( ) { results . add ( "" ) ; } @ Override protected void onConfigured ( ) { super . onConfigured ( ) ; results . add ( "" ) ; } public String getSomeValue ( ) { return "Orange" ; } public List < String > getResults ( ) { return results ; } } public void testFullLifeCycleInOddjob ( ) throws ArooaPropertyException , ArooaConversionException { String xml = "<oddjob>" + " <job>" + "" + "" + OurJob . class . getName ( ) + "'" + "" + "" + "" + "" + "" + " </bean>" + " </job>" + "</oddjob>" ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; @ SuppressWarnings ( "unchecked" ) List < String > results = ( List < String > ) new OddjobLookup ( oddjob ) . lookup ( "ours.results" , List . class ) ; assertEquals ( "" , results . get ( 0 ) ) ; assertEquals ( "" , results . get ( 1 ) ) ; assertEquals ( "" , results . get ( 2 ) ) ; assertEquals ( "" , results . get ( 3 ) ) ; assertEquals ( "" , results . get ( 4 ) ) ; assertEquals ( "" , results . get ( 5 ) ) ; assertEquals ( "Executing." , results . get ( 6 ) ) ; assertEquals ( 7 , results . size ( ) ) ; oddjob . destroy ( ) ; assertEquals ( "" , results . get | |
667 | <s> package org . rubypeople . rdt . internal . ui . packageview ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . ui . IWorkingSet ; import org . rubypeople . rdt . ui . RubyElementSorter ; public | |
668 | <s> package com . asakusafw . testdriver . directio ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . io . Text ; import com . asakusafw . runtime . directio . Counter ; import com . asakusafw . runtime . directio . hadoop . HadoopFileFormat ; import com . asakusafw . runtime . directio . hadoop . HadoopFileFormatAdapter ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; public class MockFileFormat extends HadoopFileFormatAdapter < Text > { public MockFileFormat ( ) { super ( new MockStreamFormat ( ) ) ; } @ Override public ModelInput < Text > createInput ( Class < ? extends Text > dataType , FileSystem fileSystem , Path path , long offset , long fragmentSize , Counter counter ) throws IOException , InterruptedException { assertThat ( getConf ( ) , is ( notNullValue ( ) ) ) ; return super . createInput ( dataType , fileSystem , path , offset | |
669 | <s> package com . asakusafw . testtools ; import com . asakusafw . modelgen . emitter . JavaName ; import com . asakusafw . modelgen . source . MySqlDataType ; public class ColumnInfo { public ColumnInfo ( String tableName , String columnName , String columnComment , MySqlDataType dataType , long characterMaximumLength , int numericPrecision , int numericScale , boolean nullable , boolean key , ColumnMatchingCondition columnMatchingCondition , NullValueCondition nullValueCondition ) { this . tableName = tableName ; this . columnName = columnName ; this . columnComment = columnComment ; this . dataType = dataType ; this . | |
670 | <s> package com . asakusafw . runtime . directio . util ; import java . io . IOException ; import java . io . InputStream ; public class DelimiterRangeInputStream extends InputStream { private final InputStream origin ; private final char delimiter ; private long remaining ; private boolean endOfRange ; private final byte [ ] buffer ; private int bufferOffset ; private int bufferLimit ; public DelimiterRangeInputStream ( InputStream stream , char delimiter , long length , boolean skipFirst ) throws IOException { if ( stream == null ) { throw new IllegalArgumentException ( "" ) ; } this . origin = stream ; this . delimiter = delimiter ; this . remaining = length ; this . endOfRange = false ; this . buffer = new byte [ 1024 ] ; this . bufferOffset = 0 ; this . bufferLimit = 0 ; if ( remaining == 0 ) { endOfRange = true ; } else if ( skipFirst ) { discardHead ( ) ; } } @ Override public int read ( ) throws IOException { if ( isBufferRemaining ( ) ) { return buffer [ bufferOffset ++ ] ; } if ( endOfRange ) { return - 1 ; } if ( isSoftLimitExceeded ( ) ) { int c = origin . read ( ) ; if ( c < 0 ) { endOfRange = true ; return - 1 ; } if ( isDelimiter ( c ) ) { endOfRange = true ; } return c ; } else { int c = origin . read ( ) ; if ( c < 0 ) { endOfRange = true ; return - 1 ; } remaining -= 1 ; return c ; } } @ Override public int read ( byte [ ] b ) throws IOException { return read ( b , 0 , b . length ) ; } @ Override public int read ( byte [ ] b , int | |
671 | <s> package org . rubypeople . rdt . internal . ui . viewsupport ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . jface . resource . ColorRegistry ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . viewers . IBaseLabelProvider ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Display ; import org . eclipse . swt . widgets . Item ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . Tree ; import org . eclipse . swt . widgets . TreeItem ; import org . rubypeople . rdt . internal . ui . preferences . AppearancePreferencePage ; import org . rubypeople . rdt . ui . PreferenceConstants ; public class ColoredViewersManager implements IPropertyChangeListener { public static final String QUALIFIER_COLOR_NAME = "" ; public static final String DECORATIONS_COLOR_NAME = "" ; public static final String COUNTER_COLOR_NAME = "" ; public static final String INHERITED_COLOR_NAME = "" ; | |
672 | <s> package org . oddjob . scheduling ; import junit . framework . TestCase ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaSession ; 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 ; public class RetryDesFaTest extends TestCase { DesignInstance design ; public void testCreate ( ) throws ArooaParseException { String xml = "" + "" + "" + "" + "" + "" + "" + "" + "" + " <job>" + "" + " </job>" + "" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( ) . createDescriptor ( null ) ; ArooaSession session = new StandardArooaSession ( descriptor ) ; DesignParser parser = new DesignParser ( session ) ; parser . setArooaType ( ArooaType . COMPONENT ) ; parser . parse ( new XMLConfiguration ( "TEST" , xml ) ) ; | |
673 | <s> package org . oddjob . monitor . action ; import java . awt . Component ; import java . awt . KeyboardFocusManager ; import java . awt . event . WindowAdapter ; import java . awt . event . WindowEvent ; import java . beans . PropertyChangeEvent ; import java . beans . PropertyChangeListener ; import javax . swing . JFrame ; import javax . swing . WindowConstants ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . view . SwingFormFactory ; import org . oddjob . arooa . parsing . ConfigurationOwner ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . input . StdInInputHandler ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . ConfigContextInialiser ; import org . oddjob . monitor . model . MockExplorerContext ; import org . oddjob . state . ParentState ; public class DesignerActionTest extends TestCase { private class RootContext extends MockExplorerContext { @ Override public ExplorerContext getParent ( ) { return null ; } } public void testRoot ( ) { DesignerAction test = new DesignerAction ( ) ; test . setSelectedContext ( new RootContext ( ) ) ; test . prepare ( ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; test . setSelectedContext ( null ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; test . setSelectedContext ( null ) ; } private class ParentContext extends MockExplorerContext { ConfigurationOwner configOwner ; @ Override public Object getValue ( String key ) { assertEquals ( ConfigContextInialiser . CONFIG_OWNER , key ) ; return configOwner ; } } private class OurExplorerContext extends MockExplorerContext { Object component ; ParentContext parent = new ParentContext ( ) ; @ Override public Object getThisComponent ( ) { return component ; } @ Override public ExplorerContext getParent ( ) { return parent ; } } XMLConfiguration config ; DesignerAction test = new DesignerAction ( ) ; public void testGoodConfig ( ) { String xml = "<oddjob>" + " <job>" + "" + " </job>" + "</oddjob>" ; config = new XMLConfiguration ( "TEST2" , xml ) ; Oddjob oddjob | |
674 | <s> package de . fuberlin . wiwiss . d2rq . map ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Set ; import junit . framework . TestCase ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . vocabulary . RDF ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap . Alias ; import de . fuberlin . wiwiss . d2rq . algebra . Join ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . sql . DummyDB ; import de . fuberlin . wiwiss . d2rq . sql . SQL ; public class CompileTest extends TestCase { private Model model ; private Mapping mapping ; private Database database ; private ClassMap employees ; private PropertyBridge managerBridge ; private ClassMap cities ; private PropertyBridge citiesTypeBridge ; private PropertyBridge citiesNameBridge ; private ClassMap countries ; private PropertyBridge countriesTypeBridge ; public void setUp ( ) { this . model = ModelFactory . createDefaultModel ( ) ; this . mapping = new Mapping ( ) ; this . database = new Database ( this . model . createResource ( ) ) ; database . useConnectedDB ( new DummyDB ( ) ) ; this . mapping . addDatabase ( this . database ) ; employees = createClassMap ( "" ) ; employees . addAlias ( "" ) ; employees . addJoin ( "" ) ; employees . addCondition ( "" ) ; managerBridge = createPropertyBridge ( employees , "" ) ; managerBridge . addAlias ( "e AS m" ) ; managerBridge . setRefersToClassMap ( this . employees ) ; managerBridge . addJoin ( "" ) ; cities = createClassMap ( "" ) ; citiesTypeBridge = createPropertyBridge ( cities , RDF . type . getURI ( ) ) ; citiesTypeBridge . setConstantValue ( model . createResource ( "" ) ) ; citiesNameBridge = createPropertyBridge ( cities , "" ) ; citiesNameBridge . setColumn ( "c.name" ) ; countries = createClassMap ( "" ) ; countries . setContainsDuplicates ( true ) ; countriesTypeBridge = createPropertyBridge ( countries , RDF . type . getURI ( ) ) ; countriesTypeBridge . setConstantValue ( model . createResource ( "" ) ) ; } private ClassMap createClassMap ( String uriPattern ) { ClassMap result = new ClassMap ( this . model . createResource ( ) ) ; result . setDatabase ( this . database ) ; result . setURIPattern ( uriPattern ) ; this . mapping . addClassMap ( result ) ; return result ; } private PropertyBridge createPropertyBridge ( ClassMap classMap , String propertyURI ) { PropertyBridge result = new PropertyBridge ( this . model . createResource ( ) ) ; result . setBelongsToClassMap ( classMap ) ; result . addProperty ( this . model . createProperty ( propertyURI ) ) ; classMap . addPropertyBridge ( result ) ; return result ; } public void testAttributesInRefersToClassMapAreRenamed ( ) { TripleRelation relation = ( TripleRelation ) this . managerBridge . toTripleRelations ( ) . iterator ( ) . next ( ) ; assertEquals ( "" , relation . nodeMaker ( TripleRelation . SUBJECT ) . toString ( ) ) ; assertEquals ( "" , relation . nodeMaker ( TripleRelation . OBJECT ) . toString ( ) ) ; } public void testJoinConditionsInRefersToClassMapAreRenamed ( ) { TripleRelation relation = ( TripleRelation ) this . managerBridge . toTripleRelations ( ) . iterator ( ) . next ( ) ; Set < String > joinsToString = new HashSet < | |
675 | <s> package org . rubypeople . rdt . internal . ui . preferences . formatter ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . dialogs . StatusDialog ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; 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 . Control ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Text ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . preferences . formatter . ProfileManager . CustomProfile ; public class AlreadyExistsDialog extends StatusDialog { private Composite fComposite ; protected Text fNameText ; private Button fRenameRadio , fOverwriteRadio ; private final int NUM_COLUMNS = 2 ; private final StatusInfo fOk ; private final StatusInfo fEmpty ; private final StatusInfo fDuplicate ; private final CustomProfile fProfile ; private | |
676 | <s> package com . aptana . rdt . internal . parser . warnings ; import java . util . HashSet ; import java . util . Set ; import org . jruby . ast . HashNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; public class DuplicateHashKeyVisitor extends RubyLintVisitor { public DuplicateHashKeyVisitor ( String code ) { super ( AptanaRDTPlugin . getDefault ( ) . getOptions ( ) , code ) ; } @ Override protected String getOptionKey ( ) { return | |
677 | <s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemBase ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBBinaryExpr extends SVDBExpr { public SVDBExpr fLhs ; public String fOp ; public SVDBExpr fRhs ; public SVDBBinaryExpr ( ) { this ( null , null , null ) ; } public SVDBBinaryExpr ( SVDBExpr lhs , String op , SVDBExpr rhs ) { super ( SVDBItemType . BinaryExpr ) ; fLhs = lhs ; fOp = op ; fRhs = | |
678 | <s> package com . asakusafw . testdriver . core ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . Calendar ; public enum PropertyType { BOOLEAN ( Boolean . class ) , BYTE ( Byte . class ) , SHORT ( Short . class ) , INT ( Integer . class ) , LONG ( Long . class ) , INTEGER ( BigInteger . class ) , FLOAT ( Float . class ) , DOUBLE ( Double . class ) , DECIMAL ( BigDecimal | |
679 | <s> package net . sf . sveditor . core . db . stmt ; import net . sf . sveditor . core . db . ISVDBAddChildItem ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . attr . SVDBDoNotSaveAttr ; import net . sf . sveditor . core . db . utils . SVDBSingleItemIterable ; public class SVDBBodyStmt extends SVDBStmt implements ISVDBBodyStmt , ISVDBAddChildItem , ISVDBChildParent { public SVDBStmt fBody ; @ SVDBDoNotSaveAttr private int | |
680 | <s> package org . oddjob . framework ; import java . io . IOException ; import junit . framework . TestCase ; import org . oddjob . FailedToStopException ; import org . oddjob . Helper ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . arooa . registry . ComponentPool ; import org . oddjob . arooa . registry . MockComponentPool ; import org . oddjob . images . IconEvent ; import org . oddjob . images . IconHelper ; import org . oddjob . images . IconListener ; import org . oddjob . state . JobState ; public class SerializableJobTest extends TestCase { class OurSession extends MockArooaSession { int count ; @ Override public ComponentPool getComponentPool ( ) { return new MockComponentPool ( ) { @ Override public void save ( Object component ) { ++ count ; } @ Override public void configure ( Object component ) { } } ; } } static class OurJob extends SerializableJob { private static final long serialVersionUID = 2009031800L ; @ Override protected int execute ( ) throws Throwable { return 0 ; } } public void testSaveOnChangeState ( ) { OurSession session = new OurSession ( ) ; OurJob test = new OurJob ( ) ; test . setArooaSession ( session ) ; test . run ( ) ; assertEquals ( JobState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( 1 , session . count ) ; test . hardReset ( ) ; assertEquals ( 2 , session . count ) ; assertEquals ( JobState . | |
681 | <s> package org . rubypeople . rdt . refactoring . core . inlinemethod ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . refactoring . core . renamelocal . LocalVariableRenamer ; | |
682 | <s> package net . ggtools . grand . ui . widgets ; import java . io . File ; import java . util . Collection ; import java . util . HashSet ; import java . util . Iterator ; import net . ggtools . grand . ui . RecentFilesManager ; import net . ggtools . grand . ui . widgets . OpenFileWizard . SelectedFileListener ; import net . ggtools . grand . ui . widgets . OpenFileWizard . SelectedFileProvider ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . CCombo ; 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 . FileDialog ; public class FileSelectionPage extends WizardPage implements SelectedFileProvider { private static final Log log = LogFactory . getLog ( FileSelectionPage . class ) ; private static final String [ ] FILTER_EXTENSIONS = new String [ ] { "*.xml" , "*" } ; private String selectedFileName ; private File selectedFile ; private final Collection < SelectedFileListener > subscribers ; public FileSelectionPage ( ) { super ( "fileselect" , "" , null ) ; setDescription ( "" ) ; subscribers = new HashSet < SelectedFileListener > ( ) ; } public void createControl ( final Composite parent ) { final Composite composite = new Composite ( parent , SWT . NONE ) ; final GridLayout layout = new GridLayout ( ) ; layout . numColumns = 2 ; composite . setLayout ( layout ) ; setControl ( composite ) ; final CCombo combo = new CCombo ( composite , SWT . NONE ) ; combo . setLayoutData ( new GridData ( GridData . FILL_HORIZONTAL ) ) ; combo . add ( "" ) ; for ( final Iterator < String > iter = RecentFilesManager . getInstance ( ) . getRecentFiles ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { final String fileName = iter . next ( ) ; combo . add ( fileName ) ; } combo . addSelectionListener ( new SelectionListener ( ) { public void widgetSelected ( final SelectionEvent e ) { | |
683 | <s> package com . asakusafw . bulkloader . cache ; import java . sql . Connection ; import java . util . Arrays ; import java . util . List ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . DBConnection ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . runtime . core . context . RuntimeContext ; public class ReleaseCacheLock { static final Log LOG = new Log ( ReleaseCacheLock . class ) ; private static final List < String > PROPERTIES = Constants . PROPERTIES_DB ; public static void main ( String [ ] args ) { RuntimeContext . set ( RuntimeContext . DEFAULT . apply ( System . getenv ( ) ) ) ; if ( args . length != 1 && args . length != 2 ) { LOG . error ( "" , Arrays . toString ( args ) ) ; System . exit ( Constants . EXIT_CODE_ERROR ) ; return ; } String targetName = args [ 0 ] ; String executionId = args . length == 2 ? args [ 1 ] : null ; int initExit = initialize ( targetName , executionId ) ; if ( initExit != Constants . EXIT_CODE_SUCCESS ) { System . exit ( initExit ) ; } LOG . info ( "" , targetName , executionId ) ; int exitCode = new ReleaseCacheLock ( ) . execute ( targetName , executionId ) ; LOG . info ( "" , targetName , executionId ) ; System . exit ( exitCode ) ; } private static int initialize ( String targetName , String executionId ) { if ( ! BulkLoaderInitializer . initDBServer ( "" , executionId , PROPERTIES , targetName ) ) { LOG . error ( "" , targetName , executionId ) ; return Constants . EXIT_CODE_ERROR ; } return Constants . EXIT_CODE_SUCCESS ; } public int execute ( String targetName , String executionId ) { try { Connection connection = DBConnection . getConnection ( ) ; try { LocalCacheInfoRepository repo = new LocalCacheInfoRepository ( connection ) ; if ( executionId != null ) { LOG | |
684 | <s> package org . rubypeople . rdt . refactoring . core . rename ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . documentprovider . DocumentProvider ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; public class RenameConfig implements IRefactoringConfig | |
685 | <s> package com . asakusafw . dmdl . util ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . net . URL ; import java . net . URLClassLoader ; import java . nio . charset . Charset ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . List ; import java . util . Locale ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . dmdl . source . CompositeSourceRepository ; import com . asakusafw . dmdl . source . DmdlSourceDirectory ; import com . asakusafw . dmdl . source . DmdlSourceFile ; import com . asakusafw . dmdl . source . DmdlSourceRepository ; import com . asakusafw . utils . collections . Lists ; public final class CommandLineUtils { static final Logger LOG = LoggerFactory . getLogger ( CommandLineUtils . class ) ; public static Charset parseCharset ( String charsetNameOrNull ) { if ( charsetNameOrNull == null || charsetNameOrNull . isEmpty ( ) ) { return Charset . defaultCharset ( ) ; } return Charset . forName ( charsetNameOrNull ) ; } public static Locale parseLocale ( String localeNameOrNull ) { if ( localeNameOrNull == null || localeNameOrNull . isEmpty ( ) ) { return Locale . getDefault ( ) ; } String [ ] segments = localeNameOrNull . trim ( ) . split ( "_" , 3 ) ; if ( segments . length == 0 || segments [ 0 ] . isEmpty ( ) ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , localeNameOrNull ) ) ; } String language = segments [ 0 ] ; String country = segments . length > 1 ? segments [ 1 ] : "" ; String variant = segments . length > 2 ? segments [ 2 ] : "" ; assert segments . length <= 3 ; return new Locale ( language , country , variant ) ; } public static List < File > parseFileList ( String fileListOrNull ) { if ( fileListOrNull == null || | |
686 | <s> package de . fuberlin . wiwiss . d2rq . engine ; import com . hp . hpl . jena . sparql . algebra . Op ; import com . hp . hpl . jena . sparql . algebra . TransformCopy ; import com . hp . hpl . jena . sparql . algebra . op . OpFilter ; import com . hp . hpl . jena . sparql . expr . E_LogicalAnd ; import com . hp . hpl . jena . sparql . expr . E_LogicalNot ; import com . hp . hpl . jena . sparql . expr . E_LogicalOr ; import com . hp . hpl . jena . sparql . expr . Expr ; import com . hp . hpl . jena . sparql . expr . ExprAggregator ; import com . hp . hpl . jena . sparql . expr . ExprFunction0 ; import com . hp . hpl . jena . sparql . expr . ExprFunction1 ; import com . hp . hpl . jena . sparql . expr . ExprFunction2 ; import com . hp . hpl . jena . sparql . expr . ExprFunction3 ; import com . hp . hpl . jena . sparql . expr . ExprFunctionN ; import com . hp . hpl . jena . sparql . expr . ExprFunctionOp ; import com . hp . hpl . jena . sparql . expr . ExprList ; import com . hp . hpl . jena . sparql . expr . ExprNode ; import com . hp . hpl . jena . sparql . expr . ExprVar ; import com . hp . hpl . jena . sparql . expr . ExprVisitor ; import com . hp . hpl . jena . sparql . expr . NodeValue ; public class TransformFilterCNF extends TransformCopy { public Op transform ( OpFilter opFilter , Op subOp ) { ExprList exprList = ExprList . splitConjunction ( opFilter . getExprs ( ) ) ; ExprList cnfExprList = ExprList . splitConjunction ( TransformFilterCNF . translateFilterExpressionsToCNF ( opFilter ) ) ; if ( cnfExprList . size ( ) > exprList . size ( ) ) { return OpFilter . filter ( cnfExprList , subOp ) ; } return OpFilter . filter ( exprList , subOp ) ; } public static ExprList translateFilterExpressionsToCNF ( final OpFilter opFilter ) { ExprList exprList , newExprList ; OpFilter copiedOpFilter ; newExprList = new ExprList ( ) ; exprList = opFilter . getExprs ( ) ; copiedOpFilter = ( OpFilter ) OpFilter . filter ( exprList , opFilter . getSubOp ( ) ) ; exprList = copiedOpFilter . getExprs ( ) ; for ( Expr expr : exprList ) { if ( expr instanceof ExprNode ) { expr = applyDeMorganLaw ( expr ) ; expr = applyDistributiveLaw ( expr ) ; } newExprList . add ( expr ) ; } newExprList = ExprList . splitConjunction ( newExprList ) ; return newExprList ; } private static Expr applyDeMorganLaw ( Expr expr ) { DeMorganLawApplyer deMorganLawApplyer = new DeMorganLawApplyer ( ) ; expr . visit ( deMorganLawApplyer ) ; expr = deMorganLawApplyer . result ( ) ; return expr ; } private static Expr applyDistributiveLaw ( Expr expr ) { DistributiveLawApplyer distributiveLawApplyer = new DistributiveLawApplyer ( ) ; expr . visit ( distributiveLawApplyer ) ; expr = distributiveLawApplyer . result ( ) ; return expr ; } public static class DeMorganLawApplyer implements ExprVisitor { private Expr resultExpr ; public DeMorganLawApplyer ( ) { } public void finishVisit ( ) { } public void startVisit ( ) { } public void visit ( NodeValue nv ) { this . resultExpr = nv ; } public void visit ( ExprVar nv ) { this . resultExpr = nv ; } public void visit ( ExprFunction0 func ) { this . resultExpr = func ; } public void visit ( ExprFunction1 curExpr ) { Expr subExpr , leftExpr , rightExpr ; Expr newAndExpr ; subExpr = ( curExpr ) . getArg ( ) ; if ( curExpr instanceof E_LogicalNot ) { if ( subExpr instanceof E_LogicalNot ) { this . resultExpr = ( ( ExprFunction1 ) subExpr ) . getArg ( ) ; } else if ( subExpr instanceof E_LogicalOr ) { leftExpr = ( ( ExprFunction2 ) subExpr ) . getArg1 ( ) ; leftExpr . visit ( this ) ; leftExpr = this . resultExpr ; rightExpr = ( ( ExprFunction2 ) subExpr ) . getArg2 ( ) ; rightExpr . visit ( this ) ; rightExpr = this . resultExpr ; if ( ! ( | |
687 | <s> package org . oddjob . designer . view ; import org . oddjob . arooa | |
688 | <s> package org . rubypeople . rdt . launching ; import java . io . File ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . internal . launching . IllegalCommandException ; public class VMStandin extends AbstractVMInstall { private String fRubyVersion = null ; private String fPlatform ; public VMStandin ( IVMInstallType type , String id ) { super ( type , id ) ; setNotify ( false ) ; } public VMStandin ( IVMInstall sourceVM , String id ) { super ( sourceVM . getVMInstallType ( ) , id ) ; setNotify ( false ) ; init ( sourceVM ) ; } public VMStandin ( IVMInstall realVM ) { this ( realVM . getVMInstallType ( ) , realVM . getId ( ) ) ; init ( realVM ) ; } private void init ( IVMInstall realVM ) { setName ( realVM . getName ( ) ) ; setInstallLocation ( realVM . getInstallLocation ( ) ) ; setLibraryLocations ( realVM . getLibraryLocations ( ) ) ; setVMArgs ( realVM . getVMArgs ( ) ) ; fRubyVersion = realVM . getRubyVersion ( ) ; fPlatform = realVM . getPlatform ( ) ; } public IVMInstall convertToRealVM ( ) { IVMInstallType vmType = getVMInstallType ( ) ; IVMInstall realVM = vmType . findVMInstall ( getId ( ) ) ; boolean notify = true ; if ( realVM == null ) { realVM = vmType . createVMInstall ( getId ( | |
689 | <s> package org . rubypeople . rdt . refactoring . tests . core . inlinemethod ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodCallNodeWrapper ; import org . rubypeople . rdt . refactoring . tests . core . MultipleDocumentsInOneProvider ; public class TC_SelectedCallFinder extends FinderTestsBase { public void testFindSelectedCall4 ( ) { MethodCallNodeWrapper node = findSelected ( 2 , "test4" ) ; assertEquals ( "call" , node . getName ( ) ) ; assertNotNull ( node . getArgsNode ( ) ) ; assertNotNull ( node . getWrappedNode ( ) ) ; assertNull ( | |
690 | <s> package org . rubypeople . rdt . refactoring . core . pullup ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . BlockNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . editprovider . InsertEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; import org . rubypeople . rdt . refactoring . offsetprovider . ConstructorOffsetProvider ; import org . rubypeople . rdt . refactoring . offsetprovider . IOffsetProvider ; import org . rubypeople . rdt . refactoring . offsetprovider . MethodOffsetProvider ; public class UpPulledMethods extends InsertEditProvider { private Collection < MethodNodeWrapper | |
691 | <s> package net . heraan . Player . Human ; import net . heraan . Player . Player ; public class Human extends Player { public Human ( ) { } public Human ( String nickname ) { super . set_Nickname ( nickname ) ; } public Human ( String nickname , String first_name , | |
692 | <s> package org . oddjob . values ; import java . util . LinkedHashMap ; import java . util . Map ; import org . apache . commons . beanutils . expression . DefaultResolver ; import org . apache . commons . beanutils . expression . Resolver ; import org . oddjob . arooa . ArooaException ; import org . oddjob . arooa . ArooaValue ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . reflect . PropertyAccessor ; import org . oddjob . framework . SimpleJob ; public class SetJob extends SimpleJob { private final Map < String , ArooaValue > values = new LinkedHashMap < String , ArooaValue > ( ) ; public void setValues ( String name , ArooaValue value ) { values . put ( name , value ) ; } protected int execute ( ) throws Exception { for ( Map . Entry < String , ArooaValue > entry : values . entrySet ( ) ) { String name = entry . getKey ( ) ; ArooaValue value = entry . getValue ( ) ; | |
693 | <s> package org . rubypeople . rdt . refactoring . core . renamelocal ; import java . util . ArrayList ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . ArgumentNode ; import org . jruby . ast . BlockArgNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . jruby . ast . types . INameNode ; public class VariableRenamer { protected final String oldName ; protected final String newName ; protected final IAbortCondition abort ; public VariableRenamer ( String oldName , String newName , IAbortCondition abort ) { super ( ) ; this . oldName = oldName ; this . newName = newName ; this . abort = abort ; } private boolean isRenamedVariableRestArg ( ArgsNode args , String [ ] localNames ) { return args . getRestArg ( ) > 0 && args . getRestArg ( ) < localNames . length && localNames [ args . getRestArg ( ) ] . equals ( oldName ) ; } public ArrayList < Node > replaceVariableNamesInNode ( Node n , String [ ] localNames ) { ArrayList < Node > nodes = new ArrayList < Node > ( ) ; if ( n instanceof MethodDefNode ) { nodes . addAll ( replaceVariableNames ( ( ( MethodDefNode ) n ) . getArgsNode ( ) ) ) ; nodes . addAll ( replaceVariableNames ( ( ( MethodDefNode ) n ) . getBodyNode ( ) ) ) ; } else { nodes . addAll ( replaceVariableNames ( n ) ) ; } if ( n instanceof MethodDefNode && isRenamedVariableRestArg ( ( ( MethodDefNode ) n ) . getArgsNode ( ) , localNames ) ) { MethodDefNode defn = ( ( MethodDefNode ) n ) ; localNames [ defn . getArgsNode ( ) . getRestArg ( ) ] = newName ; } return nodes ; } private ArrayList < Node > replaceVariableNames ( Node n ) { ArrayList < Node > renamedNodes = new ArrayList < Node > ( ) ; if ( n == null || abort . abort ( n ) ) { return renamedNodes ; } if ( n instanceof INameNode && ( ( INameNode ) n ) . getName ( ) . equals ( oldName | |
694 | <s> package com . asakusafw . testdata . generator . excel ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . apache . poi . hssf . usermodel . HSSFSheet ; import org . apache . poi . hssf . usermodel . HSSFWorkbook ; import org . junit . Test ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . testdriver . excel . RuleSheetFormat ; public class SheetBuilderTest extends ExcelTesterRoot { @ Test public void data_simple ( ) { HSSFWorkbook workbook = new HSSFWorkbook ( ) ; ModelDeclaration model = load ( "simple.dmdl" , "simple" ) ; SheetBuilder builder = new SheetBuilder ( workbook , model ) ; builder . addData ( "MODEL" ) ; HSSFSheet sheet = workbook . getSheet ( "MODEL" ) ; assertThat ( sheet , not ( nullValue ( ) ) ) ; assertThat ( cell ( sheet , 0 , 0 ) , is ( "value" ) ) ; } @ Test public void data_copy ( ) { HSSFWorkbook workbook = new HSSFWorkbook ( ) ; ModelDeclaration model = load ( "simple.dmdl" , "simple" ) ; SheetBuilder builder = new SheetBuilder ( workbook , model ) ; builder . addData ( "MODEL" ) ; builder . addData ( "COPY" ) ; HSSFSheet sheet = workbook . getSheet ( "COPY" ) ; assertThat ( sheet , not ( nullValue ( ) ) ) ; assertThat ( cell ( sheet , 0 , 0 ) , is ( "value" ) ) ; } @ Test public void data_primitives ( ) { HSSFWorkbook workbook = new HSSFWorkbook ( ) ; ModelDeclaration | |
695 | <s> package org . rubypeople . rdt . launching ; import java . io . File ; import java . text . MessageFormat ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . rubypeople . rdt . internal . launching . LaunchingMessages ; | |
696 | <s> package org . oddjob . tools . includes ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class FilterFactory { public final static Pattern PATTERN = Pattern | |
697 | <s> package com . sun . phobos . script . javascript ; import com . sun . phobos . script . util . * ; import javax . script . * ; import org . mozilla . javascript . * ; import java . lang . reflect . Method ; import java . io . * ; import java . util . * ; public class RhinoScriptEngine extends AbstractScriptEngine implements Invocable , Compilable { public static final boolean DEBUG = false ; private static final String TOPLEVEL_SCRIPT_NAME = "" ; private ScriptableObject topLevel ; private Map < Object , Object > indexedProps ; private ScriptEngineFactory factory ; private InterfaceImplementor implementor ; public RhinoScriptEngine ( ) { Context cx = enterContext ( ) ; try { topLevel = new ImporterTopLevel ( cx , false ) ; new LazilyLoadedCtor ( topLevel , "JSAdapter" , "" , false ) ; String names [ ] = { "bindings" , "scope" , "sync" } ; topLevel . defineFunctionProperties ( names , RhinoScriptEngine . class , ScriptableObject . DONTENUM ) ; processAllTopLevelScripts ( cx ) ; } finally { Context . exit ( ) ; } indexedProps = new HashMap < Object , Object > ( ) ; implementor = new InterfaceImplementor ( this ) { protected Object convertResult ( Method method , Object res ) throws ScriptException { Class < ? > desiredType = method . getReturnType ( ) ; if ( desiredType == void . class ) { return null ; } else { return Context . jsToJava ( res , desiredType ) ; } } } ; } public Object eval ( Reader reader , ScriptContext ctxt ) throws ScriptException { Object ret ; Context cx = enterContext ( ) ; try { Scriptable scope = getRuntimeScope ( ctxt ) ; scope . put ( "context" , scope , ctxt ) ; String filename = null ; if ( ctxt != null && ctxt . getBindings ( ScriptContext . ENGINE_SCOPE ) != null ) { filename = ( String ) ctxt . getBindings ( ScriptContext . ENGINE_SCOPE ) . get ( ScriptEngine . FILENAME ) ; } if ( filename == null ) { filename = ( String ) get ( ScriptEngine . FILENAME ) ; } filename = filename == null ? "" : filename ; ret = cx . evaluateReader ( scope , preProcessScriptSource ( reader ) , filename , 1 , null ) ; } catch ( JavaScriptException jse ) { if ( DEBUG ) jse . printStackTrace ( ) ; int line = ( line = jse . lineNumber ( ) ) == 0 ? - 1 : line ; Object value = jse . getValue ( ) ; String str = ( value != null && value . getClass ( ) . getName ( ) . equals ( "" ) ? value . toString ( ) : jse . toString ( ) ) ; throw new ExtendedScriptException ( jse , str , jse . sourceName ( ) , line ) ; } catch ( RhinoException re ) { if ( DEBUG ) re . printStackTrace ( ) ; int line = ( line = re . lineNumber ( ) ) == 0 ? - 1 : line ; throw new ExtendedScriptException ( re , re . toString ( ) , re . sourceName ( ) , line ) ; } catch ( IOException ee ) { throw new ScriptException ( ee ) ; } finally { Context . exit ( ) ; } return unwrapReturnValue ( ret ) ; } public Object eval ( String script , ScriptContext ctxt ) throws ScriptException { if ( script == null ) { throw new NullPointerException ( "null script" ) ; } return eval ( preProcessScriptSource ( new StringReader ( script ) ) , ctxt ) ; } public ScriptEngineFactory getFactory ( ) { if ( factory != null ) { return factory ; } else { return new RhinoScriptEngineFactory ( ) ; } } public Bindings createBindings ( ) { return new SimpleBindings ( ) ; } public Object invokeFunction ( String name , Object ... args ) throws ScriptException , NoSuchMethodException { return invoke ( null , name , args ) ; } public Object invokeMethod ( Object thiz , String name , Object ... args ) throws ScriptException , NoSuchMethodException { if ( thiz == null ) { throw new IllegalArgumentException ( "" ) ; } return invoke ( thiz , name , args ) ; } private Object invoke ( Object thiz , String name , Object ... args ) throws ScriptException , NoSuchMethodException { Context cx = enterContext ( ) ; try { if ( name == null ) { throw new NullPointerException ( "" ) ; } if ( thiz != null && ! ( thiz instanceof Scriptable ) ) { thiz = Context . toObject ( thiz , topLevel ) ; } Scriptable engineScope = getRuntimeScope ( context ) ; Scriptable localScope = ( thiz != null ) ? ( Scriptable ) thiz : engineScope ; Object obj = ScriptableObject . getProperty ( localScope , name ) ; if ( ! ( obj instanceof Function ) ) { throw new NoSuchMethodException ( "" + name ) ; } Function func = ( Function ) obj ; Scriptable scope = func . getParentScope ( ) ; if ( scope == null ) { scope = engineScope ; } Object result = func . call ( cx , scope , localScope , wrapArguments ( args ) ) ; return unwrapReturnValue ( result ) ; } catch ( JavaScriptException jse ) { if ( DEBUG ) jse . printStackTrace ( ) ; int line = ( line = jse . lineNumber ( ) ) == 0 ? - 1 : line ; Object value = jse . getValue ( ) ; String str = ( value != null && value . getClass ( ) . getName ( ) . equals ( "" ) ? value . toString ( ) : jse . toString ( ) ) ; throw new ExtendedScriptException ( jse , str , jse . sourceName ( ) , line ) ; } catch ( RhinoException re ) { if ( DEBUG ) re . printStackTrace ( ) ; int line = ( line = re . lineNumber ( ) ) == 0 ? - 1 : line ; throw new ExtendedScriptException ( re , re . toString ( ) , re . sourceName ( ) , line ) ; } finally { Context . exit ( ) ; } } public < T > T getInterface ( Class < T > clasz ) { try { return implementor . getInterface ( null , clasz ) ; } catch ( ScriptException e ) { return null ; } } public < T > T getInterface ( Object thiz , Class < T > clasz ) { if ( thiz == null ) { throw new IllegalArgumentException ( "" ) ; } try { return implementor . getInterface ( thiz , clasz ) ; } catch ( ScriptException e ) { return null ; } } private static final String printSource = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "}n" + "" + "" + "}" ; private static final Script printScript ; static { Context cx = enterContext ( ) ; try { printScript = cx . compileString ( printSource , "print" , 1 , null ) ; } finally { Context . exit ( ) ; } } Scriptable getRuntimeScope ( ScriptContext ctxt ) { if ( ctxt == null ) { throw new NullPointerException ( "" ) ; } Scriptable newScope = new ExternalScriptable ( ctxt , indexedProps ) ; newScope . setPrototype ( topLevel ) ; newScope . put ( "context" , newScope , ctxt ) ; Context cx = enterContext ( ) ; try { printScript . exec ( cx , newScope ) ; } finally { Context . exit ( ) ; } return newScope ; } public CompiledScript compile ( String script ) throws ScriptException { return compile ( preProcessScriptSource ( new StringReader ( script ) ) ) ; } public CompiledScript compile ( java . io . Reader script ) throws ScriptException { CompiledScript ret = null ; Context cx = enterContext ( ) ; try { String filename = ( String ) get ( ScriptEngine . FILENAME ) ; if ( | |
698 | <s> package com . asakusafw . cleaner . common ; public final class MessageIdConst { public static final String CMN_PROP_CHECK_ERROR = "" ; public static final String LCLN_START = "" ; public static final String LCLN_EXIT_SUCCESS = "" ; public static final String LCLN_EXIT_WARNING = "" ; public static final String LCLN_INIT_ERROR = "" ; public static final String LCLN_EXCEPRION = "" ; public static final String LCLN_PARAMCHECK_ERROR = "" ; public static final String LCLN_CLEN_DIR_SUCCESS = "" ; public static final String LCLN_CLEN_DIR_FAIL = "" ; public static final String LCLN_CLEN_DIR_ERROR = "" ; public static final String LCLN_CLEN_FAIL = "" ; public static final String LCLN_CLEN_FILE = "" ; public static final String LCLN_FILE_DELETE = "" ; public static final String LCLN_FILE_DELETE_SUCCESS = "" ; public static final String LCLN_DIR_DELETE = "" ; public static final String LCLN_PATTERN_FAIL = "" ; | |
699 | <s> package org . oddjob . util ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . ObjectOutputStream ; import java . io . OutputStream ; import java . io . Serializable ; public class IO { public static void copy ( InputStream in , OutputStream out ) throws IOException { byte b [ ] = new byte [ 8192 ] ; int i ; while ( ( i = in . read ( b ) ) != - 1 ) { out . write ( b , 0 , i ) ; } } public static boolean canSerialize ( Object o ) { if ( o == null ) { return true ; } if ( ! ( o instanceof Serializable ) ) { return |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.