id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
2,400 | <s> package com . asakusafw . compiler . common ; import java . text . MessageFormat ; public final class Precondition { public static void checkMustNotBeNull ( Object value , String expression ) { if ( value == null | |
2,401 | <s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . util . Arrays ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . ui . text . ruby . ContentAssistInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposalComputer ; public class LegacyRubyCompletionProposalComputer implements IRubyCompletionProposalComputer { | |
2,402 | <s> package org . springframework . social . google . api . legacyprofile ; import java . io . Serializable ; public class LegacyGoogleProfile implements Serializable { private static final long serialVersionUID = - 634483399121748105L ; private String id ; private String email ; private String name ; private String firstName ; private String lastName ; private String link ; private String profilePictureUrl ; private String gender ; private String locale ; public String getId ( ) { return id ; } public String getEmail ( ) { return email ; } public String | |
2,403 | <s> package org . rubypeople . rdt . refactoring . util ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . Iterator ; import java . util . Vector ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . jruby . ast . Colon2Node ; import org . jruby . ast . Colon3Node ; import org . jruby . ast . ConstNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . types . INameNode ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . FieldNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; public class NameHelper { public static String createName ( String string ) { Matcher matcher = Pattern . compile ( "" ) . matcher ( string ) ; if ( matcher . matches ( ) ) { return matcher . group ( 1 ) + String . valueOf ( Integer . valueOf ( matcher . group ( 2 ) ) . intValue ( ) + 1 ) ; } return string + 1 ; } public static ArrayList < String > findDuplicates ( String [ ] myNames , String [ ] oldNames ) { ArrayList < String > found = new ArrayList < String > ( ) ; for ( int i = 0 ; i < oldNames . length ; i ++ ) { if ( namesContainName ( myNames , oldNames [ i ] ) ) { found . add ( oldNames [ i ] ) ; } } return found ; } public static boolean namesContainName ( String [ ] names , String name ) { for ( int i = 0 ; i < names . length ; i ++ ) { if ( names [ i ] . equals ( name ) ) { return true ; } } return false ; } public static boolean fieldnameExistsInClass ( String name , ClassNodeWrapper klass ) { for ( FieldNodeWrapper currentTargetField : klass . getFields ( ) ) { if ( name . equals ( currentTargetField . getName ( ) ) ) { return true ; } } return false ; } | |
2,404 | <s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . eclipse . jface . resource . CompositeImageDescriptor ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . ImageData ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Display ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . viewsupport . AppearanceAwareLabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyElementImageProvider ; import org . rubypeople . rdt . ui . RubyElementImageDescriptor ; import org . rubypeople . rdt . ui . RubyElementLabels ; public class HierarchyLabelProvider extends AppearanceAwareLabelProvider { private static class FocusDescriptor extends CompositeImageDescriptor { private ImageDescriptor fBase ; public FocusDescriptor ( ImageDescriptor base ) { fBase = base ; } protected void drawCompositeImage ( int width , int height ) { drawImage ( getImageData ( fBase ) , 0 , 0 ) ; drawImage ( getImageData ( RubyPluginImages . DESC_OVR_FOCUS ) , 0 , 0 ) ; } private ImageData getImageData ( ImageDescriptor descriptor ) { ImageData data = descriptor . getImageData ( ) ; if ( data == null ) { data = DEFAULT_IMAGE_DATA ; RubyPlugin . logErrorMessage ( "" + descriptor . toString ( ) ) ; } return data ; } protected Point getSize ( ) { return RubyElementImageProvider . BIG_SIZE ; } public int hashCode ( ) { return fBase . hashCode ( ) ; } public boolean equals ( Object object ) { return object != null && FocusDescriptor . class . equals ( object . getClass ( ) ) && ( ( FocusDescriptor ) object ) . fBase . equals ( fBase ) ; } } private Color fGrayedColor ; private Color fSpecialColor ; private ViewerFilter fFilter ; private TypeHierarchyLifeCycle fHierarchy ; public HierarchyLabelProvider ( TypeHierarchyLifeCycle lifeCycle ) { super ( DEFAULT_TEXTFLAGS | RubyElementLabels . T_NAME_FULLY_QUALIFIED | RubyElementLabels . USE_RESOLVED , DEFAULT_IMAGEFLAGS ) ; fHierarchy = lifeCycle ; fFilter = null ; } public ViewerFilter getFilter ( ) { return fFilter ; } public void setFilter ( ViewerFilter filter ) { fFilter = filter ; } protected boolean isDifferentScope ( IType type ) { if ( fFilter != null && ! fFilter . select ( null , null , type ) ) { return true ; } IRubyElement input = fHierarchy . getInputElement ( ) ; if ( input == null || input . getElementType ( ) == IRubyElement . TYPE ) { return false ; } IRubyElement parent = type . getAncestor ( input . getElementType ( ) ) ; if ( input . getElementType ( ) == IRubyElement . SOURCE_FOLDER ) { if ( parent == null || parent . getElementName ( ) . equals ( input . getElementName ( ) ) ) { return false ; } } else if ( input . equals ( parent ) ) { return false ; } return true ; } public String getText ( Object element ) { String text = super . getText ( element ) ; return decorateText ( text , element ) ; } public Image getImage ( Object element ) { Image result = null ; if ( element instanceof IType ) { ImageDescriptor desc = getTypeImageDescriptor ( ( IType ) element ) ; if ( desc != null ) { | |
2,405 | <s> package com . asakusafw . testdriver . excel ; import java . util . Set ; import org . apache . poi . ss . usermodel . Row ; import org . apache . poi . ss . usermodel . Sheet ; import com . asakusafw . testdriver . rule . | |
2,406 | <s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; public class RubyUIStatus extends Status { private RubyUIStatus ( int severity , int code , String message , Throwable throwable ) { super ( severity , RubyPlugin . getPluginId ( ) , code , message , throwable ) ; } public static IStatus createError ( int code , Throwable throwable ) { String message = throwable . getMessage ( ) ; if ( message == null ) { message = throwable . getClass ( ) . getName ( ) ; } return new RubyUIStatus ( IStatus . ERROR , code , message , throwable ) ; } public static IStatus createError ( int code , String message , Throwable throwable ) { return new RubyUIStatus ( IStatus . | |
2,407 | <s> package org . oddjob . jmx ; import java . io . IOException ; import java . net . MalformedURLException ; import java . util . Map ; import javax . management . JMException ; import javax . management . MBeanServer ; import javax . management . ObjectName ; import javax . management . remote . JMXConnectorServer ; import org . apache . log4j . Logger ; import org . oddjob . OddjobException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . arooa . deploy . annotations . ArooaHidden ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . registry . BeanDirectory ; import org . oddjob . arooa . registry . ServerId ; import org . oddjob . jmx . server . HandlerFactoryProvider ; import org . oddjob . jmx . server . OddjobMBeanFactory ; import org . oddjob . jmx . server . ResourceFactoryProvider ; import org . oddjob . jmx . server . ServerContextMain ; import org . oddjob . jmx . server . ServerInterfaceManagerFactoryImpl ; import org . oddjob . jmx . server . ServerLoopBackException ; import org . oddjob . jmx . server . ServerMainBean ; import org . oddjob . jmx . server . ServerModelImpl ; import org . oddjob . jmx . server . SimpleServerSecurity ; import org . oddjob . util . | |
2,408 | <s> package $ { package } . jobflow ; import $ { package } . modelgen . dmdl . csv . AbstractStoreInfoCsvInputDescription ; public class StoreInfoFromCsv extends AbstractStoreInfoCsvInputDescription { @ Override public String getBasePath ( ) { | |
2,409 | <s> package com . asakusafw . windgate . core ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public abstract class WindGateLogger { private final Logger internal ; private final MessageFormat format = new MessageFormat ( "" ) ; private final String componentName ; public WindGateLogger ( Class < ? > target , String componentName ) { if ( target == null ) { throw new IllegalArgumentException ( "" ) ; } if ( componentName == null ) { throw new IllegalArgumentException ( "" ) ; } this . componentName = componentName ; this . internal = LoggerFactory . getLogger ( target ) ; } public void info ( String code , Object ... arguments ) { if ( internal . isInfoEnabled ( ) ) { String message = message ( code , arguments ) ; internal . info ( message ) ; } } public void info ( Exception exception , | |
2,410 | <s> package net . ggtools . grand . ui . actions ; import net . ggtools . grand . ui . widgets . GraphWindow ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . eclipse . swt . SWT ; import org . eclipse . swt . printing . PrintDialog ; import org . eclipse . swt . printing . Printer ; import org . eclipse . swt . printing . PrinterData ; public class PrintAction extends GraphControlerAction { private static final Log log = LogFactory . getLog ( PrintAction . class ) ; private static final String DEFAULT_ACTION_NAME = "Print" ; private final GraphWindow window ; | |
2,411 | <s> package net . sf . sveditor . core . db ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; public class SVDBTypeInfoUnion extends SVDBTypeInfo implements ISVDBScopeItem { public SVDBLocation fEndLocation ; public List < SVDBVarDeclStmt > fFields ; public SVDBTypeInfoUnion ( ) { super ( "" , SVDBItemType . TypeInfoUnion ) ; fFields = new ArrayList < SVDBVarDeclStmt > ( ) ; } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public Iterable < ISVDBChildItem > getChildren ( ) { return new Iterable < ISVDBChildItem > ( ) { public Iterator < ISVDBChildItem > iterator ( ) { return ( Iterator ) fFields . iterator ( ) ; } } ; } | |
2,412 | <s> package org . rubypeople . rdt . internal . ui . text . spelling . engine ; public interface ISpellCheckPreferenceKeys { public final static String SPELLING_IGNORE_DIGITS = "" ; public final static String SPELLING_IGNORE_MIXED = "" ; public final static String SPELLING_IGNORE_SENTENCE = "" ; | |
2,413 | <s> package org . oddjob . examples ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; public class PricingJob implements Runnable { private Object priceService ; public Object getPriceService ( ) { return priceService ; } @ ArooaAttribute public void setPriceService ( Object priceService ) { this . priceService = priceService ; } @ Override public void run ( ) | |
2,414 | <s> package org . oddjob . logging ; import java . io . Serializable ; public class LogEvent implements Serializable { private static final long serialVersionUID = 20061214 ; private final long number ; private final LogLevel level ; private final String logger ; private final String message ; public LogEvent ( String logger , long number , LogLevel level , String message ) { if ( logger == null ) { throw new NullPointerException ( "" ) ; } if ( number < 0 ) { throw new IllegalArgumentException ( "" ) ; } if ( level == null ) { throw new NullPointerException ( "" ) ; } if ( message == null ) { throw new NullPointerException ( "" ) ; } this . number = number ; this . level = level ; this . logger = logger ; this | |
2,415 | <s> package org . rubypeople . rdt . internal . ui . compare ; import org . eclipse . compare . CompareConfiguration ; import org . eclipse . compare . IViewerCreator ; import org . eclipse . jface . viewers . | |
2,416 | <s> package de . fuberlin . wiwiss . d2rq . sql . types ; import de . fuberlin . | |
2,417 | <s> package org . oddjob . oddballs ; import java . io . File ; import java . util . Arrays ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . deploy . ArooaDescriptorBean ; import org . oddjob . arooa . deploy . ArooaDescriptorFactory ; import org . oddjob . arooa . deploy . ListDescriptor ; public class OddballsDescriptorFactory implements ArooaDescriptorFactory { private static final Logger logger = Logger . getLogger ( OddballsDescriptorFactory . class ) ; private File [ ] files ; private OddballFactory oddballFactory ; public OddballsDescriptorFactory ( ) { this ( null , null ) ; } public OddballsDescriptorFactory ( File [ ] files ) { this ( files , null ) ; } public OddballsDescriptorFactory ( File [ ] files , OddballFactory oddballFactory ) { this . files = files ; this . oddballFactory = oddballFactory ; } public File [ ] getFiles ( ) { return files ; } public void setFiles ( File [ ] baseDir ) { this . files = baseDir ; } public OddballFactory getOddballFactory ( ) { return oddballFactory ; } public void setOddballFactory ( OddballFactory oddballFactory ) { this . oddballFactory = oddballFactory ; } public ArooaDescriptor createDescriptor ( ClassLoader classLoader ) { if ( files == null ) { throw new NullPointerException ( "" ) ; } OddballFactory oddballFactory = this . oddballFactory ; if ( oddballFactory == null ) { oddballFactory = new DirectoryOddball ( ) ; } ListDescriptor descriptor = new ListDescriptor ( ) ; for ( File file : files ) | |
2,418 | <s> package org . rubypeople . rdt . internal . corext . buildpath ; import java . lang . reflect . InvocationTargetException ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . packageview . LoadPathContainer ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . DialogPackageExplorerActionGroup ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierOperation ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage . LoadpathModifierQueries . IRemoveLinkedFolderQuery ; public class RemoveFromLoadpathOperation extends LoadpathModifierOperation { public RemoveFromLoadpathOperation ( ILoadpathModifierListener listener , ILoadpathInformationProvider informationProvider ) { super ( listener , informationProvider , NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip , ILoadpathInformationProvider . REMOVE_FROM_BP ) ; } public void run ( IProgressMonitor monitor ) throws InvocationTargetException { List result = null ; fException = null ; try { result = removeFromLoadpath ( fInformationProvider . getRemoveLinkedFolderQuery ( ) , getSelectedElements ( ) , fInformationProvider . getRubyProject ( ) , monitor ) ; } catch ( CoreException e ) { fException = e ; result = null ; } super . handleResult ( result , monitor ) ; } public boolean isValid ( List elements , int [ ] types ) throws RubyModelException { if ( elements . size ( ) == 0 ) return false ; IRubyProject project = fInformationProvider . getRubyProject ( ) ; Iterator iterator = elements . iterator ( ) ; while ( iterator . hasNext ( ) ) { Object element = iterator . next ( ) ; if ( ! ( element instanceof ISourceFolderRoot || element instanceof IRubyProject || element instanceof LoadPathContainer ) ) return false ; if ( element instanceof IRubyProject ) { if ( ! isSourceFolder ( project ) ) return false ; } else if ( element instanceof | |
2,419 | <s> package com . sun . tools . hat . internal . server ; import com . google . common . base . Predicate ; import com . google . common . collect . Iterables ; import com . google . common . io . Closeables ; import com . sun . tools . hat . internal . model . JavaClass ; import java . util . ArrayList ; import java . util . List ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . BufferedReader ; import java . io . IOException ; public class PlatformClasses { static volatile List < String > names = null ; public static List < String > getNames ( ) { if ( names == null ) { List < String > | |
2,420 | <s> package org . rubypeople . rdt . internal . core ; import junit . framework . TestCase ; import org . eclipse . core . runtime . Path ; import org . rubypeople . rdt . core . | |
2,421 | <s> package com . asakusafw . cleaner . log ; import java . sql . Timestamp ; import java . text . DateFormat ; import java . text . SimpleDateFormat ; import org . apache . log4j . Level ; import org . apache . log4j . Logger ; import org . apache . log4j . MDC ; public final class Log { private static final String LOG_TSTAMP_NULL_STR = "" ; private static final String LOG_MESSAGE_ID_NULL_STR = "-" ; private static final String LOG_MESSAGE_ARG_NULL_STR = "(null)" ; private Log ( ) { return ; } public static String log ( Class < ? > clazz , String messageId , Object ... messageArgs ) { return Log . log ( null , clazz , messageId , messageArgs ) ; } public static String log ( Throwable t , Class < ? > clazz , String messageId , Object ... messageArgs ) { if ( ! LogInitializer . isInitialized ( ) ) { return null ; } String message = LogMessageManager . getInstance ( ) . createLogMessage ( messageId , Log . changeNullToStr ( messageArgs , LOG_MESSAGE_ARG_NULL_STR ) ) ; Level level = LogMessageManager . getInstance ( ) . getLogLevel ( messageId ) ; Timestamp logTime = new Timestamp ( System . currentTimeMillis ( ) ) ; Log . setMDC ( messageId , logTime ) ; Log . writeLog ( t , clazz , level , message ) ; Log . resetMDC ( ) ; return message ; } private static void setMDC ( String messageId , Timestamp logTime ) { DateFormat dateFormat = new SimpleDateFormat ( "" ) ; MDC . put ( "LOG_TSTAMP" , dateFormat . format ( logTime ) ) ; MDC . put ( "MESSAGE_ID" , messageId ) ; } private static | |
2,422 | <s> package org . oddjob . monitor . action ; import javax . inject . Inject ; import junit . framework . TestCase ; import org . apache . commons . beanutils . PropertyUtils ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . ExplorerContextImpl ; import org . oddjob . monitor . model . ExplorerModelImpl ; import org . oddjob . util . SimpleThreadManager ; public class ExecuteActionTest2 extends TestCase { class MyClassLoader extends ClassLoader { } public static class ClassLoaderCapture implements Runnable { ClassLoader context ; ClassLoader result ; public void run ( ) { context = Thread . currentThread ( ) . | |
2,423 | <s> package net . sf . sveditor . core . tests ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOError ; import java . io . IOException ; import java . io . InputStream ; 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 . Tuple ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBFileFactory ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . db . SVDBBind ; 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 . SVDBMacroDef ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . SVDBMarker . MarkerType ; import net . sf . sveditor . core . db . SVDBModIfcInst ; import net . sf . sveditor . core . db . SVDBModIfcInstItem ; import net . sf . sveditor . core . db . SVDBPreProcObserver ; import net . sf . sveditor . core . db . index . InputStreamCopier ; import net . sf . sveditor . core . db . stmt . SVDBImportItem ; import net . sf . sveditor . core . db . stmt . SVDBImportStmt ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . preproc . SVPreProcDirectiveScanner ; import net . sf . sveditor . core . preproc . SVPreProcOutput ; import net . sf . sveditor . core . preproc . SVPreProcessor ; import net . sf . sveditor . core . scanner . IPreProcMacroProvider ; import net . sf . sveditor . core . scanner . SVPreProcDefineProvider ; import net . sf . sveditor . core . tests . utils . TestUtils ; public class SVDBTestUtils { public static void assertNoErrWarn ( SVDBFile file ) { for ( ISVDBItemBase it : file . getChildren ( ) ) { if ( it . getType ( ) == SVDBItemType . Marker ) { SVDBMarker m = ( SVDBMarker ) it ; if ( m . getMarkerType ( ) == MarkerType . Error || m . getMarkerType ( ) == MarkerType . Warning ) { System . out . println ( "" + m . getMessage ( ) + " @ " + file . getName ( ) + ":" + m . getLocation ( ) . getLine ( ) ) ; TestCase . fail ( "" + m . getMarkerType ( ) + " @ " + file . getName ( ) + ":" + m . getLocation ( ) . getLine ( ) ) ; } } } } public static void assertFileHasElements ( SVDBFile file , String ... elems ) { for ( String e : elems ) { if ( findElement ( file , e ) == null ) { TestCase . fail ( "" + e + "\" in file " + file . getName ( ) ) ; } } } public static void assertFileDoesNotHaveElements ( SVDBFile file , String ... elems ) { for ( String e : elems ) { if ( findElement ( file , e ) != null ) { TestCase . fail ( "" + e + "\" in file " + file . getName ( ) ) ; } } } public static ISVDBItemBase findInFile ( SVDBFile file , String name ) { return findElement ( file , name ) ; } private static ISVDBItemBase findElement ( ISVDBScopeItem scope , String e ) { for ( ISVDBItemBase it : scope . getItems ( ) ) { ISVDBItemBase ret = findElement ( it , e ) ; if ( ret != null ) { return ret ; } } return null ; } private static ISVDBItemBase findElement ( ISVDBItemBase it , String e ) { if ( SVDBItem . getName ( it ) . equals ( e ) ) { return it ; } else if ( it instanceof SVDBVarDeclStmt ) { for ( ISVDBChildItem c : ( ( SVDBVarDeclStmt ) it ) . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) c ; if ( vi . getName ( ) . equals ( e ) ) { return vi ; } } } else if ( it instanceof SVDBModIfcInst ) { for ( ISVDBChildItem c : ( ( SVDBModIfcInst ) it ) . getChildren ( ) ) { SVDBModIfcInstItem mi = ( SVDBModIfcInstItem ) c ; if ( mi . getName ( ) . equals ( e ) ) { return mi ; } } } else if ( it . getType ( ) == SVDBItemType . ImportStmt ) { for ( ISVDBChildItem c : ( ( SVDBImportStmt ) it ) . getChildren ( ) ) { SVDBImportItem ii = ( SVDBImportItem ) c ; if ( ii . getImport ( ) . equals ( e ) ) { return ii ; } } } else if ( it instanceof ISVDBScopeItem ) { ISVDBItemBase t ; if ( ( t = findElement ( ( ISVDBScopeItem ) it , e ) ) != null ) { return t ; } } else { switch ( it . getType ( ) ) { case Bind : { SVDBModIfcInst inst = ( ( SVDBBind ) it ) . getBindInst ( ) ; if ( inst != null ) { return findElement ( inst , e ) ; } } break ; } } return null ; } public static SVDBFile parse ( String content , String filename ) { return parse ( content , filename , false ) ; } public static Tuple < SVDBFile , SVDBFile > parsePreProc ( String content , String filename , boolean exp_err ) { List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; Tuple < SVDBFile , SVDBFile > file = parse ( null , new StringInputStream ( content ) , filename , markers ) ; if ( ! exp_err ) { TestCase . assertEquals ( "" , 0 , markers . size ( ) ) ; } return file ; } public static SVDBFile parse ( String content , String filename , boolean exp_err ) { List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; SVDBFile file = parse ( null , content , filename , markers ) ; if ( ! exp_err ) { TestCase . assertEquals ( "" , 0 , markers . size ( ) ) ; } return file ; } public static Tuple < SVDBFile , SVDBFile > parse ( LogHandle log , File file , List < SVDBMarker > markers ) { InputStream in = null ; try { in = new FileInputStream ( file ) ; } catch ( IOException e ) { TestCase . fail ( "" + file . getAbsolutePath ( ) + "\": " + e . getMessage ( ) ) ; } Tuple < SVDBFile , SVDBFile > ret = parse ( log , in , file . getName ( ) , markers ) ; return ret ; } public static SVDBFile parse ( LogHandle log , String content , | |
2,424 | <s> package com . asakusafw . directio . tools ; import java . text . MessageFormat ; import java . util . Arrays ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . conf . Configured ; import org . apache . hadoop . util . Tool ; import org . apache . hadoop . util . ToolRunner ; import com . asakusafw . runtime . directio . DirectDataSourceRepository ; import com . asakusafw . runtime . directio . hadoop . DirectIoTransactionEditor ; public final class DirectIoAbortTransaction extends Configured implements Tool { static final Log LOG = LogFactory . getLog ( DirectIoAbortTransaction . class ) ; private DirectDataSourceRepository repository ; public DirectIoAbortTransaction ( ) { return ; } DirectIoAbortTransaction ( DirectDataSourceRepository repository ) { this . repository = repository ; } @ Override public int run ( String [ ] args ) { if ( args . length == 1 ) { String executionId = args [ 0 ] ; DirectIoTransactionEditor editor = new DirectIoTransactionEditor ( repository ) ; editor . setConf ( getConf ( ) ) ; | |
2,425 | <s> package org . rubypeople . rdt . internal . core . search . matching ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . internal . core . LocalVariable ; import org . rubypeople . rdt . internal . core . index . Index ; import org . rubypeople . rdt . internal . core . search . IndexQueryRequestor ; import org . rubypeople . rdt . internal . core . search . RubySearchScope ; import org . rubypeople . rdt . internal . core . search . indexing . IIndexConstants ; import org . rubypeople . rdt . internal . core . util . Util ; public class LocalVariablePattern extends VariablePattern implements IIndexConstants { LocalVariable localVariable ; public LocalVariablePattern ( boolean findDeclarations , boolean readAccess , boolean writeAccess , LocalVariable localVariable , int matchRule ) { super ( LOCAL_VAR_PATTERN , findDeclarations , readAccess , writeAccess , localVariable . getElementName ( ) . toCharArray ( ) , matchRule ) ; this . localVariable = localVariable ; } public void findIndexMatches ( Index index , IndexQueryRequestor requestor , SearchParticipant participant , IRubySearchScope scope , IProgressMonitor progressMonitor ) { ISourceFolderRoot root = ( ISourceFolderRoot ) this . localVariable . getAncestor ( IRubyElement . SOURCE_FOLDER_ROOT ) ; String documentPath ; String relativePath ; IPath path = this . localVariable . getPath ( ) ; documentPath = path . toString ( ) ; relativePath = Util . relativePath ( path , 1 ) ; if ( scope instanceof RubySearchScope ) { RubySearchScope javaSearchScope = ( RubySearchScope ) scope ; if ( ! requestor . acceptIndexMatch ( documentPath , this , participant ) ) throw | |
2,426 | <s> package com . asakusafw . dmdl . semantics . type ; import java . text . MessageFormat ; import com . asakusafw . dmdl . model . AstBasicType ; import com . asakusafw . dmdl . model . BasicTypeKind ; import com . asakusafw . dmdl . semantics . PropertyMappingKind ; import com . asakusafw . dmdl . semantics . Type ; public class BasicType implements Type { private final AstBasicType originalAst ; private final BasicTypeKind kind ; public BasicType ( AstBasicType originalAst , BasicTypeKind kind ) { if ( kind == null ) { throw new IllegalArgumentException ( "" ) ; } this . originalAst = originalAst ; this . kind = kind ; } @ Override public AstBasicType getOriginalAst ( ) { return originalAst ; } public BasicTypeKind getKind ( ) { return kind ; } @ Override public Type map ( PropertyMappingKind mapping | |
2,427 | <s> package org . oddjob . jmx . general ; import java . util . Date ; public class Vendor implements VendorMBean { String fruit ; Date delivery ; int quantity ; double rating ; final String farm ; public Vendor ( String farm ) { this . | |
2,428 | <s> package org . oddjob . io ; import java . io . File ; import java . io . IOException ; import java . io . Serializable ; import org . apache . commons . io . FileUtils ; import org . apache . log4j . Logger ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; public class MkdirJob implements Runnable , Serializable { private static final Logger logger = Logger | |
2,429 | <s> package fi . koku . services . utility . authorizationinfo . util ; import java . util . List ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import fi . koku . KoKuException ; import fi . koku . KoKuNotAuthorizedException ; import fi . koku . auth . KoKuRoleUtil ; import fi . koku . services . utility . authorizationinfo . v1 . model . Role ; public class AuthUtils { private static Logger logger = LoggerFactory . getLogger ( AuthUtils . class ) ; private AuthUtils ( ) { } public static boolean isOperationAllowed ( String operation , List < Role > roles ) { Set < String > allowedRoles = | |
2,430 | <s> package org . rubypeople . rdt . refactoring . tests . core . movefield ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . eclipse . jface . text . BadLocationException ; import org . rubypeople . rdt . refactoring . core . movefield . MoveFieldConditionChecker ; | |
2,431 | <s> package org . oddjob . framework ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Map ; import org . apache . commons . beanutils . DynaBean ; import org . apache . commons . beanutils . DynaClass ; import org . apache . log4j . Logger ; import org . oddjob . Describeable ; import org . oddjob . FailedToStopException ; import org . oddjob . Reserved ; import org . oddjob . Resetable ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . arooa . ArooaConfigurationException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . convert . ArooaConverter ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . reflect . BeanOverview ; import org . oddjob . arooa . reflect . PropertyAccessor ; import org . oddjob . describe . UniversalDescriber ; import org . oddjob . images . IconHelper ; import org . oddjob . logging . LogEnabled ; import org . oddjob . logging . LogHelper ; import org . oddjob . state . IsStoppable ; abstract public class BaseWrapper extends BaseComponent | |
2,432 | <s> package net . sf . sveditor . ui . explorer ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBIndexRegistry ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IProject ; | |
2,433 | <s> package net . sf . sveditor . core . db . stmt ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . | |
2,434 | <s> package org . rubypeople . rdt . debug . core . tests ; import java . io . ByteArrayInputStream ; import java . io . File ; import java . util . HashMap ; import junit . framework . TestCase ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . eclipse . debug . core . ILaunchConfigurationType ; import org . eclipse . debug . core . ILaunchConfigurationWorkingCopy ; import org . eclipse . debug . core . model . IProcess ; import org . rubypeople . eclipse . testutils . ResourceTools ; import org . rubypeople . rdt . debug . core . RdtDebugModel ; import org . rubypeople . rdt . internal . launching . RubyLaunchConfigurationAttribute ; import org . rubypeople . rdt . launching . IRubyLaunchConfigurationConstants ; import org . rubypeople . rdt . launching . IVMInstallType ; import org . rubypeople . rdt . launching . RubyRuntime ; import org . rubypeople . rdt . launching . VMStandin ; public class FTC_DebuggerLaunch extends TestCase { private static final String RUBY_INTERPRETER_ID = "" ; private static final String VM_TYPE_ID = "" ; private static final boolean VERBOSE = false ; private IVMInstallType vmType ; public void setUp ( ) { vmType = RubyRuntime . getVMInstallType ( VM_TYPE_ID ) ; String rubyInterpreterPath = FTC_ClassicDebuggerCommunicationTest . RUBY_INTERPRETER ; log ( "" + rubyInterpreterPath ) ; VMStandin standin = new VMStandin ( vmType , RUBY_INTERPRETER_ID ) ; standin . setInstallLocation ( new File ( rubyInterpreterPath ) ) ; standin . convertToRealVM ( ) ; } @ Override protected void tearDown ( ) throws Exception { super . tearDown ( ) ; vmType . disposeVMInstall ( RUBY_INTERPRETER_ID ) ; } protected void log ( String label , ILaunch launch ) throws Exception { log ( "Infos about " + label + ":" ) ; IProcess process = launch . getProcesses ( ) [ 0 ] ; if ( process . isTerminated ( ) ) { log ( "" + process . getExitValue ( ) ) ; } else { log ( "" ) ; } String error = process . getStreamsProxy ( ) . getErrorStreamMonitor ( ) . getContents ( ) ; if ( error != null && error . length ( ) > 0 ) { log ( "" + error ) ; } String stdout = process . getStreamsProxy ( ) . getOutputStreamMonitor ( ) . getContents ( ) ; if ( stdout != null && stdout . length ( ) > 0 ) { log ( "" + stdout ) ; } } private void log ( String message ) { if ( VERBOSE ) System . out . println ( message ) ; } public void testTwoSessions ( ) throws Exception { ILaunchConfigurationType lcT = DebugPlugin . getDefault ( ) . getLaunchManager ( ) . getLaunchConfigurationType ( IRubyLaunchConfigurationConstants . ID_RUBY_APPLICATION ) ; ILaunchConfigurationWorkingCopy wc = lcT . newInstance ( null , "" ) ; IProject project = ResourceTools . createProject ( "" ) ; IFile rubyFile = project . getFile ( "run.rb" ) ; rubyFile . create ( new ByteArrayInputStream ( "" . getBytes ( ) ) , true , new NullProgressMonitor ( ) ) ; wc . setAttribute ( IRubyLaunchConfigurationConstants . ATTR_PROJECT_NAME , rubyFile . getProject ( ) . getName ( ) ) ; wc . setAttribute ( IRubyLaunchConfigurationConstants . ATTR_FILE_NAME , rubyFile . getProjectRelativePath ( ) . toString ( ) ) ; wc . setAttribute ( RubyLaunchConfigurationAttribute . SELECTED_INTERPRETER , RUBY_INTERPRETER_ID ) ; ILaunchConfiguration lc = wc . doSave ( ) ; RdtDebugModel . createLineBreakpoint ( rubyFile , rubyFile . | |
2,435 | <s> package org . rubypeople . rdt . internal . ui . filters ; import org . eclipse . core . resources . IProject ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; import org . rubypeople . rdt . core . IRubyProject ; public class NonRubyProjectsFilter extends ViewerFilter { public boolean select ( Viewer viewer , Object parent , Object element ) { if | |
2,436 | <s> package org . miscwidgets . widget ; import org . miscwidgets . R ; import android . content . Context ; import android . content . res . TypedArray ; import android . graphics . Canvas ; import android . graphics . drawable . Drawable ; import android . text . method . KeyListener ; import android . util . AttributeSet ; import android . util . Log ; import android . view . GestureDetector ; import android . view . KeyEvent ; import android . view . MotionEvent ; import android . view . View ; import android . view . ViewGroup ; import android . view . ViewParent ; import android . view . GestureDetector . OnGestureListener ; import android . view . animation . Animation ; import android . view . animation . Interpolator ; import android . view . animation . LinearInterpolator ; import android . view . animation . TranslateAnimation ; import android . view . animation . Animation . AnimationListener ; import android . widget . FrameLayout ; import android . widget . LinearLayout ; public class Panel extends LinearLayout { private static final String TAG = "Panel" ; public static interface OnPanelListener { public void onPanelClosed ( Panel panel ) ; public void onPanelOpened ( Panel panel ) ; } private boolean mIsShrinking ; private int mPosition ; private int mDuration ; private boolean mLinearFlying ; private int mHandleId ; private int mContentId ; private View mHandle ; private View mContent ; private Drawable mOpenedHandle ; private Drawable mClosedHandle ; private float mTrackX ; private float mTrackY ; private float mVelocity ; private OnPanelListener panelListener ; public static final int TOP = 0 ; public static final int BOTTOM = 1 ; public static final int LEFT = 2 ; public static final int RIGHT = 3 ; private enum State { ABOUT_TO_ANIMATE , ANIMATING , READY , TRACKING , FLYING , } ; private State mState ; private Interpolator mInterpolator ; private GestureDetector mGestureDetector ; private int mContentHeight ; private int mContentWidth ; private int mOrientation ; private float mWeight ; private PanelOnGestureListener mGestureListener ; private boolean mBringToFront ; public Panel ( Context context , AttributeSet attrs ) { super ( context , attrs ) ; TypedArray a = context . obtainStyledAttributes ( attrs , R . styleable . Panel ) ; mDuration = a . getInteger ( R . styleable . Panel_animationDuration , 750 ) ; mPosition = a . getInteger ( R . styleable . Panel_position , BOTTOM ) ; mLinearFlying = a . getBoolean ( R . styleable . Panel_linearFlying , false ) ; mWeight = a . getFraction ( R . styleable . Panel_weight , 0 , 1 , 0.0f ) ; if ( mWeight < 0 || mWeight > 1 ) { mWeight = 0.0f ; Log . w ( TAG , a . getPositionDescription ( ) + "" ) ; } mOpenedHandle = a . getDrawable ( R . styleable . Panel_openedHandle ) ; mClosedHandle = a . getDrawable ( R . styleable . Panel_closedHandle ) ; RuntimeException e = null ; mHandleId = a . getResourceId ( R . styleable . Panel_handle , 0 ) ; if ( mHandleId == 0 ) { e = new IllegalArgumentException ( a . getPositionDescription ( ) + "" ) ; } mContentId = a . getResourceId ( R . styleable . Panel_content , 0 ) ; if ( mContentId == 0 ) { e = new IllegalArgumentException ( a . getPositionDescription ( ) + "" ) ; } a . recycle ( ) ; if ( e != null ) { throw e ; } mOrientation = ( mPosition == TOP || mPosition == BOTTOM ) ? VERTICAL : HORIZONTAL ; setOrientation ( mOrientation ) ; mState = State . READY ; mGestureListener = new PanelOnGestureListener ( ) ; mGestureDetector = new GestureDetector ( mGestureListener ) ; mGestureDetector . setIsLongpressEnabled ( false ) ; setBaselineAligned ( false ) ; } public void setOnPanelListener ( OnPanelListener onPanelListener ) { panelListener = onPanelListener ; } public View getHandle ( ) { return mHandle ; } public View getContent ( ) { return mContent ; } public void setInterpolator ( Interpolator i ) { mInterpolator = i ; } public boolean setOpen ( boolean open , boolean animate ) { if ( mState == State . READY && isOpen ( ) ^ open ) { mIsShrinking = ! open ; if ( animate ) { mState = State . ABOUT_TO_ANIMATE ; if ( ! mIsShrinking ) { mContent . setVisibility ( VISIBLE ) ; } post ( startAnimation ) ; } else { mContent . setVisibility ( open ? VISIBLE : GONE ) ; postProcess ( ) ; } return true ; } return false ; } public boolean isOpen ( ) { return mContent . getVisibility ( ) == VISIBLE ; } @ Override protected void onFinishInflate ( ) { super . onFinishInflate ( ) ; mHandle = findViewById ( mHandleId ) ; if ( mHandle == null ) { String name = getResources ( ) . getResourceEntryName ( mHandleId ) ; throw new RuntimeException ( "" + name + "'" ) ; } mHandle . setOnTouchListener ( touchListener ) ; mHandle . setOnClickListener ( clickListener ) ; mContent = findViewById ( mContentId ) ; if ( mContent == null ) { String name = getResources ( ) . getResourceEntryName ( mHandleId ) ; throw new RuntimeException ( "" + name + "'" ) ; } removeView ( mHandle ) ; removeView ( mContent ) ; if ( mPosition == TOP || mPosition == LEFT ) { addView ( mContent ) ; addView ( mHandle ) ; } else { addView ( mHandle ) ; addView ( mContent ) ; } if ( mClosedHandle != null ) { mHandle . setBackgroundDrawable ( mClosedHandle ) ; } mContent . setClickable ( true ) ; mContent . setVisibility ( GONE ) ; if ( mWeight > 0 ) { ViewGroup . LayoutParams params = mContent . getLayoutParams ( ) ; if ( mOrientation == VERTICAL ) { params . height = ViewGroup . LayoutParams . FILL_PARENT ; } else { params . width = ViewGroup . LayoutParams . FILL_PARENT ; } mContent . setLayoutParams ( params ) ; } } @ Override protected void onAttachedToWindow ( ) { super . onAttachedToWindow ( ) ; ViewParent parent = getParent ( ) ; if ( parent != null && parent instanceof FrameLayout ) { mBringToFront = true ; } } @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { if ( mWeight > 0 && mContent . getVisibility ( ) == VISIBLE ) { View parent = ( View ) getParent ( ) ; if ( parent != null ) { if ( mOrientation == VERTICAL ) { heightMeasureSpec = MeasureSpec . makeMeasureSpec ( ( int ) ( parent . getHeight ( ) * mWeight ) , MeasureSpec . EXACTLY ) ; } else { widthMeasureSpec = MeasureSpec . makeMeasureSpec ( ( int ) ( parent . getWidth ( ) * mWeight ) , MeasureSpec . EXACTLY ) ; } } } super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; } @ Override protected void onLayout ( boolean changed , int l , int t , int r , int b ) { super . onLayout ( changed , l , t , r , b ) ; mContentWidth = mContent . getWidth ( ) ; mContentHeight = mContent . getHeight ( ) ; } @ Override protected void dispatchDraw ( Canvas canvas ) { if ( mState == State . ABOUT_TO_ANIMATE && ! mIsShrinking ) { int delta = mOrientation == VERTICAL ? mContentHeight : mContentWidth ; if ( mPosition == LEFT || mPosition == TOP ) { delta = - delta ; } if ( mOrientation == VERTICAL ) { canvas . translate ( 0 , delta ) ; } else { canvas . translate ( delta , 0 ) ; } } if ( mState == State . TRACKING || mState == State . FLYING ) { canvas . translate ( mTrackX , mTrackY ) ; } super . dispatchDraw ( canvas ) ; } private float ensureRange ( float v , int min , int max ) { v = Math . max ( v , min ) ; v = Math . min ( v , max ) ; return v ; } OnTouchListener touchListener = new OnTouchListener ( ) { int initX ; int initY ; boolean setInitialPosition ; public boolean onTouch ( View v , MotionEvent event ) { if ( mState == State . ANIMATING ) { return false ; } int action = event . getAction ( ) ; if ( action == MotionEvent . ACTION_DOWN ) { if ( mBringToFront ) { bringToFront ( ) ; } initX = 0 ; initY = 0 ; if ( mContent . getVisibility ( ) == GONE ) { if ( mOrientation == VERTICAL ) { initY = mPosition == TOP ? - 1 : 1 ; } else { initX = mPosition == LEFT ? - 1 : 1 ; } } setInitialPosition = true ; } else { if ( setInitialPosition ) { initX *= mContentWidth ; initY *= mContentHeight ; mGestureListener . setScroll ( initX , initY ) ; setInitialPosition = false ; initX = - initX ; initY = - initY ; } event . offsetLocation ( initX , initY ) ; } if ( ! mGestureDetector . onTouchEvent ( event ) ) { | |
2,437 | <s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . eclipse . jface . action . Action ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; public class ShowQualifiedTypeNamesAction extends Action { private TypeHierarchyViewPart fView ; public ShowQualifiedTypeNamesAction ( TypeHierarchyViewPart v , boolean initValue ) { super ( TypeHierarchyMessages . ShowQualifiedTypeNamesAction_label ) ; setDescription ( TypeHierarchyMessages . ShowQualifiedTypeNamesAction_description ) ; setToolTipText ( TypeHierarchyMessages . ShowQualifiedTypeNamesAction_tooltip ) ; RubyPluginImages . setLocalImageDescriptors ( this , "" ) ; fView = v ; | |
2,438 | <s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . BranchFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . BranchFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . BranchFlowFactory . Simple ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model | |
2,439 | <s> package org . rubypeople . rdt . refactoring . core ; import org . eclipse . core . resources . IFile ; public interface | |
2,440 | <s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . net . URI ; import java . net . URISyntaxException ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; public class MockSourceProvider implements DataModelSourceProvider { private final Map < URI , DataModelSource > sources = new HashMap < URI , DataModelSource > ( ) ; public MockSourceProvider ( ) { try { add ( new URI ( "" ) , "MOCK" ) ; } catch ( URISyntaxException e ) { throw new AssertionError ( e ) ; } } public final < T > MockSourceProvider add ( URI uri , DataModelDefinition < T > def , Iterable < ? extends T > iter ) { sources . put ( uri , new IteratorDataModelSource ( def , iter . iterator ( ) ) ) ; return this ; } public final MockSourceProvider add ( | |
2,441 | <s> package com . asakusafw . compiler . common ; import java . util . Set ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . SimpleName ; public class NameGenerator { private final ModelFactory factory ; private final Set < String > used = Sets . create ( ) ; public NameGenerator ( ModelFactory factory ) { Precondition . checkMustNotBeNull ( factory , "factory" ) ; this . factory = factory ; } public String reserve ( String name ) { Precondition . checkMustNotBeNull ( name , "name" ) ; used . add ( name ) ; return name ; } public SimpleName | |
2,442 | <s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . search . ui . ISearchPageScoreComputer ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . internal . ui . rubyeditor . IRubyScriptEditorInput ; public class RubySearchPageScoreComputer implements ISearchPageScoreComputer { public int computeScore ( String id , Object element ) { | |
2,443 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Attribute ; import com . asakusafw . utils . java . model . syntax . ClassDeclaration ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class ClassDeclarationImpl extends ModelRoot implements ClassDeclaration { private Javadoc javadoc ; private List < ? extends Attribute > modifiers ; private SimpleName name ; private List < ? extends TypeParameterDeclaration > typeParameters ; private Type superClass ; private List < ? extends Type > superInterfaceTypes ; private List < ? extends TypeBodyDeclaration > bodyDeclarations ; @ Override public Javadoc getJavadoc ( ) { return this . javadoc ; } public void setJavadoc ( Javadoc javadoc ) { this . javadoc = javadoc ; } @ Override public List < ? extends Attribute > getModifiers ( ) { return this . modifiers ; } public void setModifiers ( List < ? extends Attribute > modifiers ) { Util . notNull ( modifiers , "modifiers" ) ; Util . notContainNull ( modifiers , "modifiers" ) ; this . modifiers = Util . freeze ( modifiers ) ; } @ Override public SimpleName getName ( ) { return this . name ; } public void setName ( SimpleName name ) { Util . notNull ( name , "name" ) ; this . name = name ; } @ Override public List < ? extends TypeParameterDeclaration > getTypeParameters ( ) { return this . typeParameters ; } public void setTypeParameters ( List < ? extends TypeParameterDeclaration > typeParameters ) { Util . notNull ( typeParameters , "" ) ; Util . notContainNull ( typeParameters , "" ) ; this . typeParameters = Util . freeze ( typeParameters ) ; } @ Override public Type getSuperClass ( ) { return this . superClass ; } public void setSuperClass ( Type superClass ) { this . superClass = superClass ; } @ Override public List < ? extends Type > getSuperInterfaceTypes ( ) { return this . superInterfaceTypes ; } public void setSuperInterfaceTypes ( List < ? extends Type > superInterfaceTypes ) { Util . notNull ( superInterfaceTypes , "" ) ; Util | |
2,444 | <s> package com . asakusafw . compiler . flow . stage ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . plan . FlowBlock ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . compiler . flow . stage . StageModel . ResourceFragment ; import com . asakusafw . compiler . flow . stage . StageModel . Unit ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . vocabulary . flow . graph . FlowElement ; import com . asakusafw . vocabulary . flow . graph . FlowResourceDescription ; public class StageCompiler { static final Logger LOG = LoggerFactory . getLogger ( StageCompiler . class ) ; private final FlowCompilingEnvironment environment ; private final ShuffleAnalyzer shuffleAnalyzer ; private final StageAnalyzer mapredAnalyzer ; private final ShuffleKeyEmitter shuffleKeyEmitter ; private final ShuffleValueEmitter shuffleValueEmitter ; private final ShuffleGroupingComparatorEmitter shuffleGroupingEmitter ; private final ShuffleSortComparatorEmitter shuffleSortingEmitter ; private final ShufflePartitionerEmitter shuffleParitioningEmitter ; private final FlowResourceEmitter flowResourceEmitter ; private final MapFragmentEmitter mapFragmentEmitter ; private final ShuffleFragmentEmitter shuffleFragmentEmitter ; private final ReduceFragmentEmitter reduceFragmentEmitter ; private final MapperEmitter mapperEmitter ; private final ReducerEmitter reducerEmitter ; private final CombinerEmitter combinerEmitter ; public StageCompiler ( FlowCompilingEnvironment environment ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; this . environment = environment ; this . shuffleAnalyzer = new ShuffleAnalyzer ( environment ) ; this . mapredAnalyzer = new StageAnalyzer ( environment ) ; this . shuffleKeyEmitter = new ShuffleKeyEmitter ( environment ) ; this . shuffleValueEmitter = new ShuffleValueEmitter ( environment ) ; this . shuffleGroupingEmitter = new ShuffleGroupingComparatorEmitter ( environment ) ; this . shuffleSortingEmitter = new ShuffleSortComparatorEmitter ( environment ) ; this . shuffleParitioningEmitter = new ShufflePartitionerEmitter ( environment ) ; this . flowResourceEmitter = new FlowResourceEmitter ( environment ) ; this . mapFragmentEmitter = new MapFragmentEmitter ( environment ) ; this . shuffleFragmentEmitter = new ShuffleFragmentEmitter ( environment ) ; this . reduceFragmentEmitter = new ReduceFragmentEmitter ( environment ) ; this . mapperEmitter = new MapperEmitter ( environment ) ; this . reducerEmitter = new ReducerEmitter ( environment ) ; this . combinerEmitter = new CombinerEmitter ( environment ) ; } public List < StageModel > compile ( StageGraph graph ) throws IOException { Precondition . checkMustNotBeNull ( graph , "graph" ) ; LOG . info ( "" , graph . getInput ( ) . getSource ( ) . getDescription ( ) . getName ( ) ) ; Map < FlowResourceDescription , CompiledType > resourceMap = compileResources ( graph ) ; List < StageModel > results = Lists . create ( ) ; for ( StageBlock block : graph . getStages ( ) ) { StageModel model = compileStage ( block , resourceMap ) ; results . add ( model ) ; } if ( environment . hasError ( ) ) { throw new IOException ( MessageFormat . format ( "" , environment . getErrorMessage ( ) ) ) ; } return results ; } private StageModel compileStage ( StageBlock block , Map < FlowResourceDescription , CompiledType > | |
2,445 | <s> package br . com . caelum . vraptor . dash . monitor ; import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . nio . charset . Charset ; import java . util . Map . Entry ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import br . com . caelum . vraptor . Get ; import br . com . caelum . vraptor . Resource ; import br . com . caelum . vraptor . Result ; import br . com . caelum . vraptor . dash . audit . Audit ; import br . com . caelum . vraptor . dash . hibernate . AuditController ; import br . com . caelum . vraptor . environment . Environment ; import br . com . caelum . vraptor . freemarker . FreemarkerView ; import br . com . caelum . vraptor . interceptor . download . InputStreamDownload ; import br . com . caelum . vraptor . view . HttpResult ; import br . com . caelum . vraptor . view . Results ; import freemarker . template . TemplateException ; @ Resource public class SystemController { public static final String ALLOWED_LOG_REGEX = "" ; private static final Logger LOG = LoggerFactory . getLogger ( AuditController . class ) ; private final Environment environment ; private final Result result ; private final MonitorAwareUser user ; public SystemController ( Environment environment , Result result , MonitorAwareUser user ) { this . environment = environment ; this . result = result ; this . user = user ; } @ Get ( "" ) public InputStreamDownload properties ( ) throws IOException { if ( ! user . canSeeMonitorStats ( ) ) { result . use ( HttpResult . class ) . sendError ( 401 ) ; return null ; } StringBuilder sb = new StringBuilder ( ) ; Set < Entry < Object , Object > > entrySet = System . getProperties ( ) . entrySet ( ) ; for ( Entry < Object , Object > entry : entrySet ) { sb . append ( String . format ( "%-50s %sn" , entry . getKey ( ) , entry . getValue ( ) ) ) ; } sb . append ( String . format ( "%-50s %sn" , "" , Charset . defaultCharset ( ) ) ) ; return new InputStreamDownload ( new ByteArrayInputStream ( sb . toString ( ) . getBytes ( ) ) , "text/plain" , "log.log" ) ; } @ Get ( "" ) @ Audit public InputStreamDownload log ( String name ) throws IOException { if ( ! user . canSeeMonitorStats ( ) ) { result . use ( HttpResult . class ) . sendError ( 401 ) ; return null ; } File file = new File ( name ) ; String allowedPattern = environment . get ( SystemController . ALLOWED_LOG_REGEX ) ; if ( ! name . matches ( allowedPattern ) ) { result . use ( Results . status ( ) ) . forbidden ( "" ) ; return null ; } LOG . debug ( | |
2,446 | <s> import java . io . File ; public class MultiUploaderThread extends Thread { Thread thread ; MultiUploader mu ; String type ; Upload upload = new Upload ( ) ; File file ; public MultiUploaderThread ( File file , String type , MultiUploader mu ) { this . mu = mu ; this . type = type ; this . file = file ; thread = new Thread ( this ) ; thread . start ( ) ; } public void run ( ) { String response = upload . uploadImage ( file , type ) ; if | |
2,447 | <s> package com . sun . phobos . script . util ; import javax . script . * ; public abstract class ScriptEngineFactoryBase implements ScriptEngineFactory { public String getName ( ) | |
2,448 | <s> package net . ggtools . grand . ui . widgets . property ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import net . ggtools . grand . ui . event . Dispatcher ; import net . ggtools . grand . ui . event . EventManager ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; class PropertyList { private static final Log log = LogFactory . getLog ( PropertyList . class ) ; private Dispatcher allPropertiesChangedDispatcher ; private Dispatcher clearedPropertiesDispatcher ; private Dispatcher propertyAddedDispatcher ; private Dispatcher propertyChangedDispatcher ; private Dispatcher propertyRemovedDispatcher ; EventManager eventManager ; final Set < PropertyPair > pairList = new HashSet < PropertyPair > ( ) ; public PropertyList ( ) { eventManager = new EventManager ( "" ) ; try { propertyChangedDispatcher = eventManager . createDispatcher ( PropertyChangedListener . class . getDeclaredMethod ( "" , new Class [ ] { PropertyPair . class } ) ) ; | |
2,449 | <s> package org . oddjob . persist ; import java . io . File ; public class PersistRequest { private final Object toPersist ; private final String id ; private final File directory ; private boolean persisted = false ; private final Object waitOn = new Object ( ) ; | |
2,450 | <s> package org . rubypeople . rdt . internal . ui . workingsets ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . util . Assert ; public class ViewAction extends Action { private final ViewActionGroup fActionGroup ; private final int fMode ; public ViewAction ( ViewActionGroup group , int mode ) { super ( "" , AS_RADIO_BUTTON ) ; Assert . isNotNull ( group ) ; fActionGroup = group ; | |
2,451 | <s> package com . asakusafw . testdriver . html ; import java . io . File ; import java . io . IOException ; import java . net . URI ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DifferenceSink ; import com . asakusafw . testdriver . core . DifferenceSinkProvider ; import com . asakusafw . testdriver . core . TestContext ; public class HtmlDifferenceSinkProvider implements DifferenceSinkProvider { static final Logger LOG = LoggerFactory . getLogger ( HtmlDifferenceSinkProvider . class ) ; @ Override public < T > DifferenceSink create ( DataModelDefinition < T > definition , URI sink , TestContext context ) throws IOException { String scheme = sink . getScheme ( ) ; if ( scheme == null || scheme . endsWith ( "file" ) == false ) { return null ; } File file = new File ( | |
2,452 | <s> package org . springframework . social . google . connect ; import org . springframework . social . connect . UserProfile ; import org . springframework . social . connect . support . OAuth2ConnectionFactory ; | |
2,453 | <s> package com . sun . tools . hat . internal . parser ; import java . io . IOException ; public interface ReadBuffer { public void get ( long pos , byte [ ] buf ) throws IOException ; public char getChar ( long pos ) throws | |
2,454 | <s> package com . postmark . java ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . | |
2,455 | <s> package bonsai . app ; import android . app . Activity ; import android . content . Intent ; import android . net . Uri ; import android . os . Bundle ; import android . view . View ; import android . view . View . OnClickListener ; import android . widget . Button ; import android . widget . CheckBox ; import android . widget . EditText ; import android . widget . TextView ; public class EnvioMailActivity extends Activity { @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . enviomail ) ; final TextView etEmail = ( TextView ) findViewById ( R . id . etEmail ) ; final EditText etSubject = ( EditText ) findViewById ( R . id . etSubject ) ; final EditText etBody = ( EditText ) findViewById ( R . id . etBody ) ; final CheckBox chkAttachment = ( CheckBox ) findViewById ( R . id . chkAttachment ) ; Bundle bundle = getIntent ( ) . getExtras ( ) ; etEmail . setText ( bundle . getString ( "MAIL" ) ) ; Button btnSend = ( Button ) findViewById ( R . id . btnSend ) ; btnSend . setOnClickListener ( new OnClickListener ( ) { @ Override public void onClick ( View v ) { Intent itSend = new Intent ( android . content . Intent . ACTION_SEND ) ; itSend . setType ( "plain/text" ) ; itSend . putExtra ( | |
2,456 | <s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Group ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Text ; import org . eclipse . ui . preferences . IWorkbenchPreferenceContainer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . core . util . Messages ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . text . ruby . ProposalSorterHandle ; import org . rubypeople . rdt . internal . ui . text . ruby . ProposalSorterRegistry ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . IStatusChangeListener ; import org . rubypeople . rdt . ui . PreferenceConstants ; class CodeAssistConfigurationBlock extends OptionsConfigurationBlock { private static final Key PREF_CODEASSIST_AUTOACTIVATION = getRDTUIKey ( PreferenceConstants . CODEASSIST_AUTOACTIVATION ) ; private static final Key PREF_CODEASSIST_AUTOACTIVATION_DELAY = getRDTUIKey ( PreferenceConstants . CODEASSIST_AUTOACTIVATION_DELAY ) ; private static final Key PREF_CODEASSIST_AUTOINSERT = getRDTUIKey ( PreferenceConstants . CODEASSIST_AUTOINSERT ) ; private static final Key PREF_CODEASSIST_SORTER = getRDTUIKey ( PreferenceConstants . CODEASSIST_SORTER ) ; private static final Key PREF_CODEASSIST_INSERT_COMPLETION = getRDTUIKey ( PreferenceConstants . CODEASSIST_INSERT_COMPLETION ) ; private static final Key PREF_CODEASSIST_FILL_ARGUMENT_NAMES = getRDTUIKey ( PreferenceConstants . CODEASSIST_FILL_ARGUMENT_NAMES ) ; private static final Key PREF_CODEASSIST_FILL_METHOD_BLOCK_ARGUMENTS = getRDTUIKey ( PreferenceConstants . CODEASSIST_FILL_METHOD_BLOCK_ARGUMENTS ) ; private static final Key PREF_CODEASSIST_PREFIX_COMPLETION = getRDTUIKey ( PreferenceConstants . CODEASSIST_PREFIX_COMPLETION ) ; private static final Key PREF_CODEASSIST_CAMEL_CASE_MATCH = getRDTCoreKey ( RubyCore . CODEASSIST_CAMEL_CASE_MATCH ) ; private static Key [ ] getAllKeys ( ) { return new Key [ ] { PREF_CODEASSIST_AUTOACTIVATION , PREF_CODEASSIST_AUTOACTIVATION_DELAY , PREF_CODEASSIST_AUTOINSERT , PREF_CODEASSIST_SORTER , PREF_CODEASSIST_INSERT_COMPLETION , PREF_CODEASSIST_FILL_ARGUMENT_NAMES , PREF_CODEASSIST_FILL_METHOD_BLOCK_ARGUMENTS , PREF_CODEASSIST_PREFIX_COMPLETION , PREF_CODEASSIST_CAMEL_CASE_MATCH } ; } private static final String [ ] trueFalse = new String [ ] { IPreferenceStore . TRUE , IPreferenceStore . FALSE } ; private Button fCompletionInsertsRadioButton ; private Button fCompletionOverwritesRadioButton ; public CodeAssistConfigurationBlock ( IStatusChangeListener statusListener , IWorkbenchPreferenceContainer workbenchcontainer ) { super ( statusListener , null , getAllKeys ( ) , workbenchcontainer ) ; } protected Control createContents ( Composite parent ) { ScrolledPageContent scrolled = new ScrolledPageContent ( parent , SWT . H_SCROLL | SWT . V_SCROLL ) ; scrolled . setExpandHorizontal ( true ) ; scrolled . setExpandVertical ( true ) ; Composite control = new Composite ( scrolled , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; control . setLayout ( layout ) ; Composite composite ; composite = createSubsection ( control , PreferencesMessages . CodeAssistConfigurationBlock_insertionSection_title ) ; addInsertionSection ( composite ) ; composite = createSubsection ( control , PreferencesMessages . CodeAssistConfigurationBlock_sortingSection_title ) ; addSortingSection ( composite ) ; composite = createSubsection ( control , PreferencesMessages . CodeAssistConfigurationBlock_autoactivationSection_title ) ; addAutoActivationSection ( composite ) ; initialize ( ) ; scrolled . setContent ( control ) ; final Point size = control . computeSize ( SWT . DEFAULT , SWT . DEFAULT ) ; scrolled . setMinSize ( size . x , size . y ) ; return scrolled ; } protected Composite createSubsection ( Composite parent , String label ) { Group group = new Group ( parent , SWT . SHADOW_NONE ) ; group . setText ( label ) ; GridData data = new GridData ( SWT . FILL , SWT . CENTER , true , false ) ; group . setLayoutData ( data ) ; GridLayout layout = new GridLayout ( ) ; layout . numColumns = 3 ; group . setLayout ( layout ) ; return group ; } private void addInsertionSection ( Composite composite ) { addCompletionRadioButtons ( composite ) ; String label ; label = PreferencesMessages . RubyEditorPreferencePage_insertSingleProposalsAutomatically ; addCheckBox ( composite , label , PREF_CODEASSIST_AUTOINSERT , trueFalse , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_completePrefixes ; addCheckBox ( composite , label , PREF_CODEASSIST_PREFIX_COMPLETION , trueFalse , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_fillArgumentNamesOnMethodCompletion ; Button master = addCheckBox ( composite , label , PREF_CODEASSIST_FILL_ARGUMENT_NAMES , trueFalse , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_fillBlockArgumentNamesOnMethodCompletion ; Button slave = addCheckBox ( composite , label , PREF_CODEASSIST_FILL_METHOD_BLOCK_ARGUMENTS , trueFalse , 20 ) ; createSelectionDependency ( master , slave ) ; } protected static void createSelectionDependency ( final Button master , final Control slave ) { master . addSelectionListener ( new SelectionListener ( ) { public | |
2,457 | <s> package org . vaadin . teemu . clara ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertFalse ; import static org . junit . Assert . assertTrue ; import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import org . junit . Before ; import org . junit . Test ; import org . vaadin . teemu . clara . inflater . LayoutInflater ; import org . vaadin . teemu . clara . inflater . LayoutInflaterException ; import com . vaadin . ui . Button ; import com . vaadin . ui . Component ; import com . vaadin . ui . VerticalLayout ; public class LayoutInflaterTest { private LayoutInflater inflater ; @ Before public void setUp ( ) { inflater = new LayoutInflater ( ) ; } private InputStream getXml ( String fileName ) { return getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; } @ Test public void inflate_singleButton_buttonInstantiated ( ) { Button button = ( Button ) inflater . inflate ( getXml ( "" | |
2,458 | <s> package com . asakusafw . runtime . io . csv ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . Reader ; import java . math . BigDecimal ; import java . nio . CharBuffer ; import java . nio . IntBuffer ; import java . text . MessageFormat ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . io . Text ; import com . asakusafw . runtime . io . RecordParser ; import com . asakusafw . runtime . io . csv . CsvFormatException . Reason ; import com . asakusafw . runtime . io . csv . CsvFormatException . Status ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . DoubleOption ; import com . asakusafw . runtime . value . FloatOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . ShortOption ; import com . asakusafw . runtime . value . StringOption ; public class CsvParser implements RecordParser { static final Log LOG = LogFactory . getLog ( CsvParser . class ) ; private static final int BUFFER_LIMIT = 10 * 1024 * 1024 ; private static final int INPUT_BUFFER_SIZE = 4096 ; private static final int EOF = - 1 ; private static final int STATE_LINE_HEAD = 0 ; private static final int STATE_CELL_HEAD = STATE_LINE_HEAD + 1 ; private static final int STATE_CELL_BODY = STATE_CELL_HEAD + 1 ; private static final int STATE_QUOTED = STATE_CELL_BODY + 1 ; private static final int STATE_NEST_QUOTE = STATE_QUOTED + 1 ; private static final int STATE_SAW_CR = STATE_NEST_QUOTE + 1 ; private static final int STATE_QUOTED_SAW_CR = STATE_SAW_CR + 1 ; private static final int STATE_INIT = STATE_LINE_HEAD ; private static final int STATE_FINAL = - 1 ; private final Reader reader ; private final String path ; private final char separator ; private final String trueFormat ; private final DateFormatter dateFormat ; private final DateTimeFormatter dateTimeFormat ; private final List < String > headerCellsFormat ; private final boolean allowLineBreakInValue ; private boolean firstLine = true ; private IntBuffer cellBeginPositions = IntBuffer . allocate ( 256 ) ; private final CharBuffer readerBuffer = CharBuffer . allocate ( INPUT_BUFFER_SIZE ) ; private CharBuffer lineBuffer = CharBuffer . allocate ( INPUT_BUFFER_SIZE ) ; private int currentRecordNumber = 0 ; private int currentPhysicalLine = 1 ; private int currentPhysicalHeadLine = 1 ; private CsvFormatException . Status exceptionStatus = null ; private final Text textBuffer = new Text ( ) ; public CsvParser ( InputStream stream , String path , CsvConfiguration config ) { if ( stream == null ) { throw new IllegalArgumentException ( "" ) ; } if ( config == null ) { throw new IllegalArgumentException ( "" ) ; } this . reader = new InputStreamReader ( stream , config . getCharset ( ) ) ; this . path = path ; this . separator = config . getSeparatorChar ( ) ; this . trueFormat = config . getTrueFormat ( ) ; this . dateFormat = DateFormatter . newInstance ( config . getDateFormat ( ) ) ; this . dateTimeFormat = DateTimeFormatter . newInstance ( config . getDateTimeFormat ( ) ) ; this . headerCellsFormat = config . getHeaderCells ( ) ; this . allowLineBreakInValue = config . isLineBreakInValue ( ) ; readerBuffer . clear ( ) ; readerBuffer . flip ( ) ; } private void decodeLine ( ) throws IOException { currentPhysicalHeadLine = currentPhysicalLine ; lineBuffer . clear ( ) ; cellBeginPositions . clear ( ) ; int state = STATE_INIT ; addSeparator ( ) ; while ( state != STATE_FINAL ) { int c = getNextCharacter ( ) ; switch ( state ) { case STATE_LINE_HEAD : state = onLineHead ( c ) ; break ; case STATE_CELL_HEAD : state = onCellHead ( c ) ; break ; case STATE_CELL_BODY : state = onCellBody ( c ) ; break ; case STATE_QUOTED : state = onQuoted ( c ) ; break ; case STATE_NEST_QUOTE : state = onNestQuote ( c ) ; break ; case STATE_SAW_CR : state = onSawCr ( c ) ; break ; case STATE_QUOTED_SAW_CR : state = onQuotedSawCr ( c ) ; break ; default : throw new AssertionError ( state ) ; } } lineBuffer . flip ( ) ; cellBeginPositions . flip ( ) ; } private int onLineHead ( int c ) throws IOException { int state ; switch ( c ) { case '"' : state = STATE_QUOTED ; break ; case '\r' : state = STATE_SAW_CR ; break ; case '\n' : state = STATE_FINAL ; addSeparator ( ) ; currentPhysicalLine ++ ; break ; case EOF : state = STATE_FINAL ; break ; default : if ( c == separator ) { state = STATE_CELL_HEAD ; addSeparator ( ) ; } else { state = STATE_CELL_BODY ; emit ( c ) ; } break ; } return state ; } private int onCellHead ( int c ) throws IOException { int state ; switch ( c ) { case '"' : state = STATE_QUOTED ; break ; case '\r' : state = STATE_SAW_CR ; break ; case '\n' : state = STATE_FINAL ; addSeparator ( ) ; currentPhysicalLine ++ ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; break ; default : if ( c == separator ) { state = STATE_CELL_HEAD ; addSeparator ( ) ; } else { state = STATE_CELL_BODY ; emit ( c ) ; } break ; } return state ; } private int onCellBody ( int c ) throws IOException { int state ; switch ( c ) { case '"' : state = STATE_CELL_BODY ; emit ( c ) ; break ; case '\r' : state = STATE_SAW_CR ; break ; case '\n' : state = STATE_FINAL ; addSeparator ( ) ; currentPhysicalLine ++ ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; break ; default : if ( c == separator ) { state = STATE_CELL_HEAD ; addSeparator ( ) ; } else { state = STATE_CELL_BODY ; emit ( c ) ; } break ; } return state ; } private int onQuoted ( int c ) throws IOException { int state ; switch ( c ) { case '"' : state = STATE_NEST_QUOTE ; break ; case '\r' : state = STATE_QUOTED_SAW_CR ; emit ( c ) ; break ; case '\n' : state = STATE_QUOTED ; if ( allowLineBreakInValue == false ) { exceptionStatus = createStatusInDecode ( Reason . UNEXPECTED_LINE_BREAK , "\"" , "LF (0x0a)" ) ; } currentPhysicalLine ++ ; emit ( c ) ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; exceptionStatus = createStatusInDecode ( Reason . UNEXPECTED_EOF , "\"" , "End of File" ) ; break ; default : state = STATE_QUOTED ; emit ( c ) ; } return state ; } private int onNestQuote ( int c ) throws IOException { int state ; switch ( c ) { case '"' : state = STATE_QUOTED ; emit ( c ) ; break ; case '\r' : state = STATE_SAW_CR ; break ; case '\n' : state = STATE_FINAL ; addSeparator ( ) ; currentPhysicalLine ++ ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; break ; default : if ( c == separator ) { state = STATE_CELL_HEAD ; addSeparator ( ) ; } else { state = STATE_CELL_BODY ; warn ( createStatusInDecode ( Reason . CHARACTER_AFTER_QUOTE , "" , String . valueOf ( c ) ) ) ; emit ( c ) ; } break ; } return state ; } private int onSawCr ( int c ) { int state ; currentPhysicalLine ++ ; switch ( c ) { case '\n' : state = STATE_FINAL ; addSeparator ( ) ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; break ; default : state = STATE_FINAL ; addSeparator ( ) ; rewindCharacter ( ) ; } return state ; } private int onQuotedSawCr ( int c ) throws IOException { int state ; currentPhysicalLine ++ ; switch ( c ) { case '"' : state = STATE_NEST_QUOTE ; break ; case '\r' : state = STATE_QUOTED_SAW_CR ; emit ( c ) ; break ; case '\n' : state = STATE_QUOTED ; if ( allowLineBreakInValue == false ) { exceptionStatus = createStatusInDecode ( Reason . UNEXPECTED_LINE_BREAK , "\"" , "LF (0x0a)" ) ; } emit ( c ) ; break ; case EOF : state = STATE_FINAL ; addSeparator ( ) ; exceptionStatus = createStatusInDecode ( Reason . UNEXPECTED_EOF , "\"" , "End of File" ) ; break ; default : state = STATE_QUOTED ; emit ( c ) ; } return state ; } private void warn ( Status status ) { assert status != null ; LOG . warn ( status . toString ( ) ) ; } private int getNextCharacter ( ) throws IOException { CharBuffer buf = readerBuffer ; if ( buf . remaining ( ) == 0 ) { buf . clear ( ) ; int read = reader . read ( buf ) ; buf . flip ( ) ; assert read != 0 ; if ( read < 0 ) { return EOF ; } } return buf . get ( ) ; } private void rewindCharacter ( ) { CharBuffer buf = readerBuffer ; assert buf . position ( ) > 0 ; buf . position ( buf . position ( ) - 1 ) ; } private void emit ( int c ) throws IOException { assert c >= 0 ; CharBuffer buf = lineBuffer ; if ( buf . remaining ( ) == 0 ) { if ( buf . capacity ( ) == BUFFER_LIMIT ) { throw new IOException ( MessageFormat . format ( "" , path , currentPhysicalHeadLine , BUFFER_LIMIT , currentRecordNumber ) ) ; } CharBuffer newBuf = CharBuffer . allocate ( Math . min ( buf . capacity ( ) * 2 , BUFFER_LIMIT ) ) ; newBuf . clear ( ) ; buf . flip ( ) ; newBuf . put ( buf ) ; buf = newBuf ; lineBuffer = newBuf ; } buf . put ( ( char ) c ) ; } private void addSeparator ( ) { IntBuffer buf = cellBeginPositions ; if ( buf . remaining ( ) == 0 ) { IntBuffer newBuf = IntBuffer . allocate ( buf . capacity ( ) * 2 ) ; newBuf . clear ( ) ; buf . flip ( ) ; newBuf . put ( buf ) ; buf = newBuf ; cellBeginPositions = newBuf ; } buf . put ( lineBuffer . position ( ) ) ; } private Status createStatusInDecode ( Reason reason , String expected , String actual ) { assert reason != null ; return new Status ( reason , path , currentPhysicalLine , currentRecordNumber , cellBeginPositions . limit ( ) , expected , actual ) ; } @ Override public boolean next ( ) throws CsvFormatException , IOException { exceptionStatus = null ; currentRecordNumber ++ ; if ( firstLine ) { firstLine = false ; decodeLine ( ) ; if ( | |
2,459 | <s> package com . asakusafw . dmdl . thundergate . driver ; import java . util . List ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . semantics . PropertySymbol ; import com . asakusafw . dmdl . semantics . Trait ; import com . asakusafw . utils . collections . Lists ; public class PrimaryKeyTrait implements Trait < PrimaryKeyTrait > { private final AstNode originalAst ; private final List < PropertySymbol > properties ; public PrimaryKeyTrait ( AstNode originalAst , List < PropertySymbol > properties ) { this . originalAst = originalAst ; this . properties = Lists . freeze ( | |
2,460 | <s> package org . rubypeople . rdt . internal . ui . util ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . util . Assert ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbench ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . WorkbenchException ; import org . rubypeople . rdt . core . IImportDeclaration ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyUIMessages ; import org . rubypeople . rdt . internal . ui . actions . OpenActionUtil ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . internal . ui . typehierarchy . TypeHierarchyViewPart ; import org . rubypeople . rdt . ui . RubyUI ; public class OpenTypeHierarchyUtil { private OpenTypeHierarchyUtil ( ) { } public static TypeHierarchyViewPart open ( IRubyElement element , IWorkbenchWindow window ) { IRubyElement [ ] candidates = getCandidates ( element ) ; if ( candidates != null ) { return open ( candidates , window ) ; } return null ; } public static TypeHierarchyViewPart open ( IRubyElement [ ] candidates , IWorkbenchWindow window ) { Assert . isTrue ( candidates != null && candidates . length != 0 ) ; IRubyElement input = null ; if ( candidates . length > 1 ) { String title = RubyUIMessages . OpenTypeHierarchyUtil_selectionDialog_title ; String message = RubyUIMessages . OpenTypeHierarchyUtil_selectionDialog_message ; input = OpenActionUtil . selectRubyElement ( candidates , window . getShell ( ) , title , message ) ; } else { input = candidates [ | |
2,461 | <s> package org . rubypeople . rdt . ui . text . folding ; import org . rubypeople . rdt . core . IRubyElement ; public interface IRubyFoldingStructureProviderExtension { void collapseMembers ( ) ; void collapseComments ( ) ; void collapseElements ( IRubyElement [ ] elements | |
2,462 | <s> package org . oddjob . sql ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UnsupportedEncodingException ; import java . util . StringTokenizer ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . runtime . ExpressionParser ; import org . oddjob . arooa . runtime . ParsedExpression ; import org . oddjob . beanbus . BadBeanException ; import org . oddjob . beanbus . BeanBus ; import org . oddjob . beanbus . BusAware ; import org . oddjob . beanbus . BusEvent ; import org . oddjob . beanbus . BusException ; import org . oddjob . beanbus . BusListener ; import org . oddjob . beanbus . CrashBusException ; import org . oddjob . beanbus . Destination ; import org . oddjob . beanbus . Driver ; import org . oddjob . beanbus . StageListener ; import org . oddjob . beanbus . StageNotifier ; import org . oddjob . beanbus . StageSupport ; import org . oddjob . sql . SQLJob . DelimiterType ; public class ScriptParser implements ArooaSessionAware , Driver < String > , BusAware , StageNotifier { private static final Logger logger = Logger . getLogger ( ScriptParser . class ) ; private boolean keepFormat ; private boolean expandProperties ; private DelimiterType delimiterType = DelimiterType . NORMAL ; private String delimiter = ";" ; private String encoding = null ; private ArooaSession session ; private InputStream input ; private Destination < ? super String > to ; private final StageSupport stageSupport = new StageSupport ( this ) ; private volatile boolean stop ; @ Override public void setArooaSession ( ArooaSession session ) { this . session = session ; } public boolean isKeepFormat ( ) { return keepFormat ; } public void setKeepFormat ( boolean keepformat ) { this . keepFormat = keepformat ; } public boolean isExpandProperties ( ) { return expandProperties ; } public void setExpandProperties ( boolean expandProperties ) { this . expandProperties = expandProperties ; } public DelimiterType getDelimiterType ( ) { return delimiterType ; } public void setDelimiterType ( DelimiterType delimiterType ) { this . delimiterType = delimiterType ; } public String getDelimiter ( ) { return delimiter ; } public void setDelimiter ( String delimiter ) { this . delimiter = delimiter ; } public String getEncoding ( ) { return encoding ; } public void setEncoding ( String encoding ) { this . encoding = encoding ; } @ Override public void go ( ) throws BusException { stop = false ; StringBuffer sql = new StringBuffer ( ) ; BufferedReader in = null ; try { if ( encoding == null ) { in = new BufferedReader ( new InputStreamReader ( input ) ) ; } else { in = new BufferedReader ( new InputStreamReader ( input , encoding ) ) ; } } catch ( UnsupportedEncodingException e1 ) { throw new CrashBusException ( e1 ) ; } while ( ! stop ) { String line ; try { line = in . readLine ( ) ; } catch ( IOException e ) { throw new CrashBusException ( e ) ; } if ( line == null ) { break ; } if ( ! keepFormat ) { | |
2,463 | <s> package com . aptana . rdt . core . rspec ; import java . util . ArrayList ; import java . util . List ; 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 Behavior implements ISourceReference { private String className ; private List < Example > examples = new ArrayList < Example > ( ) ; private int offset ; private int length ; Behavior ( String className , int offset , int length ) { this . className = className ; this . offset = offset ; this . length = length ; } void addExample ( Example example ) { example . setParent ( this ) ; examples . add ( example ) ; } public Object [ ] getExamples ( ) { return examples . toArray ( new Object | |
2,464 | <s> package org . oddjob ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . ScheduledExecutorService ; public class MockOddjobExecutors implements OddjobExecutors { | |
2,465 | <s> package org . rubypeople . rdt . internal . debug . core . model ; public | |
2,466 | <s> package net . sf . sveditor . ui . editor . actions ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . | |
2,467 | <s> package com . asakusafw . vocabulary . model ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation | |
2,468 | <s> package com . asakusafw . compiler . fileio . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . fileio . io . ExJoined2Input ; import com . asakusafw . compiler . fileio . io . ExJoined2Output ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . vocabulary . model . Joined ; import com . asakusafw . vocabulary . model . Key ; @ DataModelKind ( "DMDL" ) @ Joined ( terms = { @ Joined . Term ( source = Ex1 . class , mappings = { @ Joined . Mapping ( source = "sid" , destination = "sid1" ) , @ Joined . Mapping ( source = "value" , destination = "key" ) } , shuffle = @ Key ( group = { "value" } ) ) , @ Joined . Term ( source = Ex2 . class , mappings = { @ Joined . Mapping ( source = "sid" , destination = "sid2" ) , @ Joined . Mapping ( source = "value" , destination = "key" ) } , shuffle = @ Key ( group = { "value" } ) ) } ) @ ModelInputLocation ( ExJoined2Input . class ) @ ModelOutputLocation ( ExJoined2Output . class ) public class ExJoined2 implements DataModel < ExJoined2 > , Writable { private final LongOption sid1 = new LongOption ( ) ; private final IntOption key = new IntOption ( ) ; private final LongOption sid2 = new LongOption ( ) ; @ Override @ SuppressWarnings ( "deprecation" ) public void reset ( ) { this . sid1 . setNull ( ) ; this . key . setNull ( ) ; this . sid2 . setNull ( ) ; } @ Override @ SuppressWarnings ( "deprecation" ) public void copyFrom ( ExJoined2 other ) { this . sid1 . copyFrom ( other . sid1 ) ; this . key . copyFrom ( other . key ) ; this . sid2 . copyFrom ( other . sid2 ) ; } public long getSid1 ( ) { return this . sid1 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid1 ( long value ) { this . sid1 . modify ( value ) ; } public LongOption getSid1Option ( ) { return this . sid1 ; } @ SuppressWarnings ( "deprecation" ) public void setSid1Option ( LongOption option ) { this . sid1 . copyFrom ( option ) ; } public int getKey ( ) { return this . key . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setKey ( int value ) { this . key . modify ( value ) ; } public IntOption getKeyOption ( ) { return this . key ; } @ SuppressWarnings ( "deprecation" ) public void setKeyOption ( IntOption option ) { this . key . copyFrom ( option ) ; } public long getSid2 ( ) { return this . sid2 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid2 ( long value ) { this . sid2 . modify ( value ) ; } public LongOption getSid2Option ( ) { return this . sid2 ; } @ | |
2,469 | <s> package org . rubypeople . eclipse . shams . resources ; import java . net . URI ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IProjectDescription ; import org . eclipse . core . resources . IProjectNature ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceVisitor ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . ResourceAttributes ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IPluginDescriptor ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . QualifiedName ; import org . eclipse . core . runtime . content . IContentTypeMatcher ; public class ShamProject extends ShamContainer implements IProject , IContainer { protected String projectName ; protected List natures = new ArrayList ( ) ; public ShamProject ( String theProjectName ) { this ( new Path ( "/" + theProjectName ) , theProjectName ) ; } public void setDefaultCharset ( String charset , IProgressMonitor monitor ) throws CoreException { } public ShamProject ( IPath aPath , String theProjectName ) { super ( aPath ) ; projectName = theProjectName ; } public void build ( int kind , String builderName , Map args , IProgressMonitor monitor ) throws CoreException { } public void build ( int kind , IProgressMonitor monitor ) throws CoreException { } public void close ( IProgressMonitor monitor ) throws CoreException { } public void create ( IProjectDescription description , IProgressMonitor monitor ) throws CoreException { } public void create ( IProgressMonitor monitor ) throws CoreException { } public void delete ( boolean deleteContent , boolean force , IProgressMonitor monitor ) throws CoreException { } public IProjectDescription getDescription ( ) throws CoreException { throw new RuntimeException ( "" ) ; } public IFile getFile ( String name ) { return new ShamFile ( getFullPath ( ) . append ( name ) ) ; } public IFolder getFolder ( String name ) { return new ShamFolder ( getFullPath ( ) . append ( name ) ) ; } public IProjectNature getNature ( String natureId ) throws CoreException { throw new RuntimeException ( "" ) ; } public | |
2,470 | <s> package com . aptana . rdt . core . rspec ; import junit . framework . TestCase ; import org . jruby . ast . Node ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; public class RSpecStructureCreatorTest extends TestCase { public void testEmptySource ( ) throws Exception { String src = "" ; Node ast = new RubyParser ( ) . parse ( src ) . getAST ( ) ; RSpecStructureCreator creator = new RSpecStructureCreator ( ) ; creator . acceptNode ( ast ) ; assertEquals ( 0 , creator . getBehaviors ( ) . length ) ; } public void testOneBehaviorNoExamples ( ) throws Exception { String src = "" ; Node ast = new RubyParser ( ) . parse ( src ) . getAST ( ) ; RSpecStructureCreator creator = new RSpecStructureCreator ( ) ; creator . acceptNode ( ast ) ; assertEquals ( 1 , creator . getBehaviors ( ) . length ) ; Behavior behavior = ( Behavior ) creator . getBehaviors ( ) [ 0 ] ; assertEquals ( "Bowling" , behavior . getClassName ( ) ) ; assertEquals ( "Bowling" , behavior . getSource ( ) ) ; assertEquals ( 0 , behavior . getSourceRange ( ) . getOffset ( ) ) ; assertEquals ( src . length ( ) , behavior | |
2,471 | <s> package org . rubypeople . rdt . ui . text . correction ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . swt . graphics . Image ; | |
2,472 | <s> package de . fuberlin . wiwiss . d2rq . mapgen ; public class FilterMatchSchema extends Filter { private final IdentifierMatcher schema ; public FilterMatchSchema ( IdentifierMatcher schema ) { this . schema = schema ; } public boolean matchesSchema ( String schema ) { return this . schema . matches ( schema ) ; } public boolean matchesTable ( String schema , String table ) { return matchesSchema ( schema ) ; } public boolean matchesColumn ( String schema , String table , String column ) { return | |
2,473 | <s> package net . sf . sveditor . core . tests ; import java . util . HashMap ; import java . util . Map ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . index . AbstractSVDBIndex ; import net . sf . sveditor . core . db . index . SVDBFSFileSystemProvider ; import net . sf . sveditor . core . db . index . SVDBFileTree ; import net . sf . sveditor . core . db . index . SVDBFileTreeUtils ; import net . sf . sveditor . core . db . index . cache . InMemoryIndexCache ; import net . sf . sveditor . core . scanner . IPreProcMacroProvider ; import net . sf . sveditor . core . scanner . SVPreProcDefineProvider ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; public class FileIndexIterator extends AbstractSVDBIndex { private SVDBFile fFile ; private SVDBFile fPPFile ; Map < String , SVDBFile > fFileMap ; public FileIndexIterator ( SVDBFile file ) { super ( "project" , "base" , new SVDBFSFileSystemProvider ( ) , new InMemoryIndexCache ( ) , null ) ; fFile = file ; fFileMap = new HashMap < String , SVDBFile > ( ) ; fFileMap . put ( file . getName ( ) , file ) ; init ( new NullProgressMonitor ( ) ) ; loadIndex ( new NullProgressMonitor ( ) ) ; } public FileIndexIterator ( Tuple < SVDBFile , SVDBFile > file ) { super ( "project" , "base" , new SVDBFSFileSystemProvider ( ) , new InMemoryIndexCache ( | |
2,474 | <s> package net . sf . sveditor . core . tests . indent ; import junit . framework . TestCase ; import net . sf . sveditor . core . indent . SVIndentScanner ; import net . sf . sveditor . core . indent . SVIndentToken ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . scanutils . StringTextScanner ; public class TestIndentScanner extends TestCase { public void testIsStartLine ( ) { String content = "" + "" + "" + "" + "" + "n" + "" + "tn" + "" + "ttn" + "" + "n" ; boolean start_line [ ] = { true , true , false , true , false , true , true , false , false , false , false , } ; boolean end_line [ ] = { true , false , true , false , true , true , false , false , false , false , true , } ; LogHandle log = LogFactory . getLogHandle ( "" ) ; SVIndentScanner scanner = new SVIndentScanner ( new StringTextScanner ( new StringBuilder ( content ) ) ) ; for ( int i = 0 ; i < start_line . length ; i ++ ) { SVIndentToken tok = scanner . next ( ) ; log . debug ( "" + tok . isStartLine ( ) + " isEndLine=" + tok . isEndLine ( ) + " value=" + tok . getImage ( ) ) ; assertEquals ( "" + tok . getImage ( ) + "" , start_line [ i ] , tok . isStartLine ( ) ) ; assertEquals ( "" + tok . getImage ( ) + " to end line" , end_line [ i ] , tok . isEndLine ( ) ) ; } LogFactory . removeLogHandle | |
2,475 | <s> package org . rubypeople . rdt . core . search ; import org . eclipse . core . resources . IResource ; import org . rubypeople . rdt . core . IRubyElement ; public class TypeReferenceMatch extends SearchMatch { private IRubyElement localElement ; | |
2,476 | <s> package org . oddjob . sql ; import java . io . Serializable ; import java . sql . Connection ; import java . sql . Driver ; import java . sql . SQLException ; import java . util . Properties ; import javax . inject . Inject ; import org . apache . log4j . Logger ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . types . ValueFactory ; public class ConnectionType implements ValueFactory < Connection > , Serializable { private final static long serialVersionUID = 20070315 ; private static final Logger logger = Logger . getLogger ( ConnectionType . class ) ; private String driver ; private String url ; private String username ; private String password ; private ClassLoader classLoader ; public Connection toValue ( ) throws ArooaConversionException { if ( driver == null ) { throw new NullPointerException ( "" ) ; } if ( url == null ) { throw new NullPointerException ( "" ) ; } ClassLoader loader = classLoader ; if ( loader == null ) { loader = getClass ( ) . getClassLoader ( ) ; } Class < ? | |
2,477 | <s> package org . rubypeople . rdt . refactoring . ui . pages . extractmethod ; import java . util . Observable ; import org . eclipse . swt . widgets . Event ; import org . eclipse . swt . widgets . Listener ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . TableItem ; public abstract class ParametersButtonListener extends Observable implements Listener { protected final Table table ; public ParametersButtonListener ( Table table ) { this . table = table ; } public void handleEvent ( Event event ) { TableItem [ ] tableItems = table . getSelection ( ) ; if ( tableItems == null || tableItems . length < 1 ) { return ; } assert ( tableItems . length == 1 ) ; if ( tableItems [ 0 ] instanceof MethodArgumentTableItem ) { | |
2,478 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . io . File ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . dialogs . StatusDialog ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . DirectoryDialog ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IListAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . SelectionButtonDialogField ; public class NewVariableEntryDialog extends StatusDialog { private class VariablesAdapter implements IDialogFieldListener , IListAdapter { public void customButtonPressed ( ListDialogField field , int index ) { switch ( index ) { case IDX_EXTEND : extendButtonPressed ( ) ; break ; } } public void selectionChanged ( ListDialogField field ) { doSelectionChanged ( ) ; } public void doubleClicked ( ListDialogField field ) { doDoubleClick ( ) ; } public void dialogFieldChanged ( DialogField field ) { if ( field == fConfigButton ) { configButtonPressed ( ) ; } } } private final int IDX_EXTEND = 0 ; private ListDialogField fVariablesList ; private boolean fCanExtend ; private boolean fIsValidSelection ; private IPath [ ] fResultPaths ; private SelectionButtonDialogField fConfigButton ; public NewVariableEntryDialog ( Shell parent ) { super ( parent ) ; setTitle ( NewWizardMessages . NewVariableEntryDialog_title ) ; int shellStyle = getShellStyle ( ) ; setShellStyle ( shellStyle | SWT . MAX | SWT . RESIZE ) ; updateStatus ( new StatusInfo ( IStatus . ERROR , "" ) ) ; String [ ] buttonLabels = new String [ ] { NewWizardMessages . NewVariableEntryDialog_vars_extend , } ; VariablesAdapter adapter = new VariablesAdapter ( ) ; CPVariableElementLabelProvider labelProvider = new CPVariableElementLabelProvider ( false ) ; fVariablesList = new ListDialogField ( adapter , buttonLabels , labelProvider ) ; fVariablesList . setDialogFieldListener ( adapter ) ; fVariablesList . setLabelText ( NewWizardMessages . NewVariableEntryDialog_vars_label ) ; fVariablesList . enableButton ( IDX_EXTEND , false ) ; fVariablesList . setViewerSorter ( new ViewerSorter ( ) { public int compare ( Viewer viewer , Object e1 , Object e2 ) { if ( e1 instanceof CPVariableElement && e2 instanceof CPVariableElement ) { return ( ( CPVariableElement ) e1 ) . getName ( ) . compareTo ( ( ( CPVariableElement ) e2 ) . getName ( ) ) ; } return super . compare ( viewer , e1 , e2 ) ; } } ) ; fConfigButton = new SelectionButtonDialogField ( SWT . PUSH ) ; fConfigButton . setLabelText ( NewWizardMessages . NewVariableEntryDialog_configbutton_label ) ; fConfigButton . setDialogFieldListener ( adapter ) ; initializeElements ( ) ; fCanExtend = false ; fIsValidSelection = false ; fResultPaths = null ; } private void initializeElements ( ) { String [ ] entries = RubyCore . getLoadpathVariableNames ( ) ; ArrayList elements = new ArrayList ( entries . length ) ; for ( int i = 0 ; i < entries . length ; i ++ ) { String name = entries [ i ] ; IPath [ ] entryPath = RubyCore . getLoadpathVariable ( name ) ; if ( entryPath != null ) { elements . add ( new CPVariableElement ( name , entryPath , false ) ) ; } } fVariablesList . setElements ( elements ) ; } protected void configureShell ( Shell shell ) { super . configureShell ( shell ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( shell , IRubyHelpContextIds . NEW_VARIABLE_ENTRY_DIALOG ) ; } protected IDialogSettings getDialogBoundsSettings ( ) { return RubyPlugin . getDefault ( ) . getDialogSettingsSection ( getClass ( ) . getName ( ) ) ; } protected Control createDialogArea ( Composite parent ) { initializeDialogUnits ( parent ) ; Composite composite = ( Composite ) super . createDialogArea ( parent ) ; GridLayout layout = ( GridLayout ) composite . getLayout ( ) ; layout . numColumns = 2 ; fVariablesList . doFillIntoGrid ( composite , 3 ) ; LayoutUtil . setHorizontalSpan ( fVariablesList . getLabelControl ( null ) , 2 ) ; GridData listData = ( GridData ) fVariablesList . getListControl ( null ) . getLayoutData ( ) ; listData . grabExcessHorizontalSpace = true ; listData . heightHint = convertHeightInCharsToPixels ( 10 ) ; listData . widthHint = convertWidthInCharsToPixels ( 70 ) ; Composite lowerComposite = new Composite ( composite , SWT . NONE ) ; lowerComposite . setLayoutData ( new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ) ; layout = new GridLayout ( ) ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; lowerComposite . setLayout ( layout ) ; fConfigButton . doFillIntoGrid ( lowerComposite , 1 ) ; applyDialogFont ( composite ) ; return composite ; } public IPath [ ] getResult ( ) { return fResultPaths ; } private void doDoubleClick ( ) { if ( fIsValidSelection ) { okPressed ( ) ; } else if ( fCanExtend ) { extendButtonPressed ( ) ; } } private void doSelectionChanged ( ) { boolean isValidSelection = true ; boolean canExtend = false ; StatusInfo status = new StatusInfo ( ) ; List selected = fVariablesList . getSelectedElements ( ) ; int nSelected = selected . size ( ) ; if ( nSelected > 0 ) { fResultPaths = new Path [ nSelected ] ; for ( int i = 0 ; i < nSelected ; i ++ ) { CPVariableElement curr = ( CPVariableElement ) selected . get ( i ) ; fResultPaths [ i ] = new Path ( curr . getName ( ) ) ; File file = curr . getPath ( ) [ 0 ] . toFile ( ) ; if ( ! file . exists ( ) ) { status . setError ( NewWizardMessages | |
2,479 | <s> package com . asakusafw . yaess . core ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . util . TreeMap ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class VariableResolver { static final Logger LOG = LoggerFactory . getLogger ( VariableResolver . class ) ; private static final Pattern VARIABLE = Pattern . compile ( "\\$\\{(.*?)\\}" ) ; private final Map < String , String > entries ; public VariableResolver ( Map < String , String > entries ) { if ( entries == null ) { throw new IllegalArgumentException ( "" ) ; } this . entries = Collections . unmodifiableMap ( new TreeMap < String , String > ( entries ) ) ; } public static VariableResolver system ( ) { Map < String , String > entries = new HashMap < String , String > ( ) ; entries . putAll ( System . getenv ( ) ) ; for ( Map . Entry < Object , Object > entry : System . getProperties ( ) . entrySet ( ) ) { Object key = entry . getKey ( ) ; Object value = entry . getValue ( ) ; if ( key instanceof String && value instanceof String ) { entries . put ( ( String ) key , ( String ) value ) ; } } return new VariableResolver ( entries ) ; } public String replace ( String string , boolean strict ) { if ( string == null ) { throw new IllegalArgumentException ( "" ) ; } StringBuilder buf = new StringBuilder ( ) ; int start = 0 ; Matcher matcher = VARIABLE . matcher ( string ) ; while ( matcher . find ( start ) ) { String | |
2,480 | <s> package org . oddjob . framework ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . Serializable ; import org . oddjob . FailedToStopException ; import org . oddjob . Forceable ; import org . oddjob . Resetable ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . Structural ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . images . IconHelper ; import org . oddjob . images . StateIcons ; import org . oddjob . persist . Persistable ; import org . oddjob . state . IsAnyState ; import org . oddjob . state . IsExecutable ; import org . oddjob . state . IsHardResetable ; import org . oddjob . state . IsSoftResetable ; import org . oddjob . state . OrderedStateChanger ; import org . oddjob . state . ParentState ; import org . oddjob . state . ParentStateChanger ; import org . oddjob . state . ParentStateHandler ; import org . oddjob . state . StateChanger ; import org . oddjob . state . StateEvent ; import org . oddjob . state . StateExchange ; import org . oddjob . state . StateOperator ; import org . oddjob . state . StructuralStateHelper ; import org . oddjob . structural . ChildHelper ; import org . oddjob . structural . StructuralListener ; public abstract class StructuralJob < E > extends BasePrimary implements Runnable , Serializable , Stoppable , Resetable , Stateful , Forceable , Structural { private static final long serialVersionUID = 2009031500L ; protected transient ParentStateHandler stateHandler ; protected transient ChildHelper < E > childHelper ; protected transient StructuralStateHelper structuralState ; protected transient StateExchange childStateReflector ; private transient ParentStateChanger stateChanger ; protected transient volatile boolean stop ; public StructuralJob ( ) { completeConstruction ( ) ; } private void completeConstruction ( ) { stateHandler = new ParentStateHandler ( this ) ; childHelper = new ChildHelper < E > ( this ) ; structuralState = new StructuralStateHelper ( childHelper , getStateOp ( ) ) ; stateChanger = new ParentStateChanger ( stateHandler , iconHelper , new Persistable ( ) { @ Override public void persist ( ) throws ComponentPersistException { save ( ) ; } } ) ; childStateReflector = new StateExchange ( structuralState , new OrderedStateChanger < ParentState > | |
2,481 | <s> package org . rubypeople . rdt . internal . debug . core . parsing ; import java . io . IOException ; import java . util . ArrayList ; import java . util . List ; import org . rubypeople . rdt . internal . debug . core . model . ThreadInfo ; import org . xmlpull . v1 . XmlPullParser ; import org . xmlpull . v1 . XmlPullParserException ; public class ThreadInfoReader extends XmlStreamReader { private List < ThreadInfo > threads = new ArrayList < ThreadInfo > ( ) ; public ThreadInfoReader ( XmlPullParser xpp ) { super ( xpp ) ; } public ThreadInfoReader ( AbstractReadStrategy readStrategy ) { super ( readStrategy ) ; } public ThreadInfo [ ] readThreads ( ) throws XmlPullParserException , IOException , XmlStreamReaderException { this . read ( ) ; return threads . toArray ( new ThreadInfo [ threads . size ( ) ] ) ; } protected boolean processStartElement ( XmlPullParser xpp ) { String name = xpp . getName ( ) ; if ( name . equals ( | |
2,482 | <s> package de . fuberlin . wiwiss . d2rq . server ; import java . io . File ; import java . io . FileInputStream ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . Calendar ; import java . util . Comparator ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . rdf . model . AnonId ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . rdf . model . Property ; import com . hp . hpl . jena . rdf . model . RDFNode ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . rdf . model . Statement ; import com . hp . hpl . jena . rdf . model . StmtIterator ; import com . hp . hpl . jena . shared . JenaException ; import de . fuberlin . wiwiss . d2rq . vocab . D2RConfig ; import de . fuberlin . wiwiss . d2rq . vocab . D2RQ ; import de . fuberlin . wiwiss . d2rq . vocab . META ; public class MetadataCreator { private final static String metadataPlaceholderURIPrefix = "" ; private Model model = ModelFactory . createDefaultModel ( ) ; ; private D2RServer server ; private boolean enable = true ; private Model tplModel ; private static final Log log = LogFactory . getLog ( MetadataCreator . class ) ; public MetadataCreator ( D2RServer server , Model template ) { this . server = server ; if ( template != null && template . size ( ) > 0 ) { this . enable = true ; this . tplModel = template ; } } public Model addMetadataFromTemplate ( String resourceURI , String documentURL , String pageUrl ) { if ( ! enable || tplModel == null ) { return ModelFactory . createDefaultModel ( ) ; } Model metadata = ModelFactory . createDefaultModel ( ) ; metadata . setNsPrefixes ( tplModel . getNsPrefixMap ( ) ) ; StmtIterator it = tplModel . listStatements ( ) ; while ( it . hasNext ( ) ) { Statement stmt = it . nextStatement ( ) ; Resource subj = stmt . getSubject ( ) ; Property pred = stmt . getPredicate ( ) ; RDFNode obj = stmt . getObject ( ) ; try { if ( subj . toString ( ) . contains ( metadataPlaceholderURIPrefix ) ) { subj = ( Resource ) parsePlaceholder ( subj , documentURL , resourceURI , pageUrl ) ; if ( subj == null ) { subj = model . createResource ( new AnonId ( String . valueOf ( stmt . getSubject ( ) . hashCode ( ) ) ) ) ; } } if ( obj . toString ( ) . contains ( metadataPlaceholderURIPrefix ) ) { obj = parsePlaceholder ( obj , documentURL , resourceURI , pageUrl ) ; } if ( obj != null ) { stmt = metadata . createStatement ( subj , pred , obj ) ; metadata . add ( stmt ) ; } } catch ( Exception e ) { metadata . remove ( stmt ) ; log . info ( "" + stmt . toString ( ) ) ; e . printStackTrace ( ) ; } } boolean changes = true ; while ( changes ) { changes = false ; StmtIterator stmtIt = metadata . listStatements ( ) ; List < Statement > remList = new ArrayList < Statement > ( ) ; while ( stmtIt . hasNext ( ) ) { Statement s = stmtIt . nextStatement ( ) ; if ( s . getObject ( ) . isAnon ( ) && ! ( ( Resource ) s . getObject ( ) . as ( Resource . class ) ) . listProperties ( ) . hasNext ( ) ) { remList . add ( s ) ; changes = true ; } } metadata . remove ( remList ) ; } return metadata ; } private RDFNode parsePlaceholder ( RDFNode phRes , String documentURL , String resourceURI , String pageURL ) { String phURI = phRes . asNode ( ) . getURI ( ) ; phURI = phURI . replace ( metadataPlaceholderURIPrefix , "" ) ; String phPackage = phURI . substring ( 0 , phURI . indexOf ( ":" ) + 1 ) ; String phName = phURI . replace ( phPackage , "" ) ; phPackage = phPackage . replace ( ":" , "" ) ; Resource serverConfig = server . getConfig ( ) . findServerResource ( ) ; if ( phPackage . equals ( "runtime" ) ) { if ( phName . equals ( "time" ) ) { return model . createTypedLiteral ( Calendar . getInstance ( ) ) ; } if ( phName . equals ( "graph" ) ) { return model . createResource ( | |
2,483 | <s> package org . rubypeople . rdt . refactoring . core ; import org . eclipse . core . runtime . ListenerList ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . ResourcesPlugin ; public class WorkspaceTracker { public final static WorkspaceTracker INSTANCE = new WorkspaceTracker ( ) ; public interface Listener { public void workspaceChanged ( ) ; } private ListenerList fListeners ; private ResourceListener fResourceListener ; private WorkspaceTracker ( ) { fListeners = new ListenerList ( ) ; } private | |
2,484 | <s> package org . oddjob . io ; import java . io . FilterInputStream ; import java . io . IOException ; import java . io . InputStream ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . types . ValueFactory ; public class | |
2,485 | <s> package com . aptana . rdt . internal . parser . warnings ; import org . jruby . ast . ConstDeclNode ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt | |
2,486 | <s> package com . asakusafw . bulkloader . testutil ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . Reader ; import java . io . Writer ; public class IOUtils extends StreamCloseLogic { protected IOUtils ( ) { } public static long pipingAndClose ( final InputStream src , final OutputStream dest ) throws IOException { return pipingAndClose ( src , dest , - 1 ) ; } public static long pipingAndClose ( final InputStream src , final OutputStream dest , final long len ) throws IOException { return pipingAndClose ( src , dest , 0 , len ) ; } public static long pipingAndClose ( final InputStream src , final OutputStream dest , final long off , final long len ) throws IOException { return pipingAndClose ( src , dest , off , len , DEFAULT_BUFFER_SIZE ) ; } public static long pipingAndClose ( final InputStream src , final OutputStream dest , final long off , final long len , final int bufSize ) throws IOException { check ( src , dest , off , bufSize ) ; long result = 0 ; try { result = piping ( src , dest , off , len , bufSize ) ; } finally { closeGently ( src ) ; closeGently ( dest ) ; } return result ; } } class StreamPipingLogic { static final int DEFAULT_BUFFER_SIZE = 8192 ; static final int EOF = - 1 ; public static long piping ( final InputStream src , final OutputStream dest ) throws IOException { return piping ( src , dest , - 1 ) ; } public static long piping ( final InputStream src , final OutputStream dest , final long len ) throws IOException { return piping ( src , dest , 0 , len ) ; } public static long piping ( final InputStream src , final OutputStream dest , final long off , final long len ) throws IOException { return piping ( src , dest , off , len , DEFAULT_BUFFER_SIZE ) ; } public static long piping ( final InputStream src , final OutputStream dest , final long off , long len , final int bufSize ) throws IOException { check ( src , dest , off , bufSize ) ; if ( len < 0 ) { len = Long . MAX_VALUE ; } skip ( src , off ) ; final byte [ ] buf = new byte [ bufSize ] ; long wroteBytes = 0 ; while ( true ) { final long rest = len - wroteBytes ; if ( rest <= 0 ) { break ; } final int readableLength ; if ( rest <= Integer . MAX_VALUE ) { readableLength = Math . min ( bufSize , ( int ) rest ) ; } else { readableLength = bufSize ; } final int readLength = src . read ( buf , 0 , readableLength ) ; if ( readLength < 0 ) { break ; } dest . write ( buf , 0 , readLength ) ; wroteBytes += readLength ; } return wroteBytes ; } public static void skip ( final InputStream src | |
2,487 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . ArrayList ; import java . util . List ; import java . util . Set ; import org . eclipse . core . runtime . IPath ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . corext . util . RubyModelUtil ; public abstract class BuildPathBasePage { public abstract List getSelection ( ) ; public abstract void setSelection ( List selection , boolean expand ) ; public void addElement ( CPListElement element ) { } public abstract boolean isEntryKind ( int kind ) ; protected void filterAndSetSelection ( List list ) { ArrayList res = new ArrayList ( list . size | |
2,488 | <s> package com . asakusafw . dmdl . thundergate . view ; public class ViewDefinition { public final String name ; public final String statement ; public ViewDefinition ( String name , String statement ) { if ( name == null ) { throw new IllegalArgumentException ( | |
2,489 | <s> package handson . springbatch ; import org . springframework . batch . item . ItemProcessor ; import org . springframework . stereotype . Component ; @ Component public class HelloWorldProcessor implements ItemProcessor < String , String > { @ Override | |
2,490 | <s> package com . asakusafw . testdriver . bulkloader ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . math . BigDecimal ; import java . sql . Connection ; import java . sql . Timestamp ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Calendar ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; public class TableOutputTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; static final DataModelDefinition < CacheSupport > CACHE = new SimpleDataModelDefinition < CacheSupport > ( CacheSupport . class ) ; @ Rule public H2Resource h2 = new H2Resource ( "config" ) { @ Override protected void before ( ) throws Exception { executeFile ( "" ) ; } } ; @ Test public void empty ( ) throws Exception { TableOutput < Simple > output = new TableOutput < Simple > ( info ( "NUMBER" , "TEXT" ) , h2 . open ( ) ) ; output . close ( ) ; assertThat ( h2 . count ( "SIMPLE" ) , is ( 0 ) ) ; } @ Test public void single ( ) throws Exception { TableOutput < Simple > output = new TableOutput < Simple > ( info ( "NUMBER" , "TEXT" ) , h2 . open ( ) ) ; try { Simple simple = new Simple ( ) ; simple . number = 100 ; simple . text = "" ; output . write ( simple ) ; } finally { output . close ( ) ; } assertThat ( h2 . count ( "SIMPLE" ) , is ( 1 ) ) ; List < List < Object > > results = h2 . query ( "" ) ; assertThat ( results , is ( table ( row ( 100 , "" ) ) ) ) ; } @ Test public void multiple ( ) throws Exception { TableOutput < Simple > output = new TableOutput < Simple > ( info ( "NUMBER" , "TEXT" ) , h2 . open ( ) ) ; try { Simple simple = new Simple ( ) ; simple . number = 100 ; simple . text = "aaa" ; output . write ( simple ) ; simple . number = 200 ; simple . text = "bbb" ; output . write ( simple ) ; simple . number = 300 ; simple . text = "ccc" ; output . write ( simple ) ; } finally { output . close ( ) ; } assertThat ( h2 . count ( "SIMPLE" ) , is ( 3 ) ) ; List < List < Object > > results = h2 . query ( "" ) ; assertThat ( results , is ( table ( row ( 100 , "aaa" ) , row ( 200 , "bbb" ) , row ( 300 , "ccc" ) ) ) ) ; } @ Test | |
2,491 | <s> package org . oddjob . jmx . general ; import java . io . IOException ; import javax . management . InstanceNotFoundException ; | |
2,492 | <s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . CoGroupFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . CoGroupFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . CoGroupFlowFactory . Op1 ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; @ JobFlow ( name = "testing" ) public class CoGroupFlowOp1 extends FlowDescription { private In < Ex1 > in1 ; private Out < Ex1 > out1 ; public CoGroupFlowOp1 ( @ Import ( name = "e1" , description = Ex1MockImporterDescription . class ) In < Ex1 | |
2,493 | <s> package org . rubypeople . rdt . refactoring . tests . core . renamelocal ; import junit . framework . Test ; import junit | |
2,494 | <s> package net . sf . sveditor . core . preproc ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import java . util . Stack ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . scanner . IDefineProvider ; import net . sf . sveditor . core . scanutils . AbstractTextScanner ; import net . sf . sveditor . core . scanutils . ScanLocation ; public class SVPreProcessor extends AbstractTextScanner { private IDefineProvider fDefineProvider ; private String fFileName ; private InputStream fInput ; private StringBuilder fOutput ; private List < Integer > fLineMap ; private StringBuilder fTmpBuffer ; private List < Tuple < String , String > > fParamList ; private Stack < Integer > fPreProcEn ; private int fLineno = 1 ; private int fLastCh ; private int fUngetCh [ ] = { - 1 , - 1 } ; private byte fInBuffer [ ] ; private int fInBufferIdx ; private int fInBufferMax ; private boolean fInPreProcess ; private static final int PP_DISABLED = 0 ; private static final int PP_ENABLED = 1 ; private static final int PP_CARRY = 2 ; private static final int PP_THIS_LEVEL_EN_BLOCK = 4 ; public static final Set < String > fIgnoredDirectives ; static { fIgnoredDirectives = new HashSet < String > ( ) ; fIgnoredDirectives . add ( "" ) ; fIgnoredDirectives . add ( "celldefine" ) ; fIgnoredDirectives . add ( "" ) ; fIgnoredDirectives . add ( "end_keywords" ) ; fIgnoredDirectives . add ( "" ) ; fIgnoredDirectives . add ( "protect" ) ; fIgnoredDirectives . add ( "endprotect" ) ; fIgnoredDirectives . add ( "line" ) ; fIgnoredDirectives . add ( "" ) ; fIgnoredDirectives . add ( "timescale" ) ; fIgnoredDirectives . add ( "resetall" ) ; fIgnoredDirectives . add ( "" ) ; fIgnoredDirectives . add ( "undef" ) ; fIgnoredDirectives . add ( "undefineall" ) ; } public SVPreProcessor ( InputStream input , String filename , IDefineProvider define_provider ) { fOutput = new StringBuilder ( ) ; fTmpBuffer = new StringBuilder ( ) ; fInput = input ; fDefineProvider = define_provider ; fParamList = new ArrayList < Tuple < String , String > > ( ) ; fFileName = filename ; fPreProcEn = new Stack < Integer > ( ) ; fLineMap = new ArrayList < Integer > ( ) ; fInBuffer = new byte [ 8 * 1024 ] ; fInBufferIdx = 0 ; fInBufferMax = 0 ; } public SVPreProcOutput preprocess ( ) { int ch , last_ch = - 1 ; int end_comment [ ] = { - 1 , - 1 } ; boolean in_string = false ; boolean ifdef_enabled = true ; fInPreProcess = true ; while ( ( ch = get_ch ( ) ) != - 1 ) { if ( ! in_string ) { if ( ch == '/' ) { int ch2 = get_ch ( ) ; if ( ch2 == '/' ) { fOutput . append ( ' ' ) ; while ( ( ch = get_ch ( ) ) != - 1 && ch != '\n' && ch != '\r' ) { } if ( ch == '\r' ) { ch = get_ch ( ) ; if ( ch != '\n' ) { unget_ch ( ch ) ; } } ch = '\n' ; last_ch = ' ' ; } else if ( ch2 == '*' ) { end_comment [ 0 ] = - 1 ; end_comment [ 1 ] = - 1 ; fOutput . append ( ' ' ) ; while ( ( ch = get_ch ( ) ) != - 1 ) { end_comment [ 0 ] = end_comment [ 1 ] ; end_comment [ 1 ] = ch ; if ( end_comment [ 0 ] == '*' && end_comment [ 1 ] == '/' ) { break ; } } ch = ' ' ; last_ch = ' ' ; } else { unget_ch ( ch2 ) ; } } if ( ch == '`' ) { handle_preproc_directive ( ) ; ifdef_enabled = ifdef_enabled ( ) ; if ( ! ifdef_enabled ) { fOutput . append ( ' ' ) ; } } else { if ( ch == '"' && last_ch != '\\' ) { in_string = true ; } if ( ifdef_enabled ) { fOutput . append ( ( char ) ch ) ; } } } else { if ( ch == '"' && last_ch != '\\' ) { in_string = false ; } if ( ifdef_enabled ) { fOutput . append ( ( char ) ch ) ; } } if ( last_ch == '\\' && ch == '\\' ) { last_ch = ' ' ; } else { last_ch = ch ; } } fInPreProcess = false ; return new SVPreProcOutput ( fOutput , fLineMap ) ; } private void handle_preproc_directive ( ) { int ch = - 1 ; while ( ( ch = get_ch ( ) ) != - 1 && Character . isWhitespace ( ch ) ) { } String type ; if ( ch == - 1 ) { type = "" ; } else { type = readIdentifier ( ch ) ; if ( type == null ) { type = "" ; } } if ( type . equals ( "ifdef" ) || type . equals ( "ifndef" ) || type . equals ( "elsif" ) ) { ch = skipWhite ( get_ch ( ) ) ; String remainder = readIdentifier ( ch ) ; if ( remainder != null ) { remainder = remainder . trim ( ) ; } else { remainder = "" ; } if ( type . equals ( "ifdef" ) ) { if ( fDefineProvider != null ) { enter_ifdef ( fDefineProvider . isDefined ( remainder , fLineno ) ) ; } else { enter_ifdef ( false ) ; } } else if ( type . equals ( "ifndef" ) ) { if ( fDefineProvider != null ) { enter_ifdef ( ! fDefineProvider . isDefined ( remainder , fLineno ) ) ; } else { enter_ifdef ( true ) ; } } else { if ( fDefineProvider != null ) { enter_elsif ( fDefineProvider . isDefined ( remainder , fLineno ) ) ; } else { enter_elsif ( false ) ; } } } else if ( type . equals ( "else" ) ) { enter_else ( ) ; } else if ( type . equals ( "endif" ) ) { leave_ifdef ( ) ; } else if ( fIgnoredDirectives . contains ( type ) ) { readLine ( get_ch ( ) ) ; } else if ( type . equals ( "define" ) ) { ch = skipWhite ( get_ch ( ) ) ; readIdentifier ( ch ) ; fParamList . clear ( ) ; ch = get_ch ( ) ; if ( ch == '(' ) { do { ch = skipWhite ( get_ch ( ) ) ; if ( ! ( Character . isJavaIdentifierPart ( ch ) ) ) { break ; } else { String p = readIdentifier ( ch ) ; String dflt = null ; ch = skipWhite ( get_ch ( ) ) ; if ( ch == '=' ) { ch = skipWhite ( get_ch ( ) ) ; if ( ch == '"' ) { dflt = readString ( ch ) ; dflt = "\"" + dflt + "\"" ; } else { startCapture ( ch ) ; while ( ( ch = get_ch ( ) ) != - 1 && ch != ',' && ch != ')' ) { } unget_ch ( ch ) ; dflt = endCapture ( ) ; } } else { unget_ch ( ch ) ; } fParamList . add ( new Tuple < String , String > ( p , dflt ) ) ; } ch = skipWhite ( get_ch ( ) ) ; } while ( ch == ',' ) ; if ( ch == ')' ) { ch = get_ch ( ) ; } } String define = readLine ( ch ) ; if ( define == null ) { define = "" ; } int last_comment ; if ( ( last_comment = define . lastIndexOf ( "//" ) ) != - 1 ) { int lr = define . indexOf ( '\n' , last_comment ) ; if ( lr == - 1 ) { define = define . substring ( 0 , define . indexOf ( "//" ) ) ; } } } else if ( type . equals ( "include" ) ) { ch = skipWhite ( get_ch ( ) ) ; if ( ch == '"' ) { String inc = readString ( ch ) ; if ( inc . length ( ) > 2 ) { inc = inc . substring ( 1 , inc . length ( ) - 1 ) ; } else { inc = "" ; } } } else if ( type . equals ( "__LINE__" ) ) { fOutput . append ( "" + fLineno ) ; } else if ( type . equals ( "__FILE__" ) ) { fOutput . append ( "\"" + fFileName + "\"" ) ; } else if ( type . equals ( "pragma" ) ) { ch = skipWhite ( get_ch ( ) ) ; String id = readIdentifier ( ch ) ; if ( id != null ) { if ( id . equals ( "protect" ) ) { ch = skipWhite ( get_ch ( ) ) ; id = readIdentifier ( ch ) ; if ( id != null ) { if ( id . equals ( "" ) ) { enter_ifdef ( false ) ; } else if ( id . equals ( "" ) ) { leave_ifdef ( ) ; } } } } } else if ( type . equals ( "protected" ) ) { enter_ifdef ( false ) ; } else if ( type . equals ( "endprotected" ) ) { leave_ifdef ( ) ; } else if ( ! type . equals ( "" ) ) { fTmpBuffer . setLength ( 0 ) ; fTmpBuffer . append ( '`' ) ; fTmpBuffer . append ( type ) ; if ( ifdef_enabled ( ) ) { boolean is_defined = ( fDefineProvider != null ) ? fDefineProvider . isDefined ( type , fLineno ) : false ; if ( fDefineProvider != null && ( fDefineProvider . hasParameters ( type , fLineno ) || ! is_defined ) ) { ch = get_ch ( ) ; while ( ch != - 1 && Character . isWhitespace ( ch ) && ch != '\n' ) { ch = get_ch ( ) ; } if ( ch == '(' ) { fTmpBuffer . append ( ( char ) ch ) ; int matchLevel = 1 ; do { ch = get_ch ( ) ; if ( ch == '(' ) { matchLevel ++ ; } else if ( ch == ')' ) { matchLevel -- ; } if ( ch != - 1 ) { fTmpBuffer . append ( ( char ) ch ) ; } } while ( ch != - 1 && matchLevel > 0 ) ; } else if ( is_defined ) { unget_ch ( ch ) ; } else { unget_ch ( ch ) ; } } if ( fDefineProvider != null ) { try { fOutput . append ( fDefineProvider . expandMacro ( fTmpBuffer . toString ( ) , fFileName , fLineno ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } } } private void enter_ifdef ( boolean enabled ) { int e = ( enabled ) ? PP_ENABLED : PP_DISABLED ; if ( fPreProcEn . size ( ) > 0 ) { int e_t = fPreProcEn . peek ( ) ; if ( ( e_t & PP_ENABLED ) == 0 ) { e = PP_DISABLED ; e |= PP_CARRY ; } } if ( ( e & PP_ENABLED ) == 1 ) { e |= PP_THIS_LEVEL_EN_BLOCK ; } fPreProcEn . push ( e ) ; } private void leave_ifdef ( ) { if ( fPreProcEn . size ( ) > 0 ) { fPreProcEn . pop ( ) ; } } private void enter_elsif ( boolean enabled ) { if ( fPreProcEn . size ( ) > 0 ) { int e = fPreProcEn . pop ( ) ; if ( enabled ) { if ( ( e & PP_CARRY ) != PP_CARRY && | |
2,495 | <s> package net . sf . sveditor . core . log ; import java . lang . ref . WeakReference ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; public class LogFactory implements ILogListener { private static LogFactory fDefault ; private Map < String , LogHandle > fLogHandleMap ; private int fLogLevel = 0 ; private Map < String , LogCategory > fLogHandleCategoryMap ; private List < WeakReference < ILogListener > > fLogListeners ; public LogFactory ( ) { fLogHandleMap = new HashMap < String , LogHandle > ( ) ; fLogHandleCategoryMap = new HashMap < String , LogCategory > ( ) ; fLogListeners = new ArrayList < WeakReference < ILogListener > > ( ) ; } public synchronized static LogFactory getDefault ( ) { if ( fDefault == null ) { fDefault = new LogFactory ( ) ; } return fDefault ; } public static synchronized LogHandle getLogHandle ( String name ) { return getLogHandle ( name , ILogHandle . LOG_CAT_DEFAULT ) ; } public void setLogLevel ( String category , int level ) { if ( category == null ) { fLogLevel = level ; for ( Entry < String , LogCategory > e : fLogHandleCategoryMap . entrySet ( ) ) { e . getValue ( ) . setLogLevel ( level ) ; } } else { LogCategory cat ; if ( fLogHandleCategoryMap . containsKey ( category ) ) { cat = new LogCategory ( category , level ) ; fLogHandleCategoryMap . put ( category , cat ) ; } else { cat = fLogHandleCategoryMap . get ( category ) ; } cat . setLogLevel ( level ) ; } } public static synchronized LogHandle getLogHandle ( String name , String category ) { LogFactory f = getDefault ( ) ; boolean created = false ; LogHandle handle = null ; synchronized ( f . fLogHandleMap ) { if ( ! f . fLogHandleMap . containsKey ( name ) ) { handle = new LogHandle ( name , category ) ; handle . init ( f ) ; f . fLogHandleMap . put ( name , handle ) ; created = true ; } else { handle = f . fLogHandleMap . get ( name ) ; } } if ( created ) { synchronized ( f . fLogHandleCategoryMap ) { LogCategory cat ; if ( ! f . fLogHandleCategoryMap . containsKey ( handle . getCategory ( ) ) ) { cat = new LogCategory ( handle . getCategory ( ) , f . fLogLevel ) ; f . fLogHandleCategoryMap . put ( handle . getCategory ( ) , cat ) ; } else { cat = f | |
2,496 | <s> package org . rubypeople . rdt . internal . core . parser . warnings ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; public class Ruby19WhenStatementsTest extends AbstractRubyLintVisitorTestCase { public void testCreatesProblemForColonInsteadOfThen ( ) throws Exception { String src = "case $agen" + "" + "elsen" + " \"adult\"n" + "endn" ; assertEquals ( 1 , getProblems ( src ) . size ( ) ) ; } public void testCreatesNoProblemForThen ( ) throws Exception { String src = "case $agen" + "" + "elsen" + " \"adult\"n" + "endn" ; | |
2,497 | <s> package com . team1160 . scouting . frontend . elements ; import java . awt . event . ActionEvent ; import java . awt . event . ActionListener ; import com . team1160 . scouting . frontend . resourcePackets . CardLayoutPacket ; import javax . swing . JMenuItem ; public class NextMenuItem extends | |
2,498 | <s> package org . rubypeople . rdt . internal . ui . text . spelling ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellCheckEngine ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellChecker ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . RankedWordProposal ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . ruby . IInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . IProblemLocation ; import org . rubypeople . rdt . ui . text . ruby . IQuickFixProcessor ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public class WordQuickFixProcessor implements IQuickFixProcessor { public IRubyCompletionProposal [ ] getCorrections ( IInvocationContext context , IProblemLocation [ ] locations ) throws CoreException { final int threshold = PreferenceConstants . getPreferenceStore ( ) . getInt ( PreferenceConstants . SPELLING_PROPOSAL_THRESHOLD ) ; int size = 0 ; List proposals = null ; String [ ] arguments = null ; IProblemLocation location = null ; RankedWordProposal proposal = null ; IRubyCompletionProposal [ ] result = null ; boolean fixed = false ; boolean match = false ; boolean sentence = false ; final ISpellCheckEngine engine = SpellCheckEngine . getInstance ( ) ; final ISpellChecker checker = engine . createSpellChecker ( engine . getLocale ( ) , PreferenceConstants . getPreferenceStore ( ) ) ; if ( checker != null ) { for ( int index = 0 ; index < locations . length ; index ++ ) { location = locations [ index ] ; if ( location . getProblemId ( ) == RubySpellingReconcileStrategy . SPELLING_PROBLEM_ID ) { arguments = location . getProblemArguments ( ) ; if ( arguments != null && arguments . length | |
2,499 | <s> package com . asakusafw . testdriver . rule ; import java . math . BigDecimal ; import java . util . Calendar ; public final class Predicates { public static ValuePredicate < Object > equalTo ( Object value ) { return new ExpectConstant < Object > ( value , new Equals ( ) ) ; } public static < T > ValuePredicate < T > not ( ValuePredicate < T > predicate ) { if ( predicate == null ) { throw new IllegalArgumentException ( "" ) ; } return new Not < T > ( predicate ) ; } public static ValuePredicate < Object > equals ( ) { return new Equals ( ) ; } public static ValuePredicate < Object > isNull ( ) { return new IsNull ( ) ; } public static ValuePredicate < Number > floatRange ( double lower , double upper ) { return new FloatRange ( lower , upper ) ; } public static ValuePredicate < Number > integerRange ( long lower , long upper ) { return new IntegerRange ( lower , upper ) ; } |