id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
2,900
<s> package org . rubypeople . rdt . internal . testunit . ui ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . model . ISourceLocator ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorDescriptor ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . ide . IDE ; import org . eclipse . ui . texteditor . IDocumentProvider ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . debug . ui . RubySourceLocator ; import org . rubypeople . rdt . internal . debug . ui . RubySourceLocator . SourceElement ; public class OpenEditorAtLineAction extends Action { private int fLineNumber ; private String fileName ; private TestUnitView fTestRunner ; public OpenEditorAtLineAction ( TestUnitView testRunner , String fileName , int line ) { super ( TestUnitMessages . OpenEditorAction_action_label ) ; fLineNumber = line ; fTestRunner = testRunner ; IRubyProject project = testRunner . getLaunchedProject ( ) ; if ( project != null ) { this . fileName = fileName . replace ( "" , project . getProject ( ) . getLocation ( ) . toPortableString ( ) ) ; } else { this . fileName = fileName ; } } public void run ( ) { try { IEditorInput input = getInput ( ) ; if ( input == null ) { if ( TestunitPlugin . getDefault ( ) . isDebugging ( ) ) { System . out . println ( "" + fileName ) ; } return ; } IEditorPart editorPart = getEditorPart ( input ) ; setEditorToLine ( editorPart , input ) ; } catch ( CoreException e ) { TestunitPlugin . log ( new Status ( IStatus . ERROR , TestunitPlugin . PLUGIN_ID , 0 , "" + fileName , e ) ) ; } } private IEditorPart getEditorPart ( IEditorInput input ) throws PartInitException { ISourceLocator sourceLocator = getSourceLocator ( ) ; if ( ! ( sourceLocator instanceof RubySourceLocator ) ) { return null ; } RubySourceLocator rubySourceLocator = ( RubySourceLocator ) sourceLocator ; SourceElement sourceElement = ( SourceElement ) rubySourceLocator . getSourceElement ( fileName ) ; IEditorDescriptor descriptor = IDE . getEditorDescriptor ( sourceElement . getFilename ( ) ) ; return IDE . openEditor ( PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) . getActivePage ( ) , input , descriptor . getId ( ) ) ; } private void setEditorToLine ( IEditorPart pEditorPart , IEditorInput pInput ) throws CoreException { if ( ! ( pEditorPart instanceof ITextEditor ) ) { return ; } if ( fLineNumber > 0 ) { fLineNumber -- ; } if ( fLineNumber == 0 ) { return ; } ITextEditor textEditor = ( ITextEditor ) pEditorPart ; IDocumentProvider provider = textEditor . getDocumentProvider ( ) ; provider . connect ( pInput ) ; IDocument document = provider . getDocument ( pInput ) ; try { IRegion line = document . getLineInformation ( fLineNumber ) ; textEditor . selectAndReveal ( line . getOffset ( ) , line . getLength ( ) ) ; } catch ( BadLocationException e ) { if ( TestunitPlugin . getDefault ( ) . isDebugging ( ) ) { System . out . println ( "" + fLineNumber ) ; } } provider . disconnect ( pInput ) ; } protected void reveal ( ITextEditor textEditor ) { if ( fLineNumber >= 0 ) { try { IDocument document =
2,901
<s> package org . rubypeople . rdt . internal . ui . text . ruby . hover ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextHover ; import org . eclipse . jface . text . ITextHoverExtension ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . information . IInformationProviderExtension2 ; import org . eclipse . ui . IEditorPart ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . ruby . hover . IRubyEditorTextHover ; public class BestMatchHover extends AbstractRubyEditorTextHover implements ITextHoverExtension , IInformationProviderExtension2 { private List < RubyEditorTextHoverDescriptor > fTextHoverSpecifications ; private List < ITextHover > fInstantiatedTextHovers ; private ITextHover fBestHover ; public BestMatchHover ( ) { installTextHovers ( ) ; } public BestMatchHover ( IEditorPart editor ) { this ( ) ; setEditor ( editor ) ; } private void installTextHovers ( ) { fTextHoverSpecifications = new ArrayList < RubyEditorTextHoverDescriptor > ( 2 ) ; fInstantiatedTextHovers = new ArrayList < ITextHover > ( 2 ) ; RubyEditorTextHoverDescriptor [ ] hoverDescs = RubyPlugin . getDefault ( ) . getRubyEditorTextHoverDescriptors ( ) ; for ( int i = 0 ; i < hoverDescs . length ; i ++ ) { if ( ! PreferenceConstants . ID_BESTMATCH_HOVER . equals ( hoverDescs [ i ] . getId ( ) ) ) fTextHoverSpecifications . add ( hoverDescs [ i ] ) ; } } private void checkTextHovers ( ) { if ( fTextHoverSpecifications . size ( ) == 0 ) return ; for ( Iterator < RubyEditorTextHoverDescriptor > iterator = new ArrayList < RubyEditorTextHoverDescriptor > ( fTextHoverSpecifications ) . iterator ( ) ; iterator . hasNext ( ) ; ) { RubyEditorTextHoverDescriptor spec = iterator . next ( ) ; IRubyEditorTextHover hover = spec . createTextHover ( ) ; if ( hover != null ) { hover . setEditor ( getEditor ( ) ) ; addTextHover ( hover ) ; fTextHoverSpecifications . remove ( spec ) ; } } } protected void addTextHover ( ITextHover hover ) { if ( ! fInstantiatedTextHovers . contains (
2,902
<s> package com . asakusafw . runtime . flow ; import java . io . File ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . text . MessageFormat ; import java . util . AbstractList ; import java . util . Arrays ; import java . util . RandomAccess ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . io . Writable ; public class FileMapListBuffer < E extends Writable > extends AbstractList < E > implements ListBuffer < E > , RandomAccess { static final Log LOG = LogFactory . getLog ( FileMapListBuffer . class ) ; private static final int DEFAULT_BUFFER_SIZE = 256 ; private static final int MINIMUM_BUFFER_SIZE = 32 ; private final BackingStore backingStore ; private final E [ ] pageBuffer ; private int currentPage ; private int size ; private int cursor ; private int limit ; public FileMapListBuffer ( ) { this ( DEFAULT_BUFFER_SIZE ) ; } @ SuppressWarnings ( "unchecked" ) public FileMapListBuffer ( int bufferSize ) { this . backingStore = new BackingStore ( ) ; this . pageBuffer = ( E [ ] ) new Writable [ Math . max ( bufferSize , MINIMUM_BUFFER_SIZE ) ] ; this . size = 0 ; this . cursor = - 1 ; this . limit = 0 ; } @ Override public void begin ( ) { size = - 1 ; cursor = 0 ; currentPage = 0 ; modCount ++ ; } @ Override public void end ( ) { if ( cursor >= 0 ) { size = cursor ; cursor = - 1 ; modCount ++ ; } } @ Override public boolean isExpandRequired (
2,903
<s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . ProjectFlowProcessor ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Part1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Part1 ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import
2,904
<s> package org . oddjob . state ; import junit . framework . TestCase ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . arooa . standard . StandardArooaParser ; import org . oddjob . arooa . xml . XMLConfiguration ; public class JobStateConvertletProviderTest extends TestCase { public static class OurBean { JobState jobState ; @ ArooaAttribute public void setJobState ( JobState jobState ) { this . jobState = jobState ; } } public void testConversions ( )
2,905
<s> package org . oddjob . jmx . handlers ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanException ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . Notification ; import javax . management . ReflectionException ; import org . oddjob . jmx . RemoteOddjobBean ; import org . oddjob . jmx . RemoteOperation ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . HandlerVersion ; import org . oddjob . jmx . client . VanillaHandlerResolver ; import org . oddjob . jmx . server . JMXOperation ; import org . oddjob . jmx . server . ServerInfo ; import org . oddjob . jmx . server . ServerInterfaceHandler ; import org . oddjob . jmx . server . ServerInterfaceHandlerFactory ; import org . oddjob . jmx . server . ServerSideToolkit ; import
2,906
<s> package org . rubypeople . rdt . internal . launching ; import java . io . IOException ; import java . text . MessageFormat ; import javax . xml . parsers . ParserConfigurationException ; import javax . xml . transform . TransformerException ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; 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 . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Status ; import org . 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 . IRubyLaunchConfigurationConstants ; import org . rubypeople . rdt . launching . IRuntimeLoadpathEntry ; import org . rubypeople . rdt . launching . RubyRuntime ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; public class RuntimeLoadpathEntry implements IRuntimeLoadpathEntry { private int fType = - 1 ; private int fLoadpathProperty = - 1 ; private ILoadpathEntry fLoadpathEntry = null ; private ILoadpathEntry fResolvedEntry = null ; private IRubyProject fRubyProject = null ; private IPath fInvalidPath ; public RuntimeLoadpathEntry ( ILoadpathEntry entry ) { switch ( entry . getEntryKind ( ) ) { case ILoadpathEntry . CPE_PROJECT : setType ( PROJECT ) ; break ; case ILoadpathEntry . CPE_LIBRARY : setType ( ARCHIVE ) ; break ; case ILoadpathEntry . CPE_VARIABLE : setType ( VARIABLE ) ; break ; case ILoadpathEntry . CPE_SOURCE : setType ( ARCHIVE ) ; break ; default : throw new IllegalArgumentException ( MessageFormat . format ( LaunchingMessages . RuntimeLoadpathEntry_Illegal_classpath_entry__0__1 , entry . toString ( ) ) ) ; } setLoadpathEntry ( entry ) ; initializeLoadpathProperty ( ) ; } public RuntimeLoadpathEntry ( ILoadpathEntry entry , int classpathProperty ) { switch ( entry . getEntryKind ( ) ) { case ILoadpathEntry . CPE_CONTAINER : setType ( CONTAINER ) ; break ; default : throw new IllegalArgumentException ( MessageFormat . format ( LaunchingMessages . RuntimeLoadpathEntry_Illegal_classpath_entry__0__1 , entry . toString ( ) ) ) ; } setLoadpathEntry ( entry ) ; setLoadpathProperty ( classpathProperty ) ; } public RuntimeLoadpathEntry ( Element root ) throws CoreException { try { setType ( Integer . parseInt ( root . getAttribute ( "type" ) ) ) ; } catch ( NumberFormatException e ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_type_2 , e ) ; } try { setLoadpathProperty ( Integer . parseInt ( root . getAttribute ( "path" ) ) ) ; } catch ( NumberFormatException e ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_location_3 , e ) ; } IPath sourcePath = null ; IPath rootPath = null ; String path = root . getAttribute ( "" ) ; if ( path != null && path . length ( ) > 0 ) { sourcePath = new Path ( path ) ; } path = root . getAttribute ( "" ) ; if ( path != null && path . length ( ) > 0 ) { rootPath = new Path ( path ) ; } switch ( getType ( ) ) { case PROJECT : String name = root . getAttribute ( "projectName" ) ; if ( isEmpty ( name ) ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_project_name_4 , null ) ; } else { IProject proj = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( name ) ; setLoadpathEntry ( RubyCore . newProjectEntry ( proj . getFullPath ( ) ) ) ; } break ; case ARCHIVE : path = root . getAttribute ( "" ) ; if ( isEmpty ( path ) ) { path = root . getAttribute ( "" ) ; if ( isEmpty ( path ) ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_archive_path_5 , null ) ; } else { setLoadpathEntry ( createLibraryEntry ( sourcePath , rootPath , path ) ) ; } } else { setLoadpathEntry ( createLibraryEntry ( sourcePath , rootPath , path ) ) ; } break ; case VARIABLE : String var = root . getAttribute ( "" ) ; if ( isEmpty ( var ) ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6 , null ) ; } else { setLoadpathEntry ( RubyCore . newVariableEntry ( new Path ( var ) ) ) ; } break ; case CONTAINER : var = root . getAttribute ( "" ) ; if ( isEmpty ( var ) ) { abort ( LaunchingMessages . RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6 , null ) ; } else { setLoadpathEntry ( RubyCore . newContainerEntry ( new Path ( var ) ) ) ; } break ; } String name = root . getAttribute ( "rubyProject" ) ; if ( isEmpty ( name ) ) { fRubyProject = null ; } else { IProject project2 = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( name ) ; fRubyProject = RubyCore . create ( project2 ) ; } } private ILoadpathEntry createLibraryEntry ( IPath sourcePath , IPath rootPath , String path ) { Path p = new Path ( path ) ; if ( ! p . isAbsolute ( ) ) { fInvalidPath = p ; return null ; } return RubyCore . newLibraryEntry ( p ) ; } protected void abort ( String message , Throwable e ) throws CoreException { IStatus s = new Status ( IStatus . ERROR , LaunchingPlugin . getUniqueIdentifier ( ) , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR , message , e ) ; throw new CoreException ( s ) ; } public int getType ( ) { return fType ; } private void setType ( int type ) { fType = type ; } private void setLoadpathEntry ( ILoadpathEntry entry ) { fLoadpathEntry = entry ; fResolvedEntry = null ; } public ILoadpathEntry getLoadpathEntry ( ) { return fLoadpathEntry ; } public String getMemento ( ) throws CoreException { Document doc ; try { doc = LaunchingPlugin . getDocument ( ) ; } catch ( ParserConfigurationException e ) { IStatus status = new Status ( IStatus . ERROR , LaunchingPlugin . getUniqueIdentifier ( ) , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR , LaunchingMessages . RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8 , e ) ; throw new CoreException ( status ) ; } Element node = doc . createElement ( "" ) ; doc . appendChild ( node ) ; node . setAttribute ( "type" , ( new Integer ( getType ( ) ) ) . toString ( ) ) ; node . setAttribute ( "path" , ( new Integer ( getLoadpathProperty ( ) ) ) . toString ( ) ) ; switch ( getType ( ) ) { case PROJECT : node . setAttribute ( "projectName" , getPath ( ) . lastSegment ( ) ) ; break ; case ARCHIVE : IResource res = getResource ( ) ; if ( res == null ) { node . setAttribute ( "" , getPath ( ) . toString ( ) ) ; } else { node . setAttribute ( "" , res . getFullPath ( ) . toString ( ) ) ; } break ; case VARIABLE : case CONTAINER : node . setAttribute ( "" , getPath ( ) . toString ( ) ) ; break ; } if ( getRubyProject ( ) != null ) { node . setAttribute ( "rubyProject" , getRubyProject ( ) . getElementName ( ) ) ; } try { return LaunchingPlugin . serializeDocument ( doc ) ; } catch ( IOException e ) { IStatus status = new Status ( IStatus . ERROR , LaunchingPlugin . getUniqueIdentifier ( ) , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR , LaunchingMessages . RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8 , e ) ; throw new CoreException ( status ) ; } catch ( TransformerException e ) { IStatus status = new Status ( IStatus . ERROR , LaunchingPlugin . getUniqueIdentifier ( ) , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR , LaunchingMessages . RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8 , e ) ;
2,907
<s> package com . pogofish . jadt . samples . ast . data ; import java . util . List ; public final class Arg { public static final Arg _Arg ( Type type , String name ) { return new Arg ( type , name ) ; } public final Type type ; public final String name ; public Arg ( Type type , String name ) { this . type = type ; this . name = name ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( type == null ) ? 0 : type . hashCode ( ) ) ; result = prime * result + ( ( name == null ) ? 0 : name . hashCode ( ) ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; Arg other = ( Arg ) obj ; if ( type
2,908
<s> package org . rubypeople . rdt . internal . launching ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . text . DateFormat ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Date ; import java . util . List ; import java . util . Map ; 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 . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . model . IProcess ; import org . osgi . framework . Version ; import org . rubypeople . rdt . launching . AbstractVMRunner ; import org . rubypeople . rdt . launching . IRubyLaunchConfigurationConstants ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . VMRunnerConfiguration ; public class StandardVMRunner extends AbstractVMRunner { private static final String SUDO_PROMPT = "Password:" ; public static final String STREAM_FLUSH_SCRIPT = "" ; private static final String LOADPATH_SWITCH = "-I" ; protected static final String END_OF_OPTIONS_DELIMITER = "--" ; protected boolean isVMArgs = true ; protected String renderDebugTarget ( String classToRun , int host ) { String format = LaunchingMessages . StandardVMRunner__0__at_localhost__1__1 ; return MessageFormat . format ( format , classToRun , String . valueOf ( host ) ) ; } public static String renderProcessLabel ( String [ ] commandLine ) { String format = LaunchingMessages . StandardVMRunner__0____1___2 ; String timestamp = DateFormat . getDateTimeInstance ( DateFormat . MEDIUM , DateFormat . MEDIUM ) . format ( new Date ( System . currentTimeMillis ( ) ) ) ; return MessageFormat . format ( format , commandLine [ 0 ] , timestamp ) ; } protected static String renderCommandLine ( String [ ] commandLine ) { if ( commandLine == null || commandLine . length < 1 ) return "" ; StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < commandLine . length ; i ++ ) { if ( commandLine [ i ] == null ) continue ; buf . append ( ' ' ) ; char [ ] characters = commandLine [ i ] . toCharArray ( ) ; StringBuffer command = new StringBuffer ( ) ; boolean containsSpace = false ; for ( int j = 0 ; j < characters . length ; j ++ ) { char character = characters [ j ] ; if ( character == '\"' ) { command . append ( '\\' ) ; } else if ( character == ' ' ) { containsSpace = true ; } command . append ( character ) ; } if ( containsSpace ) { buf . append ( '\"' ) ; buf . append ( command . toString ( ) ) ; buf . append ( '\"' ) ; } else { buf . append ( command . toString ( ) ) ; } } return buf . toString ( ) ; } protected void addArguments ( String [ ] args , List < String > v ) { if ( args == null ) { return ; } for ( int i = 0 ; i < args . length ; i ++ ) { v . add ( args [ i ] ) ; } } protected File getWorkingDir ( VMRunnerConfiguration config ) throws CoreException { String path = config . getWorkingDirectory ( ) ; if ( path == null ) { return null ; } File dir = new File ( path ) ; if ( ! dir . isDirectory ( ) ) { abort ( MessageFormat . format ( LaunchingMessages . StandardVMRunner_Specified_working_directory_does_not_exist_or_is_not_a_directory___0__3 , path ) , null , IRubyLaunchConfigurationConstants . ERR_WORKING_DIRECTORY_DOES_NOT_EXIST ) ; } return dir ; } protected String getPluginIdentifier ( ) { return LaunchingPlugin . getUniqueIdentifier ( ) ; } protected List < String > constructProgramString ( VMRunnerConfiguration config , IProgressMonitor monitor ) throws CoreException { List < String > string = new ArrayList < String > ( ) ; if ( ! Platform . getOS ( ) . equals ( Platform . OS_WIN32 ) && config . isSudo ( ) ) { forceBackgroundSudoCommand ( config , monitor ) ; string . add ( "sudo" ) ; } String command = getCommand ( config ) ; if ( command == null ) { File exe = fVMInstance . getVMInstallType ( ) . findExecutable ( fVMInstance . getInstallLocation ( ) ) ; if ( exe == null ) { abort ( MessageFormat . format ( LaunchingMessages . StandardVMRunner_Unable_to_locate_executable_for__0__1 , fVMInstance . getName ( ) ) , null , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR ) ; } string . add ( exe . getAbsolutePath ( ) ) ; return string ; } String installLocation = fVMInstance . getInstallLocation ( ) . getAbsolutePath ( ) + File . separatorChar ; File originalExe = new File ( installLocation + "bin" + File . separatorChar + command ) ; File exe = originalExe ; if ( fileExists ( exe ) ) { string . add ( exe . getAbsolutePath ( ) ) ; return string ; } exe = new File ( exe . getAbsolutePath ( ) + ".exe" ) ; if ( fileExists ( exe ) ) { string . add ( exe . getAbsolutePath ( ) ) ; return string ; } String version = fVMInstance . getRubyVersion ( ) ; Version versionObj = new Version ( version ) ; exe = new File ( originalExe . getAbsolutePath ( ) + versionObj . getMajor ( ) + "." + versionObj . getMinor ( ) ) ; if ( fileExists ( exe ) ) { string . add ( exe . getAbsolutePath ( ) ) ; return string ; } exe = new File ( exe . getAbsolutePath ( ) + ".exe" ) ; if ( fileExists ( exe ) ) { string . add ( exe . getAbsolutePath ( ) ) ; return string ; } abort ( MessageFormat . format ( LaunchingMessages . StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4 , command , fVMInstance . getName ( ) ) , null , IRubyLaunchConfigurationConstants . ERR_INTERNAL_ERROR ) ; return null ; } protected void forceBackgroundSudoCommand ( VMRunnerConfiguration config , IProgressMonitor monitor ) throws CoreException { final Process p = exec ( new String [ ] { "sudo" , "-S" , "-p" , SUDO_PROMPT , "echo" , "forced" } , null ) ; final InputStream errorStream = p . getErrorStream ( ) ; final String sudoMsg = config . getSudoMessage ( ) ; final boolean [ ] doneWaiting = new boolean [ 1 ] ; doneWaiting [ 0 ] = false ; final int [ ] exitValue = new int [ 1 ] ; exitValue [ 0 ] = 0 ; Job processWaiter = new Job ( "" ) { @ Override protected IStatus run ( IProgressMonitor monitor ) { try { exitValue [ 0 ] = p . waitFor ( ) ; } catch ( InterruptedException e ) { LaunchingPlugin . log ( e ) ; } doneWaiting [ 0 ] = true ; return Status . OK_STATUS ; } } ; processWaiter . setSystem ( true ) ; processWaiter . schedule ( ) ; Job job = new Job ( "" ) { @ Override protected IStatus run ( IProgressMonitor monitor ) { StringBuffer buffer = new StringBuffer ( ) ; String lineDelimeter = "n" ; while ( true ) { try { int value = errorStream . read ( ) ; if ( value == - 1 ) break ; if ( monitor . isCanceled ( ) ) return Status . CANCEL_STATUS ; buffer . append ( ( char ) value ) ; if ( buffer . toString ( ) . contains ( SUDO_PROMPT ) ) { buffer . delete ( 0 , buffer . length ( ) ) ; String pw = Sudo . getPassword ( sudoMsg ) ; p . getOutputStream ( ) . write ( ( pw + lineDelimeter ) . getBytes ( ) ) ; p . getOutputStream ( ) . flush ( ) ; } } catch ( IOException e ) { LaunchingPlugin . log ( e ) ; } } return Status . OK_STATUS ; } } ; job . setSystem ( true ) ; job . schedule ( ) ; while ( true ) { if ( monitor != null && monitor . isCanceled ( ) ) return ; Thread . yield ( ) ; if ( doneWaiting [ 0 ] ) break ; } if ( exitValue [ 0 ] != 0 ) { job . cancel ( ) ; IStatus status = new Status ( IStatus . ERROR , LaunchingPlugin . PLUGIN_ID , - 1 , "" , null ) ; throw new CoreException ( status ) ; } } protected String getCommand ( VMRunnerConfiguration config ) { String command = null ;
2,909
<s> package org . rubypeople . rdt . internal . ui . search ; import org . rubypeople . rdt . core . IRubyElement ; public
2,910
<s> package com . asakusafw . compiler . flow . example ; import com . asakusafw . compiler . operator . model . MockHoge ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ;
2,911
<s> import java . io . * ; import org . xmlpull . v1 . * ; import org . kxml2 . kdom . * ; import org . kxml2 . io . * ; public class KDomRoundtrip { public static void main ( String [ ] args ) throws IOException , XmlPullParserException { if ( args . length == 0 ) throw new RuntimeException ( "" ) ; for ( int i = 0 ; i < args . length ;
2,912
<s> package net . bioclipse . opentox . api ; public class TaskState { enum STATUS { CANCELLED , COMPLETED , RUNNING , ERROR , UNKNOWN } private STATUS status = STATUS . UNKNOWN ; private boolean exists = false ; private boolean isRedirected = false ; private String results = null ; private float percentageCompleted = 0.0f ; public boolean isFinished ( ) { return status == STATUS . ERROR || status == STATUS . COMPLETED ; } public void setStatus ( STATUS status ) { this . status = status ; } public STATUS getStatus ( ) { return this . status ; } public void setFinished ( boolean isFinished ) { if ( isFinished ) { this . status = STATUS . COMPLETED ; } else { this . status = STATUS . RUNNING ; } } public boolean isRedirected ( ) { return isRedirected ; } public void setRedirected ( boolean isRedirected ) { this . isRedirected =
2,913
<s> package net . sf . sveditor . core . tests . preproc ; import java . util . ArrayList ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . parser . SVParseException ; import net . sf . sveditor . core . tests . SVDBTestUtils ; public class TestConditionalEval extends TestCase { public void testIfTakenNoElse ( ) throws SVParseException { String testname = "" ; String content = "`define An" + "class c;n" + "`ifdef An" + "tinttta;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "a" } ) ; } public void testIfTakenElse ( ) throws SVParseException { String testname = "" ; String content = "`define An" + "class c;n" + "`ifdef An" + "tinttta;n" + "`elsen" + "tintttb;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "a" } ) ; } public void testIfNotTakenElseTaken ( ) throws SVParseException { String testname = "" ; String content = "class c;n" + "`ifdef An" + "tinttta;n" + "`elsen" + "tintttb;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "b" } ) ; } public void testIfTakenElsifNoElse ( ) throws SVParseException { String testname = "" ; String content = "`define An" + "class c;n" + "`ifdef An" + "tinttta;n" + "`elsif Bn" + "tintttb;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "a" } , new String [ ] { "b" } ) ; } public void testIfTakenElsifElse ( ) throws SVParseException { String testname = "" ; String content = "`define An" + "class c;n" + "`ifdef An" + "tinttta;n" + "`elsif Bn" + "tintttb;n" + "`elsen" + "tint te;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "a" } , new String [ ] { "b" , "e" } ) ; } public void testIfNotTakenElsifTakenElse ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "`define Bn" + "class c;n" + "`ifdef An" + "tinttta;n" + "`elsif Bn" + "tintttb;n" + "`elsen" + "tint te;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "b" } ) ; } public void testIfNotTakenElsifNotTakenElseTaken ( ) throws SVParseException { String testname = "" ; String content = "class c;n" + "`ifdef An" + "tinttta;n" + "`elsif Bn" + "tintttb;n" + "`elsen" + "tint te;n" + "`endifn" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" , "e" } ) ; } public void testIfNotTakenElsifTakenPostDefine ( ) throws SVParseException { SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String testname = "" ; String content = "module top;n" + "" + "" + "" + "" + "" + "" + "n" + "" + "" + "" + "" + "`endifn" + "n" + "" + "" + "" + "n" + "" + "" + "endmodulen" ; runTest ( testname
2,914
<s> package org . oddjob . beanbus ; import java . io . ByteArrayOutputStream ; import java . util . Arrays ; import junit . framework . TestCase ; import org . oddjob . arooa . reflect . ArooaClass ; import org . oddjob . arooa . reflect . BeanView ; import org . oddjob . arooa . reflect . BeanViews ; import org . oddjob . arooa . standard . StandardArooaSession ; public class BeanSheetTest extends TestCase { public static class Fruit { private String type ; private String variety ; private String colour ; private double size ; public String getType ( ) { return type ; } public void setType ( String type ) { this . type = type ; } public String getVariety ( ) { return variety ; } public void setVariety ( String variety ) { this . variety = variety ; } public String getColour ( ) { return colour ; } public void setColour ( String colour ) { this . colour = colour ; } public double getSize ( ) { return size ; } public void setSize ( double size ) { this . size = size ; } } private class OurViews implements BeanViews { @ Override public BeanView beanViewFor ( ArooaClass arooaClass ) { return new BeanView ( ) { @ Override public String titleFor ( String property ) { if ( "colour" . equals ( property ) ) { return "The Colour" ; } return property ; } @ Override public String [ ] getProperties ( ) { return new String [ ] { "colour" , "size" , "type" , "variety" } ; } } ; } } String EOL = System . getProperty ( "" ) ; private Object [ ] createFruit ( ) { Fruit fruit1 = new Fruit ( ) ; fruit1 . setType ( "Apple" ) ; fruit1 . setVariety ( "Cox" ) ; fruit1 . setColour ( "" ) ; fruit1 . setSize ( 7.6 ) ; Fruit fruit2 = new Fruit ( ) ; fruit2 . setType ( "Orange" ) ; fruit2 . setVariety ( "Jaffa" ) ; fruit2 . setColour ( "Orange" ) ; fruit2 . setSize ( 9.245 ) ; return new Object [ ] { fruit1 , fruit2 } ; } public void testFruitReport ( ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; Object [ ] values = createFruit ( ) ; BeanSheet test = new BeanSheet ( ) ; test . setOutput ( out ) ; test . setArooaSession ( new StandardArooaSession ( ) ) ; test . setBeanViews ( new OurViews ( ) ) ; test . accept ( Arrays . asList ( values ) ) ; test . accept ( Arrays
2,915
<s> package org . oddjob . jmx . server ; import javax . management . MBeanException ; import javax . management . ReflectionException ; import junit . framework . TestCase ; public class ServerAllOperationsHandlerTest extends TestCase { interface Fruit { String getColour ( ) ; } class MyFruit implements Fruit { public String getColour ( ) { return "pink" ; } } public void testInvoke ( ) throws MBeanException , ReflectionException { ServerAllOperationsHandler < Fruit > test = new ServerAllOperationsHandler < Fruit > ( Fruit . class , new
2,916
<s> package com . aptana . rdt . internal . parser . warnings ; import org . jruby . ast . AndNode ; import org . jruby . ast . Node ; import org . jruby . ast . OrNode ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; public class AndOrUsedOnRighthandAssignment extends RubyLintVisitor { public AndOrUsedOnRighthandAssignment ( String contents ) { super ( AptanaRDTPlugin . getDefault ( ) . getOptions ( ) , contents ) ; } @ Override protected String getOptionKey ( ) { return AptanaRDTPlugin . COMPILER_PB_ASSIGNMENT_PRECEDENCE ; } @ Override public Object visitOrNode ( OrNode iVisited ) { Node leftHand = iVisited . getFirstNode ( ) ; if ( isAssignment ( leftHand ) ) { createProblem ( iVisited . getPosition ( ) , createMessage ( iVisited ) ) ; } return super . visitOrNode ( iVisited ) ; } @ Override public Object visitAndNode ( AndNode iVisited ) { Node leftHand = iVisited . getFirstNode ( ) ; if ( isAssignment ( leftHand ) ) { createProblem ( iVisited . getPosition ( ) , createMessage ( iVisited ) ) ; } return super . visitAndNode ( iVisited ) ; } private String createMessage ( Node iVisited ) { String type ; Node leftHand ; Node rightHand ; if ( iVisited instanceof AndNode ) { type = "and" ; leftHand = ( ( AndNode ) iVisited ) . getFirstNode ( ) ; rightHand = ( ( AndNode ) iVisited ) . getSecondNode ( ) ; } else { type = "or" ; leftHand = ( ( OrNode ) iVisited ) . getFirstNode ( ) ; rightHand = ( ( OrNode ) iVisited ) . getSecondNode ( ) ; } StringBuffer message = new StringBuffer ( ) ; message . append ( ""
2,917
<s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . texteditor . spelling . IPreferenceStatusMonitor ; import org . eclipse . ui . texteditor . spelling . ISpellingPreferenceBlock ; import org . rubypeople . rdt . internal . ui . wizards . IStatusChangeListener ; public class SpellingPreferenceBlock implements ISpellingPreferenceBlock { private class NullStatusChangeListener implements IStatusChangeListener { public void statusChanged ( IStatus status ) { } } private class StatusChangeListenerAdapter implements IStatusChangeListener { private IPreferenceStatusMonitor fMonitor ; private IStatus fStatus ; public StatusChangeListenerAdapter ( IPreferenceStatusMonitor monitor ) { super ( ) ; fMonitor = monitor ; } public void statusChanged (
2,918
<s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . net . URI ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ProjectScope ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . DocumentCommand ; import org . eclipse . jface . text . DocumentEvent ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IDocumentExtension4 ; import org . eclipse . jface . text . IDocumentListener ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ISelectionValidator ; import org . eclipse . jface . text . ISynchronizable ; import org . eclipse . jface . text . ITextInputListener ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . ITextViewerExtension5 ; import org . eclipse . jface . text . IWidgetTokenKeeper ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . TextSelection ; import org . eclipse . jface . text . contentassist . ContentAssistant ; import org . eclipse . jface . text . contentassist . IContentAssistant ; import org . eclipse . jface . text . link . LinkedModeModel ; import org . eclipse . jface . text . source . Annotation ; import org . eclipse . jface . text . source . IAnnotationModel ; import org . eclipse . jface . text . source . IAnnotationModelExtension ; import org . eclipse . jface . text . source . IOverviewRuler ; import org . eclipse . jface . text . source . ISourceViewer ; import org . eclipse . jface . text . source . IVerticalRuler ; import org . eclipse . jface . text . source . SourceViewerConfiguration ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . ListenerList ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Display ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IPartService ; import org . eclipse . ui . IWindowListener ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . editors . text . EditorsUI ; import org . eclipse . ui . editors . text . TextEditor ; import org . eclipse . ui . texteditor . AbstractDecoratedTextEditorPreferenceConstants ; import org . eclipse . ui . texteditor . ChainedPreferenceStore ; import org . eclipse . ui . texteditor . IDocumentProvider ; import org . eclipse . ui . texteditor . SourceViewerDecorationSupport ; import org . eclipse . ui . views . contentoutline . ContentOutline ; import org . eclipse . ui . views . contentoutline . IContentOutlinePage ; import org . jruby . ast . RootNode ; import org . osgi . service . prefs . BackingStoreException ; import org . rubypeople . rdt . core . IImportContainer ; import org . rubypeople . rdt . core . IImportDeclaration ; import org . rubypeople . rdt . core . IMember ; 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 . ISourceRange ; import org . rubypeople . rdt . core . ISourceReference ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . ExternalRubyScript ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor . ITextConverter ; import org . rubypeople . rdt . internal . ui . search . IOccurrencesFinder ; import org . rubypeople . rdt . internal . ui . search . OccurrencesFinder ; import org . rubypeople . rdt . internal . ui . text . ContentAssistPreference ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . internal . ui . text . PreferencesAdapter ; import org . rubypeople . rdt . internal . ui . text . RubyPairMatcher ; import org . rubypeople . rdt . internal . ui . text . RubyWordFinder ; import org . rubypeople . rdt . internal . ui . viewsupport . ISelectionListenerWithAST ; import org . rubypeople . rdt . internal . ui . viewsupport . SelectionListenerWithASTManager ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . rubyeditor . ICustomRubyOutlinePage ; import org . rubypeople . rdt . ui . text . RubySourceViewerConfiguration ; import org . rubypeople . rdt . ui . text . RubyTextTools ; public abstract class RubyAbstractEditor extends TextEditor { private static final boolean CODE_ASSIST_DEBUG = "true" . equalsIgnoreCase ( Platform . getDebugOption ( "" ) ) ; protected RubyTextTools textTools ; private ISourceReference reference ; protected String fOutlinerContextMenuId ; protected AbstractSelectionChangedListener fOutlineSelectionChangedListener = new OutlineSelectionChangedListener ( ) ; private ICustomRubyOutlinePage fOutlinePage ; protected final static String MATCHING_BRACKETS = PreferenceConstants . EDITOR_MATCHING_BRACKETS ; protected final static String MATCHING_BRACKETS_COLOR = PreferenceConstants . EDITOR_MATCHING_BRACKETS_COLOR ; protected final static char [ ] BRACKETS = { '{' , '}' , '(' , ')' , '[' , ']' } ; private static final String CUSTOM_OUTLINE_EXTPOINT_ID = "" ; protected RubyPairMatcher fBracketMatcher = new RubyPairMatcher ( BRACKETS ) ; private Annotation [ ] fOccurrenceAnnotations = null ; private boolean fMarkOccurrenceAnnotations ; private boolean fStickyOccurrenceAnnotations ; private boolean fMarkTypeOccurrences ; private boolean fMarkMethodOccurrences ; private boolean fMarkConstantOccurrences ; private boolean fMarkFieldOccurrences ; private boolean fMarkLocalVariableOccurrences ; private boolean fMarkMethodExitPoints ; private ISelection fForcedMarkOccurrencesSelection ; private long fMarkOccurrenceModificationStamp = IDocumentExtension4 . UNKNOWN_MODIFICATION_STAMP ; private ActivationListener fActivationListener = new ActivationListener ( ) ; private ISelectionListenerWithAST fPostSelectionListenerWithAST ; private OccurrencesFinderJob fOccurrencesFinderJob ; private OccurrencesFinderJobCanceler fOccurrencesFinderJobCanceler ; private IRegion fMarkOccurrenceTargetRegion ; private IPreferenceStore createCombinedPreferenceStore ( IEditorInput input ) { List stores = new ArrayList ( 3 ) ; IRubyProject project = EditorUtility . getRubyProject ( input ) ; if ( project != null ) { stores . add ( new EclipsePreferencesAdapter ( new ProjectScope ( project . getProject ( ) ) , RubyCore . PLUGIN_ID ) ) ; } stores . add ( RubyPlugin . getDefault ( ) . getPreferenceStore ( ) ) ; stores . add ( new PreferencesAdapter ( RubyCore . getPlugin ( ) . getPluginPreferences ( ) ) ) ; stores . add ( EditorsUI . getPreferenceStore ( ) ) ; return new ChainedPreferenceStore ( ( IPreferenceStore [ ] ) stores . toArray ( new IPreferenceStore [ stores . size ( ) ] ) ) ; } public void outlinePageClosed ( ) { if ( fOutlinePage != null ) { fOutlineSelectionChangedListener . uninstall ( fOutlinePage ) ; fOutlinePage = null ; resetHighlightRange ( ) ; } } protected void configureSourceViewerDecorationSupport ( SourceViewerDecorationSupport support ) { support . setCharacterPairMatcher ( fBracketMatcher ) ; support . setMatchingCharacterPainterPreferenceKeys ( MATCHING_BRACKETS , MATCHING_BRACKETS_COLOR ) ; super . configureSourceViewerDecorationSupport ( support ) ; } protected ISourceViewer createSourceViewer ( Composite parent , IVerticalRuler ruler , int styles ) { fAnnotationAccess = createAnnotationAccess ( ) ; fOverviewRuler = createOverviewRuler ( getSharedColors ( ) ) ; IPreferenceStore store = getPreferenceStore ( ) ; ISourceViewer viewer = createRubySourceViewer ( parent , ruler , getOverviewRuler ( ) , isOverviewRulerVisible ( ) , styles , store ) ; getSourceViewerDecorationSupport ( viewer ) ; return viewer ; } protected ISourceViewer createRubySourceViewer ( Composite parent , IVerticalRuler verticalRuler , IOverviewRuler overviewRuler , boolean isOverviewRulerVisible , int styles , IPreferenceStore store ) { return new AdaptedSourceViewer ( parent , verticalRuler , overviewRuler , isOverviewRulerVisible , styles , store ) ; } protected void setOutlinerContextMenuId ( String menuId ) { fOutlinerContextMenuId = menuId ; } protected void initializeEditor ( ) { super . initializeEditor ( ) ; IPreferenceStore store = createCombinedPreferenceStore ( null ) ; setPreferenceStore ( store ) ; RubyTextTools textTools = RubyPlugin . getDefault ( ) . getRubyTextTools ( ) ; setSourceViewerConfiguration ( new RubySourceViewerConfiguration ( textTools . getColorManager ( ) , store , this , IRubyPartitions . RUBY_PARTITIONING ) ) ; fMarkOccurrenceAnnotations = store . getBoolean ( PreferenceConstants . EDITOR_MARK_OCCURRENCES ) ; fStickyOccurrenceAnnotations = store . getBoolean ( PreferenceConstants . EDITOR_STICKY_OCCURRENCES ) ; fMarkTypeOccurrences = store . getBoolean ( PreferenceConstants . EDITOR_MARK_TYPE_OCCURRENCES ) ; fMarkMethodOccurrences = store . getBoolean ( PreferenceConstants . EDITOR_MARK_METHOD_OCCURRENCES ) ; fMarkConstantOccurrences = store . getBoolean ( PreferenceConstants . EDITOR_MARK_CONSTANT_OCCURRENCES ) ; fMarkFieldOccurrences = store . getBoolean ( PreferenceConstants . EDITOR_MARK_FIELD_OCCURRENCES ) ; fMarkLocalVariableOccurrences = store . getBoolean ( PreferenceConstants . EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES ) ; fMarkMethodExitPoints = store . getBoolean ( PreferenceConstants . EDITOR_MARK_METHOD_EXIT_POINTS ) ; } protected void setPreferenceStore ( IPreferenceStore store ) { super . setPreferenceStore ( store ) ; if ( getSourceViewerConfiguration ( ) instanceof RubySourceViewerConfiguration ) { RubyTextTools textTools = RubyPlugin . getDefault ( ) . getRubyTextTools ( ) ; setSourceViewerConfiguration ( new RubySourceViewerConfiguration ( textTools . getColorManager ( ) , store , this , IRubyPartitions . RUBY_PARTITIONING ) ) ; } if ( getSourceViewer ( ) instanceof RubySourceViewer ) ( ( RubySourceViewer ) getSourceViewer ( ) ) . setPreferenceStore ( store ) ; } public void dispose ( ) { super . dispose ( ) ; fMarkOccurrenceAnnotations = false ; uninstallOccurrencesFinder ( ) ; if ( fActivationListener != null ) { PlatformUI . getWorkbench ( ) . removeWindowListener ( fActivationListener ) ; fActivationListener = null ; } } public Object getAdapter ( Class required ) { if ( IContentOutlinePage . class . equals ( required ) ) { if ( fOutlinePage == null ) fOutlinePage = createRubyOutlinePage ( ) ; return fOutlinePage ; } return super . getAdapter ( required ) ; } public void createPartControl ( Composite parent ) { super . createPartControl ( parent ) ; if ( fMarkOccurrenceAnnotations ) installOccurrencesFinder ( false ) ; } protected ICustomRubyOutlinePage createRubyOutlinePage ( ) { IRubyElement element = getInputRubyElement ( ) ; ICustomRubyOutlinePage outlinePage = null ; List < ICustomRubyOutlinePage > customPages = getCustomOutlines ( ) ; for ( ICustomRubyOutlinePage customRubyOutlinePage : customPages ) { if ( customRubyOutlinePage . isEnabled ( element ) ) { customRubyOutlinePage . init ( fOutlinerContextMenuId , this ) ; outlinePage = ( RubyOutlinePage ) customRubyOutlinePage ; break ; } } if ( outlinePage == null ) { outlinePage = new RubyOutlinePage ( ) ; outlinePage . init ( fOutlinerContextMenuId , this ) ; } fOutlineSelectionChangedListener . install ( outlinePage ) ; setOutlinePageInput ( outlinePage , getEditorInput ( ) ) ; return outlinePage ; } private List < ICustomRubyOutlinePage > getCustomOutlines ( ) { List < ICustomRubyOutlinePage > list = new ArrayList < ICustomRubyOutlinePage > ( ) ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( RubyPlugin . PLUGIN_ID , CUSTOM_OUTLINE_EXTPOINT_ID ) ; if ( extension == null ) return list ; IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = 0 ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = 0 ; j < configElements . length ; j ++ ) { final IConfigurationElement configElement = configElements [ j ] ; String elementName = configElement . getName ( ) ;
2,919
<s> package com . asakusafw . runtime . directio . util ; import java . io . IOException ; import java . io . OutputStream ; import com . asakusafw . runtime . directio . Counter ; public class CountOutputStream extends OutputStream { private final OutputStream stream ; private final Counter counter ; public CountOutputStream ( OutputStream stream , Counter counter ) { if ( stream == null ) { throw new IllegalArgumentException ( "" ) ; } if ( counter == null ) { throw new IllegalArgumentException ( "" ) ; } this . stream = stream ; this . counter = counter ; } public long getCount ( ) { return counter . get ( ) ; } @ Override public void write ( int b ) throws IOException { stream . write ( b ) ; counter . add ( 1 ) ; } @ Override public void write ( byte [ ] b ) throws IOException { stream . write ( b ) ; counter . add ( b . length ) ; } @ Override public void write ( byte [ ]
2,920
<s> package com . asakusafw . runtime . directio ; public class ResourceInfo { private final String id ; private final String path ; private final boolean directory ; public ResourceInfo ( String id , String path ) { this ( id , path , false ) ; } public ResourceInfo ( String id , String path , boolean directory ) { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } if ( path == null ) { throw new IllegalArgumentException ( "" ) ; } this . id = id ; this . path = path ; this . directory = directory ; }
2,921
<s> package net . sf . sveditor . ui ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; 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 .
2,922
<s> package com . asakusafw . runtime . flow ; import org . apache . hadoop . io . Writable ; public abstract class Rendezvous < V extends Writable > { public static final String BEGIN = "begin" ; public static final String PROCESS = "process" ; public static final String END = "end" ;
2,923
<s> package org . rubypeople . rdt . internal . ui . text . template . contentassist ; import java . io . IOException ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IExtensionRegistry ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . templates . ContextTypeRegistry ; import org . eclipse . jface . text . templates . persistence . TemplatePersistenceData ; import org . eclipse . jface . text . templates . persistence . TemplateStore ; import org . eclipse . ui . editors . text . templates . ContributionContextTypeRegistry ; import org . eclipse . ui . editors . text . templates . ContributionTemplateStore ; import org . rubypeople . rdt . internal . corext . template . ruby . RubyContextType ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . ui . extensions . IRubyTemplateProvider ; public class RubyTemplateAccess { private static final String CUSTOM_TEMPLATES_KEY = "" ; private static RubyTemplateAccess fgInstance ; private TemplateStore fStore ; private ContributionContextTypeRegistry fContextTypeRegistry ; private RubyTemplateAccess ( ) { } public static RubyTemplateAccess getDefault ( ) { if ( fgInstance == null ) { fgInstance = new RubyTemplateAccess ( ) ; } return fgInstance ; } public TemplateStore getTemplateStore ( ) { if ( fStore == null ) { fStore = new ContributionTemplateStore ( getContextTypeRegistry ( ) , RubyPlugin . getDefault ( ) . getPreferenceStore ( ) , CUSTOM_TEMPLATES_KEY ) ; try { fStore . load ( ) ; } catch ( IOException e ) { RubyPlugin . log ( e ) ; } TemplatePersistenceData [ ] tempData = getExtensionTemplateData ( ) ; if ( tempData != null ) { for ( int i = 0 ; i < tempData . length ; i ++ ) { fStore . add ( tempData [ i ] ) ; } } } return fStore ; } private TemplatePersistenceData [ ] getExtensionTemplateData ( ) { List extensions = new ArrayList ( ) ; IExtensionRegistry reg = Platform . getExtensionRegistry ( ) ; IExtensionPoint [ ] points = reg . getExtensionPoints ( RubyPlugin . PLUGIN_ID ) ; IExtensionPoint point = null ; if ( points != null ) { for ( int i = 0 ; i < points . length ; i ++ ) { IExtensionPoint currentPoint = points [ i ] ; if ( currentPoint . getUniqueIdentifier ( ) . endsWith ( "" ) ) { point = currentPoint ; break ; } } if ( point != null ) { IExtension [ ] exts = point . getExtensions ( ) ; IRubyTemplateProvider prov = null ; for ( int i = 0 ; i < exts . length ; i ++ ) { IConfigurationElement [ ] elem = exts [ i ] . getConfigurationElements ( ) ; String attrs [ ] = elem [
2,924
<s> package com . asakusafw . runtime . stage . output ; import java . io . IOException ; import org . apache . hadoop . mapreduce . RecordWriter ; import org . apache . hadoop . mapreduce . TaskAttemptContext ; import org . apache . hadoop . mapreduce . lib . output .
2,925
<s> package com . asakusafw . utils . java . model . syntax ; public abstract class Visitor < R , C , E extends Throwable > { public R visitAlternateConstructorInvocation ( AlternateConstructorInvocation elem , C context ) throws E { return null ; } public R visitAnnotationDeclaration ( AnnotationDeclaration elem , C context ) throws E { return null ; } public R visitAnnotationElement ( AnnotationElement elem , C context ) throws E { return null ; } public R visitAnnotationElementDeclaration ( AnnotationElementDeclaration elem , C context ) throws E { return null ; } public R visitArrayAccessExpression ( ArrayAccessExpression elem , C context ) throws E { return null ; } public R visitArrayCreationExpression ( ArrayCreationExpression elem , C context ) throws E { return null ; } public R visitArrayInitializer ( ArrayInitializer elem , C context ) throws E { return null ; } public R visitArrayType ( ArrayType elem , C context ) throws E { return null ; } public R visitAssertStatement ( AssertStatement elem , C context ) throws E { return null ; } public R visitAssignmentExpression ( AssignmentExpression elem , C context ) throws E { return null ; } public R visitBasicType ( BasicType elem , C context ) throws E { return null ; } public R visitBlock ( Block elem , C context ) throws E { return null ; } public R visitBlockComment ( BlockComment elem , C context ) throws E { return null ; } public R visitBreakStatement ( BreakStatement elem , C context ) throws E { return null ; } public R visitCastExpression ( CastExpression elem , C context ) throws E { return null ; } public R visitCatchClause ( CatchClause elem , C context ) throws E { return null ; } public R visitClassBody ( ClassBody elem , C context ) throws E { return null ; } public R visitClassDeclaration ( ClassDeclaration elem , C context ) throws E { return
2,926
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . net . URL ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . text . Assert ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPositionCategoryException ; import org . eclipse . jface . text . DefaultPositionUpdater ; import org . eclipse . jface . text . DocumentEvent ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IInformationControl ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . IPositionUpdater ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . ITextViewerExtension2 ; import org . eclipse . jface . text . ITextViewerExtension5 ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension2 ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension3 ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension5 ; import org . eclipse . jface . text . contentassist . IContextInformation ; import org . eclipse . jface . text . link . ILinkedModeListener ; import org . eclipse . jface . text . link . LinkedModeModel ; import org . eclipse . jface . text . link . LinkedModeUI ; import org . eclipse . jface . text . link . LinkedPosition ; import org . eclipse . jface . text . link . LinkedPositionGroup ; import org . eclipse . jface . text . link . LinkedModeUI . ExitFlags ; import org . eclipse . jface . text . link . LinkedModeUI . IExitPolicy ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . StyleRange ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . events . VerifyEvent ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . texteditor . link . EditorLinkedModeUI ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . text . HTMLPrinter ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . AbstractReusableInformationControlCreator ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . AbstractRubyEditorTextHover ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . BrowserInformationControl ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . RubyTextTools ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public abstract class AbstractRubyCompletionProposal implements IRubyCompletionProposal , ICompletionProposalExtension , ICompletionProposalExtension2 , ICompletionProposalExtension3 , ICompletionProposalExtension5 { static final class ReferenceTracker { private static final String CATEGORY = "" ; private final IPositionUpdater fPositionUpdater = new DefaultPositionUpdater ( CATEGORY ) ; private final Position fPosition = new Position ( 0 ) ; public void preReplace ( IDocument document , int offset ) throws BadLocationException { fPosition . setOffset ( offset ) ; try { document . addPositionCategory ( CATEGORY ) ; document . addPositionUpdater ( fPositionUpdater ) ; document . addPosition ( CATEGORY , fPosition ) ; } catch ( BadPositionCategoryException e ) { RubyPlugin . log ( e ) ; } } public int postReplace ( IDocument document ) { try { document . removePosition ( CATEGORY , fPosition ) ; document . removePositionUpdater ( fPositionUpdater ) ; document . removePositionCategory ( CATEGORY ) ; } catch ( BadPositionCategoryException e ) { RubyPlugin . log ( e ) ; } return fPosition . getOffset ( ) ; } } protected static final class ExitPolicy implements IExitPolicy { final char fExitCharacter ; private final IDocument fDocument ; public ExitPolicy ( char exitCharacter , IDocument document ) { fExitCharacter = exitCharacter ; fDocument = document ; } public ExitFlags doExit ( LinkedModeModel environment , VerifyEvent event , int offset , int length ) { if ( event . character == fExitCharacter ) { if ( environment . anyPositionContains ( offset ) ) return new ExitFlags ( ILinkedModeListener . UPDATE_CARET , false ) ; else return new ExitFlags ( ILinkedModeListener . UPDATE_CARET , true ) ; } switch ( event . character ) { case ';' : return new ExitFlags ( ILinkedModeListener . NONE , true ) ; case SWT . CR : if ( offset > 0 ) { try { if ( fDocument . getChar ( offset - 1 ) == '{' ) return new ExitFlags ( ILinkedModeListener . EXIT_ALL , true ) ; } catch ( BadLocationException e ) { } } default : return null ; } } } private String fDisplayString ; private String fReplacementString ; private int fReplacementOffset ; private int fReplacementLength ; private int fCursorPosition ; private Image fImage ; private IContextInformation fContextInformation ; private ProposalInfo fProposalInfo ; private char [ ] fTriggerCharacters ; private String fSortString ; private int fRelevance ; private boolean fIsInRubydoc ; private StyleRange fRememberedStyleRange ; private boolean fToggleEating ; private ITextViewer fTextViewer ; private IInformationControlCreator fCreator ; private URL fStyleSheetURL ; protected AbstractRubyCompletionProposal ( ) { } public char [ ] getTriggerCharacters ( ) { return fTriggerCharacters ; } public void setTriggerCharacters ( char [ ] triggerCharacters ) { fTriggerCharacters = triggerCharacters ; } public void setProposalInfo ( ProposalInfo proposalInfo ) { fProposalInfo = proposalInfo ; } protected ProposalInfo getProposalInfo ( ) { return fProposalInfo ; } public void setCursorPosition ( int cursorPosition ) { Assert . isTrue ( cursorPosition >= 0 ) ; fCursorPosition = cursorPosition ; } protected int getCursorPosition ( ) { return fCursorPosition ; } public final void apply ( IDocument document ) { apply ( document , ( char ) 0 , getReplacementOffset ( ) + getReplacementLength ( ) ) ; } public void apply ( IDocument document , char trigger , int offset ) { try { int delta = offset - ( getReplacementOffset ( ) + getReplacementLength ( ) ) ; if ( delta > 0 ) setReplacementLength ( getReplacementLength ( ) + delta ) ; String replacement ; if ( trigger == ( char ) 0 ) { replacement = getReplacementString ( ) ; } else { StringBuffer buffer = new StringBuffer ( getReplacementString ( ) ) ; if ( ( getCursorPosition ( ) > 0 && getCursorPosition ( ) <= buffer . length ( ) && buffer . charAt ( getCursorPosition ( ) - 1 ) != trigger ) ) { buffer . insert ( getCursorPosition ( ) , trigger ) ; setCursorPosition ( getCursorPosition ( ) + 1 ) ; } replacement = buffer . toString ( ) ; setReplacementString ( replacement ) ; } int referenceOffset = getReplacementOffset ( ) + getReplacementLength ( ) ; final ReferenceTracker referenceTracker = new ReferenceTracker ( ) ; referenceTracker . preReplace ( document , referenceOffset ) ; replace ( document , getReplacementOffset ( ) , getReplacementLength ( ) , replacement ) ; referenceOffset = referenceTracker . postReplace ( document ) ; setReplacementOffset ( referenceOffset - ( replacement == null ? 0 : replacement . length ( ) ) ) ; } catch ( BadLocationException x ) { } } protected final void replace ( IDocument document , int offset , int length , String string ) throws BadLocationException { if ( ! document . get ( offset , length ) . equals ( string ) ) document . replace ( offset , length , string ) ; } public void apply ( ITextViewer viewer , char trigger , int stateMask , int offset ) { IDocument document = viewer . getDocument ( ) ; if ( fTextViewer == null ) fTextViewer = viewer ; if ( ! isInRubydoc ( ) && ! validate ( document , offset , null ) ) { setCursorPosition ( offset - getReplacementOffset ( ) ) ; if ( trigger != '\0' ) { try { document . replace ( offset , 0 , String . valueOf ( trigger ) ) ; setCursorPosition ( getCursorPosition ( ) + 1 ) ; if ( trigger == '(' && autocloseBrackets ( ) ) { document . replace ( getReplacementOffset ( ) + getCursorPosition ( ) , 0 , ")" ) ; setUpLinkedMode ( document , ')' ) ; } } catch ( BadLocationException x ) { } } return ; } Point selection = viewer . getSelectedRange ( ) ; fToggleEating = ( stateMask & SWT . MOD1 ) != 0 ; int newLength = selection . x + selection . y - getReplacementOffset ( ) ; if ( ( insertCompletion ( ) ^ fToggleEating ) && newLength >= 0 ) setReplacementLength ( newLength ) ; apply ( document , trigger , offset ) ; fToggleEating = false ; } protected boolean isInRubydoc ( ) { return fIsInRubydoc ; } protected void setInRubydoc ( boolean isInRubydoc ) { fIsInRubydoc = isInRubydoc ; } public Point getSelection ( IDocument document ) { return new Point ( getReplacementOffset ( ) + getCursorPosition ( ) , 0 ) ; } public IContextInformation getContextInformation ( ) { return fContextInformation ; } public void setContextInformation ( IContextInformation contextInformation ) { fContextInformation = contextInformation ; } public String getDisplayString ( ) { return fDisplayString ; } public String getAdditionalProposalInfo ( ) { if ( getProposalInfo ( ) != null ) { String info = getProposalInfo ( ) . getInfo ( null ) ; if ( info != null && info . length ( ) > 0 ) { StringBuffer buffer = new StringBuffer ( ) ; HTMLPrinter . insertPageProlog ( buffer , 0 , AbstractRubyEditorTextHover . getStyleSheet ( ) ) ; buffer . append ( info ) ; HTMLPrinter . addPageEpilog ( buffer ) ; info = buffer . toString ( ) ; } return info ; } return null ; } public Object getAdditionalProposalInfo ( IProgressMonitor monitor ) { if ( getProposalInfo ( ) != null ) { String info = getProposalInfo ( ) . getInfo ( monitor ) ; if ( info != null && info . length ( ) > 0 ) { StringBuffer buffer = new StringBuffer ( ) ; HTMLPrinter . insertPageProlog ( buffer , 0 , AbstractRubyEditorTextHover . getStyleSheet ( ) ) ; buffer . append ( info ) ; HTMLPrinter . addPageEpilog ( buffer ) ; info = buffer . toString ( ) ; } return info ; } return null ; } public int getContextInformationPosition ( ) { if ( getContextInformation ( ) == null ) return getReplacementOffset ( ) - 1 ; return getReplacementOffset ( ) + getCursorPosition ( ) ; } public int getReplacementOffset ( ) { return fReplacementOffset ; } public void setReplacementOffset ( int replacementOffset ) { Assert . isTrue ( replacementOffset >= 0 ) ; fReplacementOffset = replacementOffset ; } public int getPrefixCompletionStart ( IDocument document , int completionOffset ) { return getReplacementOffset ( ) ; } public int getReplacementLength ( ) { return fReplacementLength ; } public void setReplacementLength ( int replacementLength ) { Assert . isTrue ( replacementLength >= 0 ) ; fReplacementLength = replacementLength ; } public String getReplacementString ( ) { return fReplacementString ; } public void setReplacementString ( String replacementString ) { Assert . isNotNull ( replacementString ) ; fReplacementString = replacementString ; } public CharSequence getPrefixCompletionText ( IDocument document , int completionOffset ) { return getReplacementString ( ) ; } public Image getImage ( ) { return fImage ; } public void setImage ( Image image ) { fImage = image ; } public boolean isValidFor ( IDocument document , int offset ) { return validate ( document , offset , null ) ; } public boolean validate ( IDocument document , int offset , DocumentEvent event ) { if ( offset < getReplacementOffset ( ) ) return false ; boolean validated = isValidPrefix ( getPrefix ( document , offset ) ) ; if ( validated && event != null ) { int delta = ( event . fText == null ? 0 : event . fText . length ( ) ) - event . fLength ; final int newLength = Math . max ( getReplacementLength ( ) + delta , 0 ) ; setReplacementLength ( newLength ) ; } return validated ; } protected boolean isValidPrefix ( String prefix ) { return isPrefix ( prefix , getDisplayString ( ) ) ; } public int getRelevance ( ) { return fRelevance ; } public void setRelevance ( int relevance ) { fRelevance = relevance ; } protected String getPrefix ( IDocument document , int offset ) { try
2,927
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFolder ; 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 . jface . action . IAction ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . dialogs . TrayDialog ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; 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 . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . INewWizard ; import org . eclipse . ui . model . BaseWorkbenchContentProvider ; import org . eclipse . ui . model . WorkbenchLabelProvider ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . TypedViewerFilter ; import org . rubypeople . rdt . ui . actions . AbstractOpenWizardAction ; public class CreateMultipleSourceFoldersDialog extends TrayDialog { private final class FakeFolderBaseWorkbenchContentProvider extends BaseWorkbenchContentProvider { public Object getParent ( Object element ) { Object object = fNonExistingFolders . get ( element ) ; if ( object != null ) return object ; return super . getParent ( element ) ; } public Object [ ] getChildren ( Object element ) { List result = new ArrayList ( ) ; Set keys = fNonExistingFolders . keySet ( ) ; for ( Iterator iter = keys . iterator ( ) ; iter . hasNext ( ) ; ) { Object key = iter . next ( ) ; if ( fNonExistingFolders . get ( key ) . equals ( element ) ) { result . add ( key ) ; } } if ( result . size ( ) == 0 ) return super . getChildren ( element ) ; Object [ ] children = super . getChildren ( element ) ; for ( int i = 0 ; i < children . length ; i ++ ) { result . add ( children [ i ] ) ; } return result . toArray ( ) ; } } private final IRubyProject fRubyProject ; private final CPListElement [ ] fExistingElements ; private final HashSet fRemovedElements ; private final HashSet fModifiedElements ; private final HashSet fInsertedElements ; private final Hashtable fNonExistingFolders ; public CreateMultipleSourceFoldersDialog ( final IRubyProject javaProject , final CPListElement [ ] existingElements , Shell shell ) { super ( shell ) ; fRubyProject = javaProject ; fExistingElements = existingElements ; fRemovedElements = new HashSet ( ) ; fModifiedElements = new HashSet ( ) ; fInsertedElements = new HashSet ( ) ; fNonExistingFolders = new Hashtable ( ) ; for ( int i = 0 ; i < existingElements . length ; i ++ ) { CPListElement cur = existingElements [ i ] ; if ( cur . getResource ( ) == null || ! cur . getResource ( ) . exists ( ) ) { addFakeFolder ( fRubyProject . getProject ( ) , cur ) ; } } } public int open ( ) { Class [ ] acceptedClasses = new Class [ ] { IProject . class , IFolder . class } ; List existingContainers = getExistingContainers ( fExistingElements ) ; IProject [ ] allProjects = ResourcesPlugin . getWorkspace ( ) . getRoot
2,928
<s> package com . pogofish . jadt . checker ; import java . util . List ; import com . pogofish . jadt . ast . Doc ; import com . pogofish . jadt . errors . SemanticError ; public interface
2,929
<s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IAdapterFactory ; import org . eclipse . search . ui . ISearchPageScoreComputer ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IStorageEditorInput ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . internal . ui . search . RubySearchPageScoreComputer ; import org . rubypeople . rdt . internal . ui . search . SearchUtil ; import org . rubypeople . rdt . ui . RubyUI ; public class EditorInputAdapterFactory implements IAdapterFactory { private static Class [ ] PROPERTIES = new Class [ ] { IRubyElement . class } ; private Object fSearchPageScoreComputer ; public Class [ ] getAdapterList ( ) { updateLazyLoadedAdapters ( ) ; return PROPERTIES ; } public Object getAdapter ( Object element , Class key
2,930
<s> package net . sf . sveditor . core . db ; public class SVDBMacroDefParam extends SVDBChildItem implements ISVDBNamedItem { public String fName ; public String fValue ; public SVDBMacroDefParam ( ) { super ( SVDBItemType . MacroDefParam
2,931
<s> package com . asakusafw . runtime . value ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import java . text . MessageFormat ; import com . asakusafw . runtime . io . util . WritableRawComparable ; public final class BooleanOption extends ValueOption < BooleanOption > { private static final int TRUE_HASHCODE = 1231 ; private static final int FALSE_HASHCODE = 1237 ; private boolean value ; public BooleanOption ( ) { super ( ) ; } public BooleanOption ( boolean value ) { super ( ) ; this . value = value ; this . nullValue = false ; } public boolean get ( ) { if ( nullValue ) { throw new NullPointerException ( ) ; } return value ; } public boolean or ( boolean alternate ) { if ( nullValue ) { return alternate ; } return value ; } @ Deprecated public BooleanOption modify ( boolean newValue ) { this . nullValue = false ; this . value = newValue ; return this ; } @ Override @ Deprecated public void copyFrom ( BooleanOption optionOrNull ) { if ( optionOrNull == null || optionOrNull . nullValue ) { this . nullValue = true ; } else { this . nullValue = false ; this . value = optionOrNull . value ; } } @ Override public int hashCode ( ) { final int prime = 31 ; if ( isNull ( ) ) { return 1 ; } int result = 1 ; result = prime * result + ( value ? TRUE_HASHCODE : FALSE_HASHCODE ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } BooleanOption other = ( BooleanOption ) obj ; if ( nullValue != other . nullValue ) { return false ; } if ( nullValue == false && value != other . value ) { return false ; } return true ; } public boolean has ( boolean other ) { if ( isNull ( ) ) { return false ; } return value == other ; } @ Override public int compareTo ( WritableRawComparable o ) { BooleanOption other = ( BooleanOption ) o ; if ( nullValue | other . nullValue ) { if ( nullValue & other . nullValue ) { return 0 ; } return nullValue ? - 1 : + 1 ; } if ( value ^ other . value ) { return value ? 1 : - 1 ; } return 0 ; } @ Override public String toString ( ) { if ( isNull ( ) ) { return String . valueOf ( ( Object ) null ) ; } else { return String . valueOf ( value ) ; } } private static final int SERIALIZE_NULL = - 1 ; private static final int SERIALIZE_TRUE = + 1 ; private static final int SERIALIZE_FALSE = 0 ; @ Override public void write ( DataOutput out ) throws IOException { if ( isNull ( ) ) { out . writeByte ( SERIALIZE_NULL ) ; } else { out . writeByte ( value ? SERIALIZE_TRUE : SERIALIZE_FALSE ) ; } } @ Override public void readFields ( DataInput in ) throws IOException { byte field = in . readByte ( ) ; restore ( field ) ; } @ Override public int restore ( byte [ ] bytes , int offset , int limit ) throws IOException { if ( limit - offset < 1 ) { throw new IOException ( MessageFormat . format ( "" , "" ) ) ; } restore ( bytes [ offset ] ) ; return 1 ; } @ SuppressWarnings ( "deprecation" ) private void restore ( byte field ) throws IOException { if ( field == SERIALIZE_NULL ) { setNull ( ) ; } else if (
2,932
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . BalanceTran ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class BalanceTranModelOutput implements ModelOutput < BalanceTran > { private final RecordEmitter emitter ; public BalanceTranModelOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( BalanceTran model ) throws IOException { emitter . emit ( model . getSidOption ( ) ) ; emitter . emit ( model . getVersionNoOption ( ) ) ; emitter . emit ( model . getRgstDatetimeOption ( ) ) ; emitter . emit ( model . getUpdtDatetimeOption ( ) ) ; emitter . emit ( model . getSellerCodeOption ( ) ) ; emitter . emit ( model . getPreviousCutoffDateOption
2,933
<s> package org . oddjob . state ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . Serializable ; import java . util . Date ; import java . util . EventObject ; import org . oddjob . Stateful ; import org . oddjob . util . IO ; public class StateEvent extends EventObject implements Serializable { private static final long serialVersionUID = 20051026 ; static final String REPLACEMENT_EXCEPTION_TEXT = "" ; private State state ; private Date time ; private Throwable exception ; class ExceptionReplacement extends Exception { private static final long serialVersionUID = 20051217 ; public ExceptionReplacement ( Throwable replacing ) { super ( REPLACEMENT_EXCEPTION_TEXT + replacing . getMessage ( ) ) ; super . setStackTrace ( exception . getStackTrace ( ) ) ; } } public StateEvent ( Stateful job , State jobState , Date time , Throwable exception ) { super ( job ) ; if ( jobState == null ) { throw new NullPointerException ( "" ) ; } this . state = jobState ; this . time = time ; this . exception = exception ; } public StateEvent ( Stateful job , State jobState , Throwable exception ) { this ( job , jobState , new Date ( ) , exception ) ; } public StateEvent ( Stateful job , State jobState ) { this ( job , jobState , null ) ; } @ Override public Stateful getSource ( ) { return ( Stateful ) super . getSource ( ) ; } public State getState ( ) { return state ; } public Throwable getException ( ) { return exception ; } public Date getTime ( ) { return time ; } public String
2,934
<s> package net . sf . sveditor . core . tests . lexer ; import junit . framework . TestCase ; import net . sf . sveditor . core . log . ILogHandle ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . parser . ISVParser ; import net . sf . sveditor . core . parser . SVLexer ; import net . sf . sveditor . core . parser . SVParseException ; import net . sf . sveditor . core . parser . SVParsers ; import net . sf . sveditor . core . scanutils . StringTextScanner ; public class TestClassItems extends TestCase { public void testClassFields ( ) { String content = "" + "" + "n" + "" + "n" + "" + "n" + "" + "n"
2,935
<s> package com . lmax . disruptor ; import com . lmax . disruptor . collections . Histogram ; import com . lmax . disruptor . support . * ; import org . junit . Test ; import java . io . PrintStream ; import java . math . BigDecimal ; import java . util . concurrent . * ; import static org . hamcrest . core . Is . is ; import static org . junit . Assert . assertThat ; import static org . junit . Assert . assertTrue ; public final class Pipeline3StepLatencyPerfTest { private static final int NUM_CONSUMERS = 3 ; private static final int SIZE = 1024 * 32 ; private static final long ITERATIONS = 1000 * 1000 * 50 ; private static final long PAUSE_NANOS = 1000 ; private final ExecutorService EXECUTOR = Executors . newFixedThreadPool ( NUM_CONSUMERS ) ; private final Histogram histogram ; { long [ ] intervals = new long [ 31 ] ; long intervalUpperBound = 1L ; for ( int i = 0 , size = intervals . length - 1 ; i < size ; i ++ ) { intervalUpperBound *= 2 ; intervals [ i ] = intervalUpperBound ; } intervals [ intervals . length - 1 ] = Long . MAX_VALUE ; histogram = new Histogram ( intervals ) ; } private final long nanoTimeCost ; { final long iterations = 10000000 ; long start = System . nanoTime ( ) ; long finish = start ; for ( int i = 0 ; i < iterations ; i ++ ) { finish = System . nanoTime ( ) ; } if
2,936
<s> package net . sf . sveditor . core . tests . parser ; import java . util . ArrayList ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . SVDBMarker . MarkerType ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBTypeInfoBuiltin ; import net . sf . sveditor . core . db . SVDBTypeInfoBuiltinNet ; import net . sf . sveditor . core . db . SVDBTypeInfoUserDef ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . parser . SVParseException ; import net . sf . sveditor . core . tests . SVDBTestUtils ; public class TestParseModuleBodyItems extends TestCase { public void testPackageModule ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String content = "package p;rn" + "" + "" + "endpackagern" + "rn" + "module t1rn" + "t(rn" + "" + "endmodulern" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( log , content , "" , false ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "p" , "t1" ) ; LogFactory . removeLogHandle ( log ) ; } public void testDefineCaseItems ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String content = "`define A 1n" + "" + "tint b;n" + "" + "ttcase(b)n" + "ttt`A:beginn" + "tttendn" + "ttendcasen" + "tendn" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( log , content , "" , false ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "mymodule" ) ; LogFactory . removeLogHandle ( log ) ; } public void testRandCase ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String content = "" + "" + "" + "" + "" + "" + "" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "testRandCase" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "mymodule" ) ; LogFactory . removeLogHandle ( log ) ; } public void testDelayedAssign ( ) { String content = "module t;n" + "tlogic a;n" + "" + "" + "" + "talways" + "tbegin " + "" + "" + "" + "" + "tendn" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t" ) ; } public void testDelayedExprAssign ( ) { String content = "module t;n" + "tlogic a;n" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t" ) ; } public void testDelayedExprAssignRiseFall ( ) { String content = "module t;n" + "tlogic a;n" + "tlogic b;n" + "" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t" ) ; } public void testModuleSizedParameter ( ) { String content = "module tn" + "#(n" + "" + ");n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t" ) ; } public void testModuleGenvarDecl ( ) { String content = "module t4;n" + "tgenvar k;n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t4" ) ; } public void testModuleInterfacePort ( ) { String content = "module t2n" + "(n" + "interface an" + ");n" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t2" ) ; } public void testModuleBitArrayPort ( ) { String content = "module t3n" + "(n" + "" + ");n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t3" ) ; } public void testModuleSignedPort ( ) { String content = "module t5n" + "(n" + "" + ");n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t5" ) ; } public void testModuleSizedSignedPort ( ) { String content = "module t2n" + "(n" + "" + ");n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( content , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t2" ) ; } public void testAssignInvert ( ) { String doc = "module t;n" + "" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t" ) ; } public void testAssignSystemTask ( ) { String doc = "module t2;n" + "" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t2" ) ; } public void testInitialBlock ( ) { String doc = "module top;n" + " int a;n" + "n" + "" + "" + "" + "" + "" + "" + " endn" + "n" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBModIfcDecl top = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "top" ) ) { top = ( SVDBModIfcDecl ) it ; break ; } } assertNotNull ( "" , top ) ; ISVDBItemBase initial = null ; for ( ISVDBItemBase it : top . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . InitialStmt ) { initial = it ; break ; } } assertNotNull ( "" , initial ) ; } public void testPortList ( ) { LogHandle log = LogFactory . getLogHandle ( "testPortList" ) ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String doc = "" + "" + "" + "" + "" + "n" + "" + "n" + "" + "" + " endn" + "n" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "testPortList" ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . Marker ) { log . debug ( "Marker: " + ( ( SVDBMarker ) it ) . getMessage ( ) ) ; } } SVDBModIfcDecl top = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "top" ) ) { top = ( SVDBModIfcDecl ) it ; break ; } } assertNotNull ( "" , top ) ; for ( SVDBParamPortDecl p : top . getPorts ( ) ) { for ( ISVDBChildItem c : p . getChildren ( ) ) { log . debug ( "Port: " + SVDBItem . getName ( c ) ) ; } } SVDBVarDeclItem a = null , b = null , c = null , d = null , bus = null ; for ( ISVDBItemBase it : top . getChildren ( ) ) { String name = SVDBItem . getName ( it ) ; log . debug ( "[Item] " + it . getType ( ) + " " + name ) ; if ( it . getType ( ) == SVDBItemType . VarDeclStmt ) { for ( ISVDBChildItem ci : ( ( SVDBVarDeclStmt ) it ) . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) ci ; log . debug ( " vi=" + vi . getName ( ) ) ; if ( vi . getName ( ) . equals ( "a" ) ) { a = vi ; } else if ( vi . getName ( ) . equals ( "b" ) ) { b = vi ; } else if ( vi . getName ( ) . equals ( "c" ) ) { c = vi ; } else if ( vi . getName ( ) . equals ( "d" ) ) { d = vi ; } else if ( vi . getName ( ) . equals ( "bus" ) ) { bus = vi ; } } } } assertNotNull ( a ) ; assertNotNull ( b ) ; assertNotNull ( c ) ; assertNotNull ( d ) ; assertNotNull ( bus ) ; assertEquals ( "input" , a . getParent ( ) . getTypeName ( ) ) ; assertEquals ( "input" , a . getParent ( ) . getTypeName ( ) ) ; assertTrue ( bus . getParent ( ) . getTypeInfo ( ) instanceof SVDBTypeInfoBuiltinNet ) ; SVDBTypeInfoBuiltinNet net_type = ( SVDBTypeInfoBuiltinNet ) bus . getParent ( ) . getTypeInfo ( ) ; log . debug ( "vectorDim: " + ( ( SVDBTypeInfoBuiltin ) net_type . getTypeInfo ( ) ) . getVectorDim ( ) ) ; assertEquals ( 1 , ( ( SVDBTypeInfoBuiltin ) net_type . getTypeInfo ( ) ) . getVectorDim ( ) . size ( ) ) ; LogFactory . removeLogHandle ( log ) ; } public void testTypedPortList ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "" + " int a;n" + " int b;n" + "} foo_t;n" + "n" + "module top(n" + "" + "" + "" + " );n" + "n" + "" + "" + " endn" + "n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . Marker ) { log . debug ( "Marker: " + ( ( SVDBMarker ) it ) . getMessage ( ) ) ; } } SVDBModIfcDecl top = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "top" ) ) { top = ( SVDBModIfcDecl ) it ; break ; } } assertNotNull ( "" , top ) ; SVDBVarDeclItem a = null , b = null , bar = null ; for ( SVDBParamPortDecl p : top . getPorts ( ) ) { for ( ISVDBChildItem c : p . getChildren ( ) ) { SVDBVarDeclItem pi = ( SVDBVarDeclItem ) c ; log . debug ( "Port: " + pi . getName ( ) ) ; if ( pi . getName ( ) . equals ( "a" ) ) { a = pi ; } else if ( pi . getName ( ) . equals ( "b" ) ) { b = pi ; } else if ( pi . getName ( ) . equals ( "bar" ) ) { bar = pi ; } } } assertNotNull ( a ) ; assertNotNull ( b ) ; assertNotNull ( bar ) ; assertEquals ( SVDBItemType . TypeInfoUserDef , b . getParent ( ) . getTypeInfo ( ) . getType ( ) ) ; assertEquals ( "foo_t" , ( ( SVDBTypeInfoUserDef ) b . getParent ( ) . getTypeInfo ( ) ) . getName ( ) ) ; LogFactory . removeLogHandle ( log ) ; } public void testAlwaysBlock ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "module top;n" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "" + "" + " endn" + "n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; List < SVDBMarker > errors = new ArrayList < SVDBMarker > ( ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . Marker ) { log . debug ( "Marker: " + ( ( SVDBMarker ) it ) . getMessage ( ) ) ; SVDBMarker m = ( SVDBMarker ) it ; if ( m . getMarkerType ( ) == MarkerType . Error ) { errors . add ( m ) ; } } } SVDBTestUtils . assertFileHasElements ( file , "top" ) ; assertEquals ( "No Errors" , 0 , errors . size ( ) ) ; LogFactory . removeLogHandle ( log ) ; } public void testNestedModule ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "module top;n" + "n" + "" + "" + "" + " tendn" + "" + "n" + "n" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBModIfcDecl top = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "top" ) ) { top = ( SVDBModIfcDecl ) it ; } } assertNotNull ( "" , top ) ; SVDBModIfcDecl inner = null ; for ( ISVDBItemBase it : top . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "inner" ) ) { inner = ( SVDBModIfcDecl ) it ; } } assertNotNull ( "" , inner ) ; LogFactory . removeLogHandle ( log ) ; } public void testEmptyParamList ( ) { String doc = "module t2n" + "#(n" + ");n" + "endmodule" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBTestUtils . assertFileHasElements ( file , "t2" ) ; } public void testParameterDeclaration ( ) { String doc = "module t1;n" + "" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBModIfcDecl t1 = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "t1" ) ) { t1 = ( SVDBModIfcDecl ) it ; } } assertNotNull ( "" , t1 ) ; SVDBVarDeclItem c = null ; for ( ISVDBItemBase it : t1 . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . ParamPortDecl ) { for ( ISVDBChildItem ci : ( ( SVDBParamPortDecl ) it ) . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) ci ; if ( vi . getName ( ) . equals ( "c" ) ) { c = vi ; } } } } assertNotNull ( c ) ; } public void testParameterExprInit ( ) { String doc = "module t;n" + "" + "" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBModIfcDecl t = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "t" ) ) { t = ( SVDBModIfcDecl ) it ; } } assertNotNull ( "" , t ) ; SVDBVarDeclItem a = null , b = null ; for ( ISVDBItemBase it : t . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . ParamPortDecl ) { for ( ISVDBChildItem c : ( ( SVDBParamPortDecl ) it ) . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) c ; if ( vi . getName ( ) . equals ( "a" ) ) { a = vi ; } else if ( vi . getName ( ) . equals ( "b" ) ) { b = vi ; } } } } assertNotNull ( a ) ; assertNotNull ( b ) ; } public void testAlwaysVariants ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc = "" + "" + " endn" + "" + " endn" + "endmodulen" ; SVDBFile file = SVDBTestUtils . parse ( doc , "" ) ; SVDBTestUtils . assertNoErrWarn ( file ) ; SVDBModIfcDecl t3 = null ; for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( SVDBItem . getName ( it ) . equals ( "t3" ) ) { t3 = ( SVDBModIfcDecl ) it ; } } assertNotNull ( "" , t3 ) ; for ( ISVDBItemBase it : t3 . getChildren ( ) ) { log . debug ( "it: " + it . getType ( ) + " " + SVDBItem . getName ( it ) ) ; } LogFactory .
2,937
<s> package org . rubypeople . rdt . internal . ui . browsing ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . ISourceReference ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . ui . ProblemsLabelDecorator ; import org . rubypeople . rdt . ui . viewsupport . ImageDescriptorRegistry ; class TopLevelTypeProblemsLabelDecorator extends ProblemsLabelDecorator { public TopLevelTypeProblemsLabelDecorator ( ImageDescriptorRegistry registry ) { super ( registry ) ; } protected boolean isInside ( int pos , ISourceReference sourceElement ) throws CoreException { if ( ! ( sourceElement instanceof IType ) || ( ( IType ) sourceElement ) . getDeclaringType ( ) != null ) return false ; IRubyScript cu = ( ( IType ) sourceElement ) . getRubyScript ( ) ; if ( cu == null ) return false ; IType [ ] types = cu . getTypes ( ) ; if
2,938
<s> package net . sf . sveditor . core . db ; public class SVDBConfigDecl extends SVDBScopeItem { public SVDBConfigDecl ( ) {
2,939
<s> package com . asakusafw . runtime . stage . preparator ; import java . io . IOException ; import org . apache . hadoop . mapreduce . Mapper ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . runtime . stage . output . StageOutputDriver ; public abstract class PreparatorMapper < T > extends Mapper < Object , T , Object , T > { public static final String NAME_GET_OUTPUT_NAME = "" ; private StageOutputDriver output ; private Result < T > result ; @ SuppressWarnings ( "unchecked" ) @ Override protected void setup ( Context context ) throws IOException , InterruptedException { String name = getOutputName ( ) ; this . output = new StageOutputDriver ( context ) ; this . result = ( Result < T > ) output . getResultSink ( name ) ; } public abstract String
2,940
<s> package org . rubypeople . rdt . internal . ui . text ; import org . eclipse . core . resources . IMarkerDelta ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . IResourceDelta ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . reconciler . DirtyRegion ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IFileEditorInput ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; public class RubyReconciler extends NotifyingReconciler { class ResourceChangeListener implements IResourceChangeListener { private IResource getResource ( ) { if ( fTextEditor == null ) return
2,941
<s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . rubypeople . rdt . internal . ui . actions . AbstractToggleLinkingAction ;
2,942
<s> package com . asakusafw . testdriver . windgate ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . ObjectOutputStream ; import java . net . URI ; import java . util . Collections ; import java . util . Properties ; import org . junit . Before ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . DataModelSourceProvider ; import com . asakusafw . testdriver . core . SpiDataModelSourceProvider ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . vocabulary . windgate . WindGateExporterDescription ; import com . asakusafw . vocabulary . windgate . WindGateImporterDescription ; import com . asakusafw . windgate . core . DriverScript ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; import com . asakusafw . windgate . file . resource . FileResourceProvider ; public class WindGateSourceProviderTest { private static final TestContext EMPTY = new TestContext . Empty ( ) ; @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Rule public ProfileContext context = new ProfileContext ( ) ; volatile static File file ; @ Before public void setUp ( ) throws Exception { file = folder . newFile ( "file" ) ; Properties profile = context . getTemplate ( ) ; profile . setProperty ( "" , FileResourceProvider . class . getName ( ) ) ; context . put ( "testing" , profile ) ; FileOutputStream output = new FileOutputStream ( file ) ; try { ObjectOutputStream out = new ObjectOutputStream ( output ) ; out . writeObject ( "" ) ; out . writeObject ( "" ) ; out . writeObject ( "" ) ; out . close ( ) ; } finally { output . close ( ) ; } } @ Test public void open_importer ( ) throws Exception { DataModelSourceProvider provider = new SpiDataModelSourceProvider ( getClass ( ) . getClassLoader ( ) ) ; URI uri = new URI ( "windgate:" + MockImporter . class . getName ( ) ) ; ValueDefinition < String > definition = ValueDefinition . of ( String . class ) ; DataModelSource source = provider . open ( definition , uri , EMPTY ) ; try { DataModelReflection r1 = source . next ( ) ; assertThat ( r1 , is ( notNullValue ( ) ) ) ; assertThat ( definition . toObject ( r1 ) , is ( "" ) ) ; DataModelReflection r2 = source . next ( ) ; assertThat ( r2 , is ( notNullValue ( ) ) ) ; assertThat ( definition . toObject ( r2 ) , is ( "" ) ) ; DataModelReflection r3 = source . next ( ) ; assertThat ( r3 , is ( notNullValue ( ) ) ) ; assertThat ( definition . toObject ( r3 ) , is ( "" ) ) ; DataModelReflection r4 = source . next ( ) ; assertThat ( r4 , is ( nullValue ( ) ) ) ; } finally { source . close ( ) ; } } @ Test public void open_exporter ( ) throws Exception { DataModelSourceProvider provider = new SpiDataModelSourceProvider ( getClass ( ) . getClassLoader ( ) ) ; URI
2,943
<s> package org . rubypeople . rdt . refactoring . ui . pages . encapsulatefield ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . layout . RowLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . rubypeople . rdt . refactoring . nodewrapper . VisibilityNodeWrapper ; public class EncapsulateFieldAccessorComposite extends Group { private Button enableDisableCheckBox ; private IVisibilitySelectionListener visibilitySelectionListener ; private VisibilityNodeWrapper . METHOD_VISIBILITY selectedVisibility ; private Button publicButton ; private Button protectedButton ; private Button privateButton ; public EncapsulateFieldAccessorComposite ( Composite parent , String name , VisibilityNodeWrapper . METHOD_VISIBILITY selectedVisibility , boolean isOptional ) { super ( parent , SWT . NONE ) ; this . selectedVisibility = selectedVisibility ; setLayoutData ( getDefaultGridData ( ) ) ; setLayout ( new GridLayout ( 1 , true ) ) ; setText ( name ) ; if ( isOptional ) { initEnableDisableCheckBox ( name ) ; } initAccessModifierGroup ( ) ; } private void initAccessModifierGroup
2,944
<s> package com . asakusafw . utils . java . model . util ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public final class CommentEmitTrait { private static
2,945
<s> package com . asakusafw . testdriver . excel ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . net . URI ; import java . net . URL ; import org . junit . Test ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . DataModelSourceProvider ; import com . asakusafw . testdriver . core . SpiDataModelSourceProvider ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; public class ExcelSheetSourceProviderTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; @ Test public void open_bynumber ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , ":1" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; Simple s1 = next ( source ) ; assertThat ( s1 . number , is ( 200 ) ) ; assertThat ( s1 . text , is ( "bbb" ) ) ; end ( source ) ; } @ Test public void open_byname ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , "c" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; Simple s1 = next ( source ) ; assertThat ( s1 . number , is ( 300 ) ) ; assertThat ( s1 . text , is ( "ccc" ) ) ; end ( source ) ; } @ Test public void spi ( ) throws Exception { DataModelSourceProvider provider = new SpiDataModelSourceProvider ( ExcelSheetSourceProvider . class . getClassLoader ( ) ) ; URI uri = uri ( "" , ":1" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; Simple s1 = next ( source ) ; assertThat ( s1 . number , is ( 200 ) ) ; assertThat ( s1 . text , is ( "bbb" ) ) ; end ( source ) ; } @ Test public void integration ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , "input" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; Simple s1 = next ( source ) ; assertThat ( s1 . number , is ( 100 ) ) ; assertThat ( s1 . text , is ( "aaa" ) ) ; Simple s2 = next ( source ) ; assertThat ( s2 . number , is ( 200 ) ) ; assertThat ( s2 . text , is ( "bbb" ) ) ; Simple s3 = next ( source ) ; assertThat ( s3 . number , is ( 300 ) ) ; assertThat ( s3 . text , is ( "ccc" ) ) ; end ( source ) ; } @ Test public void invalid_file ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , ":1" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , is ( nullValue ( ) ) ) ; } @ Test public void missing_fragment ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , null ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; Simple s1 = next ( source ) ; assertThat ( s1 . number , is ( 100 ) ) ; assertThat ( s1 . text , is ( "aaa" ) ) ; end ( source ) ; } @ Test public void invalid_fragment ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = uri ( "" , ":" ) ; DataModelSource source = provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; assertThat ( source , is ( nullValue ( ) ) ) ; } @ Test ( expected = IOException . class ) public void not_found ( ) throws Exception { ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider ( ) ; URI uri = new URI ( "" ) ; provider . open ( SIMPLE , uri , new TestContext . Empty ( ) ) ; } @ Test (
2,946
<s> package $ { package } . jobflow ; import $ { package } . modelgen . dmdl
2,947
<s> package org . oddjob . logging ; import java . io . OutputStream ; public class LoggingOutputStream extends AbstractLoggingOutput { private final LogLevel level ; private final LogEventSink consoleArchiver ; public LoggingOutputStream ( OutputStream existing , LogLevel level , LogEventSink consoleArchiver ) { super ( existing ) ; this . level = level ; this
2,948
<s> package com . asakusafw . modelgen . view . model ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class Join { public final Name table ; public final String alias ; public final List < On > condition ; public Join ( Name table , String alias , List < On > condition ) { if ( table == null ) { throw new IllegalArgumentException ( "" ) ; } if ( condition == null ) { throw new IllegalArgumentException ( "" ) ; } this . table = table ; this . alias = alias ; this . condition = Collections . unmodifiableList ( new ArrayList < On > ( condition ) ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( alias == null ) ? 0 : alias . hashCode ( ) ) ; result = prime * result + condition . hashCode ( ) ; result = prime * result + table . hashCode ( ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } Join other = ( Join ) obj ; if ( ! table . equals ( other . table ) ) {
2,949
<s> package com . aptana . rdt . internal . rake . view ; import org . eclipse . osgi . util . NLS ; public class RakeViewMessages extends NLS { private static final String BUNDLE_NAME = RakeViewMessages
2,950
<s> package fi . koku . services . entity . person . v1 ; import fi . koku . settings . KoKuPropertiesUtil ; public class PersonConstants { final public static String CUSTOMER_SERVICE_ENDPOINT = KoKuPropertiesUtil . get ( "" ) ; final public static String CUSTOMER_SERVICE_USER_ID = "marko" ; final public static String CUSTOMER_SERVICE_PASSWORD = "marko" ; final public static String KAHVA_SERVICE_FULL_URL = KoKuPropertiesUtil . get ( "" ) ; final public static String USER_INFORMATION_SERVICE_FULL_URL = KoKuPropertiesUtil . get ( "" ) ; final public static String USER_INFORMATION_SERVICE_USER_ID = "TODO" ; final public static String USER_INFORMATION_SERVICE_PASSWORD = "TODO" ; final public static String PERSON_SERVICE_DOMAIN_CUSTOMER = "" ; final public static String PERSON_SERVICE_DOMAIN_OFFICER = "" ; final public static String USER_INFO_SERVICE_ENDPOINT = KoKuPropertiesUtil .
2,951
<s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . search . RubySearchScopeFactory ; class SearchScopeHierarchyAction extends SearchScopeAction { private
2,952
<s> package net . bioclipse . opentox . api ; import java . util . HashMap ; import java . util . Map ; import net . bioclipse . core . domain . IStringMatrix ; import net . bioclipse . rdf . business . RDFManager ; public abstract class Model { private static RDFManager rdf = new RDFManager ( ) ; public static Map < String , String > getProperties ( String ontologyServer , String feature ) { String propertiesQuery = "" + " <" + feature + "" + "}" ; Map < String , String > properties = new HashMap
2,953
<s> package bonsai . app ; import java . io . IOException ; import java . util . Date ; import java . util . List ; import java . util . Locale ; import android . app . Activity ; import android . app . AlertDialog ; import android . content . Context ; import android . content . DialogInterface ; import android . content . Intent ; import android . database . Cursor ; import android . location . Address ; import android . location . Geocoder ; import android . location . Location ; import android . location . LocationListener ; import android . location . LocationManager ; import android . net . Uri ; import android . os . Bundle ; import android . util . Log ; import android . view . KeyEvent ; import android . view . Menu ; import android . view . MenuInflater ; import android . view . MenuItem ; import android . view . View ; import android . widget . ArrayAdapter ; import android . widget . EditText ; import android . widget . Spinner ; import android . widget . TextView ; import android . widget . Toast ; public class EditBonsaiActivity extends Activity { private BonsaiDbUtil bonsaidb ; private EditText editName ; private Spinner editFamily ; private EditText editAge ; private EditText editHeight ; private TextView photoURLtext ; private Spinner editSituation ; private EditText editpostCode ; private EditText editCountry ; private String name ; private String family ; private long age ; private int height ; private String photo ; private String localization ; private String situation ; private AlertDialog alert ; private AlertDialog deletealert ; private LocationManager locManager ; private LocationListener locListener ; @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . editbonsai ) ; editName = ( EditText ) findViewById ( R . id . editName ) ; editFamily = ( Spinner ) findViewById ( R . id . familySpinner ) ; ArrayAdapter < CharSequence > adapter = ArrayAdapter . createFromResource ( this , R . array . family_array , android . R . layout . simple_spinner_item ) ; adapter . setDropDownViewResource ( android . R . layout . simple_spinner_dropdown_item ) ; editFamily . setAdapter ( adapter ) ; editAge = ( EditText ) findViewById ( R . id . editAge ) ; editHeight = ( EditText ) findViewById ( R . id . editHeight ) ; photoURLtext = ( TextView ) findViewById ( R . id . photoURLtext ) ; editSituation = ( Spinner ) findViewById ( R . id . spinner1 ) ; ArrayAdapter < CharSequence > adapter2 = ArrayAdapter . createFromResource ( this , R . array . situation_array , android . R . layout . simple_spinner_item ) ; adapter2 . setDropDownViewResource ( android . R . layout . simple_spinner_dropdown_item ) ; editSituation . setAdapter ( adapter2 ) ; editpostCode = ( EditText ) findViewById ( R . id . editPostCode ) ; editCountry = ( EditText ) findViewById ( R . id . editCountry ) ; createCancelAlert ( ) ; createDeleteAlert ( ) ; bonsaidb = new BonsaiDbUtil ( this ) ; bonsaidb . open ( ) ; if ( AndroidProjectActivity . iamediting ) try { Cursor bonsai = bonsaidb . fetchBonsai ( AndroidProjectActivity . bonsaiactual ) ; startManagingCursor ( bonsai ) ; name = bonsai . getString ( bonsai . getColumnIndexOrThrow ( BonsaiDbUtil . KEY_NAME ) ) ; editName . setText ( name ) ; long date = new Date ( ) . getTime ( ) / ( 1000 * 60 * 60 ) ; age = ( date - bonsai . getLong ( bonsai . getColumnIndexOrThrow ( BonsaiDbUtil . KEY_AGE ) ) ) / ( 365 * 24 ) ; editAge . setText ( String . valueOf ( age ) ) ; height = bonsai . getInt ( bonsai . getColumnIndexOrThrow ( BonsaiDbUtil . KEY_HEIGHT ) ) ; editHeight . setText ( String . valueOf ( height ) ) ; photo = bonsai . getString ( bonsai . getColumnIndexOrThrow ( BonsaiDbUtil . KEY_PHOTO ) ) ; localization = bonsai . getString ( bonsai . getColumnIndexOrThrow ( BonsaiDbUtil . KEY_LOCALIZATION ) ) ; editCountry . setText ( localization . substring ( 6 , 8 ) ) ; editpostCode . setText ( localization . substring ( 0 , 5 ) ) ; if ( photo . length ( ) < 18 ) { photoURLtext . setText ( photo ) ; } else { photoURLtext . setText ( "..." + photo . substring ( ( photo . length ( ) - 18 ) , photo . length ( ) ) ) ; } bonsai . close ( ) ; } catch ( Exception e ) { Toast . makeText ( this , "" + e . toString ( ) , Toast . LENGTH_LONG ) . show ( ) ; } } @ Override public void onStop ( ) { super . onStop ( ) ; bonsaidb . close ( ) ; } public void selectImage ( View v ) { Intent intent = new Intent ( Intent . ACTION_PICK , android . provider . MediaStore . Images . Media . EXTERNAL_CONTENT_URI ) ; startActivityForResult ( intent , 0 ) ; } public void deleteImage ( View v ) { photo = "" ; photoURLtext . setText ( photo ) ; } @ Override protected void onActivityResult ( int requestCode , int resultCode , Intent data ) { super . onActivityResult ( requestCode , resultCode , data ) ; if ( resultCode == RESULT_OK ) { Uri targetUri = data . getData ( ) ; photo = targetUri . toString ( ) ; if ( photo . length ( ) < 18 ) { photoURLtext . setText ( photo ) ; } else { photoURLtext . setText ( "..." + photo . substring ( ( photo . length ( ) - 18 ) , photo . length ( ) ) ) ; } } } public void goSave ( View v ) { try { name = editName . getText ( ) . toString ( ) ; family = editFamily . getSelectedItem ( ) . toString ( ) ; age = Long . parseLong ( editAge . getText ( ) . toString ( ) ) ; height = Integer . parseInt ( editHeight . getText ( ) . toString ( ) ) ; situation = editSituation . getSelectedItem ( ) . toString ( ) ; localization = editpostCode . getText ( ) . toString ( ) + "," + editCountry . getText ( ) . toString ( ) ; if ( photoURLtext . getText ( ) . length ( ) < 2 ) photo = "" ; } catch ( Exception e ) { Toast . makeText ( this
2,954
<s> package org . rubypeople . rdt . internal . ui . search ; import java . util . ArrayList ; import java . util . HashMap ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . IToolBarManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . action . Separator ; import org . eclipse . jface . util . TransferDragSourceListener ; import org . eclipse . jface . viewers . DecoratingLabelProvider ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . OpenEvent ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . jface . viewers . TableViewer ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . search . ui . IContextMenuConstants ; import org . eclipse . search . ui . ISearchResult ; import org . eclipse . search . ui . ISearchResultViewPart ; import org . eclipse . search . ui . NewSearchUI ; import org . eclipse . search . ui . SearchResultEvent ; import org . eclipse . search . ui . text . AbstractTextSearchResult ; import org . eclipse . search . ui . text . AbstractTextSearchViewPage ; import org . eclipse . search . ui . text . Match ; import org . eclipse . swt . SWT ; import org . eclipse . swt . dnd . DND ; import org . eclipse . swt . dnd . Transfer ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Item ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . Tree ; import org . eclipse . swt . widgets . Widget ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IPageLayout ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . actions . ActionContext ; import org . eclipse . ui . dialogs . PreferencesUtil ; import org . eclipse . ui . ide . IDE ; import org . eclipse . ui . part . IPageSite ; import org . eclipse . ui . part . IShowInTargetList ; import org . eclipse . ui . part . ResourceTransfer ; import org . eclipse . ui . texteditor . ITextEditor ; import org . eclipse . ui . views . navigator . LocalSelectionTransfer ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . dnd . RdtViewerDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . ResourceTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . SelectionTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . search . RubySearchResult . MatchFilterEvent ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . viewsupport . ProblemTableViewer ; import org . rubypeople . rdt . internal . ui . viewsupport . ProblemTreeViewer ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . search . IMatchPresentation ; import com . ibm . icu . text . Collator ; public class RubySearchResultPage extends AbstractTextSearchViewPage implements IAdaptable { public static class DecoratorIgnoringViewerSorter extends ViewerSorter { private final ILabelProvider fLabelProvider ; private Collator fNewCollator ; public DecoratorIgnoringViewerSorter ( ILabelProvider labelProvider ) { super ( null ) ; fLabelProvider = labelProvider ; fNewCollator = null ; } public int compare ( Viewer viewer , Object e1 , Object e2 ) { String name1 = fLabelProvider . getText ( e1 ) ; String name2 = fLabelProvider . getText ( e2 ) ; if ( name1 == null ) name1 = "" ; if ( name2 == null ) name2 = "" ; return getNewCollator ( ) . compare ( name1 , name2 ) ; } public final java . text . Collator getCollator ( ) { if ( collator == null ) { collator = java . text . Collator . getInstance ( ) ; } return collator ; } private final Collator getNewCollator ( ) { if ( fNewCollator == null ) { fNewCollator = Collator . getInstance ( ) ; } return fNewCollator ; } } private static final int DEFAULT_ELEMENT_LIMIT = 1000 ; private static final String FALSE = "FALSE" ; private static final String TRUE = "TRUE" ; private static final String KEY_GROUPING = "" ; private static final String KEY_SORTING = "" ; private static final String KEY_LIMIT_ENABLED = "" ; private static final String KEY_LIMIT = "" ; private static final String GROUP_GROUPING = "" ; private static final String GROUP_FILTERING = "" ; private NewSearchViewActionGroup fActionGroup ; private RubySearchContentProvider fContentProvider ; private int fCurrentSortOrder ; private SortAction fSortByNameAction ; private SortAction fSortByParentName ; private SortAction fSortByPathAction ; private GroupAction fGroupTypeAction ; private GroupAction fGroupFileAction ; private GroupAction fGroupPackageAction ; private GroupAction fGroupProjectAction ; private int fCurrentGrouping ; private FilterAction [ ] fFilterActions ; private FiltersDialogAction fFilterDialogAction ; private static final String [ ] SHOW_IN_TARGETS = new String [ ] { RubyUI . ID_RUBY_EXPLORER , IPageLayout . ID_RES_NAV } ; public static final IShowInTargetList SHOW_IN_TARGET_LIST = new IShowInTargetList ( ) { public String [ ] getShowInTargetIds ( ) { return SHOW_IN_TARGETS ; } } ; private RubySearchEditorOpener fEditorOpener = new RubySearchEditorOpener ( ) ; private boolean fLimitElements = false ; private int fElementLimit ; public RubySearchResultPage ( ) { initSortActions ( ) ; initGroupingActions ( ) ; initFilterActions ( ) ; } private void initFilterActions ( ) { MatchFilter [ ] allFilters = MatchFilter . allFilters ( ) ; fFilterActions = new FilterAction [ allFilters . length ] ; for ( int i = 0 ; i < fFilterActions . length ; i ++ ) { fFilterActions [ i ] = new FilterAction ( this , allFilters [ i ] ) ; fFilterActions [ i ] . setId ( "" + i ) ; } fFilterDialogAction = new FiltersDialogAction ( this ) ; fFilterDialogAction . setId ( "" + allFilters . length ) ; RubyPluginImages . setLocalImageDescriptors ( fFilterDialogAction , "" ) ; } private void initSortActions ( ) { fSortByNameAction = new SortAction ( SearchMessages . RubySearchResultPage_sortByName , this , SortingLabelProvider . SHOW_ELEMENT_CONTAINER ) ; fSortByPathAction = new SortAction ( SearchMessages . RubySearchResultPage_sortByPath , this , SortingLabelProvider . SHOW_PATH ) ; fSortByParentName = new SortAction ( SearchMessages . RubySearchResultPage_sortByParentName , this , SortingLabelProvider . SHOW_CONTAINER_ELEMENT ) ; } private void initGroupingActions ( ) { fGroupProjectAction = new GroupAction ( SearchMessages . RubySearchResultPage_groupby_project , SearchMessages . RubySearchResultPage_groupby_project_tooltip , this , LevelTreeContentProvider . LEVEL_PROJECT ) ; RubyPluginImages . setLocalImageDescriptors ( fGroupProjectAction , "prj_mode.gif" ) ; fGroupPackageAction = new GroupAction ( SearchMessages . RubySearchResultPage_groupby_package , SearchMessages . RubySearchResultPage_groupby_package_tooltip , this , LevelTreeContentProvider . LEVEL_PACKAGE ) ; RubyPluginImages . setLocalImageDescriptors ( fGroupPackageAction , "" ) ; fGroupFileAction = new GroupAction ( SearchMessages . RubySearchResultPage_groupby_file , SearchMessages . RubySearchResultPage_groupby_file_tooltip , this , LevelTreeContentProvider . LEVEL_FILE ) ; RubyPluginImages . setLocalImageDescriptors ( fGroupFileAction , "" ) ; fGroupTypeAction = new GroupAction ( SearchMessages . RubySearchResultPage_groupby_type , SearchMessages . RubySearchResultPage_groupby_type_tooltip , this , LevelTreeContentProvider . LEVEL_TYPE ) ; RubyPluginImages . setLocalImageDescriptors ( fGroupTypeAction , "" ) ; } public void setViewPart ( ISearchResultViewPart part ) { super . setViewPart ( part ) ; fActionGroup = new NewSearchViewActionGroup ( part ) ; } public void showMatch ( Match match , int offset , int length , boolean activate ) throws PartInitException { IEditorPart editor ; try { editor = fEditorOpener . openMatch ( match ) ; } catch ( RubyModelException e ) { throw new PartInitException ( e . getStatus ( ) ) ; } if ( editor != null && activate ) editor . getEditorSite ( ) . getPage ( ) . activate ( editor ) ; Object element = match . getElement ( ) ; if ( editor instanceof ITextEditor ) { ITextEditor textEditor = ( ITextEditor ) editor ; textEditor . selectAndReveal ( offset , length ) ; } else if ( editor != null ) { if ( element instanceof IFile ) { IFile file = ( IFile ) element ; showWithMarker ( editor , file , offset , length ) ; } } else { RubySearchResult result = ( RubySearchResult ) getInput ( ) ; IMatchPresentation participant = result . getSearchParticpant ( element ) ; if ( participant != null ) participant . showMatch ( match , offset , length , activate ) ; } } private void showWithMarker ( IEditorPart editor , IFile file , int offset , int length ) throws PartInitException { try { IMarker marker = file . createMarker ( NewSearchUI . SEARCH_MARKER ) ; HashMap attributes = new HashMap ( 4 ) ; attributes . put ( IMarker . CHAR_START , new Integer ( offset ) ) ; attributes . put ( IMarker . CHAR_END , new Integer ( offset + length ) ) ; marker . setAttributes ( attributes ) ; IDE . gotoMarker ( editor , marker ) ; marker . delete ( ) ; } catch ( CoreException e ) { throw new PartInitException ( SearchMessages . RubySearchResultPage_error_marker , e ) ; } } protected void fillContextMenu ( IMenuManager mgr ) { super . fillContextMenu ( mgr ) ; addSortActions ( mgr ) ; fActionGroup . setContext ( new ActionContext ( getSite ( ) . getSelectionProvider ( ) . getSelection ( ) ) ) ; fActionGroup . fillContextMenu ( mgr ) ; } private void addSortActions ( IMenuManager mgr ) { if ( getLayout ( ) != FLAG_LAYOUT_FLAT ) return ; MenuManager sortMenu = new MenuManager ( SearchMessages . RubySearchResultPage_sortBylabel ) ; sortMenu . add ( fSortByNameAction ) ; sortMenu . add ( fSortByPathAction ) ; sortMenu . add ( fSortByParentName ) ; fSortByNameAction . setChecked ( fCurrentSortOrder == fSortByNameAction . getSortOrder ( ) ) ; fSortByPathAction . setChecked ( fCurrentSortOrder == fSortByPathAction . getSortOrder ( ) ) ; fSortByParentName . setChecked ( fCurrentSortOrder == fSortByParentName . getSortOrder ( ) ) ; mgr . appendToGroup ( IContextMenuConstants . GROUP_VIEWER_SETUP , sortMenu ) ; } protected void fillToolbar ( IToolBarManager tbm ) { super . fillToolbar ( tbm ) ; if ( getLayout ( ) != FLAG_LAYOUT_FLAT ) addGroupActions ( tbm ) ; } private void addGroupActions ( IToolBarManager mgr ) { mgr . appendToGroup ( IContextMenuConstants . GROUP_VIEWER_SETUP , new Separator ( GROUP_GROUPING ) ) ; mgr . appendToGroup ( GROUP_GROUPING , fGroupProjectAction ) ; mgr . appendToGroup ( GROUP_GROUPING , fGroupPackageAction ) ; mgr . appendToGroup ( GROUP_GROUPING , fGroupFileAction ) ; mgr . appendToGroup ( GROUP_GROUPING , fGroupTypeAction ) ; updateGroupingActions ( ) ; } private void updateGroupingActions ( ) { fGroupProjectAction . setChecked ( fCurrentGrouping == LevelTreeContentProvider . LEVEL_PROJECT ) ; fGroupPackageAction . setChecked ( fCurrentGrouping == LevelTreeContentProvider . LEVEL_PACKAGE ) ; fGroupFileAction . setChecked ( fCurrentGrouping == LevelTreeContentProvider . LEVEL_FILE ) ; fGroupTypeAction . setChecked ( fCurrentGrouping == LevelTreeContentProvider . LEVEL_TYPE ) ; } public void dispose ( ) { fActionGroup . dispose ( ) ; super . dispose ( ) ; } protected void elementsChanged ( Object [ ] objects ) { if ( fContentProvider != null ) fContentProvider . elementsChanged ( objects ) ; } protected void clear ( ) { if ( fContentProvider != null ) fContentProvider . clear ( ) ; } private void addDragAdapters ( StructuredViewer viewer ) { Transfer [ ] transfers = new Transfer [ ] { LocalSelectionTransfer . getInstance ( ) , ResourceTransfer . getInstance ( ) } ; int ops = DND . DROP_COPY | DND . DROP_LINK ; TransferDragSourceListener [ ] dragListeners = new TransferDragSourceListener [ ] { new SelectionTransferDragAdapter ( viewer ) , new ResourceTransferDragAdapter ( viewer ) } ; viewer . addDragSupport ( ops , transfers , new RdtViewerDragAdapter ( viewer , dragListeners ) ) ; } protected void configureTableViewer ( TableViewer viewer ) { viewer . setUseHashlookup ( true ) ; SortingLabelProvider sortingLabelProvider = new SortingLabelProvider ( this
2,955
<s> package org . rubypeople . rdt . refactoring . tests . core ; import java . util . ArrayList ; import java . util . Iterator ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . IRefactoringContext ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . core . RefactoringContext ; import org . rubypeople . rdt . refactoring . core .
2,956
<s> package de . fuberlin . wiwiss . d2rq . sql ; import java . sql . SQLException ; import java . sql . Statement ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import junit . framework . TestCase ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . rdf . model . ResourceFactory ; import com . hp . hpl . jena . util . iterator . ExtendedIterator ; import de . fuberlin . wiwiss . d2rq . algebra . RelationName ; import de . fuberlin . wiwiss . d2rq . dbschema . DatabaseSchemaInspector ; import de . fuberlin . wiwiss . d2rq . jena . GraphD2RQ ; import de . fuberlin . wiwiss . d2rq . map . ClassMap ; import de . fuberlin . wiwiss . d2rq . map . Database ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; import de . fuberlin . wiwiss . d2rq . map . PropertyBridge ; public abstract class DatatypeTestBase extends TestCase { private final static String EX = "" ; private final static Resource dbURI = ResourceFactory . createResource ( EX + "db" ) ; private final static Resource classMapURI = ResourceFactory . createResource ( EX + "classmap" ) ; private final static Resource propertyBridgeURI = ResourceFactory . createResource ( EX + "" ) ; private final static Resource valueProperty = ResourceFactory . createProperty ( EX + "value" ) ; private String jdbcURL ; private String driver ; private String user ; private String password ; private String schema ;
2,957
<s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . jruby . ast . CallNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . VCallNode ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . parser . InOrderVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; class CalleeAnalyzerVisitor extends InOrderVisitor { private IMethod fMethod ; private CallSearchResultCollector fSearchResults ; private IProgressMonitor fProgressMonitor ; private int fMethodStartPosition ; private int fMethodEndPosition ; public CalleeAnalyzerVisitor ( IMethod method , IProgressMonitor progressMonitor ) { fSearchResults = new CallSearchResultCollector ( ) ; this . fMethod = method ; this . fProgressMonitor = progressMonitor ; try { ISourceRange sourceRange = method . getSourceRange ( ) ; this . fMethodStartPosition = sourceRange . getOffset ( ) ; this . fMethodEndPosition = fMethodStartPosition + sourceRange . getLength ( ) ; } catch ( RubyModelException jme ) { RubyPlugin . log ( jme ) ; } } private void addMethodCall ( ISourcePosition pos ) { int offset = pos . getStartOffset ( ) ; int endOffset = pos . getEndOffset ( ) ; int length = endOffset - offset ; try { IRubyElement [ ] elements = fMethod . getRubyScript ( ) . codeSelect ( offset , length ) ; if ( elements == null ) return ; for ( int i = 0 ; i < elements . length ; i ++ ) { if ( elements [ i ] instanceof IMember ) { IMember member = ( IMember ) elements [ i ] ; fSearchResults . addMember ( fMethod , member , offset , endOffset , pos . getStartLine ( ) ) ; } } } catch ( RubyModelException e ) { RubyPlugin . log ( e ) ; } } public Map < String , MethodCall > getCallees ( ) { return fSearchResults . getCallers ( ) ; } @ Override public Object visitVCallNode ( VCallNode iVisited ) { if ( isNodeWithinMethod ( iVisited ) ) { addMethodCall ( iVisited . getPosition ( ) ) ; } return super . visitVCallNode ( iVisited ) ; } @ Override public Object visitFCallNode ( FCallNode iVisited ) { if ( isNodeWithinMethod ( iVisited ) ) { addMethodCall ( iVisited . getPosition ( ) ) ; } return super . visitFCallNode ( iVisited ) ; } @ Override public Object visitCallNode ( CallNode iVisited ) { if ( isNodeWithinMethod ( iVisited ) )
2,958
<s> package com . asakusafw . yaess . multidispatch ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . lang . ref . Reference ; import java . lang . ref . SoftReference ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitor ; import com . asakusafw . yaess . core . ExecutionScript ; import com . asakusafw . yaess . core . ExecutionScriptHandler ; import com . asakusafw . yaess . core . ServiceProfile ; import com . asakusafw . yaess . core . YaessLogger ; import com . asakusafw . yaess . core . util . PropertiesUtil ; public abstract class ExecutionScriptHandlerDispatcher < T extends ExecutionScript > implements ExecutionScriptHandler < T > { static final YaessLogger YSLOG = new YaessMultiDispatchLogger ( ExecutionScriptHandlerDispatcher . class ) ; static final Logger LOG = LoggerFactory . getLogger ( ExecutionScriptHandlerDispatcher . class ) ; private static final String LABEL_UNDEFINED = "(undefined)" ; static final String PREFIX_CONF = "conf" ; static final String KEY_DIRECTORY = PREFIX_CONF + ".directory" ; static final String KEY_SETUP = PREFIX_CONF + ".setup" ; static final String KEY_CLEANUP = PREFIX_CONF + ".cleanup" ; static final String PREFIX_DEFAULT = "default" ; static final String SUFFIX_CONF = ".properties" ; private final Class < ? extends ExecutionScriptHandler < T > > handlerKind ; private volatile String prefix ; private volatile File confDirectory ; private volatile Reference < Map < String , Properties > > confCache = new SoftReference < Map < String , Properties > > ( null ) ; private volatile Map < String , ExecutionScriptHandler < T > > delegations ; private volatile String forceSetUp ; private volatile String forceCleanUp ; protected ExecutionScriptHandlerDispatcher ( Class < ? extends ExecutionScriptHandler < T > > handlerKind ) { if ( handlerKind == null ) { throw new IllegalArgumentException ( "" ) ; } this . handlerKind = handlerKind ; } @ Override public void configure ( ServiceProfile < ? > profile ) throws IOException , InterruptedException { this . prefix = profile . getPrefix ( ) ; try { this . confDirectory = getConfDirectory ( profile ) ; this . delegations = getDelegations ( profile ) ; this . forceSetUp = profile . getConfiguration ( KEY_SETUP , false , true ) ; this . forceCleanUp = profile . getConfiguration ( KEY_CLEANUP , false , true ) ; } catch ( IllegalArgumentException e ) { throw new IOException ( MessageFormat . format ( "" , profile . getPrefix ( ) , profile . getServiceClass ( ) . getName ( ) ) , e ) ; } if ( forceSetUp != null && delegations . containsKey ( forceSetUp ) == false ) { throw new IOException ( MessageFormat . format ( "" , profile . getPrefix ( ) , KEY_SETUP , forceSetUp ) ) ; } if ( forceCleanUp != null && delegations . containsKey ( forceCleanUp ) == false ) { throw new IOException ( MessageFormat . format ( "" , profile . getPrefix ( ) , KEY_CLEANUP , forceCleanUp ) ) ; } } private File getConfDirectory ( ServiceProfile < ? > profile ) { assert profile != null ; String value = profile . getConfiguration ( KEY_DIRECTORY , true , true ) ; File dir = new File ( value ) ; if ( dir . exists ( ) == false ) { YSLOG . info ( "I00001" , profile . getPrefix ( ) , KEY_DIRECTORY , value ) ; } return dir ; } private Map < String , ExecutionScriptHandler < T > > getDelegations ( ServiceProfile < ? > profile ) throws IOException , InterruptedException { assert profile != null ; Map < String , String > conf = profile . getConfiguration ( ) ; Set < String > keys = PropertiesUtil . getChildKeys ( conf , "" , "." ) ; keys . remove ( PREFIX_CONF ) ; if ( keys . contains ( PREFIX_DEFAULT ) == false ) { throw new IOException ( MessageFormat . format ( "" , profile . getPrefix ( ) , PREFIX_DEFAULT ) ) ; } Properties properties = new Properties ( ) ; for ( Map . Entry < String , String > entry : conf . entrySet ( ) ) { String key = profile . getPrefix ( ) + "." + entry . getKey ( ) ; String value = entry . getValue ( ) ; properties . setProperty ( key , value ) ; } Map < String , ExecutionScriptHandler < T > > results = new HashMap < String , ExecutionScriptHandler < T > > ( ) ; for ( String key : keys ) { String subPrefix = profile . getPrefix ( ) + "." + key ; ServiceProfile < ? extends ExecutionScriptHandler < T > > subProfile ; try { subProfile = ServiceProfile . load ( properties , subPrefix , handlerKind , profile . getContext ( ) ) ; } catch ( IllegalArgumentException e ) { throw new IOException ( MessageFormat . format ( "" , subPrefix ) , e ) ; } ExecutionScriptHandler < T > subInstance = subProfile . newInstance ( ) ; results . put ( key , subInstance ) ; } return results ; } @ Override public String getHandlerId ( ) { return prefix ; } private ExecutionScriptHandler < T > resolve ( ExecutionContext context , ExecutionScript script ) throws IOException { assert context != null ; Properties batchConf = getBatchConf ( context , script ) ; String key = findKey ( context , script , batchConf ) ; if ( key != null ) { ExecutionScriptHandler < T > target = delegations . get ( key ) ; if ( target != null ) { return target ; } throw new IOException ( MessageFormat . format ( "" + "" , context . getBatchId ( ) , context . getFlowId ( ) , context . getPhase ( ) , script == null ? LABEL_UNDEFINED : script . getId ( ) , key ) ) ; } ExecutionScriptHandler < T > defaultTarget = delegations . get ( PREFIX_DEFAULT ) ; assert defaultTarget != null ; return defaultTarget ; } private String findKey ( ExecutionContext context , ExecutionScript script , Properties batchConf ) { if ( batchConf != null ) { for ( FindPattern pattern : FindPattern . values ( ) ) { String key = pattern . getKey ( context , script ) ; if ( key == null ) { continue ; } String value = batchConf . getProperty ( key ) ; if ( value == null ) { continue ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "" , new Object [ ] { context . getBatchId ( ) , context . getFlowId ( ) , context . getPhase ( ) , script == null ? LABEL_UNDEFINED : script . getId ( ) , key , value , } ) ; } return value ; } } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "" , new Object [ ] { context . getBatchId ( ) , context . getFlowId ( ) , context . getPhase ( ) . getSymbol ( ) , script == null ? LABEL_UNDEFINED : script . getId ( ) , } ) ; } return null ; } private Properties getBatchConf ( ExecutionContext context , ExecutionScript script ) throws IOException { assert context != null ; Map < String , Properties > cached = confCache . get ( ) ; if ( cached != null ) { String batchId = context . getBatchId ( ) ; synchronized ( this ) { if ( cached . containsKey ( batchId ) ) { return cached . get ( batchId ) ; } } } Properties batchConf = loadBatchConf ( context , script ) ; synchronized ( this ) { cached = confCache . get ( ) ; if ( cached == null ) { cached = new HashMap < String , Properties > ( ) ; confCache = new SoftReference < Map < String , Properties > > ( cached ) ; } cached . put ( context . getBatchId ( ) , batchConf ) ; } return batchConf ; } private Properties loadBatchConf ( ExecutionContext context , ExecutionScript script ) throws IOException { assert context != null ; String fileName = context . getBatchId ( ) + SUFFIX_CONF ; File file = new File ( confDirectory , fileName ) ; LOG . debug ( "" , context . getBatchId ( ) , file ) ; if ( file . isFile ( ) == false ) { LOG . debug ( "" , context . getBatchId ( ) , file ) ; return null ; } LOG . debug ( "" , context . getBatchId ( ) , file ) ; try { InputStream in = new FileInputStream ( file ) ; try { Properties properties = new
2,959
<s> package org . rubypeople . rdt . internal . ui . compare ; import java . io . UnsupportedEncodingException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . compare . CompareUI ; import org . eclipse . compare . IEditableContent ; import org . eclipse . compare . IEncodedStreamContentAccessor ; import org . eclipse . compare . IResourceProvider ; import org . eclipse . compare . IStreamContentAccessor ; import org . eclipse . compare . ITypedElement ; import org . eclipse . compare . structuremergeviewer . DiffNode ; import org . eclipse . compare . structuremergeviewer . Differencer ; import org . eclipse . compare . structuremergeviewer . DocumentRangeNode ; import org . eclipse . compare . structuremergeviewer . ICompareInput ; import org . eclipse . compare . structuremergeviewer . IDiffContainer ; import org . eclipse . compare . structuremergeviewer . IDiffElement ; import org . eclipse . compare . structuremergeviewer . IStructureComparator ; import org . eclipse . compare . structuremergeviewer . IStructureCreator ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class RubyStructureCreator implements IStructureCreator { private Map fDefaultCompilerOptions ; static class RewriteInfo { boolean fIsOut = false ; RubyNode fAncestor = null ; RubyNode fLeft = null ; RubyNode fRight = null ; ArrayList fChildren = new ArrayList ( ) ; void add ( IDiffElement diff ) { fChildren . add ( diff ) ; } void setDiff ( ICompareInput diff ) { if ( fIsOut ) return ; fIsOut = true ; RubyNode a = ( RubyNode ) diff . getAncestor ( ) ; RubyNode y = ( RubyNode ) diff . getLeft ( ) ; RubyNode m = ( RubyNode ) diff . getRight ( ) ; if ( a != null ) { if ( fAncestor != null ) return ; fAncestor = a ; } if ( y != null ) { if ( fLeft != null ) return ; fLeft = y ; } if ( m != null ) { if ( fRight != null ) return ; fRight = m ; } fIsOut = false ; } boolean matches ( ) { return ! fIsOut && fAncestor != null && fLeft != null && fRight != null ; } } public RubyStructureCreator ( ) { } void setDefaultCompilerOptions ( Map compilerSettings ) { fDefaultCompilerOptions = compilerSettings ; } public String getName ( ) { return CompareMessages . RubyStructureViewer_title ; } public IStructureComparator getStructure ( final Object input ) { String contents = null ; char [ ] buffer = null ; IDocument doc = CompareUI . getDocument ( input ) ; if ( doc == null ) { if ( input instanceof IStreamContentAccessor ) { IStreamContentAccessor sca = ( IStreamContentAccessor ) input ; try { contents = RubyCompareUtilities . readString ( sca ) ; } catch ( CoreException ex ) { return null ; } } if ( contents != null ) { int n = contents . length ( ) ; buffer = new char [ n ] ; contents . getChars ( 0 , n , buffer , 0 ) ; doc = new Document ( contents ) ;
2,960
<s> package org . rubypeople . rdt . core . formatter ; import java . io . BufferedReader ; import java . io . FileOutputStream ; import java . io . FileReader ; import java . io . IOException ; import java . io . StringWriter ; import junit . framework . TestCase ; import org . jruby . ast . ArgumentNode ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . ConstNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . Node ; import org . jruby . ast . PostExeNode ; import org . jruby . ast . RegexpNode ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . jruby . util . ByteList ; public class TestReWriteVisitor extends TestCase { static final IDESourcePosition emptyPosition = new IDESourcePosition ( "" , 0 , 0 , 0 , 0 ) ; private String visitNode ( Node n ) { StringWriter out = new StringWriter ( ) ; ReWriteVisitor visitor = new ReWriteVisitor ( out , "" ) ; n . accept ( visitor ) ; visitor . flushStream ( ) ; return out . getBuffer ( ) . toString ( ) ; } public void testVisitRegexpNode ( ) { RegexpNode n = new RegexpNode ( new IDESourcePosition ( "" , 0 , 0 , 2 , 4 ) , ByteList . create ( ".*" ) , 0 ) ; assertEquals ( "/.*/" , visitNode ( n ) ) ; } public void testGetLocalVarIndex ( ) { assertEquals ( ReWriteVisitor . getLocalVarIndex ( new LocalVarNode ( emptyPosition , 5 , "" ) ) , 5 ) ; assertEquals ( ReWriteVisitor . getLocalVarIndex ( new LocalVarNode ( emptyPosition , 1 , "" ) ) , 1 ) ; assertEquals ( ReWriteVisitor . getLocalVarIndex ( null ) , - 1 ) ; } private ReWriteVisitor getVisitor ( ) { return new ReWriteVisitor ( new StringWriter ( ) , "" ) ; } public void testVisitPostExeNode ( ) { assertNull ( getVisitor ( ) . visitPostExeNode ( new PostExeNode ( emptyPosition , null ) ) ) ; } public
2,961
<s> package org . oddjob . jobs ; import java . io . OutputStream ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . deploy . annotations . ArooaHidden ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . reflect . ArooaClass ; import org . oddjob . arooa . reflect . BeanView ; import org . oddjob . arooa . reflect . BeanViews ; import org . oddjob . beanbus . BeanSheet ; import org . oddjob . beanbus . BusException ; import org . oddjob . beanbus . Destination ; import org . oddjob . beanbus . Driver ; import org . oddjob . beanbus . SimpleBus ; public class BeanReportJob implements Runnable , ArooaSessionAware { private String name ; private Iterable < ? > beans ; private OutputStream output ; private boolean noHeaders ; private ArooaSession session ; private BeanView beanView ; @ ArooaHidden @ Override public void setArooaSession ( ArooaSession session ) { this . session = session ; } @ Override public void run ( ) { if ( beans == null ) { throw new NullPointerException ( "No beans." ) ; } if (
2,962
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ExportTempImportTarget13 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ExportTempImportTarget13ModelOutput implements ModelOutput < ExportTempImportTarget13 > { private final RecordEmitter emitter ; public ExportTempImportTarget13ModelOutput ( RecordEmitter emitter ) { if ( emitter ==
2,963
<s> package net . sf . sveditor . core . srcgen ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBFieldItem ; import net . sf . sveditor . core . db . SVDBFunction ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . SVDBTypeInfo ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDimItem ; public class MethodGenerator { public String generate ( SVDBTask tf ) { StringBuilder new_tf = new StringBuilder ( ) ; String classname = "" ; String tf_type = ( tf . getType ( ) == SVDBItemType . Task ) ? "Task" : "Function" ; if ( tf . getParent ( ) != null && tf . getParent ( ) . getType ( ) == SVDBItemType . ClassDecl ) { classname = ( ( ISVDBNamedItem ) tf . getParent ( ) ) . getName ( ) ; } new_tf . append ( " /**n" + " * " + tf_type + ": " + tf . getName ( ) + "n" + " *n" + "" + classname + "n" + " */n" ) ; new_tf . append ( " " ) ; if ( ( tf . getAttr ( ) & SVDBFieldItem . FieldAttr_Virtual ) != 0 ) { new_tf . append ( "virtual " ) ; } if ( tf . getType ( ) == SVDBItemType . Function ) { SVDBTypeInfo ti = ( ( SVDBFunction ) tf ) . getReturnType ( ) ; new_tf . append ( "function " ) ; if ( ti != null ) { new_tf . append ( ti . toString ( ) ) ; new_tf . append ( " " ) ; } } else { new_tf . append ( "task " ) ; } new_tf . append ( tf . getName ( ) ) ; new_tf . append ( "(" ) ; for ( int i = 0 ; i < tf . getParams ( ) . size ( ) ; i ++ ) { SVDBParamPortDecl p = tf . getParams ( ) . get ( i ) ; SVDBTypeInfo ti = p . getTypeInfo ( ) ; if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Const ) != 0 ) { new_tf . append ( "const " ) ; } if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Ref ) != 0 ) { new_tf . append ( "ref " ) ; } else if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Var ) != 0 ) { new_tf . append ( "var " ) ; } else if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Input ) != 0 ) { new_tf . append ( "input " ) ; } else if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Output ) != 0 ) { new_tf . append ( "output " ) ; } else if ( ( p . getDir ( ) & SVDBParamPortDecl . Direction_Inout ) != 0 ) { new_tf . append ( "inout " ) ; } new_tf . append ( ti . toString ( ) ) ; new_tf . append ( " " ) ; for ( ISVDBChildItem c : p . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) c ; new_tf . append ( vi . getName ( ) ) ; if ( vi . getArrayDim ( ) != null ) { for ( SVDBVarDimItem di : vi . getArrayDim ( ) ) { switch ( di . getDimType ( ) ) { case Associative : new_tf . append ( "[" ) ; new_tf . append
2,964
<s> package de . fuberlin . wiwiss . d2rq . find ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import junit . framework . TestCase ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . sparql . vocabulary . FOAF ; import com . hp . hpl . jena . vocabulary . RDF ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . algebra . Join ; import de . fuberlin . wiwiss . d2rq . algebra . OrderSpec ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . algebra . RelationImpl ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . find . URIMakerRule . URIMakerRuleChecker ; import de . fuberlin . wiwiss . d2rq . nodes . FixedNodeMaker ; import de . fuberlin . wiwiss . d2rq . nodes . TypedNodeMaker ; import de . fuberlin . wiwiss . d2rq . values . Column ; import de . fuberlin . wiwiss . d2rq . values . Pattern ; public class URIMakerRuleTest extends TestCase { private TripleRelation withURIPatternSubject ; private TripleRelation withURIPatternSubjectAndObject ; private TripleRelation withURIColumnSubject ; private TripleRelation withURIPatternSubjectAndURIColumnObject ; private URIMakerRuleChecker employeeChecker ; private URIMakerRuleChecker foobarChecker ; public void setUp ( ) { Relation base = new RelationImpl ( null , AliasMap . NO_ALIASES , Expression . TRUE , Expression . TRUE , Collections . < Join > emptySet ( ) , Collections . < ProjectionSpec > emptySet ( ) , false , OrderSpec . NONE , Relation . NO_LIMIT , Relation . NO_LIMIT ) ; this . withURIPatternSubject = new TripleRelation ( base , new TypedNodeMaker ( TypedNodeMaker . URI , new Pattern ( "" ) , true ) , new FixedNodeMaker ( RDF . type . asNode ( ) , false ) , new FixedNodeMaker ( FOAF . Person . asNode ( ) , false ) ) ; this . withURIPatternSubjectAndObject = new TripleRelation ( base , new TypedNodeMaker ( TypedNodeMaker . URI , new Pattern ( "" ) , true ) , new FixedNodeMaker ( FOAF . knows . asNode ( ) , false ) , new TypedNodeMaker ( TypedNodeMaker . URI , new Pattern ( "" ) , true ) ) ; this . withURIColumnSubject = new TripleRelation ( base , new TypedNodeMaker ( TypedNodeMaker . URI , new Column ( new Attribute ( null , "employees" , "homepage" ) ) , false ) , new FixedNodeMaker ( RDF . type . asNode ( ) , false ) , new FixedNodeMaker ( FOAF . Document . asNode ( ) , false ) ) ; this . withURIPatternSubjectAndURIColumnObject = new TripleRelation ( base , new TypedNodeMaker ( TypedNodeMaker . URI , new Pattern ( "" ) , true ) , new FixedNodeMaker ( FOAF . homepage . asNode ( ) , false ) , new TypedNodeMaker ( TypedNodeMaker . URI , new Column ( new Attribute ( null , "employees" , "homepage" ) ) , false ) ) ; this . employeeChecker = new URIMakerRule ( ) . createRuleChecker ( Node . createURI ( "" ) ) ; this . foobarChecker = new URIMakerRule ( ) . createRuleChecker ( Node . createURI ( "" ) ) ; } public void testComparator ( ) { URIMakerRule u = new URIMakerRule ( ) ; assertEquals ( 0 , u . compare ( this . withURIPatternSubject , this . withURIPatternSubject ) ) ; assertEquals ( 1 , u . compare ( this . withURIPatternSubject , this . withURIPatternSubjectAndObject ) ) ; assertEquals ( - 1 , u . compare ( this . withURIPatternSubject , this . withURIColumnSubject ) ) ; assertEquals ( - 1 , u . compare ( this . withURIPatternSubject , this . withURIPatternSubjectAndURIColumnObject ) ) ; assertEquals ( - 1 , u . compare ( this . withURIPatternSubjectAndObject , this . withURIPatternSubject ) ) ; assertEquals ( 0 , u . compare ( this . withURIPatternSubjectAndObject , this . withURIPatternSubjectAndObject ) ) ; assertEquals ( - 1 , u . compare ( this . withURIPatternSubjectAndObject , this . withURIColumnSubject ) ) ; assertEquals ( - 1 , u . compare ( this . withURIPatternSubjectAndObject , this . withURIPatternSubjectAndURIColumnObject ) ) ; assertEquals ( 1 , u . compare ( this . withURIColumnSubject , this . withURIPatternSubject ) ) ; assertEquals ( 1 , u . compare ( this . withURIColumnSubject , this . withURIPatternSubjectAndObject ) ) ; assertEquals ( 0 , u . compare ( this . withURIColumnSubject , this . withURIColumnSubject ) ) ; assertEquals ( 1 , u . compare ( this . withURIColumnSubject , this . withURIPatternSubjectAndURIColumnObject ) ) ; assertEquals ( 1 , u . compare ( this .
2,965
<s> package net . ggtools . grand . ui . graph . draw2d ; import net . ggtools . grand . ui . Application ; import net . ggtools . grand . ui . graph . DotGraphAttributes ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . eclipse . draw2d . Label ; import org . eclipse . draw2d . text . BlockFlow ; import org . eclipse . draw2d . text . FlowPage ; import org . eclipse . draw2d . text . InlineFlow ; import org . eclipse . draw2d . text . TextFlow ; import sf . jzgraph . IVertex ; public class NodeTooltip extends AbstractGraphTooltip implements DotGraphAttributes { private static final Log log = LogFactory . getLog ( NodeTooltip . class ) ; private final IVertex vertex ; public NodeTooltip ( final IVertex vertex ) { super ( ) ; this . vertex = vertex ; createContents ( ) ; } @ Override protected void createContents ( ) { final Label name = new Label ( vertex . getName ( ) , Application . getInstance ( ) . getImage ( Application . NODE_ICON ) ) ; name . setFont ( Application . getInstance ( ) . getBoldFont ( Application . TOOLTIP_FONT ) ) ; add ( name ) ; FlowPage page = null ; if ( vertex . hasAttr ( BUILD_FILE_ATTR ) )
2,966
<s> package com . asakusafw . windgate . core ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; import java . util . Properties ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . core . process . ProcessProfile ; import com . asakusafw . windgate . core . process . ProcessProvider ; import com . asakusafw . windgate . core . resource . ResourceProfile ; import com . asakusafw . windgate . core . session . SessionProfile ; public class GateProfile { static final WindGateLogger WGLOG = new WindGateCoreLogger ( GateProfile . class ) ; static final Logger LOG = LoggerFactory . getLogger ( GateProfile . class ) ; private final String name ; private final CoreProfile core ; private final SessionProfile session ; private final List < ProcessProfile > processes ; private final List < ResourceProfile > resources ; public GateProfile ( String name , CoreProfile core , SessionProfile session , Collection < ? extends ProcessProfile > processes , Collection < ? extends ResourceProfile > resources ) { if ( core == null ) { throw new IllegalArgumentException ( "" ) ; } if ( session == null ) { throw new IllegalArgumentException ( "" ) ; } if ( processes == null ) { throw new IllegalArgumentException ( "" ) ; } if ( resources == null ) { throw new IllegalArgumentException ( "" ) ; } this . name = name ; this . core = core ; this . session = session ; this . processes = Collections . unmodifiableList ( new ArrayList < ProcessProfile > ( processes ) ) ; this . resources = Collections . unmodifiableList ( new ArrayList < ResourceProfile > ( resources ) ) ; } public String getName ( ) { return name ; } public CoreProfile getCore ( ) { return core ; } public SessionProfile getSession ( ) { return session ; } public List < ProcessProfile > getProcesses ( ) { return processes ; } public List < ResourceProfile > getResources ( ) { return resources ; } @ Deprecated public static GateProfile loadFrom ( String name , Properties properties , ClassLoader loader ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } if ( loader == null ) { throw new IllegalArgumentException ( "" ) ; } return loadFrom ( name , properties , ProfileContext . system ( loader )
2,967
<s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . net . URI ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . testdriver . rule . VerifyRuleBuilder ; import com . asakusafw . vocabulary . external . ExporterDescription ; @ Deprecated public class TestResultInspector { static final Logger LOG = LoggerFactory . getLogger ( TestResultInspector . class ) ; private final DataModelAdapter adapter ; private final DataModelSourceProvider sources ; private final VerifyRuleProvider rules ; private final ExporterRetriever < ExporterDescription > targets ; private final TestContext context ; public TestResultInspector ( ClassLoader serviceClassLoader ) { this ( new TestContext . Empty ( ) , serviceClassLoader ) ; } public TestResultInspector ( DataModelAdapter adapter , DataModelSourceProvider sources , VerifyRuleProvider rules , ExporterRetriever < ExporterDescription > retrievers ) { this ( new TestContext . Empty ( ) , adapter , sources , rules , retrievers ) ; } public TestResultInspector ( TestContext context , ClassLoader serviceClassLoader ) { if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } if ( serviceClassLoader == null ) { throw new IllegalArgumentException ( "" ) ; } this . context = context ; this . adapter = new SpiDataModelAdapter ( serviceClassLoader ) ; this . sources = new SpiDataModelSourceProvider ( serviceClassLoader ) ; this . rules = new SpiVerifyRuleProvider ( serviceClassLoader ) ; this . targets = new SpiExporterRetriever ( serviceClassLoader ) ; } public TestResultInspector ( TestContext context , DataModelAdapter adapter , DataModelSourceProvider sources , VerifyRuleProvider rules , ExporterRetriever < ExporterDescription > retrievers ) { if ( adapter == null ) { throw new IllegalArgumentException ( "" ) ; } if ( sources == null ) { throw new IllegalArgumentException ( "" ) ; } if ( rules == null ) { throw new IllegalArgumentException ( "" ) ; } if ( retrievers == null ) { throw new IllegalArgumentException ( "" ) ; } this . context = context ; this . adapter = adapter ; this . sources = sources ; this . rules = rules ; this . targets = retrievers ; } public List < Difference > inspect ( Class < ? > modelClass , ExporterDescription description , VerifyContext verifyContext , URI expected , URI rule ) throws IOException { if ( modelClass == null ) { throw new IllegalArgumentException ( "" ) ; } if ( description == null ) { throw new IllegalArgumentException ( "" ) ; } if ( verifyContext == null ) { throw new IllegalArgumentException ( "" ) ; } if ( expected == null ) { throw new IllegalArgumentException ( "" ) ; } if ( rule == null ) { throw new IllegalArgumentException ( "" ) ; } DataModelDefinition < ? > definition = findDefinition ( modelClass ) ; VerifyRule ruleDesc = findRule ( definition , verifyContext , rule ) ; return inspect ( modelClass , description , expected , ruleDesc ) ; } public VerifyRuleBuilder rule ( Class < ? > modelClass ) throws IOException { if ( modelClass == null ) { throw new IllegalArgumentException ( "" ) ; } DataModelDefinition < ? > definition = findDefinition ( modelClass ) ; return new VerifyRuleBuilder ( definition ) ; } public < T > VerifyRule rule ( Class < ? extends T > modelClass , ModelVerifier < T > verifier ) throws IOException { if ( modelClass == null ) { throw new IllegalArgumentException ( "" ) ; } if ( verifier == null ) { throw new IllegalArgumentException ( "" ) ; } DataModelDefinition < ? extends T > definition = findDefinition ( modelClass ) ; return new ModelVerifierDriver < T > ( verifier , definition ) ; } public List < Difference > inspect ( Class < ? > modelClass , ExporterDescription description , URI expected , VerifyRule rule ) throws IOException { if ( modelClass == null ) { throw new IllegalArgumentException ( "" ) ; } if ( description == null ) { throw new IllegalArgumentException ( "" ) ; } if ( expected == null ) { throw new IllegalArgumentException ( "" ) ; } if ( rule == null ) { throw new IllegalArgumentException ( "" ) ; } DataModelDefinition < ? > definition = findDefinition ( modelClass ) ; DataModelSource expectedDesc = findSource ( definition , expected ) ; VerifyEngine engine = buildVerifier ( definition , rule , expectedDesc ) ; List < Difference > results = inspect ( definition , description , engine ) ; return results ; } private < T > DataModelDefinition < T > findDefinition ( Class < T > modelClass ) throws IOException { assert modelClass != null ; DataModelDefinition < T > definition = adapter . get ( modelClass ) ; if ( definition == null ) { throw new IOException ( MessageFormat . format ( ""
2,968
<s> package com . asakusafw . testdriver . json ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . text . SimpleDateFormat ; import java . util . Calendar ; import org . hamcrest . BaseMatcher ; import org . hamcrest . Description ; import org . hamcrest . Matcher ; import org . junit . Test ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; import com . google . gson . JsonObject ; public class JsonObjectDriverTest { @ Test public void simple ( ) throws Exception { DataModelDefinition < Simple > def = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; JsonObject json = new JsonObject ( ) ; json . addProperty ( "number" , 100 ) ; json . addProperty ( "text" , "" ) ; DataModelReflection ref = JsonObjectDriver . convert ( def , json ) ; Simple object = def . toObject ( ref ) ; assertThat ( object . number , is ( 100 ) ) ; assertThat ( object . text , is ( "" ) ) ; } @ Test public void invalid_property ( ) throws Exception { DataModelDefinition < Simple > def = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; JsonObject json = new JsonObject ( ) ; json . addProperty ( "invalid" , 100 ) ; json . addProperty ( "text" , "" ) ; DataModelReflection ref = JsonObjectDriver . convert ( def , json ) ; Simple object = def . toObject ( ref ) ; assertThat ( object . number , is ( nullValue ( ) ) ) ; assertThat ( object . text , is ( "" ) ) ; } @ Test ( expected = IOException . class ) public void inconsistent_type ( ) throws Exception { DataModelDefinition < Simple > def = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; JsonObject json = new JsonObject ( ) ; json . addProperty ( "number" , "QQQ" ) ; json
2,969
<s> package com . asakusafw . modelgen ; import java . nio . charset . Charset ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public final class Constants { public static final String VERSION = "0.0.1" ; public static final Charset OUTPUT_ENCODING = Charset . forName ( "UTF-8" ) ; public static final String SOURCE_TABLE = "table" ; public static final String SOURCE_VIEW = "view" ; public static final String CATEGORY_MODEL = "model" ; public static final String CATEGORY_IO = "io" ; private static final String [ ] ENV_PREFIX = { "" , "NS_MODELGEN_" } ; public static final List < String > ENV_JDBC_PROPERTIES = buildEnvProperties ( "JDBC" ) ; public static final List < String > ENV_BASE_PACKAGE = buildEnvProperties ( "PACKAGE" ) ; public static final List < String > ENV_OUTPUT = buildEnvProperties ( "OUTPUT"
2,970
<s> package org . rubypeople . rdt . internal . core . parser ; import junit . framework . TestCase ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . LexerSource ; import org . jruby . parser . DefaultRubyParser ; import org . jruby . parser .
2,971
<s> package org . rubypeople . rdt . internal . core . index ; import java . io . File ; import java . io . IOException ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . compiler . util . HashtableOfObject ; import org . rubypeople . rdt . internal . compiler . util . SimpleSet ; import org . rubypeople . rdt . internal . core . search . indexing . ReadWriteMonitor ; import org . rubypeople . rdt . internal . core . util . CharOperation ; public class Index { public String containerPath ; public ReadWriteMonitor monitor ; static final char DEFAULT_SEPARATOR = '/' ; public char separator = DEFAULT_SEPARATOR ; protected DiskIndex diskIndex ; protected MemoryIndex memoryIndex ; static final int MATCH_RULE_INDEX_MASK = SearchPattern . R_EXACT_MATCH | SearchPattern . R_PREFIX_MATCH | SearchPattern . R_PATTERN_MATCH | SearchPattern . R_REGEXP_MATCH | SearchPattern . R_CASE_SENSITIVE | SearchPattern . R_CAMELCASE_MATCH ; public static boolean isMatch ( char [ ] pattern , char [ ] word , int matchRule ) { if ( pattern == null ) return true ; int patternLength = pattern . length ; int wordLength = word . length ; if ( patternLength == 0 ) return matchRule != SearchPattern . R_EXACT_MATCH ; if ( wordLength == 0 ) return ( matchRule & SearchPattern . R_PATTERN_MATCH ) != 0 && patternLength == 1 && pattern [ 0 ] == '*' ; boolean isCamelCase = ( matchRule & SearchPattern . R_CAMELCASE_MATCH ) != 0 ; if ( isCamelCase && pattern [ 0 ] == word [ 0 ] && CharOperation . camelCaseMatch ( pattern , word ) ) { return true ; } matchRule &= ~ SearchPattern . R_CAMELCASE_MATCH ; switch ( matchRule & MATCH_RULE_INDEX_MASK ) { case SearchPattern . R_EXACT_MATCH : if ( ! isCamelCase ) { return patternLength == wordLength && CharOperation . equals ( pattern , word , false ) ; } case SearchPattern . R_PREFIX_MATCH : return patternLength <= wordLength && CharOperation . prefixEquals ( pattern , word , false ) ; case SearchPattern . R_PATTERN_MATCH : return CharOperation . match ( pattern , word , false ) ; case SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE : if ( ! isCamelCase ) { return pattern [ 0 ] == word [ 0 ] && patternLength == wordLength && CharOperation . equals ( pattern , word ) ; } case SearchPattern . R_PREFIX_MATCH | SearchPattern . R_CASE_SENSITIVE : return pattern [ 0 ] == word [ 0 ] && patternLength <= wordLength && CharOperation . prefixEquals ( pattern , word ) ; case SearchPattern . R_PATTERN_MATCH | SearchPattern . R_CASE_SENSITIVE : return CharOperation . match ( pattern , word , true ) ; } return false ; } public Index ( String fileName , String containerPath , boolean reuseExistingFile
2,972
<s> package org . rubypeople . rdt . internal . corext . util ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . ITypeHierarchyChangedListener ; import org . rubypeople . rdt . core . RubyModelException ; public class SuperTypeHierarchyCache { private static class HierarchyCacheEntry implements ITypeHierarchyChangedListener { private ITypeHierarchy fTypeHierarchy ; private long fLastAccess ; public HierarchyCacheEntry ( ITypeHierarchy hierarchy ) { fTypeHierarchy = hierarchy ; fTypeHierarchy . addTypeHierarchyChangedListener ( this ) ; markAsAccessed ( ) ; } public void typeHierarchyChanged ( ITypeHierarchy typeHierarchy ) { removeHierarchyEntryFromCache ( this ) ; } public ITypeHierarchy getTypeHierarchy ( ) { return fTypeHierarchy ; } public void markAsAccessed ( ) { fLastAccess = System . currentTimeMillis ( ) ; } public long getLastAccess ( ) { return fLastAccess ; } public void dispose ( ) { fTypeHierarchy . removeTypeHierarchyChangedListener ( this ) ; fTypeHierarchy = null ; } public String toString ( ) { return "" + fTypeHierarchy . getType ( ) . getElementName ( ) ; } } private static final int CACHE_SIZE = 8 ; private static ArrayList fgHierarchyCache = new ArrayList ( CACHE_SIZE ) ; private static Map fgMethodOverrideTesterCache = new LRUMap ( CACHE_SIZE ) ; private static int fgCacheHits = 0 ; private static int fgCacheMisses = 0 ; public static ITypeHierarchy getTypeHierarchy ( IType type ) throws RubyModelException { return getTypeHierarchy ( type , null ) ; } public static MethodOverrideTester getMethodOverrideTester ( IType type ) throws RubyModelException { MethodOverrideTester test = null ; synchronized ( fgMethodOverrideTesterCache ) { test = ( MethodOverrideTester ) fgMethodOverrideTesterCache . get ( type ) ; } if ( test == null ) { ITypeHierarchy hierarchy = getTypeHierarchy ( type ) ; synchronized ( fgMethodOverrideTesterCache ) { test = ( MethodOverrideTester ) fgMethodOverrideTesterCache . get ( type ) ; if ( test == null ) { test = new MethodOverrideTester ( type , hierarchy ) ; fgMethodOverrideTesterCache . put ( type , test ) ; } } } return test ; } private static void removeMethodOverrideTester ( ITypeHierarchy hierarchy ) { synchronized ( fgMethodOverrideTesterCache ) { for ( Iterator iter = fgMethodOverrideTesterCache . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { MethodOverrideTester curr = ( MethodOverrideTester ) iter . next ( ) ; if ( curr . getTypeHierarchy ( ) . equals ( hierarchy ) ) { iter . remove ( ) ; } } } } public static ITypeHierarchy getTypeHierarchy ( IType type , IProgressMonitor progressMonitor ) throws RubyModelException { ITypeHierarchy hierarchy = findTypeHierarchyInCache ( type ) ; if ( hierarchy == null ) { fgCacheMisses ++ ; hierarchy = type . newSupertypeHierarchy ( progressMonitor ) ; addTypeHierarchyToCache ( hierarchy ) ; } else { fgCacheHits ++ ; } return hierarchy ; } private static void addTypeHierarchyToCache ( ITypeHierarchy hierarchy ) { if ( hierarchy == null ) return ; synchronized ( fgHierarchyCache ) { int nEntries = fgHierarchyCache . size ( ) ; if ( nEntries >= CACHE_SIZE ) { HierarchyCacheEntry oldest = null ; ArrayList obsoleteHierarchies = new ArrayList ( CACHE_SIZE ) ; for ( int i = 0 ; i < nEntries ; i ++ ) { HierarchyCacheEntry entry = ( HierarchyCacheEntry ) fgHierarchyCache . get ( i ) ; ITypeHierarchy curr = entry . getTypeHierarchy ( ) ; if ( ! curr . exists ( ) || hierarchy . contains ( curr . getType ( ) ) ) { obsoleteHierarchies . add ( entry ) ; } else { if ( oldest == null || entry . getLastAccess ( ) < oldest . getLastAccess ( ) ) { oldest = entry ; } } } if ( ! obsoleteHierarchies . isEmpty ( ) ) { for (
2,973
<s> package com . lmax . disruptor ; import com . lmax . disruptor . support . StubEntry ; import org . hamcrest . Description ; import org . jmock . Expectations ; import org . jmock . Mockery ; import org . jmock . Sequence ; import org . jmock . api . Action ; import org . jmock . api . Invocation ; import org . jmock . integration . junit4 . JMock ; import org . junit . Test ; import org . junit . runner . RunWith ; import java . util . concurrent . CountDownLatch ; import static com . lmax . disruptor . support . Actions . countDown ; import static org . junit . Assert . assertEquals ; @ RunWith ( JMock . class ) public final class BatchConsumerTest { private final Mockery context = new Mockery ( ) ; private final Sequence lifecycleSequence = context . sequence ( "" ) ; private final CountDownLatch latch = new CountDownLatch ( 1 ) ; private final RingBuffer < StubEntry > ringBuffer = new RingBuffer < StubEntry > ( StubEntry . ENTRY_FACTORY , 16 ) ; private final ConsumerBarrier < StubEntry > consumerBarrier = ringBuffer . createConsumerBarrier ( ) ; @ SuppressWarnings ( "unchecked" ) private final BatchHandler < StubEntry > batchHandler = context . mock ( BatchHandler . class ) ; private final BatchConsumer batchConsumer = new BatchConsumer < StubEntry > ( consumerBarrier , batchHandler ) ; private final ProducerBarrier < StubEntry > producerBarrier = ringBuffer . createProducerBarrier ( batchConsumer ) ; @ Test ( expected = NullPointerException . class ) public void shouldThrowExceptionOnSettingNullExceptionHandler ( ) { batchConsumer . setExceptionHandler ( null ) ; } @ Test public void shouldReturnUnderlyingBarrier ( ) { assertEquals ( consumerBarrier , batchConsumer . getConsumerBarrier ( ) ) ; } @ Test public void shouldCallMethodsInLifecycleOrder ( ) throws Exception { context . checking ( new Expectations ( ) { { oneOf ( batchHandler ) . onAvailable ( ringBuffer . getEntry ( 0 ) ) ; inSequence ( lifecycleSequence ) ; oneOf ( batchHandler ) . onEndOfBatch ( ) ; inSequence ( lifecycleSequence ) ; will ( countDown ( latch ) ) ; } } ) ; Thread thread = new Thread ( batchConsumer ) ; thread . start ( ) ; assertEquals ( - 1L , batchConsumer . getSequence ( ) ) ; producerBarrier . commit ( producerBarrier . nextEntry ( ) ) ; latch . await ( ) ; batchConsumer . halt ( ) ; thread . join ( ) ; } @ Test public void shouldCallMethodsInLifecycleOrderForBatch ( ) throws Exception { context . checking ( new Expectations ( ) { { oneOf ( batchHandler ) . onAvailable ( ringBuffer . getEntry ( 0 ) ) ; inSequence ( lifecycleSequence ) ; oneOf ( batchHandler ) . onAvailable ( ringBuffer . getEntry ( 1 ) ) ; inSequence ( lifecycleSequence
2,974
<s> package com . team1160 . scouting . frontend . elements ; import java . awt . Component ; import javax . swing . JLabel ; import javax . swing . JTextField ; public class SingleLineInputElement extends ScoutingElement { private static final long serialVersionUID = 998523818094409304L ; private JLabel label ; private JTextField input ; private int type ; private String name ; public static final int INTEGER = 1 , STRING = 2 , DOUBLE = 3 ; protected boolean inComments ; protected boolean isNegative ; protected boolean isTime ; protected int maxTime ; public SingleLineInputElement ( String name , int type , boolean isNegative , boolean isTime , int maxTime ) { super ( ) ; this . isNegative = isNegative ; this . isTime = isTime ; this . maxTime = maxTime ; this . inComments = false ; if ( ! ( name . endsWith ( ":" ) ) ) { label = new JLabel ( name + ":" ) ; this . name = name + ":" ; } else { label = new JLabel ( name ) ; this . name = name ; } this . input = new JTextField ( ) ; this . input . setColumns ( 10 ) ; this . label . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; this . input . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; this . add ( label ) ; this . add ( input ) ; } public SingleLineInputElement ( String name , int type , boolean isNegative ) { this ( name , type , isNegative , false , 0 ) ; } public SingleLineInputElement ( String name , int type ) { this ( name , type , false , false , 0 ) ; } public String getText ( ) { return this . label . getText ( ) . substring ( 0 , this . label . getText ( ) . length ( ) ) ; } public String getInput ( ) { String text = this . input . getText ( ) ; if ( this . isNegative ) { if ( text . startsWith ( "-" ) ) { return text ; } else { return "-" + text ; } } else if ( this . isTime ) { int value = Math . abs ( Integer . parseInt ( text ) ) ; return Integer . toString ( this . maxTime - value ) ; } else { return text ; } } public int getType ( ) { return type ; } public boolean isNegative ( ) { return this . isNegative ; } public boolean isTime ( ) { return this . isTime ; } public int getMaxTime ( ) { return this . maxTime ; } public void setInComments ( boolean b ) { this . inComments = b ; } public boolean isInComments ( ) { return this . inComments ; } @ Override public boolean equals ( Object obj ) { if ( obj ==
2,975
<s> package com . asakusafw . compiler . flow ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . lang . reflect . Constructor ; import java . lang . reflect . Field ; import java . lang . reflect . Method ; import java . util . List ; import javax . tools . Diagnostic ; import javax . tools . JavaFileObject ; import org . apache . hadoop . io . Writable ; import org . junit . After ; import org . junit . Before ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . plan . StagePlanner ; import com . asakusafw . compiler . flow . stage . CompiledShuffle ; import com . asakusafw . compiler . flow . stage . CompiledType ; import com . asakusafw . compiler . flow . stage . MapFragmentEmitter ; import com . asakusafw . compiler . flow . stage . ReduceFragmentEmitter ; import com . asakusafw . compiler . flow . stage . ShuffleAnalyzer ; import com . asakusafw . compiler . flow . stage . ShuffleGroupingComparatorEmitter ; import com . asakusafw . compiler . flow . stage . ShuffleKeyEmitter ; import com . asakusafw . compiler . flow . stage . ShuffleModel ; import com . asakusafw . compiler . flow . stage . ShuffleModel . Segment ; import com . asakusafw . compiler . flow . stage . ShufflePartitionerEmitter ; import com . asakusafw . compiler . flow . stage . ShuffleSortComparatorEmitter ; import com . asakusafw . compiler . flow . stage . ShuffleValueEmitter ; import com . asakusafw . compiler . flow . stage . StageAnalyzer ; import com . asakusafw . compiler . flow . stage . StageCompiler ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . compiler . flow . stage . StageModel . MapUnit ; import com . asakusafw . compiler . flow . stage . StageModel . ReduceUnit ; import com . asakusafw . compiler . repository . SpiDataClassRepository ; import com . asakusafw . compiler . repository . SpiExternalIoDescriptionProcessorRepository ; import com . asakusafw . compiler . repository . SpiFlowElementProcessorRepository ; import com . asakusafw . compiler . repository . SpiFlowGraphRewriterRepository ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . runtime . flow . Rendezvous ; import com . asakusafw . runtime . flow . SegmentedWritable ; import com . asakusafw . utils . java . jsr199 . testing . VolatileCompiler ; import com . asakusafw . utils . java . jsr199 . testing . VolatileJavaFile ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; public class JobflowCompilerTestRoot { protected boolean dump = true ; private final VolatileCompiler javaCompiler = new VolatileCompiler ( ) ; private VolatilePackager packager = new VolatilePackager ( ) ; protected FlowCompilingEnvironment environment ; @ Before public void setUp ( ) throws Exception { packager = new VolatilePackager ( ) ; FlowCompilerConfiguration config = new FlowCompilerConfiguration ( ) ; config . setBatchId ( "batch" ) ; config . setFlowId ( "flow" ) ; config . setFactory ( Models . getModelFactory ( ) ) ; config . setProcessors ( new SpiFlowElementProcessorRepository ( ) ) ; config . setExternals ( new SpiExternalIoDescriptionProcessorRepository ( ) ) ; config . setDataClasses ( new SpiDataClassRepository ( ) ) ; config . setGraphRewriters ( new SpiFlowGraphRewriterRepository ( ) ) ; config . setPackager ( packager ) ; config . setRootPackageName ( "com.example" ) ; config . setRootLocation ( Location . fromPath ( "com/example" , '/' ) ) ; config . setServiceClassLoader ( getClass ( ) . getClassLoader ( ) ) ; config . setOptions ( new FlowCompilerOptions ( ) ) ; config . setBuildId ( "testing" ) ; environment = new FlowCompilingEnvironment ( config ) ; environment . bless ( ) ; } @ After public void tearDown ( ) throws Exception { javaCompiler . close ( ) ; } protected List < StageModel > compile ( Class < ? extends FlowDescription > aClass ) { assert aClass != null ; StageGraph graph = jfToStageGraph ( aClass ) ; return compileStages ( graph ) ; } protected StageGraph jfToStageGraph ( Class < ? extends FlowDescription > aClass ) { assert aClass != null ; JobFlowDriver analyzed = JobFlowDriver . analyze ( aClass ) ; assertThat ( analyzed . getDiagnostics ( ) . toString ( ) , analyzed . hasError ( ) , is ( false ) ) ; JobFlowClass flow = analyzed . getJobFlowClass ( ) ; FlowGraph flowGraph = flow . getGraph ( ) ; return flowToStageGraph ( flowGraph ) ; } private StageGraph flowToStageGraph ( FlowGraph flowGraph ) { assert flowGraph != null ; StagePlanner planner = new StagePlanner ( environment . getGraphRewriters ( ) . getRewriters ( ) , environment . getOptions ( ) ) ; StageGraph planned = planner . plan ( flowGraph ) ; assertThat ( planner . getDiagnostics ( ) . toString ( ) , planner . getDiagnostics ( ) . isEmpty ( ) , is ( true ) ) ; return planned ; } protected List < StageModel > compileStages ( StageGraph graph ) { try { return new StageCompiler ( environment ) . compile ( graph ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } } protected StageModel compileFragments ( StageBlock block ) throws IOException { ShuffleModel shuffle = compileShuffle ( block ) ; StageModel stage = new StageAnalyzer ( environment ) . analyze ( block , shuffle ) ; for ( MapUnit unit : stage . getMapUnits ( ) ) { for ( Fragment fragment : unit . getFragments ( ) ) { compile ( fragment , stage ) ; } } for ( ReduceUnit unit : stage . getReduceUnits ( ) ) { for ( Fragment fragment : unit . getFragments ( ) ) { compile ( fragment , stage ) ; } } return stage ; } private void compile ( Fragment fragment , StageModel stage ) throws IOException { if ( fragment . isRendezvous ( ) ) { CompiledType compiled = new ReduceFragmentEmitter ( environment ) . emit ( fragment , stage . getShuffleModel ( ) , stage . getStageBlock ( ) ) ; fragment . setCompiled ( compiled ) ; } else { CompiledType compiled = new MapFragmentEmitter ( environment ) . emit ( fragment , stage . getStageBlock ( ) ) ; fragment . setCompiled ( compiled ) ; } } protected ShuffleModel compileShuffle ( StageBlock block ) throws IOException { ShuffleModel shuffle = new ShuffleAnalyzer ( environment ) . analyze ( block ) ; assertThat ( environment . hasError ( ) , is ( false ) ) ; if ( shuffle == null ) { return null ; } Name keyTypeName = new ShuffleKeyEmitter ( environment ) . emit ( shuffle ) ; Name valueTypeName = new ShuffleValueEmitter ( environment ) . emit ( shuffle ) ; Name groupComparatorTypeName = new ShuffleGroupingComparatorEmitter ( environment ) . emit ( shuffle , keyTypeName ) ; Name sortComparatorTypeName = new ShuffleSortComparatorEmitter ( environment ) . emit ( shuffle , keyTypeName ) ; Name partitionerTypeName = new ShufflePartitionerEmitter ( environment ) . emit ( shuffle , keyTypeName , valueTypeName ) ; CompiledShuffle compiled = new CompiledShuffle ( keyTypeName , valueTypeName , groupComparatorTypeName , sortComparatorTypeName , partitionerTypeName ) ; shuffle . setCompiled ( compiled ) ; return shuffle ; } protected Object create ( ClassLoader loader , Name name , Object ... arguments ) { try { Class < ? > loaded = loader . loadClass ( name . toNameString ( ) ) ; for ( Constructor < ? > ctor : loaded . getConstructors ( ) ) { if ( ctor . getParameterTypes ( ) . length == arguments . length ) { return ctor . newInstance ( arguments ) ; } } throw new AssertionError ( ) ; } catch ( Exception e ) { throw new AssertionError ( e ) ; } } @ SuppressWarnings ( "unchecked" ) protected < T > Result < T > createResult ( ClassLoader loader , Name name , Object ... arguments ) { return ( Result < T > ) create ( loader , name , arguments ) ; } @ SuppressWarnings ( "unchecked" ) protected < K extends Writable , V extends Writable > Rendezvous < V > createRendezvous ( ClassLoader loader , Name name , Object ... arguments ) { return ( Rendezvous < V > ) create ( loader , name , arguments ) ; } protected Object invoke ( Object object , String name , Object ... arguments ) { try { for ( Method method : object . getClass ( ) . getMethods ( ) ) { if ( method . getName ( ) . equals ( name ) ) { return method . invoke ( object , arguments ) ; } } } catch ( Exception e ) { throw new AssertionError ( e ) ; } throw new AssertionError ( name ) ; } protected Object access ( Object object , String name ) {
2,976
<s> package com . asakusafw . compiler . bulkloader . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . bulkloader . testing . model . MockTableModel ; import com . asakusafw . runtime . io .
2,977
<s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . Arrays ; import java . util . Collection ; import java . util . HashSet ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class RubyImplementorFinder implements IImplementorFinder { public Collection findImplementingTypes ( IType type , IProgressMonitor progressMonitor ) { ITypeHierarchy typeHierarchy ; try { typeHierarchy = type . newTypeHierarchy ( progressMonitor ) ; IType [ ] implementingTypes = typeHierarchy . getAllClasses ( ) ; HashSet result = new HashSet ( Arrays
2,978
<s> package com . asakusafw . dmdl . directio . csv . driver ; import com . asakusafw . dmdl . directio . csv . driver . CsvFieldTrait . Kind ; import com . asakusafw . dmdl .
2,979
<s> package com . asakusafw . bulkloader . common ; import java . util . Collections ; import java . util . HashSet ; import java . util . Map ; import java . util . Set ; import java . util . TreeMap ; public enum FileCompType { DEFLATED ( "COMPRESS" , "1" , "DEFLATE" ) , STORED ( "NONE" , "0" , "STORE" ) , ; private String symbol ; Set < String > keys ; private FileCompType ( String symbol , String ... alternatives ) { this . symbol = symbol ; this . keys = new HashSet < String > ( ) ; this .
2,980
<s> import org . xmlpull . v1 . * ; import java . util . * ; import java . io . * ; import java . net . * ; public class Weblogs { static List listChannels ( ) throws IOException , XmlPullParserException { return listChannels ( "" ) ; } static List listChannels ( String uri ) throws IOException , XmlPullParserException { Vector result = new Vector ( ) ; InputStream is = new URL ( uri ) . openStream ( ) ; XmlPullParser parser = XmlPullParserFactory . newInstance ( ) . newPullParser ( ) ; parser . setInput ( is , null ) ; parser . nextTag ( ) ; parser . require ( parser . START_TAG , "" , "weblogs" ) ; while ( parser . nextTag ( ) == parser . START_TAG ) { String url = readSingle ( parser ) ; if ( url != null ) result . addElement ( url ) ; } parser . require ( parser . END_TAG , "" , "weblogs" ) ; parser . next ( ) ; parser . require ( parser . END_DOCUMENT , null , null ) ; is . close ( ) ; parser . setInput ( null ) ; return result ; } public static String readSingle ( XmlPullParser parser ) throws IOException , XmlPullParserException { String url = null ; parser . require ( parser . START_TAG , "" , "log" ) ;
2,981
<s> package com . asakusafw . compiler . flow . processor . operator ; import javax . annotation . Generated ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . ObservationCount ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . operator . Extract ; @ Generated ( "" ) public class ExtractFlowFactory { public static final class Op1 implements Operator { private final FlowElementResolver $ ; public final Source < Ex1 > r1 ; Op1 ( Source < Ex1 > a1 ) { OperatorDescription . Builder builder = new OperatorDescription . Builder ( Extract . class ) ; builder . declare ( ExtractFlow . class , ExtractFlowImpl . class , "op1" ) ; builder . declareParameter ( Ex1 . class ) ; builder . declareParameter ( Result . class ) ; builder . addInput ( "a1" , a1 ) ; builder . addOutput ( "r1" , Ex1 . class ) ; builder . addAttribute ( ObservationCount . DONT_CARE ) ; this . $ = builder . toResolver ( ) ; this . $ . resolveInput ( "a1" , a1 ) ; this . r1 = this . $ . resolveOutput ( "r1" ) ; } public ExtractFlowFactory . Op1 as ( String newName ) { this . $ . setName ( newName ) ; return this ; } } public ExtractFlowFactory . Op1 op1 ( Source < Ex1 > a1 ) { return new ExtractFlowFactory . Op1 ( a1 ) ; } public static final class Op2 implements Operator { private final FlowElementResolver $ ; public final Source < Ex1 > r1 ; public final Source < Ex2 > r2 ; Op2 ( Source < Ex1 > a1 ) { OperatorDescription . Builder builder0 = new OperatorDescription . Builder ( Extract . class ) ; builder0 . declare ( ExtractFlow . class , ExtractFlowImpl . class , "op2" ) ; builder0 . declareParameter ( Ex1 . class ) ; builder0 . declareParameter ( Result . class ) ; builder0 . declareParameter ( Result . class ) ; builder0 . addInput ( "a1" , a1 ) ; builder0 . addOutput ( "r1" , Ex1 . class ) ; builder0 . addOutput ( "r2" , Ex2 .
2,982
<s> package net . sf . sveditor . core . db ; import java . util . List ; import net . sf . sveditor . core . db . stmt . SVDBVarDimItem ; public class SVDBTypeInfoBuiltin extends SVDBTypeInfo { public static final int TypeAttr_Signed = ( 1 << 7 ) ; public static final int TypeAttr_Unsigned = ( 1 << 8 ) ; public int fAttr ; public List < SVDBVarDimItem > fVectorDim ; public SVDBTypeInfoBuiltin ( ) { this ( "" ) ; } public SVDBTypeInfoBuiltin ( String typename ) { super ( typename , SVDBItemType . TypeInfoBuiltin ) ; } public SVDBTypeInfoBuiltin ( String typename , SVDBItemType type ) { super ( typename , type ) ; } public int getAttr ( ) { return fAttr ; } public void setAttr ( int attr ) { fAttr = attr ; }
2,983
<s> package org . rubypeople . rdt . internal . core . search ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Path ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . SearchDocument ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . internal . core . search . processing . JobManager ; import org . rubypeople . rdt . internal . core . util . Util ; public class RubySearchDocument extends SearchDocument { private IFile
2,984
<s> package og . android . tether ; import java . util . ArrayList ; import java . util . List ; import og . android . tether . system . WebserviceTask ; import org . apache . http . HttpResponse ; import org . apache . http . message . BasicNameValuePair ; import android . content . Context ; import android . content . SharedPreferences ; import android . content . SharedPreferences . Editor ; import android . content . res . Configuration ; import android . preference . PreferenceManager ; import android . provider . Settings . Secure ; import android . util . Log ; public class DeviceRegistrar { public static final String STATUS_EXTRA = "Status" ; public static final int REGISTERED_STATUS = 1 ; public static final int AUTH_ERROR_STATUS = 2 ; public static final int UNREGISTERED_STATUS = 3 ; public static final int ERROR_STATUS = 4 ; private static final String TAG = "" ; static final String SENDER_ID = "" ; static final String BASE_URL = "" ; private static final String REGISTER_PATH = BASE_URL + "/register" ; private static final String UNREGISTER_PATH = BASE_URL + "/unregister" ; static final String RECEIVED_PATH = BASE_URL + "/received" ; static final String REACT_PATH = BASE_URL
2,985
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import org . eclipse . jface . action . Action ; import org . eclipse . ui . PlatformUI ;
2,986
<s> package net . sf . sveditor . core . db . stmt ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . expr . SVDBExpr ; public class SVDBAssertStmt extends SVDBStmt { public SVDBExpr fExpr ;
2,987
<s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . search . ui . NewSearchUI ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceReference ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . ASTProvider ; public abstract class FindOccurrencesEngine { private IOccurrencesFinder fFinder ; private static class FindOccurencesCUEngine extends FindOccurrencesEngine { private IRubyScript fScript ; public FindOccurencesCUEngine ( IRubyScript unit , IOccurrencesFinder finder ) { super ( finder ) ; fScript = unit ; } protected Node createAST ( ) { return RubyPlugin . getDefault ( ) . getASTProvider ( ) . getAST ( fScript , ASTProvider . WAIT_YES , null ) ; } protected IRubyElement getInput ( ) { return fScript ; } protected ISourceReference getSourceReference ( ) { return fScript ; } }
2,988
<s> package com . aptana . rdt . core . rspec ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . ISourceReference ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . SourceRange ; public class Example implements ISourceReference { private String description ; private Behavior parent ; private int offset ; private int length ; Example ( String description , int offset , int length ) { this . description = description ; this . offset = offset ; this . length = length ; } void setParent ( Behavior parent ) { this . parent
2,989
<s> package com . sun . tools . hat . internal . model ; import java . io . IOException ; import com . sun . tools . hat . internal . parser . ReadBuffer ; public class JavaObjectArray extends JavaLazyReadObject { private Object clazz ; public JavaObjectArray ( long classID , long offset ) { super ( offset ) ; this . clazz = makeId ( classID ) ; } public JavaClass getClazz ( ) { return ( JavaClass ) clazz ; } public void resolve ( Snapshot snapshot ) { if ( clazz instanceof JavaClass ) { return ; } long classID = getIdValue ( ( Number ) clazz ) ; if ( snapshot . isNewStyleArrayClass ( ) ) { JavaThing t = snapshot . findThing ( classID ) ; if ( t instanceof JavaClass ) { clazz = t ; } } if ( ! ( clazz instanceof JavaClass ) ) { JavaThing t = snapshot . findThing ( classID ) ; if ( t != null && t instanceof JavaClass ) { JavaClass el = ( JavaClass ) t ; String nm = el . getName ( ) ; if ( ! nm . startsWith ( "[" ) ) { nm = "L" + el . getName ( ) + ";" ; } clazz = snapshot . getArrayClass ( nm ) ; } } if ( ! ( clazz instanceof JavaClass ) ) { clazz = snapshot . getOtherArrayType ( ) ; } ( ( JavaClass ) clazz ) . addInstance ( this ) ; super . resolve ( snapshot ) ; } public JavaThing [ ] getValues ( ) { return getElements ( ) ; } public JavaThing [ ] getElements ( )
2,990
<s> package org . rubypeople . rdt . refactoring . tests . util ; import junit . framework . TestCase ; import org . rubypeople . rdt . refactoring . util . StringHelper ; public class TC_StringHelper extends TestCase { public void testNumberOfOccurences ( ) { assertEquals ( 2
2,991
<s> package com . lmax . disruptor . support ; import com . lmax . disruptor . BatchHandler ; public final class ValueMutationHandler implements BatchHandler < ValueEntry > { private final Operation operation ; private long value ; public ValueMutationHandler
2,992
<s> package org . oddjob . scheduling ; import java . io . IOException ; import java . io . NotSerializableException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . Serializable ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . registry . BeanDirectory ; import org . oddjob . arooa . registry . BeanDirectoryCrawler ; import org . oddjob . arooa . registry . BeanRegistry ; import org . oddjob . arooa . registry . Path ; public class JobToken implements Serializable { private static final long serialVersionUID = 20060112 ; private final transient Object job ; private final String path ; private JobToken ( String path , Object job ) { this . path = path ; this . job = job ; } public static JobToken create ( BeanRegistry registry ,
2,993
<s> package net . sf . sveditor . ui ; import java . net . URI ; import net . sf . sveditor . core . db . index . plugin_lib . PluginFileStore ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IPersistableElement ; import org . eclipse . ui . editors . text . ILocationProvider ; import org . eclipse . ui . editors . text . ILocationProviderExtension ; import org . eclipse . ui . ide
2,994
<s> package org . rubypeople . rdt . internal . ti ; import java . util . Collection ; import junit . framework . TestCase ; public abstract class TypeInferrerTestCase extends TestCase { protected ITypeInferrer inferrer ; public TypeInferrerTestCase ( ) { super ( ) ; } public void setUp ( ) { inferrer = createTypeInferrer ( ) ; } protected void assertInfersTypeWithoutDoubt ( Collection < ITypeGuess > guesses , String type ) { assertEquals ( 1 , guesses . size ( ) ) ; ITypeGuess guess = guesses . iterator ( ) . next ( ) ; assertEquals ( type , guess . getType ( ) ) ; assertEquals ( 100 , guess . getConfidence ( ) ) ; } protected void assertInfersTypeFiftyFifty ( Collection < ITypeGuess > guesses , String type1 , String type2 ) { assertEquals ( 2 , guesses . size ( ) ) ; ITypeGuess guess1 = findGuess ( guesses , type1 ) ; assertNotNull ( "" + type1 , guess1 ) ; assertEquals ( guess1 . getConfidence ( ) , 50
2,995
<s> package de . fuberlin . wiwiss . d2rq . algebra ; import java . util . Collections ; import java . util . Set ; import de . fuberlin . wiwiss . d2rq . expr . AttributeExpr ; import de . fuberlin . wiwiss . d2rq . expr . NotNull ; import de . fuberlin . wiwiss . d2rq . expr . Equality ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . sql . ConnectedDB ; public class Attribute implements ProjectionSpec { private String attributeName ; private RelationName relationName ; private String qualifiedName ; public Attribute ( String schemaName , String tableName , String attributeName ) { this ( new RelationName ( schemaName , tableName ) , attributeName ) ; } public Attribute ( RelationName relationName , String attributeName ) { this . attributeName = attributeName ; this . relationName = relationName ; this . qualifiedName = this . relationName . qualifiedName ( ) + "." + this . attributeName ; } public String qualifiedName ( ) { return this . qualifiedName ; } public String toSQL ( ConnectedDB database , AliasMap aliases ) { return database . vendor ( ) . quoteAttribute ( this ) ; } public String attributeName ( ) { return this . attributeName ; } public String tableName ( ) { return this . relationName . tableName ( ) ; } public RelationName relationName ( ) { return this . relationName ; } public String schemaName ( ) { return this . relationName . schemaName ( ) ; } public Set < Attribute > requiredAttributes ( ) { return Collections . singleton ( this ) ; } public Expression selectValue ( String value ) { return Equality . createAttributeValue ( this , value ) ; }
2,996
<s> package com . pogofish . jadt . source ; import java . io . BufferedReader ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; public class FileSource implements Source { private final File srcFile ; public FileSource ( File srcFile ) { this . srcFile = srcFile ; } @ Override public BufferedReader createReader (
2,997
<s> package com . asakusafw . vocabulary . bulkloader ; import java . util . List ; import com . asakusafw . vocabulary . external . ExporterDescription ; public abstract class BulkLoadExporterDescription implements ExporterDescription { public abstract String getTargetName ( ) ; public abstract Class < ? > getTableModelClass ( ) ; public abstract String getTableName ( ) ; public abstract List < String > getColumnNames ( ) ; public abstract List < String > getTargetColumnNames ( ) ; public abstract List < String > getPrimaryKeyNames ( ) ; public DuplicateRecordCheck getDuplicateRecordCheck ( ) { return null ; } public static class DuplicateRecordCheck { private final Class < ? > tableModelClass ; private final String tableName ; private final List < String > columnNames ; private final List < String > checkColumnNames ; private final String errorCodeColumnName ; private final String errorCodeValue ; public DuplicateRecordCheck ( Class < ? > tableModelClass , String tableName , List < String > columnNames , List < String > checkColumnNames , String errorCodeColumnName , String errorCodeValue ) { if ( tableModelClass == null ) { throw new IllegalArgumentException ( "" ) ; } if ( tableName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( columnNames == null ) { throw new IllegalArgumentException ( "" ) ; } if ( checkColumnNames == null ) { throw new IllegalArgumentException ( "" ) ; } if ( errorCodeColumnName
2,998
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . AnnotationElement ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class AnnotationElementImpl extends ModelRoot implements AnnotationElement { private SimpleName name ; private Expression expression ; @ Override public SimpleName getName ( ) { return this . name ; } public void setName ( SimpleName name ) { Util . notNull ( name , "name" ) ; this . name = name ; } @ Override public Expression getExpression ( ) { return this . expression ; } public void setExpression ( Expression expression ) { Util . notNull ( expression , "expression" ) ; this . expression = expression ; } @ Override public ModelKind getModelKind ( ) { return ModelKind
2,999
<s> package org . oddjob . jmx ; import java . lang . management . ManagementFactory ; import java . util . HashMap ; import java . util . Map ; import javax . management . MBeanServer ; import javax . management . ObjectName ; import javax . management . remote . JMXConnectorServer ; import javax . management . remote . JMXConnectorServerFactory ; import javax . management . remote . JMXServiceURL ; import javax . management . remote . rmi . RMIConnectorServer ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . StateSteps ; import org . oddjob . Stateful ; import org . oddjob . Structural ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jmx . general . Vendor ; import org . oddjob . rmi . RMIRegistryJob ; import org . oddjob . state . ParentState ; import org . oddjob . state . ServiceState ; import org . oddjob . structural . StructuralEvent ; import org . oddjob . structural . StructuralListener ; public class JMXServiceJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( JMXServiceJobTest . class ) ; ObjectName objectName ; MBeanServer mBeanServer ; JMXConnectorServer cntorServer ; Vendor simple = new Vendor ( "Hay Medows" ) ; protected void createServer ( Map < String , ? > environment ) throws Exception { RMIRegistryJob rmi = new RMIRegistryJob ( ) ; rmi . setPort ( 13013 ) ; rmi . run ( ) ; JMXServiceURL serviceURL = new JMXServiceURL ( "" ) ; objectName = new ObjectName ( "" ) ; mBeanServer = ManagementFactory . getPlatformMBeanServer ( ) ; mBeanServer . registerMBean ( simple , objectName ) ; cntorServer = JMXConnectorServerFactory . newJMXConnectorServer ( serviceURL , environment , mBeanServer ) ; cntorServer . start ( ) ; String address = cntorServer . getAddress ( ) . toString ( ) ; logger . info ( "" + address ) ; } @ Override protected void tearDown ( ) throws Exception { mBeanServer . unregisterMBean ( objectName ) ; cntorServer . stop ( ) ; } private class ChildCatcher implements StructuralListener { final Map < String , Object > children = new HashMap < String , Object > ( ) ; public void childAdded ( StructuralEvent event ) { Object child = event . getChild ( ) ; String name = child . toString ( ) ; if ( children . containsKey ( name ) ) { throw new IllegalStateException ( ) ; } children . put ( name , child ) ; } public void childRemoved ( StructuralEvent event ) { children . remove ( event . getChild ( ) . toString ( ) ) ; } } public void testExample ( ) throws Exception { createServer ( null ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . ACTIVE , oddjob . lastStateEvent ( ) . getState ( ) ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; Object test =