id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
800 | <s> package net . sf . sveditor . core . db . index ; import java . io . InputStream ; import java . util . List ; import java . util . Map . Entry ; import java . util . Set ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . job_mgr . IJob ; import net . sf . sveditor . core . scanutils . ITextScanner ; import net . sf . sveditor . core . scanutils . InputStreamTextScanner ; import net . sf . sveditor . core . svf_scanner . SVFScanner ; import org . apache . tools . ant . filters . StringInputStream ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; public class SVDBThreadedArgFileIndex extends AbstractThreadedSVDBIndex { private StringBuilder fArguments ; public SVDBThreadedArgFileIndex ( String project , String root , ISVDBFileSystemProvider fs_provider , ISVDBIndexCache cache , SVDBIndexConfig config ) { super ( project , root , fs_provider , cache , config ) ; fInWorkspaceOk = ( root . startsWith ( "" ) ) ; } public SVDBThreadedArgFileIndex ( String project , String root , StringBuilder arguments , ISVDBFileSystemProvider fs_provider , ISVDBIndexCache cache , SVDBIndexConfig config ) { super ( project , root , fs_provider , cache , config ) ; fArguments = arguments ; fInWorkspaceOk = ( root . startsWith ( "" ) ) ; } @ Override protected String getLogName ( ) { return "" ; } public String getTypeID ( ) { return SVDBArgFileIndexFactory . TYPE ; } @ Override protected SVDBBaseIndexCacheData createIndexCacheData ( ) { return new SVDBArgFileIndexCacheData ( getBaseLocation ( ) ) ; } @ Override protected boolean checkCacheValid ( ) { SVDBArgFileIndexCacheData cd = ( SVDBArgFileIndexCacheData ) getCacheData ( ) ; int i = 0 ; for ( String arg_file : cd . getArgFilePaths ( ) ) { long ts = getFileSystemProvider ( ) . getLastModifiedTime ( arg_file ) ; long ts_c = cd . getArgFileTimestamps ( ) . get ( i ) ; if ( ts > ts_c ) { fLog . debug ( "" + arg_file + " ts=" + ts + " cached ts=" + ts_c ) ; return false ; } i ++ ; } return super . checkCacheValid ( ) ; } @ Override protected void discoverRootFiles ( List < IJob > jobs ) { fLog . debug ( "" + getBaseLocation ( ) ) ; clearFilesList ( ) ; clearIncludePaths ( ) ; clearDefines ( ) ; SVDBArgFileIndexCacheData cd = ( SVDBArgFileIndexCacheData ) getCacheData ( ) ; cd . getArgFileTimestamps ( ) . clear ( ) ; cd . getArgFilePaths ( ) . clear ( ) ; addIncludePath ( getResolvedBaseLocationDir ( ) ) ; processArgFile ( new NullProgressMonitor ( ) , getResolvedBaseLocation ( ) ) ; } private void processArgFile ( IProgressMonitor monitor , String path ) { InputStream in = null ; | |
801 | <s> package org . rubypeople . rdt . refactoring . core . mergewithexternalclassparts ; import org . rubypeople . rdt . refactoring . classnodeprovider . ClassNodeProvider ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; public class MergeWithExternalClassPartConfig implements IRefactoringConfig { private ClassNodeProvider classNodeProvider ; private IDocumentProvider documentProvider ; private boolean selectionEmpty ; public MergeWithExternalClassPartConfig ( IDocumentProvider documentProvider ) { this . documentProvider = documentProvider ; selectionEmpty = true ; } public IDocumentProvider getDocumentProvider ( ) { return documentProvider ; } public ClassNodeProvider getClassNodeProvider ( ) { return classNodeProvider ; } public | |
802 | <s> package com . asakusafw . testdriver . rule ; import java . text . MessageFormat ; import java . util . Calendar ; public class CalendarRange implements ValuePredicate < Calendar > { private final int lowerBound ; private final int upperBound ; private final int scale ; public CalendarRange ( int lowerBound , int upperBound , int scale ) { this . lowerBound = lowerBound ; this . upperBound = upperBound ; this . scale = scale ; } @ Override public boolean accepts ( Calendar expected , Calendar actual ) { if ( expected == null || actual == null ) { throw new IllegalArgumentException ( ) ; } return add ( expected | |
803 | <s> package com . aptana . rdt . internal . core . parser . warnings ; import java . util . List ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . parser . warnings . AbstractRubyLintVisitorTestCase ; import com . aptana . rdt . IProblem ; import com . aptana . rdt . internal . parser . warnings . ConstantNamingConvention ; public class | |
804 | <s> package org . rubypeople . rdt . internal . corext . buildpath ; import java . lang . reflect . InvocationTargetException ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . DialogPackageExplorerActionGroup ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierOperation ; public class UnexcludeOperation extends LoadpathModifierOperation { public UnexcludeOperation ( ILoadpathModifierListener listener , ILoadpathInformationProvider informationProvider ) { super ( listener , informationProvider , NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Unexclude_tooltip , ILoadpathInformationProvider . UNEXCLUDE ) ; } public void run ( IProgressMonitor monitor ) throws InvocationTargetException { List result = null ; fException = null ; try { List resources = getSelectedElements ( ) ; IRubyProject | |
805 | <s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import org . eclipse . jface . action . Action ; import org . rubypeople . rdt . core . search . IRubySearchScope ; abstract class SearchScopeAction extends Action { private final SearchScopeActionGroup fGroup ; public SearchScopeAction ( SearchScopeActionGroup group , String text ) { super ( text , AS_RADIO_BUTTON ) ; this . | |
806 | <s> package com . asakusafw . compiler . batch ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . UUID ; import java . util . concurrent . atomic . AtomicBoolean ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; public class BatchCompilingEnvironment { static final Logger LOG = LoggerFactory . getLogger ( BatchCompilingEnvironment . class ) ; private final BatchCompilerConfiguration configuration ; private final AtomicBoolean initialized = new AtomicBoolean ( false ) ; private final String buildId = UUID . randomUUID ( ) . toString ( ) ; private String firstError ; public BatchCompilingEnvironment ( BatchCompilerConfiguration configuration ) { Precondition . checkMustNotBeNull ( configuration , "" ) ; this . configuration = configuration ; } public BatchCompilingEnvironment bless ( ) { if ( initialized . compareAndSet ( false , true ) == false ) { return this ; } configuration . getWorkflows ( ) . initialize ( this ) ; clearError ( ) ; return this ; } public String getBuildId ( ) { return buildId ; } public String getErrorMessage ( ) { return firstError ; } public boolean hasError ( ) { return firstError != null ; } public void clearError ( ) { firstError = null ; } public BatchCompilerConfiguration getConfiguration ( ) { return configuration ; } public WorkflowProcessor . Repository getWorkflows ( ) { return configuration . getWorkflows ( ) ; } public OutputStream openResource ( String path ) throws IOException { Precondition . checkMustNotBeNull ( path , "path" ) ; File output = configuration . getOutputDirectory ( ) ; File file = new File ( output , path ) ; File parent = file . getParentFile ( ) ; if ( parent . mkdirs ( ) == false && parent . isDirectory ( ) == false ) { throw new IOException ( MessageFormat . format ( "" , parent ) ) ; } | |
807 | <s> package de . fuberlin . wiwiss . d2rq . expr ; import java . util . Arrays ; import java . util . Collections ; import junit . framework . TestCase ; public class ConjunctionTest extends TestCase { private final static String sql1 = "" ; private final static String sql2 = "" ; private final static String sql3 = "" ; private final static Expression expr1 = SQLExpression . create ( sql1 ) ; private final static Expression expr2 = SQLExpression . create ( sql2 ) ; private final static Expression expr3 = SQLExpression . create ( sql3 ) ; private final static Expression conjunction12 = Conjunction . create ( Arrays . asList ( new Expression [ ] { expr1 , expr2 } ) ) ; private final static Expression conjunction123 = Conjunction . create ( Arrays . asList ( new Expression [ ] { expr1 , expr2 , expr3 } ) ) ; private final static Expression conjunction21 = Conjunction . create ( Arrays . asList ( new Expression [ ] { expr2 , expr1 } ) ) ; public void testEmptyConjunctionIsTrue ( ) { assertEquals ( Expression . TRUE , Conjunction . create ( Collections . < Expression > emptySet ( ) ) ) ; } | |
808 | <s> package org . oddjob . arooa . types ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . ConsoleCapture ; import org . oddjob . Oddjob ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . ParentState ; public class ListTypeExamplesTest extends TestCase { private static final Logger logger = Logger . getLogger ( ListTypeExamplesTest . class ) ; public void testFruitExample ( ) { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . setArgs ( new String [ ] { "kiwis" , "mangos" } ) ; ConsoleCapture console = new ConsoleCapture ( ) ; console . capture ( Oddjob . CONSOLE ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; console . close ( ) ; console . dump ( logger ) ; String [ ] lines = console . getLines ( ) ; assertEquals ( 5 , lines . length ) ; assertEquals ( "apples" , lines [ 0 ] . trim ( ) ) ; assertEquals ( "oranges" , lines [ 1 ] . trim ( ) ) ; assertEquals ( "bananas" , lines [ 2 ] . trim ( ) ) ; assertEquals ( "kiwis" , lines [ 3 ] . trim ( ) ) ; assertEquals ( "mangos" , lines [ 4 ] . trim ( ) ) ; oddjob . destroy ( ) ; } public void testTestConvertExample ( ) { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; ConsoleCapture console = new ConsoleCapture | |
809 | <s> package net . sf . sveditor . core . log ; import java . lang . ref . WeakReference ; import java . util . ArrayList ; import java . util . List ; public class LogHandle implements ILogHandle { private String fName ; private String fCategory ; private ILogListener fListener ; private int fDebugLevel = 1 ; private int fIndent ; private List < WeakReference < ILogLevelListener > > fLogLevelListeners ; public LogHandle ( String name ) { this ( name , LOG_CAT_DEFAULT ) ; } public LogHandle ( String name , String category ) { fName = name ; fCategory = category ; fLogLevelListeners = new ArrayList < WeakReference < ILogLevelListener > > ( ) ; } public void init ( ILogListener parent ) { fListener = parent ; } public String getName ( ) { return fName ; } public String getCategory ( ) { return fCategory ; } public void addLogLevelListener ( ILogLevelListener l ) { fLogLevelListeners . add ( new WeakReference < ILogLevelListener > ( l ) ) ; } public void setDebugLevel ( int level ) { if ( fDebugLevel != level ) { fDebugLevel = level ; for ( int i = 0 ; i < fLogLevelListeners . size ( ) ; i ++ ) { WeakReference < ILogLevelListener > l = fLogLevelListeners . get ( i ) ; if ( l == null || l . get ( ) == null ) { fLogLevelListeners . remove ( i ) ; i -- ; } else { l . get ( ) . logLevelChanged ( this ) ; } } } fDebugLevel = level ; } public int getDebugLevel ( ) { return fDebugLevel ; } public boolean isEnabled ( ) { return ( fDebugLevel > 0 ) ; } public boolean isEnabled ( int level ) { return ( fDebugLevel > level ) ; } public void print ( int type , int level , String msg ) { } public void println ( int type , int level , String msg ) { fListener . message ( this , type , level , msg ) ; } public void note ( String msg ) { println ( ILogListener . Type_Info , 0 , msg ) ; } public void debug ( String msg ) { println ( ILogListener . Type_Debug , 3 , ( fIndent > 0 ) ? ( indent ( fIndent ) + msg ) : msg ) ; } public void debug ( String msg , Exception e ) { int level = ILogListener . Type_Error + ILogListener . Type_Debug ; println ( level , 3 , msg ) ; println ( level , 3 , e . getMessage ( ) ) ; for ( StackTraceElement s_e : e . getStackTrace ( ) ) { String m = " | |
810 | <s> package com . asakusafw . compiler . legacy . workflow ; import java . io . Closeable ; import java . io . File ; import java . io . IOException ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . List ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . AbstractWorkflowProcessor ; import com . asakusafw . compiler . batch . WorkDescriptionProcessor ; import com . asakusafw . compiler . batch . Workflow ; import com . asakusafw . compiler . batch . processor . JobFlowWorkDescriptionProcessor ; import com . asakusafw . compiler . batch . processor . ScriptWorkDescriptionProcessor ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider . Command ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider . CommandContext ; import com . asakusafw . compiler . flow . jobflow . CompiledStage ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Stage ; import com . asakusafw . runtime . stage . StageConstants ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graphs ; import com . asakusafw . vocabulary . batch . JobFlowWorkDescription ; import com . asakusafw . vocabulary . batch . ScriptWorkDescription ; import com . asakusafw . vocabulary . batch . WorkDescription ; public class ExperimentalWorkflowProcessor extends AbstractWorkflowProcessor { public static final String VAR_BATCH_ARGS = "" ; static final Logger LOG = LoggerFactory . getLogger ( ExperimentalWorkflowProcessor . class ) ; static final Charset ENCODING = Charset . forName ( "UTF-8" ) ; private static final Pattern SH_METACHARACTERS = Pattern . compile ( "[\\$`\"\\\\n]" ) ; private static final String CMD_HADOOP_JOB = "" ; private static final String CMD_CLEANER = "" ; private static final String VAR_HOME = "ASAKUSA_HOME" ; private static final String VAR_BATCH_ID = "_BATCH_ID" ; private static final String VAR_FLOW_ID = "_FLOW_ID" ; private static final String VAR_EXECUTION_ID = "" ; private static final String EXPR_EXECUTION_ID = "$" + VAR_EXECUTION_ID ; private static final String EXPR_BATCH_ARGS = "$" + VAR_BATCH_ARGS ; private static final String PREFIX_APP_HOME = MessageFormat . format ( "${0}/" , VAR_HOME ) ; private static final String JOBFLOW_LIB_SOURCE = JobFlowWorkDescriptionProcessor . JOBFLOW_PACKAGE ; private static final String JOBFLOW_LIB_DEST = MessageFormat . format ( "" , VAR_HOME , VAR_BATCH_ID ) ; public static final String PATH = "" ; public static final String K_OPTS = "" ; public static File getScriptOutput ( File outputDir ) { Precondition . checkMustNotBeNull ( outputDir , "outputDir" ) ; return new File ( outputDir , PATH ) ; } @ Override public Collection < Class < ? extends WorkDescriptionProcessor < ? > > > getDescriptionProcessors ( ) { List < Class < ? extends WorkDescriptionProcessor < ? > > > results = Lists . create ( ) ; results . add ( JobFlowWorkDescriptionProcessor . class ) ; results . add ( ScriptWorkDescriptionProcessor . class ) ; return results ; } @ Override public void process ( Workflow workflow ) throws IOException { OutputStream output = getEnvironment ( ) . openResource ( PATH ) ; try { Context context = new Context ( output ) ; context . put ( "#!/bin/bash" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; String batchId = getEnvironment ( ) . getConfiguration ( ) . getBatchId ( ) ; context . put ( "" , batchId ) ; context . put ( "" , toLiteral ( batchId ) ) ; context . put ( "" ) ; dump ( context , workflow . getGraph ( ) ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . close ( ) ; } finally { output . close ( ) ; } } private void dump ( Context context , Graph < Workflow . Unit > graph ) { assert context != null ; assert graph != null ; for ( Workflow . Unit unit : Graphs . sortPostOrder ( graph ) ) { dumpUnit ( context , unit ) ; } } private void dumpUnit ( Context context , Workflow . Unit unit ) { assert context != null ; assert unit != null ; WorkDescription desc = unit . getDescription ( ) ; if ( desc instanceof ScriptWorkDescription ) { dumpDescription ( context , ( ScriptWorkDescription ) desc ) ; } else if ( desc instanceof JobFlowWorkDescription ) { dumpDescription ( context , ( JobFlowWorkDescription ) desc , ( JobflowModel ) unit . getProcessed ( ) ) ; } else { throw new AssertionError ( desc ) ; } } private void dumpDescription ( Context context , ScriptWorkDescription desc ) { assert context != null ; assert desc != null ; context . put ( "" , desc . getCommand ( ) ) ; context . put ( "" , desc . getCommand ( ) ) ; dumpRun ( context , null , desc . getCommand ( ) ) ; context . put ( "" ) ; } private void dumpDescription ( Context context , JobFlowWorkDescription desc , JobflowModel model ) { assert context != null ; assert desc != null ; assert model != null ; context . put ( "" , model . getFlowId ( ) ) ; context . put ( "" , model . getFlowId ( ) ) ; context . put ( "" ) ; context . put ( "" , VAR_EXECUTION_ID ) ; context . put ( "{0}={1}" , VAR_BATCH_ID , toLiteral ( model . getBatchId ( ) ) ) ; context . put ( "{0}={1}" , VAR_FLOW_ID , toLiteral ( model . getFlowId ( ) ) ) ; context . put ( "" , VAR_EXECUTION_ID ) ; context . put ( "" , VAR_BATCH_ID ) ; context . put ( "" , VAR_FLOW_ID ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" , JOBFLOW_LIB_SOURCE , Naming . getJobflowClassPackageName ( model . getFlowId ( ) ) , JOBFLOW_LIB_DEST ) ; context . put ( "mkdir -p {0}" , quote ( JOBFLOW_LIB_DEST ) ) ; context . put ( "" , quote ( JOBFLOW_LIB_SOURCE ) , toLiteral ( Naming . getJobflowClassPackageName ( model . getFlowId ( ) ) ) , quote ( JOBFLOW_LIB_DEST ) ) ; context . put ( "" ) ; dumpInitializer ( context , model ) ; dumpImporter ( context , model ) ; Graph < Stage > graph = model . getDependencyGraph ( ) ; for ( CompiledStage stage : model . getCompiled ( ) . getPrologueStages ( ) ) { dumpStage ( context , model , stage ) ; } for ( Stage stage : Graphs . sortPostOrder ( graph ) ) { dumpStage ( context , model , stage . getCompiled ( ) ) ; } for ( CompiledStage stage : model . getCompiled ( ) . getEpilogueStages ( ) ) { dumpStage ( context , model , stage ) ; } dumpExporter ( context , model ) ; dumpCleaner ( context , model ) ; dumpFinalizer ( context , model , "" ) ; context . put ( "" ) ; } private void dumpImporter ( Context context , JobflowModel model ) { assert context != null ; assert model != null ; List < ExternalIoCommandProvider > providers = model . getCompiled ( ) . getCommandProviders ( ) ; CommandContext cmdContext = createContext ( model ) ; for ( ExternalIoCommandProvider provider : providers ) { List < Command > commands = provider . getImportCommand ( cmdContext ) ; for ( Command cmd : commands ) { context . put ( "" , provider . getName ( ) ) ; context . put ( "" , provider . getName ( ) ) ; dumpRun ( context , model , cmd . getCommandLineString ( ) ) ; } } } private CommandContext createContext ( JobflowModel model ) { assert model != null ; return new CommandContext ( quote ( PREFIX_APP_HOME ) , quote ( EXPR_EXECUTION_ID ) , quote ( EXPR_BATCH_ARGS ) ) ; } private void dumpExporter ( Context context , JobflowModel model ) { assert context != null ; assert model != null ; List < ExternalIoCommandProvider > providers = model . getCompiled ( ) . getCommandProviders ( ) ; CommandContext cmdContext = createContext ( model ) ; for ( ExternalIoCommandProvider provider : providers ) { List < Command > commands = provider . getExportCommand ( cmdContext ) ; for ( Command cmd : commands ) { context . put ( "" , provider . getName ( ) ) ; context . put ( "" , provider . getName ( ) ) ; dumpRun ( context , model , cmd . getCommandLineString ( ) ) ; } } } private void dumpStage ( Context context , JobflowModel model , CompiledStage stage ) { assert context != null ; assert model != null ; if ( stage . getQualifiedName ( ) == null ) { return ; } String batchId = model . getBatchId ( ) ; String flowId = model . getFlowId ( ) ; String stageId = stage . getStageId ( ) ; context . put ( "" , stage . getQualifiedName ( ) . toNameString ( ) ) ; context . put ( "" , StageConstants . getDefinitionId ( batchId , flowId , stageId ) ) ; dumpRun ( context , model , toHadoopJob ( model , stage ) ) ; } private void dumpRun ( Context context , JobflowModel modelOrNull , String pattern , Object ... arguments ) { assert context != null ; assert pattern != null ; assert arguments != null ; String command ; if ( arguments . length == 0 ) { command = pattern ; } else { command = MessageFormat . format ( pattern , arguments ) ; } context . put ( "" , VAR_HOME ) ; context . put ( "{0}" , command ) ; context . put ( "_RET=$?" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "" , command ) ; if ( modelOrNull != null ) { dumpFinalizer ( context , modelOrNull , " " ) ; } context . put ( "" ) ; context . put ( "" ) ; context . put ( "" ) ; context . put ( "fi" ) ; context . put ( "" ) ; } private void dumpInitializer ( Context context , JobflowModel model ) { assert context != null ; assert model != null ; List < ExternalIoCommandProvider > providers = model . getCompiled ( ) . getCommandProviders ( ) ; CommandContext cmdContext = createContext ( model ) ; for ( ExternalIoCommandProvider provider : providers ) { List < Command > commands = provider . getInitializeCommand ( cmdContext ) ; for ( Command cmd : commands ) { context . put ( "" , provider . getName ( ) ) ; context . put ( "" , provider . getName ( ) , model . getFlowId ( ) ) ; dumpRun ( context , model , cmd . getCommandLineString ( ) ) ; } } } private void dumpCleaner ( Context context , JobflowModel model ) { assert context != null ; assert model != null ; VariableTable variables = new VariableTable ( ) ; variables . defineVariable ( StageConstants . VAR_USER , "$USER" ) ; variables . defineVariable ( StageConstants . VAR_BATCH_ID , "$" + VAR_BATCH_ID ) ; variables . defineVariable ( StageConstants . VAR_FLOW_ID , "$" + VAR_FLOW_ID ) ; variables . defineVariable ( StageConstants . VAR_EXECUTION_ID , EXPR_EXECUTION_ID ) ; String path = getEnvironment ( ) . getConfiguration ( ) | |
811 | <s> package com . asakusafw . testdriver . excel ; import java . io . IOException ; import java . net . URI ; import org . apache . poi . ss . usermodel . Sheet ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . DataModelSourceProvider ; import | |
812 | <s> package com . asakusafw . compiler . operator ; import static com . asakusafw . utils . java . model . syntax . ModifierKind . * ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . List ; import javax . lang . model . element . PackageElement ; import org . junit . Test ; import com . asakusafw . utils . java . jsr269 . bridge . Jsr269 ; import com . asakusafw . utils . java . model . syntax . ClassDeclaration ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . ImportBuilder . Strategy ; import com . asakusafw . utils . java . model . util . Models ; public class OperatorImplementationClassGeneratorTest extends OperatorCompilerTestRoot { @ Test public void concrete ( ) { add ( "" ) ; ClassDeclaration tree = generate ( new MockOperatorProcessor ( ) ) ; assertThat ( Find . modifiers ( tree ) , hasItem ( PUBLIC ) ) ; assertThat ( Find . modifiers ( tree ) , not ( hasItem ( ABSTRACT ) ) ) ; assertThat ( tree . getName ( ) . getToken ( ) , is ( "ConcreteImpl" ) ) ; assertThat ( tree . getSuperClass ( ) . toString ( ) , is ( "Concrete" ) ) ; assertThat ( Find . method ( tree , "example" ) , is ( nullValue ( ) ) ) ; } @ Test public void skeleton ( ) { add ( "" ) ; ClassDeclaration tree = generate ( new MockOperatorProcessor ( ) ) ; assertThat ( Find . modifiers ( tree ) , hasItem ( PUBLIC ) ) ; assertThat ( Find . modifiers ( tree ) , not ( hasItem ( ABSTRACT ) ) ) ; assertThat ( tree . getName ( ) . getToken ( ) , is ( "AbstractImpl" ) ) ; assertThat ( tree . getSuperClass ( ) . toString ( ) , is ( "Abstract" ) ) ; MethodDeclaration method = Find . method ( tree , "example" ) ; assertThat ( method , not ( nullValue ( ) ) ) ; assertThat ( Find . modifiers ( method ) , hasItem ( PUBLIC ) ) ; assertThat ( Find . modifiers ( method ) , not ( hasItems ( ABSTRACT , STATIC ) ) ) ; assertThat ( method . getReturnType ( ) . toString ( ) , is ( "CharSequence" ) ) ; List < ? extends FormalParameterDeclaration > params = method . getFormalParameters ( ) ; assertThat ( params . size ( ) , is ( 2 ) ) ; assertThat ( params . get ( 0 ) . getType ( ) . toString ( ) , is ( "String" ) ) ; assertThat ( params . get ( 0 ) . getName ( ) . toString ( ) , is ( "string" ) ) ; assertThat ( params . get ( 1 ) . getType ( ) . toString ( ) , is ( "int" ) ) ; assertThat ( params . get ( 1 ) . getName ( ) . toString ( ) , is ( "param" ) ) ; } private ClassDeclaration generate ( OperatorProcessor ... procs ) { Engine engine = new Engine ( procs ) ; start ( engine ) ; assertThat ( engine . collected , not ( nullValue ( | |
813 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . List ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . dialogs . StatusDialog ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; 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 . ui . dialogs . ElementTreeSelectionDialog ; import org . eclipse . ui . dialogs . ISelectionStatusValidator ; import org . eclipse . ui . model . WorkbenchContentProvider ; import org . eclipse . ui . model . WorkbenchLabelProvider ; import org . eclipse . ui . views . navigator . ResourceSorter ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . TypedElementSelectionValidator ; import org . rubypeople . rdt . internal . ui . wizards . TypedViewerFilter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IStringButtonAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringButtonDialogField ; public class ExclusionInclusionEntryDialog extends StatusDialog { private StringButtonDialogField fExclusionPatternDialog ; private StatusInfo fExclusionPatternStatus ; private IContainer fCurrSourceFolder ; private String fExclusionPattern ; private List fExistingPatterns ; private boolean fIsExclusion ; public ExclusionInclusionEntryDialog ( Shell parent , boolean isExclusion , String patternToEdit , List existingPatterns , CPListElement entryToEdit ) { super ( parent ) ; fIsExclusion = isExclusion ; fExistingPatterns = existingPatterns ; String title , message ; if ( isExclusion ) { if ( patternToEdit == null ) { title = NewWizardMessages . ExclusionInclusionEntryDialog_exclude_add_title ; } else { title = NewWizardMessages . ExclusionInclusionEntryDialog_exclude_edit_title ; } message = Messages . format ( NewWizardMessages . ExclusionInclusionEntryDialog_exclude_pattern_label , entryToEdit . getPath ( ) . makeRelative ( ) . toString ( ) ) ; } else { if ( patternToEdit == null ) { title = NewWizardMessages . ExclusionInclusionEntryDialog_include_add_title ; } else { title = NewWizardMessages . ExclusionInclusionEntryDialog_include_edit_title ; } message = Messages . format ( NewWizardMessages . ExclusionInclusionEntryDialog_include_pattern_label , entryToEdit . getPath ( ) . makeRelative ( ) . toString ( ) ) ; } setTitle ( title ) ; if ( patternToEdit != null ) { fExistingPatterns . remove ( patternToEdit ) ; } IWorkspaceRoot root = entryToEdit . getRubyProject ( ) . getProject ( ) . getWorkspace ( ) . getRoot ( ) ; IResource res = root . findMember ( entryToEdit . getPath ( ) ) ; if ( res instanceof IContainer ) { fCurrSourceFolder = ( IContainer ) res ; } fExclusionPatternStatus = new StatusInfo ( ) ; ExclusionPatternAdapter adapter = new ExclusionPatternAdapter ( ) ; fExclusionPatternDialog = new StringButtonDialogField ( adapter ) ; fExclusionPatternDialog . setLabelText ( message ) ; fExclusionPatternDialog . setButtonLabel ( NewWizardMessages . ExclusionInclusionEntryDialog_pattern_button ) ; fExclusionPatternDialog . setDialogFieldListener ( adapter ) ; fExclusionPatternDialog . enableButton ( fCurrSourceFolder != null ) ; if ( patternToEdit == null ) { fExclusionPatternDialog . setText ( "" ) ; } else { fExclusionPatternDialog . setText ( patternToEdit . toString ( ) ) ; } } protected Control createDialogArea ( Composite parent ) { Composite composite = ( Composite ) super . createDialogArea ( parent ) ; int widthHint = convertWidthInCharsToPixels ( 60 ) ; Composite inner = new Composite ( composite , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; layout . numColumns = 2 ; inner . setLayout ( layout ) ; Label description = new Label ( inner , SWT . WRAP ) ; if ( fIsExclusion ) { | |
814 | <s> package org . rubypeople . rdt . internal . ui . browsing ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Widget ; import org . rubypeople . rdt . internal . ui . viewsupport . ProblemTableViewer ; class PackagesViewTableViewer extends ProblemTableViewer implements IPackagesViewViewer { public PackagesViewTableViewer ( Composite parent , int style ) { super ( parent , style ) ; } public void mapElement ( Object element , Widget item ) { super . mapElement ( element , item ) ; } public void unmapElement ( Object element , Widget item ) { super . unmapElement ( element , item ) ; } protected Object [ ] getFilteredChildren ( Object parent ) { Object [ ] result = getRawChildren ( parent ) ; List list = new ArrayList ( ) ; if ( result != null ) { Object [ ] toBeFiltered = new Object [ 1 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { Object object = result [ i ] ; toBeFiltered [ 0 ] = object ; if ( filter ( toBeFiltered ) . length == 1 ) list . add ( object ) ; } } return list . toArray ( ) ; } public Widget doFindItem ( Object element ) { return super . doFindItem ( element ) ; } | |
815 | <s> package com . sun . tools . hat ; import java . io . IOException ; import java . io . File ; import com . sun . tools . hat . internal . lang . guava . Guava ; import com . sun . tools . hat . internal . lang . jruby12 . JRuby12 ; import com . sun . tools . hat . internal . lang . jruby16 . JRuby16 ; import com . sun . tools . hat . internal . lang . openjdk6 . OpenJDK6 ; import com . sun . tools . hat . internal . model . Snapshot ; import com . sun . tools . hat . internal . model . ReachableExcludesImpl ; import com . sun . tools . hat . internal . server . QueryListener ; public class Main { private static String VERSION_STRING = "" ; private static void usage ( String message ) { if ( message != null ) { System . err . println ( "ERROR: " + message ) ; } System . err . println ( "" ) ; System . err . println ( ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( "" ) ; System . err . println ( ) ; System . err . println ( "" ) ; System . exit ( 1 ) ; } private static boolean booleanValue ( String s ) { if ( "true" . equalsIgnoreCase ( s ) ) { return true ; } else if ( "false" . equalsIgnoreCase ( s ) ) { return false ; } else { usage ( "" ) ; return false ; } } public static void main ( String [ ] args ) throws IOException { if ( args . length < 1 ) { usage ( "" ) ; } boolean parseonly = false ; int portNumber = 7000 ; boolean callStack = true ; boolean calculateRefs = true ; String baselineDump = null ; String excludeFileName = null ; int debugLevel = 0 ; for ( int i = 0 ; ; i += 2 ) { if ( i > ( args . length - 1 ) ) { usage ( "" ) ; } if ( "-version" . equals ( args [ i ] ) ) { System . out . print ( VERSION_STRING ) ; System . out . println ( "" + System . getProperty ( "java.version" ) + ")" ) ; System . exit ( 0 ) ; } if ( "-h" . equals ( args [ i ] ) || "-help" . equals ( args [ i ] ) ) { usage ( null ) ; } if ( i == ( args . length - 1 ) ) { break ; } String key = args [ i ] ; String value = args [ i + 1 ] ; if ( "-stack" . equals ( key ) ) { callStack = booleanValue ( value ) ; } else if ( "-refs" . equals ( key ) ) { calculateRefs = booleanValue ( value ) ; } else if ( "-port" . equals ( key ) ) { portNumber = Integer . parseInt ( value , 10 ) ; } else if ( "-exclude" . equals ( key ) ) { excludeFileName = value ; } else if ( "-baseline" . equals ( key ) ) { baselineDump = value ; } else if ( "-debug" . equals ( key ) ) { debugLevel = Integer . parseInt ( value | |
816 | <s> package com . asakusafw . dmdl . semantics ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import com . asakusafw . dmdl . Diagnostic ; import com . asakusafw . dmdl . Diagnostic . Level ; import com . asakusafw . dmdl . model . AstAttribute ; import com . asakusafw . dmdl . model . AstDescription ; import com . asakusafw . dmdl . model . AstModelDefinition ; import com . asakusafw . dmdl . model . AstSimpleName ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; public class DmdlSemantics { private final Map < String , ModelDeclaration > declaredModels = Maps . create ( ) ; private final List < Diagnostic > diagnostics = Lists . create ( ) ; private boolean sawError = false ; public ModelDeclaration declareModel ( AstModelDefinition < ? > modelOriginalAst , AstSimpleName modelName , AstDescription modelDescription , List < ? extends AstAttribute > modelAttributes ) { if ( modelName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( modelAttributes == null ) { throw new IllegalArgumentException ( "" ) ; } if ( | |
817 | <s> package org . springframework . social . google . api . tasks . impl ; import static org . springframework . util . Assert . isNull ; import static org . springframework . util . Assert . isTrue ; import static org . springframework . util . Assert . notNull ; import static org . springframework . util . StringUtils . hasText ; import org . springframework . social . google . api . impl . AbstractGoogleApiOperations ; import org . springframework . social . google . api . tasks . Task ; import org . springframework . social . google . api . tasks . TaskList ; import org . springframework . social . google . api . tasks . TaskListQueryBuilder ; import org . springframework . social . google . api . tasks . TaskListsPage ; import org . springframework . social . google . api . tasks . TaskOperations ; import org . springframework . social . google . api . tasks . TaskQueryBuilder ; import org . springframework . social . google . api . tasks . TasksPage ; import org . springframework . web . client . RestTemplate ; public class TaskTemplate extends AbstractGoogleApiOperations implements TaskOperations { static final String TASK_LISTS_URL = "" ; static final String TASKS_URL = "" ; static final String DEFAULT = "@default" ; static final String TASKS = "/tasks" ; public TaskTemplate ( RestTemplate restTemplate , boolean isAuthorized ) { super ( restTemplate , isAuthorized ) ; } @ Override public TaskListsPage getTaskLists ( ) { return taskListQuery ( ) . maxResultsNumber ( 100 ) . getPage ( ) ; } @ Override public TaskList getTaskList ( String id ) { return getEntity ( TASK_LISTS_URL + '/' + id , TaskList . class ) ; } @ Override public TaskList saveTaskList ( TaskList taskList ) { return saveEntity ( TASK_LISTS_URL , taskList ) ; } @ Override public void deleteTaskList ( TaskList taskList ) { deleteEntity ( TASK_LISTS_URL , taskList ) ; } @ Override public TaskListQueryBuilder taskListQuery ( ) { return new TaskListQueryBuilderImpl ( restTemplate ) ; } @ Override public TasksPage getTasks ( ) { return taskQuery ( ) . maxResultsNumber ( 100 ) . getPage ( ) ; } @ Override public Task getTask ( String id ) { return getTask ( DEFAULT , id ) ; } @ Override public Task getTask ( String taskListId , String id ) { return getEntity ( TASKS_URL + taskListId + TASKS + '/' + id , Task . class ) ; } @ Override public Task saveTask ( Task task ) { return saveTask | |
818 | <s> package com . asakusafw . utils . java . model . util ; import java . io . IOException ; import java . io . PrintWriter ; import com . asakusafw . utils . java . model . syntax . Attribute ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Modifier ; import com . asakusafw . utils . java . model . syntax . ModifierKind ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; public abstract class Emitter { private static final String EXTENSION = ".java" ; private static final String PACKAGE_INFO = "package-info" + EXTENSION ; public PrintWriter openFor ( CompilationUnit unit ) throws IOException { if ( unit == null ) { throw new IllegalArgumentException ( "" ) ; } TypeDeclaration primary = findPrimaryType ( unit ) ; if ( primary == null ) { return openFor ( unit . getPackageDeclaration ( ) , PACKAGE_INFO ) ; } return openFor ( unit . getPackageDeclaration ( ) , primary ) ; } public static TypeDeclaration findPrimaryType ( CompilationUnit unit ) { if ( unit == | |
819 | <s> package com . asakusafw . compiler . flow . testing . external ; import com . asakusafw . compiler | |
820 | <s> package org . rubypeople . rdt . internal . launching ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . rubypeople . rdt . core . ILoadpathContainer ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . LoadpathContainerInitializer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . launching . IRuntimeContainerComparator ; import org . rubypeople . rdt . launching . IRuntimeLoadpathEntry ; import org . rubypeople . rdt . launching . RubyRuntime ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; public class DefaultProjectLoadpathEntry extends AbstractRuntimeLoadpathEntry { public static final String TYPE_ID = "" ; private boolean fExportedEntriesOnly = false ; public DefaultProjectLoadpathEntry ( ) { } public DefaultProjectLoadpathEntry ( IRubyProject project ) { setRubyProject ( project ) ; } protected void buildMemento ( Document document , Element memento ) throws CoreException { memento . setAttribute ( "project" , getRubyProject ( ) . getElementName ( ) ) ; memento . setAttribute ( "" , Boolean . toString ( fExportedEntriesOnly ) ) ; } public void initializeFrom ( Element memento ) throws CoreException { String name = memento . getAttribute ( "project" ) ; if ( name == null ) { abort ( LaunchingMessages . DefaultProjectLoadpathEntry_3 , null ) ; } IRubyProject project = RubyCore . create ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( name ) ) ; setRubyProject ( project ) ; name = memento . getAttribute ( "" ) ; if ( name == null ) { fExportedEntriesOnly = false ; } else { fExportedEntriesOnly = Boolean . valueOf ( name ) . booleanValue ( ) ; } } public String getTypeId ( ) { return TYPE_ID ; } public int getType ( ) { return OTHER ; } protected IProject getProject ( ) { return getRubyProject ( ) . getProject ( ) ; } public String getLocation ( ) { return getProject ( ) . getLocation ( ) . toOSString ( ) ; } public IPath getPath ( ) { return getProject ( ) . getFullPath ( ) ; } public IResource getResource ( ) { return getProject ( ) ; } public IRuntimeLoadpathEntry [ ] getRuntimeLoadpathEntries ( ILaunchConfiguration configuration ) throws CoreException { ILoadpathEntry entry = RubyCore . newProjectEntry ( getRubyProject ( ) . getProject ( ) . getFullPath ( ) ) ; List classpathEntries = new ArrayList ( 5 ) ; List < ILoadpathEntry > expanding = new ArrayList < ILoadpathEntry > ( 5 ) ; expandProject ( entry , classpathEntries , expanding ) ; IRuntimeLoadpathEntry [ ] runtimeEntries = new IRuntimeLoadpathEntry [ classpathEntries . size ( ) ] ; for ( int i = 0 ; i < runtimeEntries . length ; i ++ ) { Object e = classpathEntries . get ( i ) ; if ( e instanceof ILoadpathEntry ) { ILoadpathEntry cpe = ( ILoadpathEntry ) e ; runtimeEntries [ i ] = new RuntimeLoadpathEntry ( cpe ) ; } else { runtimeEntries [ i ] = ( IRuntimeLoadpathEntry ) e ; } } List < IRuntimeLoadpathEntry > ordered = new ArrayList < IRuntimeLoadpathEntry > ( runtimeEntries . length ) ; for ( int i = 0 ; i < runtimeEntries . length ; i ++ ) { if ( runtimeEntries [ i ] . getLoadpathProperty ( ) == IRuntimeLoadpathEntry . USER_CLASSES ) { ordered . add ( runtimeEntries [ i ] ) ; } } return ordered . toArray ( new IRuntimeLoadpathEntry [ ordered . size ( ) ] ) ; } private void expandProject ( ILoadpathEntry projectEntry , List expandedPath , List < ILoadpathEntry > expanding ) throws CoreException { expanding | |
821 | <s> package net . sf . sveditor . ui . editor . actions ; import java . util . ResourceBundle ; import net . sf . sveditor . ui . editor . SVEditor ; import org . eclipse . ui . texteditor . TextEditorAction ; public class OpenQuickObjectsViewAction extends TextEditorAction { private SVEditor fEditor ; public OpenQuickObjectsViewAction ( ResourceBundle bundle , SVEditor editor ) { super ( bundle , "" , editor ) ; fEditor = | |
822 | <s> package de . fuberlin . wiwiss . d2rq ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . util . Collection ; import junit . framework . TestCase ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import de . fuberlin . wiwiss . d2rq . map . Database ; import de . fuberlin . wiwiss . d2rq . parser . MapParser ; import de . fuberlin . wiwiss . d2rq . sql . ConnectedDB ; public class DBConnectionTest extends TestCase { private Model mapModel ; private Collection < Database > databases ; private Database firstDatabase ; private ConnectedDB cdb ; private String simplestQuery ; private String mediumQuery ; private String complexQuery ; protected void setUp ( ) throws Exception { mapModel = ModelFactory . createDefaultModel ( ) ; mapModel . read ( D2RQTestSuite . ISWC_MAP , "http://test/" , "TURTLE" ) ; MapParser parser = new MapParser ( mapModel , null ) ; databases = parser . parse ( ) . databases ( ) ; | |
823 | <s> package de . fuberlin . wiwiss . d2rq . nodes ; import java . util . List ; import java . util . Set ; import com . hp . hpl . jena . datatypes . RDFDatatype ; import com . hp . hpl . jena . datatypes . xsd . XSDDatatype ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . rdf . model . AnonId ; import de . fuberlin . wiwiss . d2rq . algebra . ColumnRenamer ; import de . fuberlin . wiwiss . d2rq . algebra . OrderSpec ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . algebra . RelationalOperators ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . pp . PrettyPrinter ; import de . fuberlin . wiwiss . d2rq . sql . ResultRow ; import de . fuberlin . wiwiss . d2rq . values . ValueMaker ; public class TypedNodeMaker implements NodeMaker { public final static NodeType URI = new URINodeType ( ) ; public final static NodeType BLANK = new BlankNodeType ( ) ; public final static NodeType PLAIN_LITERAL = new LiteralNodeType ( "" , null ) ; public final static NodeType XSD_DATE = new DateLiteralNodeType ( ) ; public final static NodeType XSD_TIME = new TimeLiteralNodeType ( ) ; public final static NodeType XSD_DATETIME = new DateTimeLiteralNodeType ( ) ; public final static NodeType XSD_BOOLEAN = new BooleanLiteralNodeType ( ) ; public static NodeType languageLiteral ( String language ) { return new LiteralNodeType ( language , null ) ; } public static NodeType typedLiteral ( RDFDatatype datatype ) { if ( datatype . equals ( XSDDatatype . XSDdate ) ) { return XSD_DATE ; } if ( datatype . equals ( XSDDatatype . XSDtime ) ) { return XSD_TIME ; } if ( datatype . equals ( XSDDatatype . XSDdateTime ) ) { return XSD_DATETIME ; } if ( datatype . equals ( XSDDatatype . XSDboolean ) ) { return XSD_BOOLEAN ; } return new LiteralNodeType ( "" , datatype ) ; } private NodeType nodeType ; private ValueMaker valueMaker ; private boolean isUnique ; public TypedNodeMaker ( NodeType nodeType , ValueMaker valueMaker , boolean isUnique ) { this . nodeType = nodeType ; this . valueMaker = valueMaker ; this . isUnique = isUnique ; } public Set < ProjectionSpec > projectionSpecs ( ) { return this . valueMaker . projectionSpecs ( ) ; } public boolean isUnique ( ) { return this . isUnique ; } public void describeSelf ( NodeSetFilter c ) { this . nodeType . matchConstraint ( c ) ; this . valueMaker . describeSelf ( c ) ; } public ValueMaker valueMaker ( ) { return this . valueMaker ; } public Node | |
824 | <s> package com . devtty . gat . model ; import java . io . Serializable ; import javax . persistence . Column ; import javax . persistence . Entity ; import javax . persistence . GeneratedValue ; import javax . persistence . Id ; import javax . persistence . Table ; import javax . persistence . UniqueConstraint ; import javax . validation . constraints . Digits ; import javax . validation . constraints . NotNull ; import javax . validation . constraints . Pattern ; import javax . validation . constraints . Size ; import javax . xml . bind . annotation . XmlRootElement ; import org . hibernate . validator . constraints . Email ; import org . hibernate . validator . constraints . NotEmpty ; @ Entity @ XmlRootElement @ Table ( uniqueConstraints = @ UniqueConstraint ( columnNames = "email" ) ) public class Member implements Serializable { private Long id ; private String name ; private String email ; private String phoneNumber ; @ Id @ GeneratedValue public Long getId ( ) { return id ; } public void setId ( Long id ) { this . id = id ; } @ NotNull @ Size ( min = 1 , max = 25 ) | |
825 | <s> package com . asakusafw . yaess . core ; import java . io . IOException ; import java . io . OutputStream ; public abstract class PhaseMonitor implements ExecutionMonitor { public static final PhaseMonitor NULL = new PhaseMonitor ( ) { @ Override public void progressed ( double deltaSize ) { return ; } @ Override public void setProgress ( double workedSize ) throws IOException { return ; } @ Override public void open ( double taskSize ) { return ; } @ Override public void reportJobStatus ( String jobId , JobStatus status , Throwable cause ) { return ; } @ Override public void close ( ) { return ; } } ; @ Override public void checkCancelled ( ) throws InterruptedException { if ( Thread . interrupted ( ) || isCancelRequested ( ) ) { throw new InterruptedException ( ) ; } } protected boolean isCancelRequested ( ) { return false ; } @ Override public OutputStream getOutput ( ) throws IOException { return System . out ; } public ExecutionMonitor createJobMonitor ( String jobId , double childTaskSize ) { if ( jobId == | |
826 | <s> package com . asakusafw . compiler . flow ; import java . util . Collections ; import java . util . Map ; import java . util . NoSuchElementException ; import java . util . Properties ; import java . util . Set ; import java . util . TreeSet ; import java . util . concurrent . ConcurrentHashMap ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; public class FlowCompilerOptions { static final Logger LOG = LoggerFactory . getLogger ( FlowCompilerOptions . class ) ; public static final String K_OPTIONS = "" ; public static final String PREFIX_EXTRA_OPTION = "X" ; public enum Item { enableCombiner ( false ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setEnableCombiner ( value ) ; } } , compressFlowPart ( true ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setCompressFlowPart ( value ) ; } } , compressConcurrentStage ( true ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setCompressConcurrentStage ( value ) ; } } , hashJoinForTiny ( true ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setHashJoinForTiny ( value ) ; } } , hashJoinForSmall ( false ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setHashJoinForSmall ( value ) ; } } , enableDebugLogging ( false ) { @ Override public void setTo ( FlowCompilerOptions options , boolean value ) { options . setEnableDebugLogging ( value ) ; } } , ; public final boolean defaultValue ; private Item ( boolean defaultValue ) { this . defaultValue = defaultValue ; } public abstract void setTo ( FlowCompilerOptions options , boolean value ) ; } public enum GenericOptionValue { ENABLED ( "enabled" , "enable" , "t" , "true" , "y" , "yes" , "on" ) , DISABLED ( "disabled" , "disable" , "f" , "false" , "n" , "no" , "off" ) , AUTO ( "auto" ) , INVALID ( "invalid" ) , ; private final String primary ; private final Set < String > symbols ; private GenericOptionValue ( String primary , String ... symbols ) { assert primary != null ; assert symbols != null ; this . primary = primary ; this . symbols = new TreeSet < String > ( String . CASE_INSENSITIVE_ORDER ) ; Collections . addAll ( this . symbols , primary ) ; Collections . addAll ( this . symbols , symbols ) ; } public String getSymbol ( ) { return primary ; } public static GenericOptionValue fromSymbol ( String symbol ) { if ( symbol == null ) { throw new IllegalArgumentException ( "" ) ; } for ( GenericOptionValue | |
827 | <s> package org . rubypeople . rdt . internal . core . search ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyElementDelta ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . WorkingCopyOwner ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . internal . core . RubyElement ; import org . rubypeople . rdt . internal . core . RubyModelManager ; import org . rubypeople . rdt . internal . core . RubyProject ; import org . rubypeople . rdt . internal . core . hierarchy . TypeHierarchy ; public class HierarchyScope implements IRubySearchScope { public IType focusType ; private String focusPath ; private WorkingCopyOwner owner ; private ITypeHierarchy hierarchy ; private IType [ ] types ; private HashSet resourcePaths ; private IPath [ ] enclosingProjectsAndJars ; protected IResource [ ] elements ; protected int elementCount ; public boolean needsRefresh ; public void add ( IResource element ) { if ( this . elementCount == this . elements . length ) { System . arraycopy ( this . elements , 0 , this . elements = new IResource [ this . elementCount * 2 ] , 0 , this . elementCount ) ; } elements [ elementCount ++ ] = element ; } public HierarchyScope ( IType type , WorkingCopyOwner owner ) throws RubyModelException { this . focusType = type ; this . owner = owner ; this . enclosingProjectsAndJars = this . computeProjectsAndJars ( type ) ; ISourceFolderRoot root = ( ISourceFolderRoot ) type . getSourceFolder ( ) . getParent ( ) ; this . focusPath = type . getPath ( ) . toString ( ) ; this . needsRefresh = true ; } private void buildResourceVector ( ) { HashMap resources = new HashMap ( ) ; HashMap paths = new HashMap ( ) ; this . types = this . hierarchy . getAllTypes ( ) ; IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; for ( int i = 0 ; i < this . types . length ; i ++ ) { IType type = this . types [ i ] ; IResource resource = type . getResource ( ) ; if ( resource != null && resources . get ( resource ) == null ) { resources . put ( resource , resource ) ; add ( resource ) ; } ISourceFolderRoot root = ( ISourceFolderRoot ) type . getSourceFolder ( ) . getParent ( ) ; paths . put ( type . getRubyProject ( ) . getProject ( ) . getFullPath ( ) , type ) ; } this . enclosingProjectsAndJars = new IPath [ paths . size ( ) ] ; int i = 0 ; for ( Iterator iter = paths . keySet ( ) . iterator ( ) ; iter . hasNext | |
828 | <s> package test . modelgen . io ; import java . io . IOException ; import test . modelgen . model . AllTypesWNoerr ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class AllTypesWNoerrModelOutput implements ModelOutput < AllTypesWNoerr > { private final RecordEmitter emitter ; public AllTypesWNoerrModelOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( AllTypesWNoerr model ) throws IOException { emitter . emit ( model . getCTagOption ( ) ) ; emitter . emit ( model . getCCommentOption ( ) ) ; emitter . emit ( model . getCBigintOption ( ) | |
829 | <s> package net . sf . sveditor . ui . tests ; import org . eclipse . ui . plugin . AbstractUIPlugin ; import org . osgi . framework . BundleContext ; public class UiTestsPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "" ; private static UiTestsPlugin plugin ; public UiTestsPlugin ( ) { } public void start ( BundleContext context ) throws Exception { super . start ( context ) ; plugin = this ; } public | |
830 | <s> package org . rubypeople . rdt . refactoring . core . renamefield . fielditems ; import org . jruby . ast . ClassVarAsgnNode ; import org . jruby . ast . ClassVarNode ; import org . jruby . ast . Node ; public class ClassVarAsgnFieldItem extends FieldItem { private ClassVarAsgnNode classVarAsgnNode ; public ClassVarAsgnFieldItem ( ClassVarAsgnNode classVarAsgnNode ) { this . classVarAsgnNode = classVarAsgnNode ; } @ Override public String getFieldName ( ) { return fieldName ( classVarAsgnNode . getName ( ) ) ; } @ Override public Node getFieldNode ( ) { return classVarAsgnNode ; } @ Override public Node getRenamedNode ( String newName | |
831 | <s> package com . asakusafw . dmdl . analyzer ; import java . util . Collections ; import java . util . List ; import com . asakusafw . dmdl . Diagnostic ; import com . asakusafw . utils . collections . Lists ; public class DmdlSemanticException | |
832 | <s> package net . sf . sveditor . core . db ; import net . sf . sveditor . core . db . expr . SVDBExpr ; import net . sf . sveditor . core . db . stmt . SVDBStmt ; public class SVDBAssign extends SVDBStmt { public SVDBExpr fLHS ; public SVDBExpr fDelay ; public SVDBExpr fRHS ; | |
833 | <s> package com . asakusafw . compiler . operator . processor ; import java . util . List ; import javax . lang . model . element . ExecutableElement ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . operator . AbstractOperatorProcessor ; import com . asakusafw . compiler . operator . ExecutableAnalyzer ; import com . asakusafw . compiler . operator . ExecutableAnalyzer . TypeConstraint ; import com . asakusafw . compiler . operator . ImplementationBuilder ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor . Builder ; import com . asakusafw . compiler . operator . processor . MasterKindOperatorAnalyzer . ResolveException ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . operator . MasterJoin ; @ TargetOperator ( MasterJoin . class ) public class MasterJoinOperatorProcessor extends AbstractOperatorProcessor { @ Override public OperatorMethodDescriptor describe ( Context context ) { Precondition . checkMustNotBeNull ( context , "context" ) ; | |
834 | <s> package org . rubypeople . rdt . internal . formatter ; public class BeginBlockMarker extends AbstractBlockMarker { public BeginBlockMarker ( String aKeyword , int aLine ) { super ( aKeyword , aLine ) ; } protected void indentAfterPrint ( IndentationState state ) { if ( ! ( state . | |
835 | <s> package com . asakusafw . compiler . flow . processor . operator ; import java . util . Arrays ; import javax . annotation . Generated ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . ExSummarized ; import com . asakusafw . compiler . flow . testing . model . ExSummarized2 ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . ObservationCount ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . flow . processor . PartialAggregation ; import com . asakusafw . vocabulary . operator . Summarize ; @ Generated ( "" ) public class SummarizeFlowFactory { public static final class Simple implements Operator { private final FlowElementResolver $ ; public final Source < ExSummarized > out ; Simple ( Source < Ex1 > model ) { OperatorDescription . Builder builder = new OperatorDescription . Builder ( Summarize . class ) ; builder . | |
836 | <s> package hudson . jbpm . model ; import hudson . jbpm . PluginImpl ; import java . io . IOException ; import javax . servlet . ServletException ; import org . jbpm . taskmgmt . exe . TaskInstance ; import org . kohsuke . stapler . StaplerRequest ; import org . kohsuke . stapler . StaplerResponse ; public class Form { private final TaskInstance taskInstance ; public Form ( TaskInstance taskInstance ) { super ( ) ; this . taskInstance = taskInstance ; } public TaskInstance getTaskInstance ( ) { return taskInstance ; } public void handle ( StaplerRequest request , StaplerResponse response ) throws ServletException , IOException { } public void doSubmit ( | |
837 | <s> package com . asakusafw . dmdl . java . util ; import java . util . List ; import com . asakusafw . dmdl . model . AstSimpleName ; import com . asakusafw . utils . collections . Lists ; public class JavaName { private final List < String > words ; JavaName ( List < ? extends String > words ) { if ( words == null ) { throw new NullPointerException ( "words" ) ; } if ( words . isEmpty ( ) ) { throw new IllegalArgumentException ( "words" ) ; } this . words = Lists . create ( ) ; for ( String word : words ) { this . words . add ( normalize ( word ) ) ; } } public static JavaName of ( AstSimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return new JavaName ( normalize ( name . getWordList ( ) | |
838 | <s> package org . oddjob . values . properties ; import org . oddjob . arooa . ArooaAnnotations ; import org . oddjob . arooa . ArooaBeanDescriptor ; import org . oddjob . arooa . ArooaConfigurationException ; import org . oddjob . arooa . ConfiguredHow ; import org . oddjob . arooa . ParsingInterceptor ; import org . oddjob . arooa | |
839 | <s> package com . aptana . rdt . internal . parser . warnings ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . ConstNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt | |
840 | <s> package net . sf . sveditor . ui . editor ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . jface . resource . ImageRegistry ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . contentassist . ICompletionProposal ; import org . eclipse . jface . text . templates . ContextTypeRegistry ; import org . eclipse . jface . text . templates . Template ; import org . eclipse . jface . text . templates . TemplateCompletionProcessor ; import org . eclipse . jface . text . templates . TemplateContext ; import org . eclipse . jface . text . templates . TemplateContextType ; import org . eclipse . jface . text . templates . TemplateException ; import org . eclipse . swt . graphics . Image ; public class SVTemplateCompletionProcessor extends TemplateCompletionProcessor { private SVEditor fEditor ; private SVCompletionProcessor fSubProcessor ; @ SuppressWarnings ( "rawtypes" ) private static final class ProposalComparator implements Comparator { public int compare ( Object o1 , Object o2 ) { return ( ( SVIndentingTemplateProposal ) o2 ) | |
841 | <s> package org . oddjob . designer . view ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignListener ; import org . oddjob . arooa . design . DesignStructureEvent ; import org . oddjob . arooa . design . InstanceSupport ; import org . oddjob . arooa . design . screem . SingleTypeSelection ; import org . oddjob . arooa . design . view . DesignViewException ; import org . oddjob . arooa . parsing . QTag ; public class TypeSelectionDummy implements DummyItemView { SingleTypeSelection typeSelection ; DesignInstance instance ; public TypeSelectionDummy ( SingleTypeSelection typeSelection ) { this . typeSelection = typeSelection ; typeSelection . getDesignElementProperty ( ) . addDesignListener ( new DesignListener ( ) { public void childAdded ( DesignStructureEvent event ) { if ( event . getIndex ( ) != 0 ) { throw new RuntimeException ( "Unexpected." ) ; } | |
842 | <s> package org . oddjob . state ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . arooa . deploy . annotations . ArooaComponent ; import org . oddjob . framework . StructuralJob ; public class EqualsState extends StructuralJob < Stateful > implements Stoppable { private static final long serialVersionUID = 2009031800L ; private StateCondition state = StateConditions . COMPLETE ; public StateCondition getState ( ) { return state ; } @ ArooaAttribute public void setState ( StateCondition state ) { this . state = state ; } | |
843 | <s> package com . asakusafw . compiler . flow . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . flow . testing . model . KeyConflict ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class KeyConflictOutput implements ModelOutput < KeyConflict > { private final RecordEmitter emitter ; public KeyConflictOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( KeyConflict model ) throws IOException { emitter . emit ( | |
844 | <s> package org . rubypeople . rdt . refactoring . ui . pages . extractmethod ; import java . util . Observable ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . TableEditor ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . graphics . Rectangle ; import org . eclipse . swt . widgets . Event ; import org . eclipse . swt . widgets . Listener ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . TableItem ; import org . eclipse . swt . widgets . Text ; import org . rubypeople . rdt . refactoring . util . NameValidator ; public class ParametersTableCellEditorListener extends Observable implements Listener { private final class TextListener implements Listener { private final MethodArgumentTableItem item ; private final Text text ; private TextListener ( MethodArgumentTableItem item , Text text ) { this . item = item ; this . text = text ; } public void handleEvent ( final Event e ) { if ( e . type == SWT . FocusOut ) { setNewName ( item , text ) ; text . dispose ( ) ; table . setFocus ( ) ; } else if ( e . type == SWT . Traverse ) { if ( e . detail == SWT . TRAVERSE_RETURN ) { setNewName ( item , text ) ; } if ( e . detail == SWT . TRAVERSE_RETURN || e . detail == SWT . TRAVERSE_ESCAPE ) { text . dispose ( ) ; e . doit = false ; } } } } private final Table table ; private final IValidationController validationController ; public ParametersTableCellEditorListener ( Table parametersTable , IValidationController validationController ) { this . table = parametersTable ; this . validationController = validationController ; } private boolean areAllNamesUnique ( ) { TableItem [ ] items = table . getItems ( ) ; boolean unique = true ; for ( int outer = 0 ; outer < items . length ; outer ++ ) { for ( int inner = 0 ; inner < items . length ; inner ++ ) { if ( outer == inner ) { continue ; } else if ( items | |
845 | <s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . Map ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchRequestor ; class MethodReferencesSearchRequestor extends SearchRequestor { private CallSearchResultCollector fSearchResults ; private boolean fRequireExactMatch = false ; MethodReferencesSearchRequestor ( ) { fSearchResults = new CallSearchResultCollector ( ) ; } public Map getCallers ( ) { return fSearchResults . getCallers ( ) ; } public void acceptSearchMatch ( SearchMatch match ) { if ( fRequireExactMatch && ( match . getAccuracy ( ) != SearchMatch . A_ACCURATE ) ) { return ; } if ( match . isInsideDocComment ( ) ) { return ; } if ( match . getElement ( ) != null && match . getElement ( ) instanceof IMember ) { IMember member = ( IMember ) match . | |
846 | <s> package com . google . android . c2dm ; import java . io . IOException ; import android . app . AlarmManager ; import android . app . IntentService ; import android . app . PendingIntent ; import android . content . Context ; import android . content . ContextWrapper ; import android . content . Intent ; import android . os . PowerManager ; import android . util . Log ; public abstract class C2DMBaseReceiver extends IntentService { private static final String C2DM_RETRY = "" ; public static final String REGISTRATION_CALLBACK_INTENT = "" ; private static final String C2DM_INTENT = "" ; private static final String TAG = "C2DM" ; public static final String EXTRA_UNREGISTERED = "unregistered" ; public static final String EXTRA_ERROR = "error" ; public static final String EXTRA_REGISTRATION_ID = "" ; public static final String ERR_SERVICE_NOT_AVAILABLE = "" ; public static final String ERR_ACCOUNT_MISSING = "" ; public static final String ERR_AUTHENTICATION_FAILED = "" ; public static final String ERR_TOO_MANY_REGISTRATIONS = "" ; public static final String ERR_INVALID_PARAMETERS = "" ; public static final String ERR_INVALID_SENDER = "" ; public static final String ERR_PHONE_REGISTRATION_ERROR = "" ; private static final String WAKELOCK_KEY = "C2DM_LIB" ; private static PowerManager . WakeLock mWakeLock ; private final String senderId ; public C2DMBaseReceiver ( String senderId ) { super ( senderId ) ; this . senderId = senderId ; } protected abstract void onMessage ( Context context , Intent intent ) ; public abstract void onError ( Context context , String errorId ) ; public void onRegistered ( Context context , String registrationId ) throws IOException { } public void onUnregistered ( Context context ) { } @ Override public final void onHandleIntent ( Intent intent ) { try { Context context = getApplicationContext ( ) ; if ( intent . getAction ( ) . equals ( REGISTRATION_CALLBACK_INTENT ) ) { handleRegistration ( context , intent ) ; } else if ( intent . getAction ( ) . equals ( C2DM_INTENT ) ) { onMessage ( context , intent ) ; } else if ( intent . getAction ( ) . equals ( C2DM_RETRY ) ) { C2DMessaging . register ( context , senderId ) ; } } finally { mWakeLock . release ( ) ; } } static void runIntentInService ( Context context , Intent intent ) { if ( mWakeLock == null ) { PowerManager pm = ( PowerManager ) context . getSystemService ( Context . POWER_SERVICE ) ; mWakeLock = pm . newWakeLock ( PowerManager . PARTIAL_WAKE_LOCK , WAKELOCK_KEY ) ; } mWakeLock . acquire ( ) ; ContextWrapper cwrap = ( ContextWrapper ) context ; String receiver = cwrap . getBaseContext ( ) . getClass ( ) . getPackage ( ) . getName ( ) + "" ; intent . setClassName ( context , receiver ) ; context . startService ( intent ) ; } private void handleRegistration ( final Context context , Intent intent ) { final String registrationId = intent . getStringExtra ( EXTRA_REGISTRATION_ID ) ; String error = intent . getStringExtra ( EXTRA_ERROR ) ; String removed = intent . getStringExtra ( EXTRA_UNREGISTERED ) ; if ( Log . isLoggable ( TAG , Log . DEBUG ) ) { Log . d ( TAG , "" + registrationId + ", error = " + error + ", removed = " + removed ) ; } if ( removed != null ) { C2DMessaging . clearRegistrationId ( context ) ; onUnregistered ( context ) ; return ; } else if ( error != | |
847 | <s> package org . oddjob . jobs . structural ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Iterator ; import java . util . List ; import java . util . concurrent . Exchanger ; import java . util . concurrent . Future ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . FailedToStopException ; import org . oddjob . Helper ; import org . oddjob . Loadable ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . StateSteps ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . Structural ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . life . Configured ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . scheduling . DefaultExecutors ; import org . oddjob . scheduling . MockExecutorService ; import org . oddjob . scheduling . MockScheduledFuture ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; import org . oddjob . structural . StructuralEvent ; import org . oddjob . structural . StructuralListener ; public class ForEachParallelTest extends TestCase { private static final Logger logger = Logger . getLogger ( ForEachParallelTest . class ) ; public void testSimpleParallel ( ) throws InterruptedException { DefaultExecutors defaultServices = new DefaultExecutors ( ) ; String xml = "" + " <job>" + "" + " </job>" + "</foreach>" ; ForEachJob test = new ForEachJob ( ) ; test . setExecutorService ( defaultServices . getPoolExecutor ( ) ) ; ArooaSession session = new OddjobSessionFactory ( ) . createSession ( ) ; test . setArooaSession ( session ) ; test . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; test . setValues ( Arrays . asList ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ) ) ; test . setParallel ( true ) ; StateSteps state = new StateSteps ( test ) ; state . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE , ParentState . COMPLETE ) ; test . run ( ) ; Object [ ] children = Helper . getChildren ( test ) ; assertEquals ( 10 , children . length ) ; state . checkWait ( ) ; test . destroy ( ) ; defaultServices . stop ( ) ; } public void testStop ( ) throws InterruptedException , FailedToStopException { DefaultExecutors defaultServices = new DefaultExecutors ( ) ; String xml = "" + " <job>" + "" + " </job>" + "</foreach>" ; ForEachJob test = new ForEachJob ( ) ; test . setExecutorService ( defaultServices . getPoolExecutor ( ) ) ; ArooaSession session = new OddjobSessionFactory ( ) . createSession ( ) ; test . setArooaSession ( session ) ; test . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; test . setValues ( Arrays . asList ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ) ) ; test . setParallel ( true ) ; test . load ( ) ; StateSteps state = new StateSteps ( test ) ; state . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE ) ; Object [ ] children = Helper . getChildren ( test ) ; assertEquals ( 10 , children . length ) ; StateSteps [ ] childChecks = new StateSteps [ 10 ] ; for ( int i = 0 ; i < 10 ; ++ i ) { childChecks [ i ] = new StateSteps ( ( Stateful ) children [ i ] ) ; childChecks [ i ] . startCheck ( JobState . READY , JobState . EXECUTING ) ; } test . run ( ) ; state . checkNow ( ) ; for ( int i = 0 ; i < 10 ; ++ i ) { childChecks [ i ] . checkWait ( ) ; } state . startCheck ( ParentState . ACTIVE , ParentState . COMPLETE ) ; test . stop ( ) ; state . checkNow ( ) ; test . destroy ( ) ; defaultServices . stop ( ) ; } private static class MyExecutor extends MockExecutorService { List < Runnable > jobs = new ArrayList < Runnable > ( ) ; int cancels ; @ Override public Future < ? > submit ( Runnable task ) { jobs . add ( task ) ; return new MockScheduledFuture < Void > ( ) { @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { ++ cancels ; return false ; } } ; } } public void testStopWithSlowStartingChild ( ) throws InterruptedException , FailedToStopException { MyExecutor executor = new MyExecutor ( ) ; String xml = "" + " <job>" + "" + " </job>" + "</foreach>" ; ForEachJob test = new ForEachJob ( ) ; test . setExecutorService ( executor ) ; ArooaSession session = new OddjobSessionFactory ( ) . createSession ( ) ; test . setArooaSession ( session ) ; test . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; test . setValues ( Arrays . asList ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ) ) ; test . setParallel ( true ) ; StateSteps state = new StateSteps ( test ) ; state . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE ) ; test . run ( ) ; state . checkNow ( ) ; Object [ ] children = Helper . getChildren ( test ) ; assertEquals ( 10 , children . length ) ; assertEquals ( 10 , executor . jobs . size ( ) ) ; for ( int i = 0 ; i < 5 ; ++ i ) { executor . jobs . get ( i ) . run ( ) ; } state . startCheck ( ParentState . ACTIVE , ParentState . READY ) ; test . stop ( ) ; state . checkNow ( ) ; assertEquals ( 10 , executor . cancels ) ; test . destroy ( ) ; } public void testExampleInOddjob ( ) throws InterruptedException , FailedToStopException { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . load ( ) ; Object foreach = Helper . getChildren ( oddjob ) [ 0 ] ; ( ( Loadable ) foreach ) . load ( ) ; Object [ ] children = Helper . getChildren ( foreach ) ; StateSteps wait1 = new StateSteps ( ( Stateful ) children [ 0 ] ) ; StateSteps wait2 = new StateSteps ( ( Stateful ) children [ 1 ] ) ; StateSteps wait3 = new StateSteps ( ( Stateful ) children [ 2 ] ) ; wait1 . startCheck ( JobState . READY , JobState . EXECUTING ) ; wait2 . startCheck ( JobState . READY , JobState . EXECUTING ) ; wait3 . startCheck ( JobState . READY , JobState . EXECUTING ) ; oddjob . run ( ) ; assertEquals ( ParentState . ACTIVE , oddjob . lastStateEvent ( ) . getState ( ) ) ; wait1 . checkWait ( ) ; wait2 . checkWait ( ) ; wait3 . checkWait ( ) ; oddjob . stop ( ) ; assertEquals ( ParentState . READY , oddjob . lastStateEvent ( ) . getState ( ) ) ; oddjob . destroy ( ) ; } static final int BIG_LIST_SIZE = 20 ; public static class BigList implements Iterable < Integer > { private int listSize = BIG_LIST_SIZE ; List < Integer > theList = new ArrayList < Integer > ( ) ; @ Configured public void afterConfigure ( ) { for ( int i = 0 ; i < listSize ; ++ i ) { theList . add ( new Integer ( i ) ) ; } } @ Override public Iterator < Integer > iterator ( ) { return theList . iterator ( ) ; } public int getListSize ( ) { return listSize ; } public void setListSize ( int listSize ) { this . listSize = listSize ; } } private class ChildTracker implements StructuralListener { List < Object > children = new ArrayList < Object > ( ) ; Exchanger < Stateful > lastChild ; @ Override public void childAdded ( StructuralEvent event ) { children . add ( event . getIndex ( ) , event . getChild ( ) ) ; if ( lastChild != null ) { try { logger . info ( "" + event . getChild ( ) . toString ( ) ) ; lastChild . exchange ( ( Stateful ) event . getChild ( ) ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } } } @ Override public void childRemoved ( StructuralEvent event ) { children . remove ( event . getIndex ( ) ) ; } } public void testParallelWithWindow ( ) throws FailedToStopException , ArooaPropertyException , ArooaConversionException , InterruptedException { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; StateSteps oddjobState = new StateSteps ( oddjob ) ; oddjobState . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE , ParentState . COMPLETE ) ; oddjob . run ( ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; Structural foreach = lookup . lookup ( "foreach" , Structural . class ) ; int preLoad = lookup . lookup ( "" , int . class ) ; ChildTracker tracker = new ChildTracker ( ) ; foreach . addStructuralListener ( tracker ) ; List < ? > children = tracker . children ; assertEquals ( preLoad , children . size ( ) ) ; while ( ( ( Stateful ) children . get ( children . size ( ) - preLoad ) ) . lastStateEvent ( ) . getState ( ) != JobState . EXECUTING ) { Thread . sleep ( 20 ) ; } tracker . lastChild = new Exchanger < Stateful > ( ) ; for ( int index = 1 ; index < BIG_LIST_SIZE - 1 ; ++ index ) { if ( index < 5 ) { for ( int i = 0 ; i < index ; ++ i ) { assertEquals ( "Wait " + i , children . get ( i ) . toString ( ) ) ; } } else if ( index < | |
848 | <s> package com . asakusafw . testdriver . html ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . Difference ; import com . asakusafw . testdriver . core . DifferenceSink ; import com . asakusafw . testdriver . core . DifferenceSinkFactory ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . core . TestToolRepository ; import com . asakusafw . testdriver . excel . Simple ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; public class HtmlDifferenceSinkProviderTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; @ Rule public final TemporaryFolder temp = new TemporaryFolder ( ) ; @ Test public void spi ( ) throws Exception { TestToolRepository repo = new TestToolRepository ( getClass ( ) . getClassLoader ( ) ) ; File file = temp . newFile | |
849 | <s> package org . rubypeople . rdt . launching ; import java . io . File ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . model . IProcess ; import org . rubypeople . rdt . internal . launching . LaunchingMessages ; import org . rubypeople . rdt . internal . launching . LaunchingPlugin ; public abstract class AbstractVMRunner implements IVMRunner { protected IVMInstall fVMInstance ; protected void abort ( String message , Throwable exception , int code ) throws CoreException { throw new CoreException ( new Status ( IStatus . ERROR , getPluginIdentifier ( ) , code , message , exception ) ) ; } protected abstract String getPluginIdentifier ( ) ; public void setVMInstall ( IVMInstall vm ) { fVMInstance = vm ; } protected Process exec ( String [ ] cmdLine , File workingDirectory ) throws CoreException { if ( cmdLine == null ) { abort ( "" , null , - 1 ) ; } List < String > newCmdLine = new ArrayList < String > ( ) ; for ( String string : cmdLine ) { if ( string == null ) { LaunchingPlugin . log ( new Throwable ( "" + | |
850 | <s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . FoldFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . FoldFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . FoldFlowFactory . Simple ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; 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 | |
851 | <s> package org . apache . camel . example . reportincident . dao ; import org . apache . camel . example . reportincident . model . Incident ; import java . util . List ; public interface IncidentDAO { public abstract Incident getIncident ( long paramLong ) ; public abstract List < Incident > findIncident ( ) ; public abstract List < Incident > findIncident ( | |
852 | <s> package com . asakusafw . windgate . jdbc ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . sql . Connection ; import java . sql . Statement ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . windgate . core . ParameterList ; import com . asakusafw . windgate . core . ProfileContext ; import com . asakusafw . windgate . core . resource . ResourceProfile ; public class JdbcProfileTest { @ Rule public H2Resource h2 = new H2Resource ( "testing" ) { @ Override protected void before ( ) throws Exception { executeFile ( "simple.sql" ) ; } } ; @ Test public void convert ( ) throws Exception { Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( JdbcProfile . KEY_DRIVER , org . h2 . Driver . class . getName ( ) ) ; map . put ( JdbcProfile . KEY_URL , h2 . getJdbcUrl ( ) ) ; ResourceProfile rp = toProfile ( map ) ; JdbcProfile profile = JdbcProfile . convert ( rp ) ; assertThat ( profile . getResourceName ( ) , is ( rp . getName ( ) ) ) ; assertThat ( profile . getBatchPutUnit ( ) , greaterThan ( 0L ) ) ; Connection conn = profile . openConnection ( ) ; try { Statement stmt = conn . createStatement ( ) ; stmt . execute ( "" ) ; stmt . close ( ) ; conn . commit ( ) ; } finally { conn . close ( ) ; } assertThat ( h2 . count ( "SIMPLE" ) , is ( 1 ) ) ; } @ Test public void convert_all ( ) throws Exception { Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( JdbcProfile . KEY_DRIVER , org . h2 | |
853 | <s> package net . sf . sveditor . core . db ; import java | |
854 | <s> package com . asakusafw . yaess . core . task ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . Map ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionScript ; import com . asakusafw . yaess . core . ExecutionScriptHandler ; public interface ExecutionTracker { String KEY_CLASS = "" ; String KEY_ID = "tracker.id" ; void add ( Id id , Record record ) throws IOException , InterruptedException ; public class Record { public final ExecutionContext context ; public final ExecutionScript script ; public final ExecutionScriptHandler < ? > handler ; public Record ( ExecutionContext context , ExecutionScript script | |
855 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . filebuffers . FileBuffers ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ISynchronizable ; import org . eclipse . jface . text . source . IAnnotationModel ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IFileEditorInput ; import org . eclipse . ui . editors . text . FileDocumentProvider ; import org . rubypeople . rdt . core . ElementChangedEvent ; import org . rubypeople . rdt . core . IElementChangedListener ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyElementDelta ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . ui . text . RubyTextTools ; public class RubyScriptDocumentProvider extends FileDocumentProvider { public interface InputChangeListener { void inputChanged ( IRubyScriptEditorInput input ) ; } protected class RubyScriptSynchronizer implements IElementChangedListener { protected IRubyScriptEditorInput fInput ; protected ISourceFolderRoot fSourceFolderRoot ; public RubyScriptSynchronizer ( IRubyScriptEditorInput input ) { fInput = input ; IRubyElement parent = fInput . getRubyScript ( ) . getParent ( ) ; while ( parent != null && ! ( parent instanceof ISourceFolderRoot ) ) { parent = parent . getParent ( ) ; } fSourceFolderRoot = ( ISourceFolderRoot ) parent ; } public void install ( ) { RubyCore . addElementChangedListener ( this ) ; } public void uninstall ( ) { RubyCore . removeElementChangedListener ( this ) ; } public void elementChanged ( ElementChangedEvent e ) { check ( fSourceFolderRoot , e . getDelta ( ) ) ; } protected boolean check ( ISourceFolderRoot input , IRubyElementDelta delta ) { IRubyElement element = delta . getElement ( ) ; if ( ( delta . getKind ( ) & IRubyElementDelta . REMOVED ) != 0 || ( delta . getFlags ( ) & IRubyElementDelta . F_CLOSED ) != 0 ) { if ( element . equals ( input . getRubyProject ( ) ) || element . equals ( input ) ) { handleDeleted ( fInput ) ; return true ; } } if ( ( ( delta . getFlags ( ) & IRubyElementDelta . F_ARCHIVE_CONTENT_CHANGED ) != 0 ) && input . equals ( element ) ) { handleDeleted ( fInput ) ; return true ; } if ( ( ( delta . getFlags ( ) & IRubyElementDelta . F_REMOVED_FROM_CLASSPATH ) != 0 ) && input . equals ( element ) ) { handleDeleted ( fInput ) ; return true ; } IRubyElementDelta [ ] subdeltas = delta . getAffectedChildren ( ) ; for ( int i = 0 ; i < subdeltas . length ; i ++ ) { if ( check ( input , subdeltas [ i ] ) ) return true ; } if ( ( delta . getFlags ( ) & IRubyElementDelta . F_SOURCEDETACHED ) != 0 || ( delta . getFlags ( ) & IRubyElementDelta . F_SOURCEATTACHED ) != 0 ) { IRubyScript file = fInput != null ? fInput . getRubyScript ( ) : null ; IRubyProject project = input != null ? input . getRubyProject ( ) : null ; boolean isOnClasspath = false ; if ( file != null && project != null ) isOnClasspath = project . isOnLoadpath ( file ) ; | |
856 | <s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemBase ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBArrayAccessExpr extends SVDBExpr { public SVDBExpr fLhs ; public SVDBExpr fLow ; public SVDBExpr fHigh ; public SVDBArrayAccessExpr ( ) { this ( null , null , null ) ; } public SVDBArrayAccessExpr ( SVDBExpr lhs , SVDBExpr low , SVDBExpr high ) { super ( SVDBItemType . ArrayAccessExpr ) ; fLhs = lhs ; fLow = low ; fHigh = high ; } public SVDBExpr getLhs ( ) { return fLhs ; } public SVDBExpr getLow ( ) { return fLow ; } public SVDBExpr getHigh ( ) { return fHigh ; } public SVDBArrayAccessExpr duplicate ( ) { return | |
857 | <s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . source . Annotation ; import org . eclipse . jface . text . source . AnnotationModelEvent ; import org . eclipse . jface . text . source . IAnnotationModel ; import org . eclipse . ui . texteditor . MarkerAnnotation ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class RubyScriptAnnotationModelEvent extends AnnotationModelEvent { private boolean fIncludesProblemMarkerAnnotations ; private IResource fUnderlyingResource ; public RubyScriptAnnotationModelEvent ( IAnnotationModel model , IResource underlyingResource ) { super ( model ) ; fUnderlyingResource = underlyingResource ; fIncludesProblemMarkerAnnotations = false ; } private void testIfProblemMarker ( Annotation annotation ) { if ( fIncludesProblemMarkerAnnotations ) { return ; } if ( annotation instanceof RubyMarkerAnnotation ) { fIncludesProblemMarkerAnnotations = ( ( RubyMarkerAnnotation ) annotation ) . isProblem ( ) ; } else if ( annotation instanceof MarkerAnnotation ) { try { IMarker marker = ( ( MarkerAnnotation ) annotation ) . getMarker ( ) ; if ( ! marker . exists ( ) || marker . isSubtypeOf ( IMarker . PROBLEM ) ) { fIncludesProblemMarkerAnnotations = true ; } } | |
858 | <s> package org . rubypeople . rdt . ui ; public interface IRubyConstants { public static final String EDITOR_ID = RubyUI . ID_RUBY_EDITOR ; public static final String EXTERNAL_FILES_EDITOR_ID = RubyUI . ID_EXTERNAL_EDITOR ; | |
859 | <s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import org . eclipse . jface . viewers . ITableLabelProvider ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . internal . corext . callhierarchy . CallLocation ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; class LocationLabelProvider extends LabelProvider implements ITableLabelProvider { private static final int COLUMN_ICON = 0 ; private static final int COLUMN_LINE = 1 ; private static final int COLUMN_INFO = 2 ; LocationLabelProvider ( ) { } public String getText ( Object element ) { return getColumnText ( element , COLUMN_INFO ) ; } public Image getImage ( Object element ) { return getColumnImage ( element , COLUMN_ICON ) ; } private String removeWhitespaceOutsideStringLiterals ( CallLocation callLocation ) { StringBuffer buf = new StringBuffer ( ) ; boolean withinString = false ; String s = callLocation . getCallText ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ch == '"' ) { withinString = ! withinString ; } if ( withinString ) { buf . append ( ch ) ; } else if ( Character . isWhitespace ( ch ) ) { if ( ( buf . length ( ) == 0 ) || ! Character . isWhitespace ( buf . charAt ( buf . length ( ) - 1 ) ) ) { if ( ch != | |
860 | <s> package info . naturwerk . app ; import android . content . Intent ; import android . database . Cursor ; import android . os . Bundle ; import android . util . Log ; import android . view . View ; import android . widget . AdapterView ; import android . widget . AdapterView . OnItemClickListener ; import android . widget . ListView ; import android . widget . SimpleCursorAdapter ; public class NWFaunaActivity extends NWBaseActivity { private static final String TAG = NWFaunaActivity . class . getSimpleName ( ) ; Cursor cursor ; | |
861 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchPartReference ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . part . ISetSelectionTarget ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . buildpath . LoadpathModifier ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . CPListElement ; public class ExcludeFromBuildpathAction extends Action implements ISelectionChangedListener { private final IWorkbenchSite fSite ; private final List fSelectedElements ; public ExcludeFromBuildpathAction ( IWorkbenchSite site ) { super ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Exclude_label , RubyPluginImages . DESC_ELCL_EXCLUDE_FROM_BUILDPATH ) ; setToolTipText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Exclude_tooltip ) ; setDisabledImageDescriptor ( RubyPluginImages . DESC_DLCL_EXCLUDE_FROM_BUILDPATH ) ; fSite = site ; fSelectedElements = new ArrayList ( ) ; } public void run ( ) { final IRubyProject project ; Object object = fSelectedElements . get ( 0 ) ; if ( object instanceof IRubyScript ) { project = ( ( IRubyScript ) object ) . | |
862 | <s> package com . asakusafw . runtime . stage . directio ; import com . asakusafw . runtime . io . util . ShuffleKey ; import com . asakusafw . runtime . io . util . WritableRawComparableUnion ; public abstract class AbstractDirectOutputKey extends ShuffleKey < WritableRawComparableUnion , WritableRawComparableUnion > { protected AbstractDirectOutputKey ( DirectOutputSpec ... specs ) { super ( DirectOutputSpec . createGroupUnion ( specs ) , DirectOutputSpec . createOrderUnion ( specs ) ) ; } public void setPosition ( int position ) { getGroupObject ( ) . switchObject ( position ) ; getOrderObject ( ) . switchObject ( position ) ; } public void setObject ( Object value ) { | |
863 | <s> package com . asakusafw . compiler . flow . plan ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Collection ; import java . util . Set ; import org . junit . Test ; import com . asakusafw . compiler . flow . FlowGraphGenerator ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElementInput ; import com . asakusafw . vocabulary . flow . graph . FlowElementOutput ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; public class FlowPathTest { @ Test public void union ( ) { FlowGraphGenerator gen = new FlowGraphGenerator ( ) ; gen . defineInput ( "in1" ) ; gen . defineInput ( "in2" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . definePseud ( "a" , FlowBoundary . STAGE ) ; gen . definePseud ( "b" , FlowBoundary . STAGE ) ; gen . definePseud ( "c" , FlowBoundary . STAGE ) ; gen . definePseud ( "d" , FlowBoundary . STAGE ) ; gen . definePseud ( "e" , FlowBoundary . STAGE ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . connect ( "in1" , "a" ) . connect ( "a" , "op1" ) . connect ( "op1" , "c" ) . connect ( "c" , "out1" ) ; gen . connect ( "in2" , "b" ) . connect ( "b" , "op2" ) . connect ( "op2" , "d" ) . connect ( "d" , "out2" ) ; gen . connect ( "op1" , "e" ) . connect ( "e" , "out2" ) ; FlowPath a = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "a" ) ) ; FlowPath b = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "b" ) ) ; FlowPath path = a . union ( b ) ; assertThat ( path . getStartings ( ) , is ( gen . getAsSet ( "a" , "b" ) ) ) ; assertThat ( path . getPassings ( ) , is ( gen . getAsSet ( "op1" , "op2" ) ) ) ; assertThat ( path . getArrivals ( ) , is ( gen . getAsSet ( "c" , "d" , "e" ) ) ) ; } @ Test public void transposeIntersect ( ) { FlowGraphGenerator gen = new FlowGraphGenerator ( ) ; gen . defineInput ( "in1" ) ; gen . defineInput ( "in2" ) ; gen . defineOutput ( "out1" ) ; gen . defineOutput ( "out2" ) ; gen . definePseud ( "a" , FlowBoundary . STAGE ) ; gen . definePseud ( "b" , FlowBoundary . STAGE ) ; gen . definePseud ( "c" , FlowBoundary . STAGE ) ; gen . definePseud ( "d" , FlowBoundary . STAGE ) ; gen . definePseud ( "e" , FlowBoundary . STAGE ) ; gen . defineOperator ( "op1" , "in" , "out" ) ; gen . defineOperator ( "op2" , "in" , "out" ) ; gen . connect ( "in1" , "a" ) . connect ( "a" , "op1" ) . connect ( "op1" , "c" ) . connect ( "c" , "out1" ) ; gen . connect ( "in2" , "b" ) . connect ( "b" , "op2" ) . connect ( "op2" , "d" ) . connect ( "d" , "out2" ) ; gen . connect ( "op1" , "e" ) . connect ( "e" , "out2" ) ; FlowPath a = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "a" ) ) ; FlowPath b = FlowGraphUtil . getPredeceaseBoundaryPath ( gen . get ( "e" ) ) ; FlowPath path = a . transposeIntersect ( b ) ; assertThat ( path . getStartings ( ) , is ( gen . getAsSet ( "a" ) ) ) ; assertThat ( path . getPassings ( ) , is ( gen . getAsSet ( "op1" ) ) ) ; assertThat ( path . getArrivals ( ) , is ( gen . getAsSet ( "e" ) ) ) ; } @ Test public void createBlock_includeIn_includeOut ( ) { FlowGraphGenerator gen = graph ( ) ; FlowPath a = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "a" ) ) ; FlowPath b = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "b" ) ) ; FlowPath c = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "c" ) ) ; FlowPath in3 = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "in3" ) ) ; FlowPath path = a . union ( b ) . union ( c ) . union ( in3 ) ; FlowBlock block = path . createBlock ( gen . toGraph ( ) , 0 , true , true ) ; assertThat ( block . getElements ( ) , is ( gen . getAsSet ( "a" , "b" , "c" , "d" , "e" , "f" , "op1" , "op2" , "in3" , "out3" ) ) ) ; Set < FlowElementInput > inputs = input ( block . getBlockInputs ( ) ) ; Set < FlowElementOutput > outputs = output ( block . getBlockOutputs ( ) ) ; assertThat ( inputs , is ( gen . inputs ( "a" , "b" , "c" ) ) ) ; assertThat ( outputs , is ( gen . outputs ( "d" , "e" , "f" ) ) ) ; } @ Test public void createBlock_excludeIn_includeOut ( ) { FlowGraphGenerator gen = graph ( ) ; FlowPath a = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "a" ) ) ; FlowPath b = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "b" ) ) ; FlowPath c = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "c" ) ) ; FlowPath in3 = FlowGraphUtil . getSucceedBoundaryPath ( gen . get ( "in3" ) ) ; FlowPath path = a . union ( b ) . union ( c ) . union ( in3 ) ; FlowBlock block = path . createBlock ( gen . toGraph ( ) , 0 , false , true ) ; assertThat ( block . getElements ( ) , is ( gen . getAsSet ( "d" , "e" , "f" , "op1" , "op2" , "out3" ) ) ) ; Set < FlowElementInput > inputs = input ( block . getBlockInputs ( ) ) ; Set < FlowElementOutput > outputs = output ( block . getBlockOutputs ( ) ) ; assertThat | |
864 | <s> package com . asakusafw . compiler . flow . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . flow . testing . model . | |
865 | <s> package org . rubypeople . rdt . internal . core . search . matching ; import org . eclipse . core . resources . IResource ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . search . SearchDocument ; import org . rubypeople . rdt . internal . core . Openable ; import org . rubypeople . rdt . internal . core . RubyScript ; import org . rubypeople . rdt . internal . core . util . CharOperation ; import org . rubypeople . rdt . internal . core . util . Util ; public class PossibleMatch { public static final String NO_SOURCE_FILE_NAME = "" ; public IResource resource ; public Openable openable ; public MatchingNodeSet nodeSet ; public char [ ] [ ] compoundName ; Node parsedUnit ; public SearchDocument document ; private String sourceFileName ; private char [ ] source ; public PossibleMatch ( MatchLocator locator , IResource resource , Openable openable , SearchDocument document , boolean mustResolve ) { this . resource = resource ; this . openable = openable ; this . document = document ; this . nodeSet = new MatchingNodeSet ( mustResolve ) ; char [ ] qualifiedName = getQualifiedName ( ) ; if ( qualifiedName != null ) this . compoundName = CharOperation . splitOn ( '.' , qualifiedName ) ; } public void cleanUp ( ) { this . source = null ; if ( this . parsedUnit != null ) { this . parsedUnit = null ; } this . nodeSet = null ; } public boolean equals ( Object obj ) { if ( this . compoundName == null ) return super . equals ( obj ) ; if ( ! ( obj instanceof PossibleMatch ) ) return false ; return CharOperation . equals ( this . compoundName , ( ( PossibleMatch ) obj ) . compoundName ) ; } public char [ ] getContents ( ) { if ( this . source != null ) return this . source ; return this . source = this . document . getCharContents | |
866 | <s> package org . oddjob . doclet ; public class Property { private final String name ; private String description ; private String required ; public Property ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } this . name = name ; } public String getName ( ) { return name ; } public void setDescription ( String description ) { this . description = description ; } public String getDescription ( ) { return description ; } | |
867 | <s> package org . oddjob . jobs . structural ; import junit . framework . TestCase ; import org . apache . commons . beanutils . PropertyUtils ; import org . apache . log4j . Logger ; import org . oddjob . ConsoleCapture ; import org . oddjob . FailedToStopException ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Stateful ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . framework . SimpleJob ; import org . oddjob . framework . StopWait ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; public class RepeatJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( RepeatJobTest . class ) ; volatile boolean stop ; RepeatJob job ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; stop = false ; job = new RepeatJob ( ) ; job . setName ( "Test Repeat" ) ; } public void testSimpleRepeat3Times ( ) { Counter childJob = new Counter ( ) ; job . setJob ( childJob ) ; job . setTimes ( 3 ) ; job . run ( ) ; assertEquals ( "" , 3 , childJob . count ) ; } public void testSimpleUntil ( ) { Runnable childJob = new SimpleJob ( ) { @ Override protected int execute ( ) throws Throwable { job . setUntil ( true ) ; return 0 ; } } ; job . setJob ( childJob ) ; job . run ( ) ; assertEquals ( JobState . COMPLETE , ( ( Stateful ) childJob ) . lastStateEvent ( ) . getState ( ) ) ; } public void testInOddjob ( ) throws FailedToStopException { String config = "" + " <job>" + "" + " <jobs>" + "" + " <job>" + "" + " </job>" + "" + "" + " <job>" + "" + " </job>" + "" + " </jobs>" + "" + " </job>" + "</oddjob>" ; Oddjob oj = new Oddjob ( ) ; oj . setConfiguration ( new XMLConfiguration ( "TEST" , config ) ) ; oj . run ( ) ; new StopWait ( oj ) . run ( ) ; assertEquals ( "OJ complete" , ParentState . COMPLETE , Helper . getJobState ( oj ) ) ; } public static class Counter extends SimpleJob { int count ; @ Override protected int execute ( ) throws Throwable { count ++ ; return 0 ; } public int getCount ( ) { return count ; } } public void testSimpleCountOJ ( ) throws Exception { String xml = "" + " <job>" + "" + " <job>" + "" + Counter . class . getName ( ) + "'/>" + " </job>" + " </repeat>" + " </job>" + "</oddjob>" ; Oddjob oj = new Oddjob ( ) ; oj . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oj . run ( ) ; Object c = new OddjobLookup ( oj ) . lookup ( "c" ) ; assertEquals ( new Integer ( 10 ) , PropertyUtils . getProperty ( c , "count" ) ) ; } public static class ExceptionJob implements Runnable { public void run ( ) { throw new RuntimeException ( "fail" ) ; } } public void testSimpleFailOJ ( ) throws Exception { String xml = "" + " <job>" + "" + " <job>" + "" + ExceptionJob . class . getName ( ) + "'/>" + " </job>" + "" + " </job>" + "</oddjob>" ; Oddjob oj = new Oddjob ( ) ; oj . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oj . run ( ) ; Stateful repeat = new OddjobLookup ( oj ) . lookup ( "repeat" | |
868 | <s> package org . rubypeople . rdt . internal . ui . wizards ; import java . net . MalformedURLException ; import java . net . URL ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Preferences ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . wizard . IWizardPage ; import org . eclipse . jface . wizard . Wizard ; import org . eclipse . ui . INewWizard ; import org . eclipse . ui . IWorkbench ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . browser . IWebBrowser ; import org . eclipse . ui . browser . IWorkbenchBrowserSupport ; import org . rubypeople . rdt . internal . launching . LaunchingPlugin ; import org . | |
869 | <s> package net . bioclipse . opentox . ds . wizards ; import org . eclipse . jface . viewers . IBaseLabelProvider ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ILabelProviderListener ; import org . eclipse . swt . graphics . Image ; public class ServicesLabelProvider implements ILabelProvider { @ Override public void addListener ( ILabelProviderListener listener ) { } @ Override public void dispose ( ) { } @ Override public boolean isLabelProperty ( Object element , String property ) { return false ; } | |
870 | <s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBStringExpr extends SVDBExpr { public String fStr ; public SVDBStringExpr ( ) { this ( "" ) ; } public SVDBStringExpr ( String str ) { super ( SVDBItemType . StringExpr ) ; fStr = str ; } public String getContent | |
871 | <s> package org . rubypeople . rdt . internal . core ; public abstract class MemberElementInfo extends SourceRefElementInfo { protected int nameStart = - 1 ; protected int nameEnd = | |
872 | <s> package org . springframework . samples . petclinic . aspects ; import org . aspectj . lang . ProceedingJoinPoint ; import org . aspectj . lang . annotation . Around ; import org . aspectj . lang . annotation . Aspect ; import org . springframework . jmx . export . annotation . ManagedAttribute ; import org . springframework . jmx . export . annotation . ManagedOperation ; import org . | |
873 | <s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . corext . util . SearchUtils ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; class CallerMethodWrapper extends MethodWrapper { public CallerMethodWrapper ( MethodWrapper parent , MethodCall methodCall ) { super ( parent , methodCall ) ; } protected IRubySearchScope getSearchScope ( ) { return CallHierarchy . getDefault ( ) . getSearchScope ( ) ; } protected String getTaskName ( ) { return CallHierarchyMessages . CallerMethodWrapper_taskname ; } protected MethodWrapper createMethodWrapper ( MethodCall methodCall ) { return new CallerMethodWrapper ( this , methodCall ) ; } | |
874 | <s> package org . rubypeople . rdt . internal . ti ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . ArgumentNode ; import org . jruby . ast . CallNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . Colon2Node ; import org . jruby . ast . ConstNode ; import org . jruby . ast . DVarNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . GlobalAsgnNode ; import org . jruby . ast . GlobalVarNode ; import org . jruby . ast . InstAsgnNode ; import org . jruby . ast . InstVarNode ; import org . jruby . ast . IterNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . jruby . ast . VCallNode ; import org . jruby . ast . YieldNode ; import org . jruby . lexer . yacc . SyntaxException ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . search . CollectingSearchRequestor ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import org . rubypeople . rdt . internal . ti . data . LiteralNodeTypeNames ; import org . rubypeople . rdt . internal . ti . data . TypicalMethodReturnNames ; import org . rubypeople . rdt . internal . ti . util . ClosestSpanningNodeLocator ; import org . rubypeople . rdt . internal . ti . util . FirstPrecursorNodeLocator ; import org . rubypeople . rdt . internal . ti . util . INodeAcceptor ; import org . rubypeople . rdt . internal . ti . util . OffsetNodeLocator ; import org . rubypeople . rdt . internal . ti . util . ScopedNodeLocator ; public class DefaultTypeInferrer implements ITypeInferrer { private static final String CONSTRUCTOR_INVOKE_NAME = "new" ; private RootNode rootNode ; private Set < Node > dontVisitNodes ; private HashSet < Node > fVisitedNodes ; private Map < String , RootNode > parsed ; public Collection < ITypeGuess > infer ( String source , int offset ) { dontVisitNodes = new HashSet < Node > ( ) ; fVisitedNodes = new HashSet < Node > ( ) ; parsed = new HashMap < String , RootNode > ( ) ; try { rootNode = parse ( source ) ; Node node = OffsetNodeLocator . Instance ( ) . getNodeAtOffset ( rootNode . getBodyNode ( ) , offset ) ; if ( node == null ) { return Collections . emptyList ( ) ; } return infer ( node ) ; } catch ( SyntaxException e ) { return Collections . emptyList ( ) ; } finally { parsed . clear ( ) ; dontVisitNodes . clear ( ) ; fVisitedNodes . clear ( ) ; } } private Set < ITypeGuess > infer ( Node node ) { if ( fVisitedNodes . contains ( node ) ) return new HashSet < ITypeGuess > ( ) ; fVisitedNodes . add ( node ) ; Set < ITypeGuess > guesses = new HashSet < ITypeGuess > ( ) ; tryLiteralNode ( node , guesses ) ; tryAsgnNode ( node , guesses ) ; tryDVarNode ( node , guesses ) ; tryLocalVarNode ( node , guesses ) ; tryInstVarNode ( node , guesses ) ; tryGlobalVarNode ( node , guesses ) ; tryMethodNode ( node , guesses ) ; tryIterNode ( node , guesses ) ; tryWellKnownMethodCalls ( node , guesses ) ; if ( node instanceof Colon2Node ) { Colon2Node colonNode = ( Colon2Node ) node ; String name = ASTUtil . getFullyQualifiedName ( colonNode ) ; guesses . add ( new BasicTypeGuess ( name , 100 ) ) ; } if ( node instanceof ConstNode ) { ConstNode constNode = ( ConstNode ) node ; String name = constNode . getName ( ) ; if ( ! name . equals ( "ARGV" ) ) guesses . add ( new BasicTypeGuess ( constNode . getName ( ) , 100 ) ) ; } if ( guesses . isEmpty ( ) ) { if ( node instanceof CallNode ) { CallNode call = ( CallNode ) node ; return infer ( call . getReceiverNode ( ) ) ; } } return guesses ; } private void tryDVarNode ( Node node , Set < ITypeGuess > guesses ) { if ( ! ( node instanceof DVarNode ) ) return ; Node iterNode = ClosestSpanningNodeLocator . Instance ( ) . findClosestSpanner ( rootNode , node . getPosition ( ) . getStartOffset ( ) , new INodeAcceptor ( ) { public boolean doesAccept ( Node node ) { return ( node instanceof IterNode ) ; } } ) ; Node methodCall = OffsetNodeLocator . Instance ( ) . getNodeAtOffset ( rootNode , iterNode . getPosition ( ) . getStartOffset ( ) - 1 ) ; try { SearchEngine engine = new SearchEngine ( ) ; SearchPattern pattern = SearchPattern . createPattern ( IRubyElement . METHOD , ASTUtil . getNameReflectively ( methodCall ) , IRubySearchConstants . DECLARATIONS , SearchPattern . R_EXACT_MATCH ) ; SearchParticipant [ ] participants = new SearchParticipant [ ] { SearchEngine . getDefaultSearchParticipant ( ) } ; IRubySearchScope scope = SearchEngine . createWorkspaceScope ( ) ; CollectingSearchRequestor requestor = new CollectingSearchRequestor ( ) ; engine . search ( pattern , participants , scope , requestor , new NullProgressMonitor ( ) ) ; List < SearchMatch > matches = requestor . getResults ( ) ; for ( SearchMatch match : matches ) { IMethod method = ( IMethod ) match . getElement ( ) ; String src = method . getRubyScript ( ) . getSource ( ) ; Node otherRoot = parse ( src ) ; Node methodNodeThing = OffsetNodeLocator . Instance ( ) . getNodeAtOffset ( otherRoot , method . getSourceRange ( ) . getOffset ( ) ) ; List < Node > yields = ScopedNodeLocator . Instance ( ) . findNodesInScope ( methodNodeThing , new INodeAcceptor ( ) { public boolean doesAccept ( Node node ) { return node instanceof YieldNode ; } } ) ; if ( yields == null ) continue ; for ( Node yield : yields ) { if ( yield instanceof YieldNode ) { YieldNode yieldNode = ( YieldNode ) yield ; Node argsNode = yieldNode . getArgsNode ( ) ; guesses . addAll ( infer ( src , argsNode . getPosition ( ) . getStartOffset ( ) ) ) ; } } } } catch ( CoreException e ) { RubyCore . log ( e ) ; } } private RootNode parse ( String src ) { if ( parsed . containsKey ( src ) ) { return parsed . get ( src ) ; } RubyParser parser = new RubyParser ( ) ; RootNode root = ( RootNode ) parser . parse ( src ) . getAST ( ) ; parsed . put ( src , root ) ; return root ; } private void tryIterNode ( Node node , Set < ITypeGuess > guesses ) { if ( ! ( node instanceof IterNode ) ) return ; tryEnclosingType ( node , guesses ) ; } private void tryEnclosingType ( Node node , Set < ITypeGuess > guesses ) { Node typeNode = ClosestSpanningNodeLocator . Instance ( ) . findClosestSpanner ( rootNode , node . getPosition ( ) . getStartOffset ( ) , new INodeAcceptor ( ) { public boolean doesAccept ( Node node ) { return ( node instanceof ClassNode || node instanceof ModuleNode ) ; } } ) ; if ( typeNode == null ) { guesses . add ( new BasicTypeGuess ( "Object" , 100 ) ) ; } else { guesses . add ( new BasicTypeGuess ( ASTUtil . getFullyQualifiedTypeName ( rootNode , typeNode ) , 100 ) ) ; } } private void | |
875 | <s> package org . rubypeople . rdt . internal . corext . refactoring . changes ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . ltk . core . refactoring . Change ; import org . eclipse . ltk . core . refactoring . ChangeDescriptor ; import org . eclipse . ltk . core . refactoring . RefactoringChangeDescriptor ; import org . eclipse . ltk . core . refactoring . RefactoringDescriptor ; import org . eclipse . ltk . core . refactoring . RefactoringStatus ; import org . rubypeople . rdt . internal . corext . refactoring . base . RDTChange ; import org . rubypeople . rdt . refactoring . core . Messages ; public final class RenameResourceChange extends RDTChange { public static IPath renamedResourcePath ( IPath path , String newName ) { return path . removeLastSegments ( 1 ) . append ( newName ) ; } private final String fComment ; private final RefactoringDescriptor fDescriptor ; private final String fNewName ; private final IPath fResourcePath ; private final long fStampToRestore ; private RenameResourceChange ( RefactoringDescriptor descriptor , IPath resourcePath , String newName , String comment , long stampToRestore ) { fDescriptor = descriptor ; fResourcePath = resourcePath ; fNewName = newName ; fComment = comment ; fStampToRestore = stampToRestore ; } public RenameResourceChange ( RefactoringDescriptor descriptor , IResource resource , String newName , String comment ) { this ( descriptor , resource . getFullPath ( ) , newName , comment , IResource . NULL_STAMP ) ; } public ChangeDescriptor getDescriptor ( ) { if ( fDescriptor != null ) return new RefactoringChangeDescriptor ( fDescriptor ) ; return null ; } public Object getModifiedElement ( ) { return getResource ( ) ; } public String getName ( ) { return Messages . format ( Messages . RenameResourceChange_name , new String [ ] { fResourcePath . toString ( ) , fNewName } ) ; } public String getNewName ( ) { return fNewName ; } private IResource getResource ( ) { return ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . findMember ( fResourcePath ) ; } public RefactoringStatus isValid ( IProgressMonitor pm ) throws CoreException { IResource resource = getResource ( ) ; if ( resource == null || ! resource . exists ( ) ) { return RefactoringStatus . createFatalErrorStatus ( Messages . format ( Messages . RenameResourceChange_does_not_exist , fResourcePath . toString | |
876 | <s> package com . team1160 . scouting . h2 ; import java . sql . * ; import org . h2 . Driver ; @ SuppressWarnings ( "unused" ) public abstract class H2Table { protected String database ; protected Connection connection ; protected Statement statement ; public H2Table ( String database ) throws ClassNotFoundException , SQLException { this . database = database ; Class | |
877 | <s> package com . asakusafw . yaess . jobqueue . client ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . Reader ; import java . lang . reflect . Field ; import java . lang . reflect . Type ; import java . net . Socket ; import java . net . URI ; import java . nio . charset . Charset ; import java . security . GeneralSecurityException ; import java . security . KeyManagementException ; import java . security . NoSuchAlgorithmException ; import java . security . cert . CertificateException ; import java . security . cert . X509Certificate ; import java . text . MessageFormat ; import javax . net . ssl . SSLContext ; import javax . net . ssl . TrustManager ; import javax . net . ssl . X509TrustManager ; import org . apache . http . HttpEntity ; import org . apache . http . HttpResponse ; import org . apache . http . HttpStatus ; import org . apache . http . auth . AuthScope ; import org . apache . http . auth . UsernamePasswordCredentials ; import org . apache . http . client . HttpClient ; import org . apache . http . client . methods . HttpGet ; import org . apache . http . client . methods . HttpPost ; import org . apache . http . client . methods . HttpPut ; import org . apache . http . client . methods . HttpUriRequest ; import org . apache . http . conn . scheme . Scheme ; import org . apache . http . conn . ssl . SSLSocketFactory ; import org . apache . http . entity . ContentType ; import org . apache . http . entity . StringEntity ; import org . apache . http . impl . client . DefaultHttpClient ; import org . apache . http . impl . conn . PoolingClientConnectionManager ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . ExecutionPhase ; import com . google . gson . FieldNamingStrategy ; import com . google . gson . GsonBuilder ; import com . google . gson . JsonDeserializationContext ; import com . google . gson . JsonDeserializer ; import com . google . gson . JsonElement ; import com . google . gson . JsonObject ; import com . google . gson . JsonParseException ; import com . google . gson . JsonParser ; import com . google . gson . JsonPrimitive ; import com . google . gson . JsonSerializationContext ; import com . google . gson . JsonSerializer ; import com . google . gson . annotations . SerializedName ; public class HttpJobClient implements JobClient { static final Logger LOG = LoggerFactory . getLogger ( HttpJobClient . class ) ; private static final Charset ENCODING = Charset . forName ( "UTF-8" ) ; static final ContentType CONTENT_TYPE = ContentType . create ( "text/json" , ENCODING ) ; private static final GsonBuilder GSON_BUILDER ; static { GSON_BUILDER = new GsonBuilder ( ) ; GSON_BUILDER . registerTypeAdapter ( JobStatus . Kind . class , new JobStatusKindAdapter ( ) ) ; GSON_BUILDER . registerTypeAdapter ( ExecutionPhase . class , new ExecutionPhaseAdapter ( ) ) ; GSON_BUILDER . setFieldNamingStrategy ( new FieldNamingStrategy ( ) { @ Override public String translateName ( Field f ) { SerializedName name = f . getAnnotation ( SerializedName . class ) ; if ( name != null ) { return name . value ( ) ; } return f . getName ( ) ; } } ) ; } private final String baseUri ; private final String user ; private final HttpClient http ; public HttpJobClient ( String baseUri ) { if ( baseUri == null ) { throw new IllegalArgumentException ( "" ) ; } this . baseUri = normalize ( baseUri ) ; this . user = null ; this . http = createClient ( ) ; } public HttpJobClient ( String baseUri , String user , String password ) { if ( baseUri == null ) { throw new IllegalArgumentException ( "" ) ; } if ( user == null ) { throw new IllegalArgumentException ( "" ) ; } if ( password == null ) { throw new IllegalArgumentException ( "" ) ; } this . baseUri = normalize ( baseUri ) ; this . user = user ; DefaultHttpClient client = createClient ( ) ; client . getCredentialsProvider ( ) . setCredentials ( AuthScope . ANY , new UsernamePasswordCredentials ( user , password ) ) ; this . http = client ; } private DefaultHttpClient createClient ( ) { try { DefaultHttpClient client = new DefaultHttpClient ( new PoolingClientConnectionManager ( ) ) ; SSLSocketFactory socketFactory = TrustedSSLSocketFactory . create ( ) ; Scheme sch = new Scheme ( "https" , 443 , socketFactory ) ; client . getConnectionManager ( ) . getSchemeRegistry ( ) . register ( sch ) ; return client ; } catch ( GeneralSecurityException e ) { throw new IllegalStateException ( MessageFormat . format ( "" , baseUri ) , e ) ; } } private static String normalize ( String url ) { assert url != null ; if ( url . endsWith ( "/" ) ) { return url ; } return url + "/" ; } public String getBaseUri ( ) { return baseUri ; } public String getUser ( ) { return user ; } @ Override public JobId register ( JobScript script ) throws IOException , InterruptedException { if ( script == null ) { throw new IllegalArgumentException ( "" ) ; } HttpPost request = new HttpPost ( ) ; URI uri = createUri ( "jobs" ) ; request . setURI ( uri ) ; request . setEntity ( createEntity ( script ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "" , uri , script ) ; } HttpResponse response = http . execute ( request ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ) { JobStatus status = extractJobStatus ( request , response ) ; if ( status . getKind ( ) == JobStatus . Kind . ERROR ) { throw toException ( request , response , status , MessageFormat . format ( "" , script , status . getErrorMessage ( ) ) ) ; } return new JobId ( status . getJobId ( ) ) ; } else { throw toException ( request , response , MessageFormat . format ( "" , script ) ) ; } } @ Override public JobStatus getStatus ( JobId id ) throws IOException , InterruptedException { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } HttpGet request = new HttpGet ( ) ; URI uri = createUri ( String . format ( "jobs/%s" , id . getToken ( ) ) ) ; request . setURI ( uri ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "" , uri ) ; } HttpResponse response = http . execute ( request ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ) { JobStatus status = extractJobStatus ( request , response ) ; return status ; } else { throw toException ( request , response , MessageFormat . format ( "" , id . getToken ( ) , request . getURI ( ) ) ) ; } } @ Override public void submit ( JobId id ) throws IOException , InterruptedException { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } HttpPut request = new HttpPut ( ) ; URI uri = createUri ( String . format ( "" , id . getToken ( ) ) ) ; request . setURI ( uri ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "" , uri ) ; } HttpResponse response = http . execute ( request ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ) { JobStatus status = extractJobStatus ( request , response ) ; if ( status . getKind ( ) == JobStatus . Kind . ERROR ) { throw toException ( request , response , status , MessageFormat . format ( "" , id . getToken ( ) , request . getURI ( ) ) ) ; } } else { throw toException ( request , response , MessageFormat . format ( "" , id . getToken ( ) , request . getURI ( ) ) ) ; } } private URI createUri ( String path ) { return URI . create ( baseUri + path ) ; } private JobStatus extractJobStatus ( HttpUriRequest request , HttpResponse response ) throws IOException { assert request != null ; assert response != null ; JobStatus status = extractContent ( JobStatus . class , request , response ) ; if ( status . getKind ( ) == null ) { throw new IOException ( MessageFormat . format ( "" , request . getURI ( ) ) ) ; } if ( status . getKind ( ) != JobStatus . Kind . ERROR && status . getJobId ( ) == null ) { throw new IOException ( MessageFormat . format ( "" , request . getURI ( ) ) ) ; } if ( status . getKind ( ) == JobStatus . Kind . COMPLETED && status . getExitCode ( ) == null ) { throw new IOException ( MessageFormat . format ( "" , request . getURI ( ) ) ) ; } return status ; } private < T > T extractContent ( Class < T > type , HttpUriRequest request , HttpResponse response ) throws IOException { assert request != null ; assert response != null ; HttpEntity entity = response . getEntity ( ) ; if ( entity == null ) { throw new IOException | |
878 | <s> package com . asakusafw . runtime . io . util ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . runtime . value . IntOption ; public class InvertOrderTest extends WritableTestRoot { @ Test public void fundamental ( ) throws Exception { IntOption entity = new IntOption ( 100 ) ; InvertOrder invert = new InvertOrder ( entity ) ; assertThat ( invert . getEntity ( ) , sameInstance ( ( Object ) entity ) ) ; } @ Test public void serialize ( ) throws Exception { IntOption entity = new IntOption ( 100 ) ; InvertOrder invert = new InvertOrder ( entity ) ; byte [ ] serialized | |
879 | <s> package org . rubypeople . rdt . internal . corext . util ; import java . lang . reflect . InvocationTargetException ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jface . operation . IRunnableContext ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . jface . operation . ModalContext ; import org . eclipse . swt . custom . BusyIndicator ; public class BusyIndicatorRunnableContext implements IRunnableContext { private static class BusyRunnable implements Runnable { private static class ThreadContext extends Thread { IRunnableWithProgress fRunnable ; Throwable fThrowable ; public ThreadContext ( IRunnableWithProgress runnable ) { this ( runnable , "" ) ; } protected ThreadContext ( IRunnableWithProgress runnable , String name ) { super ( name ) ; fRunnable = runnable ; } public void run ( ) { try { fRunnable . run ( new NullProgressMonitor ( ) ) ; } catch ( InvocationTargetException e ) { fThrowable = e ; } catch ( InterruptedException e ) { fThrowable = e ; } catch ( ThreadDeath e ) { fThrowable = e ; throw e ; } catch ( RuntimeException e ) { fThrowable = e ; } catch ( Error e ) { fThrowable = e ; } } void sync ( ) { try { join ( ) ; } catch ( InterruptedException e ) { } } } public Throwable fThrowable ; private boolean fFork ; private IRunnableWithProgress fRunnable ; public BusyRunnable ( boolean fork , IRunnableWithProgress runnable ) { fFork = fork ; fRunnable = runnable ; } public void run ( ) { try { internalRun ( fFork , fRunnable ) ; } catch ( InvocationTargetException e ) { fThrowable = e ; } catch ( InterruptedException e ) { fThrowable = e ; } } private void internalRun ( boolean fork , final IRunnableWithProgress runnable ) throws InvocationTargetException , InterruptedException { Thread thread = Thread . currentThread ( ) ; if ( thread instanceof ThreadContext || ModalContext . isModalContextThread ( thread ) ) fork = false ; if ( fork ) { final ThreadContext t = new ThreadContext ( runnable ) ; t . start ( ) ; t . sync ( ) ; Throwable throwable = t . fThrowable ; if ( throwable != null ) { if ( throwable instanceof InvocationTargetException ) { throw ( InvocationTargetException ) throwable ; } else if ( throwable instanceof InterruptedException ) { throw ( InterruptedException ) throwable ; } else if ( throwable instanceof OperationCanceledException ) { throw new InterruptedException ( ) ; } else { | |
880 | <s> package org . rubypeople . rdt . internal . core . parser . warnings ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . core . search . CollectingSearchRequestor ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; public class CoreClassReOpening extends RubyLintVisitor { private List < Node > typeStack ; private RootNode rootNode ; private IRubyScript script ; private static Set < String > coreTypes = new HashSet < String > ( ) ; static { coreTypes . add ( "Array" ) ; coreTypes . add ( "Bignum" ) ; coreTypes . add ( "Class" ) ; coreTypes . add ( "Complex" ) ; coreTypes . add ( "Date" ) ; coreTypes . add ( "DateTime" ) ; coreTypes . add ( "Enumerable" ) ; coreTypes . add ( "FalseClass" ) ; coreTypes . add ( "Fixnum" ) ; coreTypes . add ( "Float" ) ; coreTypes . add ( "NilClass" ) ; coreTypes . add ( "Numeric" ) ; coreTypes . add ( "Rational" ) ; coreTypes . add ( "Regexp" ) ; coreTypes . add ( "Set" ) ; coreTypes . add ( "String" ) ; coreTypes . add ( "Time" ) ; coreTypes . add ( "TrueClass" ) ; } public CoreClassReOpening ( IRubyScript script , String contents ) { super ( contents ) ; this . script = script ; typeStack = new ArrayList < Node > ( ) ; } @ Override protected String getOptionKey ( ) { return RubyCore . COMPILER_PB_REDEFINITION_CORE_CLASS_METHOD ; } @ Override public Object visitDefnNode ( DefnNode iVisited ) { String typeName = getCurrentTypeName ( ) ; if ( isCoreClass ( typeName ) ) { String methodName = iVisited . getName ( ) ; if ( methodExistsOnType ( typeName , methodName ) ) createProblem ( iVisited . getPosition ( ) , "" ) ; } return super . visitDefnNode ( iVisited ) ; } protected boolean methodExistsOnType ( String typeName , String methodName ) { try { ISourceFolderRoot [ ] roots = script . getRubyProject ( ) . getAllSourceFolderRoots ( ) ; ISourceFolderRoot stubs = findCoreStubsRoot ( roots ) ; if ( stubs == null ) return false ; SearchParticipant [ ] participants = new SearchParticipant [ ] { SearchEngine . getDefaultSearchParticipant ( ) } ; SearchEngine engine = new SearchEngine ( ) ; IRubySearchScope scope = | |
881 | <s> package org . oddjob . jmx . general ; import org . apache . commons . beanutils . DynaBean ; import org . oddjob . jmx | |
882 | <s> package de . fuberlin . wiwiss . d2rq . values ; import java . util . Arrays ; import java . util . Collections ; import junit . framework . TestCase ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; public class ValueMakerTest extends TestCase { private final static Attribute foo_col1 = new Attribute ( null , "foo" , "col1" ) ; private final static Attribute foo_col2 = new Attribute ( null , "foo" , "col2" ) ; public void testBlankNodeIDToString ( ) { BlankNodeID b = new BlankNodeID ( "classmap1" , Arrays . asList ( new Attribute [ ] { foo_col1 , foo_col2 } ) ) ; assertEquals ( "" , b . toString ( ) ) ; } public void testColumnToString ( ) { assertEquals ( "" , new Column ( foo_col1 ) . toString ( ) ) ; } public void testPatternToString ( ) { assertEquals ( "" , new Pattern ( "" ) . toString ( ) ) ; } public void testValueDecoratorWithoutTranslatorToString ( ) { assertEquals ( "" , new ValueDecorator ( new Column ( foo_col1 ) , Collections . singletonList ( ValueDecorator . maxLengthConstraint ( 10 ) ) ) . toString ( ) ) ; } public void testMaxLengthConstraint ( ) { DummyValueMaker source = new DummyValueMaker ( "foo" ) ; ValueDecorator values = new ValueDecorator ( source , Collections . singletonList ( ValueDecorator . maxLengthConstraint ( 5 ) ) ) ; assertFalse ( matches ( values , null ) ) ; assertTrue ( matches ( values , "" ) ) ; assertTrue ( matches ( values , "foo" ) ) ; assertTrue ( matches ( values , "fooba" ) ) ; assertFalse ( matches ( values , "foobar" ) ) ; source . setSelectCondition ( Expression . FALSE ) ; assertFalse ( matches ( values , "foo" ) ) ; } public void testContainsConstraint ( ) { DummyValueMaker source = new DummyValueMaker ( "foo" ) ; ValueDecorator values = new ValueDecorator ( | |
883 | <s> package com . asakusafw . yaess . basic ; import java . io . Closeable ; import java . io . File ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . nio . channels . FileLock ; import java . nio . channels . OverlappingFileLockException ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . Map ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . ExecutionLock ; import com . asakusafw . yaess . core . YaessLogger ; class FileExecutionLock extends ExecutionLock { static final YaessLogger YSLOG = new YaessBasicLogger ( FileExecutionLock . class ) ; static final Logger LOG = LoggerFactory . getLogger ( FileExecutionLock . class ) ; private static final String NAME_WORLD = "world.lck" ; private static final String NAME_BATCH = "" ; private static final String NAME_FLOW = "" ; private static final String NAME_EXECUTION = "" ; private final Scope lockScope ; private final String batchId ; private final File directory ; private final LockObject batchLock ; private final Map < String , LockObject > flowLocks ; private boolean closed ; public FileExecutionLock ( Scope lockScope , String batchId , File directory ) throws IOException { if ( lockScope == null ) { throw new IllegalArgumentException ( "" ) ; } if ( batchId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( directory == null ) { throw new IllegalArgumentException ( "" ) ; } this . lockScope = lockScope ; this . batchId = batchId ; this . directory = directory ; this . flowLocks = new HashMap < String , LockObject > ( ) ; try { this . batchLock = acquireForBatch ( ) ; } catch ( IOException e ) { YSLOG . error ( "E41001" , batchId , lockScope ) ; throw e ; } } @ Override public synchronized void beginFlow ( String flowId , String executionId ) throws IOException { if ( flowId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( executionId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( closed ) { throw new IOException ( "" ) ; } LockObject other = flowLocks . get ( flowId ) ; if ( other != null ) { YSLOG . error ( "E41002" , batchId , flowId , executionId , lockScope ) ; throw new IOException ( MessageFormat . format ( "" , flowId , other . label ) ) ; } try { LockObject lock = acquireForFlow ( flowId , executionId ) ; if ( lock != null ) { flowLocks . put ( flowId , lock ) ; } } catch ( IOException e ) { YSLOG . error ( "E41002" , batchId , flowId , executionId , lockScope ) ; throw e ; } } @ Override public synchronized void endFlow ( String flowId , String executionId ) throws IOException { if ( flowId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( executionId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( closed ) { throw new IOException ( "" ) ; } LockObject lock = flowLocks . remove ( flowId ) ; closeQuiet ( lock ) ; } @ Override public synchronized void close ( ) { if ( closed ) { return ; } closeQuiet ( batchLock ) ; for ( LockObject lock : flowLocks . values ( ) ) { closeQuiet ( lock ) ; } closed = true ; } private void closeQuiet ( LockObject lock ) { if ( lock == null ) { return ; } lock . close ( ) ; } private LockObject acquireForBatch ( ) throws IOException { assert directory != null ; assert batchId != null ; switch ( lockScope ) { case WORLD : return new LockObject ( "world lock" , new File ( directory , NAME_WORLD ) ) ; case BATCH : return new LockObject ( MessageFormat . format ( "" , batchId ) , new File ( directory , MessageFormat . format ( NAME_BATCH , batchId ) ) ) ; default : return null ; } } private LockObject acquireForFlow ( String flowId , String executionId ) throws IOException { assert flowId != null ; assert executionId != null ; switch ( lockScope ) { case WORLD : case BATCH : case FLOW : return new LockObject ( MessageFormat . format ( "" , batchId , flowId ) , new File ( directory , MessageFormat . format ( NAME_FLOW , batchId , flowId , executionId ) ) ) ; case EXECUTION : return new LockObject ( MessageFormat . format ( "" , batchId , flowId , executionId ) , new File ( directory , MessageFormat . format ( NAME_EXECUTION , batchId , flowId , executionId ) ) ) ; default : return null ; } } private static class LockObject implements Closeable { final String label ; final File path ; private final RandomAccessFile file ; private final FileLock lock ; private boolean closed ; LockObject ( String label , File path ) throws IOException { if ( path == null ) { throw new IllegalArgumentException ( "" ) ; } if ( label == null ) { throw new | |
884 | <s> package com . asakusafw . yaess . core ; public class ProfileContext { private final ClassLoader classLoader ; private final VariableResolver contextParameters ; public ProfileContext ( ClassLoader classLoader , VariableResolver contextParameters ) { if ( classLoader == null ) { throw new IllegalArgumentException ( "" ) ; } if ( contextParameters == null ) { throw new IllegalArgumentException ( "" ) ; } this . classLoader = classLoader ; this . contextParameters = contextParameters ; } public static ProfileContext system ( ClassLoader classLoader ) { return new ProfileContext ( classLoader , new VariableResolver | |
885 | <s> package com . aptana . rdt . internal . ui . text . correction ; import java . util . Collection ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . text . correction . CorrectionProposal ; import org . rubypeople . rdt . ui . text . ruby . IProblemLocation ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public class LocalCorrectionsSubProcessor { public static void addReplacementProposal ( String replacement , String display , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) { addReplacementProposal ( problem . getOffset ( ) , problem . getLength ( | |
886 | <s> package de . fuberlin . wiwiss . d2rq . sql ; import java . sql . Connection ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . util . List ; import java . util . NoSuchElementException ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . query . QueryCancelledException ; import com . hp . hpl . jena . util . iterator . ClosableIterator ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . map . Database ; public class SQLIterator implements ClosableIterator < ResultRow > { private final static Log log = LogFactory . getLog ( SQLIterator . class ) ; private String sql ; private List < ProjectionSpec > columns ; private ConnectedDB database ; private volatile Statement statement = null ; private ResultSet resultSet = null ; private ResultRow prefetchedRow = null ; private int numCols = 0 ; private boolean queryExecuted = false ; private boolean explicitlyClosed = false ; private volatile boolean cancelled = false ; public SQLIterator ( String sql , List < ProjectionSpec > columns , ConnectedDB db ) { this . sql = sql ; this . columns = columns ; this . database = db ; } public boolean hasNext ( ) { if ( cancelled ) { throw new QueryCancelledException ( ) ; } if ( explicitlyClosed ) { return false ; } if ( prefetchedRow == null ) { ensureQueryExecuted ( ) ; tryFetchNextRow ( ) ; } return prefetchedRow != null ; } public ResultRow next ( ) { if | |
887 | <s> package org . oddjob . schedules ; import java . util . Date ; import org . oddjob . arooa . utils . DateHelper ; public class IntervalTo extends IntervalBase implements ScheduleResult { private static final long serialVersionUID = 2009022700L ; public IntervalTo ( Date on ) { super ( on ) ; } public IntervalTo ( Date from , Date upTo ) { super ( from . getTime ( ) , upTo . getTime ( ) - 1 ) ; } public IntervalTo ( Interval interval ) { super ( interval . getFromDate ( ) . getTime ( ) , interval . getToDate ( ) . getTime ( ) - 1 ) ; } public Date getToDate ( ) { return new Date ( getEndDate ( ) . getTime ( ) + 1 ) ; } public Interval limit ( Interval limit ) { if ( limit == null ) { return null ; } if ( limit . getFromDate ( ) . compareTo ( this . getFromDate ( ) ) < 0 ) { return null ; } if ( limit . getFromDate ( ) . compareTo ( this . getEndDate ( ) ) > 0 ) { return null ; } Date newStart ; if ( this . getFromDate ( ) . compareTo ( limit . getFromDate ( ) ) < 0 ) { newStart = limit . getFromDate ( ) ; } else | |
888 | <s> package org . oddjob . sql ; import java . io . ByteArrayInputStream ; import java . sql . Connection ; import java . util . List ; import junit . framework . TestCase ; import org . apache . commons . beanutils . DynaBean ; import org . apache . log4j . Logger ; import org . oddjob . ConsoleCapture ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . io . BufferType ; import org . oddjob . io . StdoutType ; import org . oddjob . jobs . BeanReportJob ; import org . oddjob . state . ParentState ; public class SQLJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( SQLJobTest . class ) ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . info ( "" + getName ( ) + "" ) ; } public void testSql ( ) throws Exception { ConnectionType ct = new ConnectionType ( ) ; ct . setDriver ( "" ) ; ct . setUrl ( "" ) ; ct . setUsername ( "sa" ) ; ct . setPassword ( "" ) ; SQLJob test = new SQLJob ( ) ; BufferType buffer = new BufferType ( ) ; buffer . setText ( "" ) ; buffer . configured ( ) ; SQLResultsBean beans = new SQLResultsBean ( ) ; test . setResults ( beans ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . setArooaSession ( new StandardArooaSession ( ) ) ; test . run ( ) ; buffer . setText ( "" ) ; buffer . configured ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . run ( ) ; buffer . setText ( "" ) ; buffer . configured ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . run ( ) ; logger . debug ( "Inserted: " + beans . getUpdateCount ( ) ) ; buffer . setText ( "" ) ; buffer . configured ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . run ( ) ; buffer . setText ( "" ) ; buffer . configured ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . run ( ) ; assertEquals ( "hello" , ( ( DynaBean ) beans . getRows ( ) [ 0 ] ) . get ( "GREETING" ) ) ; assertEquals ( "goodbye" , ( ( DynaBean ) beans . getRows ( ) [ 1 ] ) . get ( "GREETING" ) ) ; buffer . setText ( "shutdown" ) ; buffer . configured ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setInput ( buffer . toInputStream ( ) ) ; test . run ( ) ; assertEquals ( null , beans . getRows ( ) ) ; } public void testInOddjob ( ) throws Exception { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; List < ? > o = new OddjobLookup ( oddjob ) . lookup ( "" , List . class ) ; BeanReportJob rep = new BeanReportJob ( ) ; rep . setOutput ( new StdoutType ( ) . toValue ( ) ) ; rep . setArooaSession ( new StandardArooaSession ( ) ) ; rep . setBeans ( o ) ; rep . run ( ) ; Integer result = new OddjobLookup ( oddjob ) . lookup ( "" , Integer . class ) ; assertEquals ( new Integer ( 10 ) , result ) ; oddjob . destroy ( ) ; } public void testFirstExample ( ) throws ArooaPropertyException , ArooaConversionException { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; ConsoleCapture console = new ConsoleCapture ( ) ; console . capture ( Oddjob . CONSOLE ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; console . close ( ) ; console . dump ( logger ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; String [ ] lines = console . getLines ( ) ; assertEquals ( 2 , lines . length ) ; assertEquals ( "Hello" , lines [ 0 ] . trim ( ) ) ; assertEquals ( "Hello" , lines [ 1 ] . trim ( ) ) ; Connection connection = new OddjobLookup ( oddjob ) . lookup ( "" , Connection . class ) ; SQLJob shutdown = new SQLJob ( ) ; shutdown . setArooaSession ( new StandardArooaSession ( ) ) ; shutdown . setConnection ( connection ) ; shutdown . setInput ( new ByteArrayInputStream ( "shutdown" . getBytes ( ) ) ) ; shutdown . run ( ) ; } public void testInOddjobEmptyResultSet ( ) throws Exception { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; List < ? > o = lookup . lookup ( "" , List . class ) ; assertNotNull ( o ) ; int rows = lookup . lookup ( "" , int . class ) ; assertEquals ( 0 , rows ) ; oddjob . destroy ( ) ; } public void testMultipleStatements ( ) throws Exception { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; assertEquals ( new Integer ( 1 ) , lookup . lookup ( "" , Integer . class ) ) ; String [ ] rows = lookup . lookup ( "" , String [ ] . class ) ; assertEquals ( 6 , rows . length ) ; assertEquals ( "01" , lookup . lookup ( "" , String . class ) ) ; assertEquals ( "06" , lookup . lookup ( "" , String . class ) ) ; oddjob . destroy ( ) ; } public void testContinueOnFailure ( ) throws Exception { Oddjob oddjob = new | |
889 | <s> package com . asakusafw . compiler . batch . processor ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . util . Comparator ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . compiler . batch . BatchCompilerEnvironmentProvider ; import com . asakusafw . compiler . batch . BatchCompilingEnvironment ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . testing . DirectFlowCompiler ; import com . asakusafw . compiler . testing . JobflowInfo ; import com . asakusafw . compiler . util . tester . CompilerTester ; import com . asakusafw . runtime | |
890 | <s> package org . springframework . social . google . api . plus . activity . impl ; import org . springframework . social . google . api . impl . AbstractGoogleApiOperations ; import org . springframework . social . google . api . plus . activity . ActivitiesPage ; import org . springframework . social . google . api . plus . activity . Activity ; import org . springframework . social . google . api . plus . activity . ActivityOperations ; import org . springframework . social . google . api . plus . activity . ActivityQueryBuilder ; import org . springframework . web . client . RestTemplate ; public class ActivityTemplate extends AbstractGoogleApiOperations implements ActivityOperations { private static final String PEOPLE_URL = "" ; private static final String ACTIVITIES_PUBLIC = "" ; private static final String ACTIVITIES_URL = "" ; public ActivityTemplate ( RestTemplate restTemplate , boolean isAuthorized ) { super ( restTemplate , isAuthorized ) ; } @ Override public Activity getActivity ( String id ) { return getEntity ( ACTIVITIES_URL + id , Activity . class ) ; } @ Override public ActivitiesPage getActivitiesPage ( String userId , String pageToken ) { StringBuilder sb = new StringBuilder ( PEOPLE_URL ) . append ( userId ) . append ( ACTIVITIES_PUBLIC ) ; if ( pageToken | |
891 | <s> package $ { package } . jobflow ; import org . junit . Test ; import $ { package } . jobflow . CategorySummaryJob ; import $ { package } . modelgen . table . model . CategorySummary ; import $ { package } . modelgen . table . model . ErrorRecord ; import $ { package } . modelgen . table . model . ItemInfo ; import $ { package } . modelgen . table . model . | |
892 | <s> package uk . me . sample . android . confcaller ; import java . net . URLEncoder ; import android . app . ListActivity ; import android . content . Intent ; import android . content . SharedPreferences ; import android . database . Cursor ; import android . net . Uri ; import android . os . Bundle ; import android . preference . PreferenceManager ; import android . telephony . PhoneNumberUtils ; import android . view . ContextMenu ; import android . view . Menu ; import android . view . MenuItem ; import android . view . View ; import android . view . ContextMenu . ContextMenuInfo ; import android . widget . AdapterView ; import android . widget . ListView ; import android . widget . SimpleCursorAdapter ; import android . widget . TextView ; import android . widget . Toast ; import android . widget . AdapterView . AdapterContextMenuInfo ; import android . widget . AdapterView . OnItemClickListener ; public class ConfCaller extends ListActivity { private ConfDbAdapter mDbHelper ; @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; mDbHelper = new ConfDbAdapter ( this ) ; mDbHelper . open ( ) ; setListAdapter ( getList ( ) ) ; ListView lv = getListView ( ) ; lv . setTextFilterEnabled ( true ) ; registerForContextMenu ( lv ) ; lv . setOnItemClickListener ( new OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { Cursor confItem = mDbHelper . fetchConf ( id ) ; String confNumber = confItem . getString ( confItem . getColumnIndexOrThrow ( ConfDbAdapter . KEY_NUMBER ) | |
893 | <s> package com . asakusafw . compiler . operator . processor ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . compiler . operator . OperatorCompilerTestRoot ; import com . asakusafw . compiler . operator . model . MockFoo ; import com . asakusafw . compiler . operator . model . MockHoge ; import com . asakusafw . compiler . operator . model . MockKeyValue1 ; import com . asakusafw . compiler . operator . model . MockKeyValue2 ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . vocabulary . flow . testing . MockIn ; import com . asakusafw . vocabulary . flow . testing . MockOut ; public class MasterCheckOperatorProcessorTest extends OperatorCompilerTestRoot { @ Test public void simple ( ) { add ( "" ) ; ClassLoader loader = start ( new MasterCheckOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > a = MockIn . of ( MockHoge . class , "a" ) ; MockIn < MockFoo > b = MockIn . of ( MockFoo . class , "b" ) ; MockOut < MockFoo > found = MockOut . of ( MockFoo . class , "found" ) ; MockOut < MockFoo > missed = MockOut . of ( MockFoo . class , "missed" ) ; Object masterCheck = invoke ( factory , "example" , a , b ) ; found . add ( output ( MockFoo . class , masterCheck , "found" ) ) ; missed . add ( output ( MockFoo . class , masterCheck , "missed" ) ) ; Graph < String > graph = toGraph ( a , b ) ; assertThat ( graph . getConnected ( "a" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "b" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "" ) , isJust ( "found" , "missed" ) ) ; } @ Test public void selector ( ) { add ( "" ) ; ClassLoader loader = start ( new MasterCheckOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > a = MockIn . of ( MockHoge . class , "a" ) ; MockIn < MockFoo > b = MockIn . of ( MockFoo . class , "b" ) ; MockOut < MockFoo > found = MockOut . of ( MockFoo . class , "found" ) ; MockOut < MockFoo > missed = MockOut . of ( MockFoo . class , "missed" ) ; Object masterCheck = invoke ( factory , "example" , a , b ) ; found . add ( output ( MockFoo . class , masterCheck , "found" ) ) ; missed . add ( output ( MockFoo . class , masterCheck , "missed" ) ) ; Graph < String > graph = toGraph ( a , b ) ; assertThat ( graph . getConnected ( "a" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "b" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "" ) , isJust ( "found" , "missed" ) ) ; } @ Test public void generics ( ) { add ( "" ) ; ClassLoader loader = start ( new MasterCheckOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockKeyValue1 > a = MockIn . of ( MockKeyValue1 . class , "a" ) ; MockIn < MockKeyValue2 > b = MockIn . of ( MockKeyValue2 . class , "b" ) ; MockOut < MockKeyValue2 > found = MockOut . of ( MockKeyValue2 . class , "found" ) ; MockOut | |
894 | <s> package org . oddjob . state ; import java . util . concurrent . TimeUnit ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . FailedToStopException ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . StateSteps ; import org . oddjob . Stateful ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . framework . SimpleJob ; import org . oddjob . schedules . schedules . CountSchedule ; import org . oddjob . schedules . schedules . IntervalSchedule ; import org . oddjob . scheduling . DefaultExecutors ; import org . oddjob . scheduling . Timer ; import org . oddjob . state . FlagState ; import org . oddjob . state . JobState ; public class JoinJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( JoinJobTest . class ) ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . info ( "" + getName ( ) + "" ) ; } private static class OurJob extends SimpleJob { int ran ; @ Override protected int execute ( ) throws Throwable { ++ ran ; return 0 ; } } public void testEmpty ( ) { JoinJob test = new JoinJob ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; test . run ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; } public void testSimpleRunnable ( ) throws FailedToStopException , InterruptedException { OurJob job1 = new OurJob ( ) ; JoinJob test = new JoinJob ( ) ; test . setJob ( job1 ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; StateSteps testState = new StateSteps ( test ) ; testState . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . COMPLETE ) ; test . run ( ) ; testState . checkNow ( ) ; assertEquals ( JobState . COMPLETE , job1 . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( 1 , job1 . ran ) ; ( ( Resetable ) job1 ) . hardReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . READY , job1 . lastStateEvent ( ) . getState ( ) ) ; testState . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . COMPLETE ) ; test . run ( ) ; testState . checkNow ( ) ; assertEquals ( 2 , job1 . ran ) ; } public void testNotComplete ( ) throws FailedToStopException { FlagState job1 = new FlagState ( ) ; job1 . setState ( JobState . INCOMPLETE ) ; JoinJob test = new JoinJob ( ) ; test . setJob ( job1 ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; test . run ( ) ; assertEquals ( ParentState . INCOMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; job1 . setState ( JobState . COMPLETE ) ; job1 . hardReset ( ) ; job1 . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . COMPLETE , job1 . lastStateEvent ( ) . getState ( ) ) ; } public void testAsynchronous ( ) throws FailedToStopException , InterruptedException { DefaultExecutors executors = new DefaultExecutors ( ) ; FlagState job1 = new FlagState ( ) ; job1 . setState ( JobState . COMPLETE ) ; Timer timer = new Timer ( ) ; CountSchedule count = new CountSchedule ( 1 ) ; IntervalSchedule interval = new IntervalSchedule ( 500 ) ; count . setRefinement ( interval ) ; timer . setSchedule ( count ) ; timer . setJob ( job1 ) ; timer . setScheduleExecutorService ( executors . getScheduledExecutor ( ) ) ; JoinJob test = new JoinJob ( ) ; test . setJob ( timer ) ; StateSteps testStates = new StateSteps ( test ) ; testStates . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . COMPLETE ) ; test . run ( ) ; testStates . checkNow ( ) ; assertEquals ( JobState . COMPLETE , job1 . lastStateEvent ( ) . getState ( ) ) ; assertEquals | |
895 | <s> package com . asakusafw . compiler . flow . plan ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . Comparator ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; import org . junit . runner . RunWith ; import org . junit . runners . Parameterized ; import org . junit . runners . Parameterized . Parameters ; import com . asakusafw . compiler . flow . FlowCompilerOptions . GenericOptionValue ; import com . asakusafw . compiler . flow . example . BranchStage ; import com . asakusafw . compiler . flow . example . CombineStage ; import com . asakusafw . compiler . flow . example . DuplicateStage ; import com . asakusafw . compiler . flow . example . SplitStage ; import com . asakusafw . compiler . flow . example . StickyStage ; import com . asakusafw . compiler . flow . example . TwinCogroupStage ; import com . asakusafw . compiler . flow . example . VolatileStage ; import com . asakusafw . compiler . flow . processor . operator . UpdateFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . UpdateFlowFactory . Simple ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . Branch ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . Cogroup ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . CogroupAdd ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . Update ; import com . asakusafw . compiler . util . tester . CompilerTester ; import com . asakusafw . compiler . util . tester . CompilerTester . TestInput ; import com . asakusafw . compiler . util . tester . CompilerTester . TestOutput ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . Out ; import com . asakusafw . vocabulary . flow . util . CoreOperatorFactory ; import com . asakusafw . vocabulary . flow . util . CoreOperatorFactory . Checkpoint ; import com . asakusafw . vocabulary . flow . util . CoreOperatorFactory . Confluent ; @ RunWith ( Parameterized . class ) public class StagePlannerRunTest { @ Rule public final CompilerTester tester ; @ Parameters public static List < Object [ ] > parameters ( ) { return Arrays . asList ( new Object [ ] [ ] { { GenericOptionValue . DISABLED } , { GenericOptionValue . ENABLED } , } ) ; } public StagePlannerRunTest ( GenericOptionValue opt ) { tester = new CompilerTester ( ) ; tester . options ( ) . putExtraAttribute ( StagePlanner . KEY_COMPRESS_FLOW_BLOCK_GROUP , opt . getSymbol ( ) ) ; } @ Test public void keep_sticky ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; in . add ( new Ex1 ( ) ) ; boolean result = tester . runFlow ( new StickyStage ( in . flow ( ) ) ) ; assertThat ( result , is ( false ) ) ; } @ Test public void unify_volatile ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "out" ) ; in . add ( new Ex1 ( ) ) ; boolean result = tester . runFlow ( new VolatileStage ( in . flow ( ) , out . flow ( ) ) ) ; assertThat ( result , is ( true ) ) ; List < Ex1 > outputs = out . toList ( ) ; assertThat ( outputs . size ( ) , is ( 2 ) ) ; assertThat ( outputs . get ( 0 ) , equalTo ( outputs . get ( 1 ) ) ) ; } @ Test public void duplicate ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "out" ) ; in . add ( new Ex1 ( ) ) ; boolean result = tester . runFlow ( new DuplicateStage ( in . flow ( ) , out . flow ( ) ) ) ; assertThat ( result , is ( true ) ) ; List < Ex1 > outputs = out . toList ( ) ; assertThat ( outputs . size ( ) , is ( 2 ) ) ; assertThat ( outputs . get ( 0 ) , equalTo ( outputs . get ( 1 ) ) ) ; } @ Test public void confluent ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; TestOutput < Ex1 > out = tester . output ( Ex1 . class , "out" ) ; Ex1 ex1 = new Ex1 ( ) ; ex1 . setStringAsString ( "Hello" ) ; ex1 . setValue ( 100 ) ; in . add ( ex1 ) ; boolean result = tester . runFlow ( new TwinCogroupStage ( in . flow ( ) , out . flow ( ) ) ) ; assertThat ( result , is ( true ) ) ; List < Ex1 > outputs = out . toList ( ) ; assertThat ( outputs . size ( ) , is ( 1 ) ) ; assertThat ( outputs . get ( 0 ) . getValue ( ) , is ( 200 ) ) ; } @ Test public void branch ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; TestOutput < Ex1 > out1 = tester . output ( Ex1 . class , "out1" ) ; TestOutput < Ex1 > out2 = tester . output ( Ex1 . class , "out2" ) ; TestOutput < Ex1 > out3 = tester . output ( Ex1 . class , "out3" ) ; Ex1 model = new Ex1 ( ) ; model . setValue ( 0 ) ; in . add ( model ) ; model . setValue ( 1 ) ; in . add ( model ) ; boolean result = tester . runFlow ( new BranchStage ( in . flow ( ) , out1 . flow ( ) , out2 . flow ( ) , out3 . flow ( ) ) ) ; assertThat ( result , is ( true ) ) ; assertThat ( out1 . toList ( ) . size ( ) , is ( 1 ) ) ; assertThat ( out2 . toList ( ) . size ( ) , is ( 2 ) ) ; assertThat ( out3 . toList ( ) . size ( ) , is ( 1 ) ) ; } @ Test public void split_unify ( ) throws Exception { TestInput < Ex1 > in = tester . input ( Ex1 . class , "in" ) ; TestOutput < Ex1 > out1 = tester . output ( Ex1 . class , "out1" ) ; TestOutput < Ex1 > out2 = tester . output ( Ex1 . class , "out2" ) ; Ex1 model = new Ex1 ( ) ; model . setValue ( 0 ) ; in . add ( model ) ; boolean result = tester . runFlow ( new SplitStage ( in . flow ( ) , out1 . flow ( ) , out2 . flow ( ) ) ) ; assertThat ( result , is ( true ) ) ; assertThat ( out1 . toList ( ) . size ( ) , is ( 1 ) ) ; assertThat ( out2 . toList ( ) . size ( ) , is ( 1 ) ) ; } @ Test public void ident_unify ( ) throws Exception { TestInput < Ex1 > in1 = tester . input ( Ex1 . class , "in1" ) ; TestInput < Ex1 > in2 = tester . input ( Ex1 . class , "in2" ) ; TestOutput < Ex1 > out1 = tester . output ( Ex1 . class , "out1" ) ; Ex1 model = new Ex1 ( ) ; model . setValue ( 1 ) ; in1 . add ( model ) ; model . setValue ( 2 ) ; in2 . add ( model ) ; final In < Ex1 > pIn1 = in1 . flow ( ) ; final In < Ex1 > pIn2 = in2 . flow ( ) ; final Out < Ex1 > pOut1 = out1 . flow ( ) ; boolean result = tester . runFlow ( new FlowDescription ( ) { @ Override protected void describe ( ) { UpdateFlowFactory uf = new UpdateFlowFactory ( ) ; ExOperatorFactory f = new ExOperatorFactory ( ) ; CoreOperatorFactory c = new CoreOperatorFactory ( ) ; Confluent < Ex1 > in = c . confluent ( pIn1 , pIn2 ) ; Simple simple = uf . simple ( in ) ; Checkpoint < Ex1 > cp = c . checkpoint ( simple . out ) ; Cogroup cog = f . cogroup ( cp , c . empty ( Ex2 . class ) ) ; c . stop ( cog | |
896 | <s> package org . rubypeople . rdt . internal . testunit . runner ; public class MessageIds { public static final int MSG_HEADER_LENGTH = 8 ; public static final String TRACE_START = "%TRACES " ; public static final String TRACE_END = "%TRACEE " ; public static final String EXPECTED_START = "%EXPECTS" ; public static final String EXPECTED_END = "%EXPECTE" ; public static final String ACTUAL_START = "%ACTUALS" ; public static final String ACTUAL_END = "%ACTUALE" ; public static final String RTRACE_START | |
897 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . StatementExpressionList ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class StatementExpressionListImpl extends ModelRoot implements StatementExpressionList { private List < ? extends Expression > expressions ; @ Override public List < ? extends Expression > getExpressions ( ) { return this . expressions ; } public void setExpressions ( List < ? extends Expression > expressions ) { Util . | |
898 | <s> package de . fuberlin . wiwiss . d2rq ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . sparql . vocabulary . FOAF ; import com . hp . hpl . jena . vocabulary . DC ; import com . hp . hpl . jena . vocabulary . DCTerms ; import com . hp . hpl . jena . vocabulary . RDF ; import com . hp . hpl . jena . vocabulary . RDFS ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . algebra . RelationalOperators ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . find . FindQuery ; import de . fuberlin . wiwiss . d2rq . find . TripleQueryIter ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; import de . fuberlin . wiwiss . d2rq . nodes . FixedNodeMaker ; import de . fuberlin . wiwiss . d2rq . nodes . NodeMaker ; import de . fuberlin . wiwiss . d2rq . vocab . SKOS ; public class ClassMapLister { private static final Log log = LogFactory . getLog ( ClassMapLister . class ) ; private final Mapping mapping ; private Map < String , List < TripleRelation > > classMapInventoryBridges = new HashMap < String , List < TripleRelation > > ( ) ; private Map < String , NodeMaker > classMapNodeMakers = new HashMap < String , NodeMaker > ( ) ; public ClassMapLister ( Mapping mapping ) { this . mapping = mapping ; groupTripleRelationsByClassMap ( ) ; } private void groupTripleRelationsByClassMap ( ) { if ( ! classMapInventoryBridges . isEmpty ( ) || ! classMapNodeMakers . isEmpty ( ) ) return ; for ( Resource classMapResource : mapping . classMapResources ( ) ) { NodeMaker resourceMaker = this . mapping . classMap ( classMapResource ) . nodeMaker ( ) ; Node classMap = classMapResource . asNode ( ) ; this . classMapNodeMakers . put ( toClassMapName ( classMap ) , resourceMaker ) ; List < TripleRelation > inventoryBridges = new ArrayList < TripleRelation > ( ) ; for ( TripleRelation bridge : mapping . classMap ( classMapResource ) . compiledPropertyBridges ( ) ) { bridge = bridge . orderBy ( TripleRelation . SUBJECT , true ) ; if ( bridge . selectTriple ( new Triple ( Node . ANY , RDF . Nodes . type , Node . ANY ) ) != null ) { inventoryBridges . add ( bridge ) ; } if ( bridge . selectTriple ( new Triple ( Node | |
899 | <s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import java . util . Arrays ; import java . util . List ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . ui . IWorkbenchPart ; import org . rubypeople . rdt . core . Flags ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; public class TraditionalHierarchyViewer extends TypeHierarchyViewer { public TraditionalHierarchyViewer ( Composite parent , TypeHierarchyLifeCycle lifeCycle , IWorkbenchPart part ) { super ( parent , new TraditionalHierarchyContentProvider ( lifeCycle ) , lifeCycle , part ) ; } public String getTitle ( ) { if ( isMethodFiltering ( ) ) { return TypeHierarchyMessages . TraditionalHierarchyViewer_filtered_title ; } else { return TypeHierarchyMessages . TraditionalHierarchyViewer_title ; } } public void updateContent ( boolean expand ) { getTree ( ) . setRedraw ( false ) ; refresh ( ) ; if ( |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.