id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
1,000
<s> package com . asakusafw . compiler . testing ; import java . io . File ; import java . io . IOException ; import java . net . URI ; import java . net . URISyntaxException ; import java . net . URL ; import java . text . MessageFormat ; import java . util . Enumeration ; import java . util . List ; import java . util . Set ; import java . util . UUID ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . ResourceRepository ; import com . asakusafw . compiler . common . FileRepository ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . common . ZipRepository ; import com . asakusafw . compiler . flow . FlowCompiler ; import com . asakusafw . compiler . flow . FlowCompilerConfiguration ; import com . asakusafw . compiler . flow . FlowCompilerOptions ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . flow . Packager ; import com . asakusafw . compiler . flow . jobflow . CompiledStage ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . compiler . flow . packager . FilePackager ; import com . asakusafw . compiler . repository . SpiDataClassRepository ; import com . asakusafw . compiler . repository . SpiExternalIoDescriptionProcessorRepository ; import com . asakusafw . compiler . repository . SpiFlowElementProcessorRepository ; import com . asakusafw . compiler . repository . SpiFlowGraphRewriterRepository ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graphs ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; public final class DirectFlowCompiler { static final Logger LOG = LoggerFactory . getLogger ( DirectFlowCompiler . class ) ; public static JobflowInfo compile ( FlowGraph flowGraph , String batchId , String flowId , String basePackageName , Location clusterWorkingDirectory , File localWorkingDirectory , List < File > extraResources , ClassLoader serviceClassLoader , FlowCompilerOptions flowCompilerOptions ) throws IOException { Precondition . checkMustNotBeNull ( flowGraph , "flowGraph" ) ; Precondition . checkMustNotBeNull ( batchId , "batchId" ) ; Precondition . checkMustNotBeNull ( flowId , "flowId" ) ; Precondition . checkMustNotBeNull ( clusterWorkingDirectory , "" ) ; Precondition . checkMustNotBeNull ( localWorkingDirectory , "" ) ; Precondition . checkMustNotBeNull ( extraResources , "" ) ; Precondition . checkMustNotBeNull ( serviceClassLoader , "" ) ; Precondition . checkMustNotBeNull ( flowCompilerOptions , "" ) ; if ( localWorkingDirectory . exists ( ) ) { clean ( localWorkingDirectory ) ; } List < ResourceRepository > repositories = createRepositories ( serviceClassLoader , extraResources ) ; FlowCompilerConfiguration config = createConfig ( batchId , flowId , basePackageName , clusterWorkingDirectory , localWorkingDirectory , repositories , serviceClassLoader , flowCompilerOptions ) ; FlowCompiler compiler = new FlowCompiler ( config ) ; JobflowModel jobflow = compiler . compile ( flowGraph ) ; File jobflowSources = new File ( localWorkingDirectory , Naming . getJobflowSourceBundleName ( flowId ) ) ; File jobflowPackage = new File ( localWorkingDirectory , Naming . getJobflowClassPackageName ( flowId ) ) ; compiler . collectSources ( jobflowSources ) ; compiler . buildSources ( jobflowPackage ) ; return toInfo ( jobflow , jobflowSources , jobflowPackage ) ; } public static JobflowInfo toInfo ( JobflowModel jobflow , File sourceBundle , File packageFile ) { Precondition . checkMustNotBeNull ( jobflow , "jobflow" ) ; Precondition . checkMustNotBeNull ( sourceBundle , "sourceBundle" ) ; Precondition . checkMustNotBeNull ( packageFile , "packageFile" ) ; List < StageInfo > stages = Lists . create ( ) ; for ( CompiledStage compiled : jobflow . getCompiled ( ) . getPrologueStages ( ) ) { stages . add ( toInfo ( compiled ) ) ; } Graph < JobflowModel . Stage > depenedencies = jobflow . getDependencyGraph ( ) ; for ( JobflowModel . Stage stage : Graphs . sortPostOrder ( depenedencies ) ) { stages . add ( toInfo ( stage . getCompiled ( ) ) ) ; } for ( CompiledStage compiled : jobflow . getCompiled ( ) . getEpilogueStages ( ) ) { stages . add ( toInfo ( compiled ) ) ; } return new JobflowInfo ( jobflow , packageFile , sourceBundle , stages ) ; } private static void clean ( File localWorkingDirectory ) { assert localWorkingDirectory != null ; LOG . info ( "" , localWorkingDirectory ) ; delete ( localWorkingDirectory ) ; } private static boolean delete ( File target ) { assert target != null ; boolean success = true ; if ( target . isDirectory ( ) ) { for ( File child : target . listFiles ( ) ) { success &= delete ( child ) ; } } success &= target . delete ( ) ; return success ; } static List < ResourceRepository > createRepositories ( ClassLoader classLoader , List < File > extraResources ) throws IOException { assert classLoader != null ; assert extraResources != null ; List < File > targets = Lists . create ( ) ; targets . addAll ( collectLibraryPathsFromMarker ( classLoader ) ) ; targets . addAll ( extraResources ) ; List < ResourceRepository > results = Lists . create ( ) ; Set < File > saw = Sets . create ( ) ; for ( File file : targets ) { LOG . debug ( "" , file ) ; File canonical = file . getAbsoluteFile ( ) . getCanonicalFile ( ) ; if ( saw . contains ( canonical ) ) { LOG . debug ( "" , file ) ; continue ; } saw . add ( file ) ; if ( file . isDirectory ( ) ) { results . add ( new FileRepository ( file ) ) ; } else if ( file . isFile ( ) && file . getName ( ) . endsWith ( ".zip" ) ) { results . add ( new ZipRepository ( file ) ) ; } else if ( file . isFile ( ) && file . getName ( ) . endsWith ( ".jar" ) ) { results . add ( new ZipRepository ( file ) ) ; } else { LOG . warn ( "" , file ) ; } } return results ; } private static FlowCompilerConfiguration createConfig ( String batchId , String flowId , String basePackageName , Location baseLocation , File workingDirectory , List < ? extends ResourceRepository > repositories , ClassLoader serviceClassLoader , FlowCompilerOptions flowCompilerOptions ) { assert batchId != null ; assert flowId != null ; assert basePackageName != null ; assert baseLocation != null ; assert workingDirectory != null ; assert repositories != null ; assert serviceClassLoader != null ; assert flowCompilerOptions != null ; FlowCompilerConfiguration config
1,001
<s> package org . oddjob . jmx . server ; import java . io . Serializable ; import org . oddjob . arooa . registry . Address ; import org . oddjob . jmx . client . ClientHandlerResolver ; public class ServerInfo implements Serializable { private static final long serialVersionUID = 2009090500L ; private final Address address ; private final ClientHandlerResolver < ? > [ ] clientResolvers ;
1,002
<s> package net . sf . sveditor . ui . editor . actions ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . utils . SVDBSearchUtils ; import net . sf . sveditor . core . indent . ISVIndenter ; import net . sf . sveditor . core . indent . SVIndentScanner ; import net . sf . sveditor . core . scanutils . IRandomAccessTextScanner ; import net . sf . sveditor . core . srcgen . MethodGenerator ; import net . sf . sveditor . ui . SVUiPlugin ; import net . sf . sveditor . ui . editor . ISVEditor ; import net . sf . sveditor . ui . pref . SVEditorPrefsConstants ; import net . sf . sveditor . ui . scanutils . SVDocumentTextScanner ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextSelection ; public class OverrideTaskFuncImpl { private ISVEditor fEditor ; private IOverrideMethodsTargetProvider fTargetProvider ; public OverrideTaskFuncImpl ( ISVEditor editor , IOverrideMethodsTargetProvider target_provider ) { fEditor = editor ; fTargetProvider = target_provider ; } public void run ( ) { IDocument doc = fEditor . getDocument ( ) ; ITextSelection sel = fEditor . getTextSel ( ) ; int offset = sel . getOffset ( ) + sel . getLength ( ) ; SVDBFile file = fEditor . getSVDBFile ( ) ; ISVDBChildItem active_scope = SVDBSearchUtils . findActiveScope ( file , fEditor . getTextSel ( ) . getStartLine ( ) ) ; ISVDBChildItem insert_point = active_scope ; int insert_point_line = fEditor . getTextSel ( ) . getStartLine ( ) ; if ( insert_point . getType ( ) != SVDBItemType . ClassDecl ) { while ( insert_point != null && insert_point . getType ( ) != SVDBItemType . ClassDecl && insert_point . getParent ( ) != null && insert_point . getParent ( ) . getType ( ) != SVDBItemType . ClassDecl ) { insert_point = insert_point . getParent ( ) ; } if ( insert_point . getParent ( ) != null && insert_point . getParent ( ) . getType ( ) == SVDBItemType . ClassDecl ) { ISVDBScopeItem scope = ( ISVDBScopeItem ) insert_point ; insert_point_line = scope . getEndLocation ( ) . getLine ( ) ; } else { System . out . println ( "" ) ; return ; } } while ( active_scope != null && active_scope . getType ( ) != SVDBItemType . ClassDecl ) { active_scope = active_scope . getParent ( ) ; } if ( active_scope == null ) { return ; } List < SVDBTask > targets = null ; if ( active_scope instanceof ISVDBScopeItem ) { targets = fTargetProvider . getTargets ( ( ISVDBScopeItem ) active_scope ) ; } if ( targets == null ) { return ; } try { StringBuilder new_tf = new StringBuilder ( ) ; MethodGenerator gen = new MethodGenerator ( ) ; new_tf . append (
1,003
<s> package org . oddjob . framework ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import junit . framework . TestCase ; import org . apache . commons . beanutils . DynaProperty ; public class WrapDynaClassTest extends TestCase { public static class MyBean { public String getSimple ( ) { return null ; } public String getMapped ( String foo ) { return null ; } public String [ ] getIndexed ( ) { return null ; } public boolean isOk ( ) { return true ; } } public void testProperties ( ) { WrapDynaClass test = WrapDynaClass . createDynaClass ( MyBean . class ) ; DynaProperty result ; result = test . getDynaProperty ( "simple" ) ; assertNotNull ( "simple" , result ) ; assertEquals ( "simple class" , String . class , result . getType ( ) ) ; result = test . getDynaProperty ( "indexed" ) ; assertNotNull ( "indexed" , result ) ; assertTrue ( "is indexed" , result . isIndexed ( ) ) ; result = test . getDynaProperty ( "mapped" ) ; assertNotNull ( "mapped" , result ) ; assertTrue ( "is mapped" , result . isMapped ( ) ) ; result = test . getDynaProperty ( "ok" ) ; assertNotNull ( "boolean" , result ) ; } public static class MixedTypes { public String getStuff
1,004
<s> package org . rubypeople . rdt . internal . ui . packageview ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . viewers . TreePath ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . IWorkingSetManager ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . ui . workingsets . OthersWorkingSetUpdater ; import org . rubypeople . rdt . internal . ui . workingsets . RubyWorkingSetUpdater ; import org . rubypeople . rdt . internal . ui . workingsets . WorkingSetModel ; public class WorkingSetAwareContentProvider extends PackageExplorerContentProvider implements IMultiElementTreeContentProvider { private WorkingSetModel fWorkingSetModel ; private IPropertyChangeListener fListener ; public WorkingSetAwareContentProvider ( boolean provideMembers , WorkingSetModel model ) { super ( provideMembers ) ; fWorkingSetModel = model ; fListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { workingSetModelChanged ( event ) ; } } ; fWorkingSetModel . addPropertyChangeListener ( fListener ) ; } public void dispose ( ) { fWorkingSetModel . removePropertyChangeListener ( fListener ) ; super . dispose ( ) ; } public boolean hasChildren ( Object element ) { if ( element instanceof IWorkingSet ) return true ; return super . hasChildren ( element ) ; } public Object [ ] getChildren ( Object element ) { Object [ ] children ; if ( element instanceof WorkingSetModel ) { Assert . isTrue ( fWorkingSetModel == element ) ; return fWorkingSetModel . getActiveWorkingSets ( ) ; } else if ( element instanceof IWorkingSet ) { children = getWorkingSetChildren ( ( IWorkingSet ) element ) ; } else { children = super . getChildren ( element ) ; } return children ; } private Object [ ] getWorkingSetChildren ( IWorkingSet set ) { IAdaptable [ ] elements = fWorkingSetModel . getChildren ( set ) ; boolean isKnownWorkingSet = isKnownWorkingSet ( set ) ; List result = new ArrayList ( elements . length ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { IAdaptable element = elements [ i ] ; boolean add = false ; if ( element instanceof IProject ) { add = true ; } else if ( element instanceof IResource ) { IProject project = ( ( IResource ) element ) . getProject ( ) ; add = project == null || project . isOpen ( ) ; } else if ( element instanceof IRubyProject ) { add = true ; } else if ( element instanceof IRubyElement ) { IProject project = getProject ( ( IRubyElement ) element ) ; add = project == null || project . isOpen ( ) ; } if ( add ) { if ( isKnownWorkingSet ) { result . add ( element ) ; } else { IProject project = ( IProject ) element . getAdapter ( IProject . class ) ; if ( project != null && project . exists ( ) ) { IRubyProject jp = RubyCore . create ( project ) ; if ( jp != null && jp . exists ( ) ) { result . add ( jp ) ; } else { result . add ( project ) ; } } } } } return result . toArray ( ) ; } private boolean isKnownWorkingSet ( IWorkingSet set ) { String id = set . getId ( ) ; return OthersWorkingSetUpdater . ID . equals ( id ) || RubyWorkingSetUpdater . ID . equals ( id ) ; } private IProject getProject ( IRubyElement element ) { if ( element == null ) return null ; IRubyProject project = element . getRubyProject ( ) ; if ( project == null ) return null ; return project . getProject ( ) ; } public TreePath [ ] getTreePaths ( Object element ) { if ( element instanceof IWorkingSet ) { TreePath path = new TreePath ( new Object [ ] { element } ) ; return new TreePath [ ] { path } ; } List modelParents = getModelPath ( element ) ; List result = new ArrayList ( ) ; for ( int i = 0 ; i < modelParents . size ( ) ; i ++ ) { result . addAll ( getTreePaths ( modelParents , i ) ) ; } return ( TreePath [ ] ) result . toArray ( new TreePath [ result . size ( ) ] ) ; } private List getModelPath ( Object element ) { List result = new ArrayList ( ) ; result . add ( element ) ; Object parent = super . getParent ( element ) ; Object input = getViewerInput ( ) ; while ( parent != null && ! parent . equals (
1,005
<s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . Retention ; import java .
1,006
<s> package $ { package } . operator ; import java . util . List ; import $ { package } . modelgen . dmdl . model . CategorySummary ; import $ { package } . modelgen . dmdl . model . ErrorRecord ; import $ { package } . modelgen . dmdl . model . ItemInfo ; import $ { package } . modelgen . dmdl . model . JoinedSalesInfo ; import $ { package } . modelgen . dmdl . model . SalesDetail ; import $ { package } . modelgen . dmdl . model . StoreInfo ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . vocabulary . model . Key ; import com . asakusafw . vocabulary . operator . MasterCheck ; import com . asakusafw . vocabulary . operator . MasterJoin ; import com . asakusafw . vocabulary . operator . MasterSelection ; import com . asakusafw . vocabulary . operator . Summarize ; import com . asakusafw . vocabulary . operator . Update ; public abstract class CategorySummaryOperator { @ MasterCheck public abstract boolean checkStore ( @ Key ( group = "store_code" ) StoreInfo info , @ Key ( group = "store_code" ) SalesDetail sales ) ; @ MasterJoin ( selection = "" ) public abstract JoinedSalesInfo joinItemInfo ( ItemInfo info , SalesDetail sales ) ; private final Date dateBuffer = new Date ( ) ; @ MasterSelection public ItemInfo selectAvailableItem ( List < ItemInfo > candidates , SalesDetail sales ) { DateTime dateTime = sales . getSalesDateTime ( ) ; dateBuffer . setElapsedDays ( DateUtil . getDayFromDate ( dateTime . getYear ( ) ,
1,007
<s> package org . oddjob . schedules . schedules ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalHelper ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . Schedule ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . ScheduleResult ; import org . oddjob . schedules . ScheduleType ; import org . oddjob . schedules . SimpleScheduleResult ; public class NowSchedule implements Schedule { public ScheduleResult nextDue (
1,008
<s> package org . rubypeople . eclipse . shams . resources ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . Reader ; import java . net . URI ; import java . nio . charset . Charset ; import junit . framework . Assert ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFileState ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IProjectDescription ; 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 . IProgressMonitor ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . QualifiedName ; import org . eclipse . core . runtime . content . IContentDescription ; import org . eclipse . core . runtime . content . IContentType ; public class ShamFile extends ShamResource implements IFile { public static final String WORKSPACE_ROOT = "" ; protected String contents = "" ; protected boolean readContentFromFile ; private InputStream inputStream ; private IProject project ; public void setCharset ( String newCharset , IProgressMonitor monitor ) throws CoreException { } public ShamFile ( String fullPath ) { this ( fullPath , false ) ; } public ShamFile ( IPath aPath ) { this ( aPath , false ) ; } public String getCharset ( ) throws CoreException { return Charset . defaultCharset ( ) . name ( ) ; } public ShamFile ( String fullPath , boolean readContentFromFile ) { this ( new Path ( fullPath ) , readContentFromFile ) ; } public ShamFile ( IPath aPath , boolean readContentFromFile ) { super ( aPath ) ; this . readContentFromFile = readContentFromFile ; project = new ShamProject ( "" ) ; } public void appendContents ( InputStream source , boolean force , boolean keepHistory , IProgressMonitor monitor ) throws CoreException { } public void appendContents ( InputStream source , int updateFlags , IProgressMonitor monitor ) throws CoreException { } public void create ( InputStream source , boolean force , IProgressMonitor monitor ) throws CoreException { } public void create ( InputStream source , int updateFlags , IProgressMonitor monitor ) throws CoreException { } public void delete ( boolean force , boolean keepHistory , IProgressMonitor monitor ) throws CoreException { } public InputStream getContents ( ) throws CoreException { if ( readContentFromFile ) { try { return openStream ( new FileInputStream ( this . path . toString ( ) ) ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( e . toString ( ) ) ; } } return openStream ( new ByteArrayInputStream ( contents . getBytes ( ) ) ) ; } private InputStream openStream ( InputStream newStream ) { Assert . assertNull ( "" , inputStream ) ; inputStream = new MonitoredInputStream ( newStream ) ; return inputStream ; } public void assertContentStreamClosed ( ) { Assert . assertNull ( "" , inputStream ) ; } public InputStream getContents ( boolean force ) throws CoreException { return getContents ( ) ; } public int getEncoding ( ) throws CoreException { throw new RuntimeException ( "" ) ; } public IFileState [ ] getHistory ( IProgressMonitor monitor ) throws CoreException { throw new RuntimeException ( "" ) ; } public boolean isReadOnly ( ) { throw new RuntimeException ( "" ) ; } public void move ( IPath destination , boolean force , boolean keepHistory , IProgressMonitor monitor ) throws CoreException { } public void setContents ( InputStream source , boolean force , boolean keepHistory , IProgressMonitor monitor ) throws CoreException { } public void setContents ( IFileState source , boolean force , boolean keepHistory , IProgressMonitor monitor ) throws CoreException { } public void setContents ( InputStream source , int updateFlags , IProgressMonitor monitor ) throws CoreException { } public void setContents (
1,009
<s> package org . oddjob . jmx . server ; import java . io . NotSerializableException ; import java . rmi . RemoteException ; import javax . management . Attribute ; import javax . management . AttributeList ; import javax . management . DynamicMBean ; import javax . management . MBeanException ; import javax . management . MBeanInfo ; import javax . management . MBeanNotificationInfo ; import javax . management . Notification ; import javax . management . NotificationBroadcasterSupport ; import javax . management . ObjectName ; import javax . management . ReflectionException ; import org . apache . log4j . Logger ; import org . oddjob . jmx . RemoteOddjobBean ; import org . oddjob . jmx . Utils ; public class OddjobMBean extends NotificationBroadcasterSupport implements DynamicMBean { private static final Logger logger = Logger . getLogger ( OddjobMBean . class ) ; private final Object node ; private final ServerContext srvcon ; private int sequenceNumber = 0 ; private final ObjectName objectName ; private final ServerSession factory ; private final ServerInterfaceManager serverInterfaceManager ; private final Object resyncLock = new Object ( ) ; public OddjobMBean ( Object node , ServerSession factory , ServerContext srvcon ) { if ( node == null ) { throw new NullPointerException ( "" ) ; } if ( srvcon == null ) { throw new NullPointerException ( "" ) ; } this . node = node ; this . factory = factory ; this . srvcon = srvcon ; this . objectName = factory . nameFor ( node ) ; ServerInterfaceManagerFactory imf = srvcon . getModel ( ) . getInterfaceManagerFactory ( ) ; serverInterfaceManager = imf . create ( node , new Toolkit ( ) ) ; } public Object getNode ( ) { return node ; } public Object getAttribute ( String attribute ) throws ReflectionException , MBeanException { logger . debug ( "" + attribute + ")" ) ; return invoke ( "get" , new Object [ ] { attribute } , new String [ ] { String . class . getName ( ) } ) ; } public void setAttribute ( Attribute attribute ) throws ReflectionException , MBeanException { logger . debug ( "" + attribute . getName ( ) + ")" ) ; invoke ( "set" , new Object [ ] { attribute . getClass ( ) , attribute . getValue ( ) } , new String [ ] { String . class . getName ( ) , Object . class . getName ( ) } ) ; } public AttributeList getAttributes ( String [ ] attributes ) { AttributeList al = new AttributeList ( ) ; for ( int i = 0 ; i < attributes . length ; ++ i ) { String attribute = attributes [ i ] ; Attribute attr ; try { attr = new Attribute ( attribute , getAttribute ( attribute ) ) ; al . add ( attr ) ; } catch ( ReflectionException e ) { logger . debug ( e ) ; } catch ( MBeanException e ) { logger . debug ( e ) ; } } return al ; } public AttributeList setAttributes ( AttributeList attributes ) { AttributeList al = new AttributeList ( ) ; for ( Attribute attribute : attributes . asList ( ) ) { try { setAttribute ( attribute ) ; al . add ( attribute ) ; } catch ( ReflectionException e ) { logger . debug ( e ) ; } catch ( MBeanException e ) { logger . debug ( e ) ; } } return al ; } static String methodDescription ( final String actionName , String [ ] signature ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( actionName ) ; buf . append ( '(' ) ; for ( int j = 0 ; j < signature . length ; ++ j ) { buf . append ( j == 0 ? "" : ", " ) ; buf . append ( signature [ j ] ) ; }
1,010
<s> package com . asakusafw . vocabulary . flow . graph ; import java . lang . annotation . Annotation ; import java . lang . reflect . Method ; import java . lang . reflect . Type ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import com . asakusafw . vocabulary . flow . Source ; public class OperatorDescription implements FlowElementDescription { private final Declaration declaration ; private final List < FlowElementPortDescription > inputPorts ; private final List < FlowElementPortDescription > outputPorts ; private final List < FlowResourceDescription > resources ; private final List < Parameter > parameters ; private final Map < Class < ? extends FlowElementAttribute > , FlowElementAttribute > attributes ; private String name ; public OperatorDescription ( Declaration declaration , List < FlowElementPortDescription > inputPorts , List < FlowElementPortDescription > outputPorts , List < FlowResourceDescription > resources , List < Parameter > parameters , List < FlowElementAttribute > attributes ) { if ( declaration == null ) { throw new IllegalArgumentException ( "" ) ; } if ( inputPorts == null ) { throw new IllegalArgumentException ( "" ) ; } if ( outputPorts == null ) { throw new IllegalArgumentException ( "" ) ; } if ( resources == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "" ) ; } if ( attributes == null ) { throw new IllegalArgumentException ( "" ) ; } this . declaration = declaration ; this . inputPorts = Collections . unmodifiableList ( new ArrayList < FlowElementPortDescription > ( inputPorts ) ) ; this . outputPorts = Collections . unmodifiableList ( new ArrayList < FlowElementPortDescription > ( outputPorts ) ) ; this . resources = Collections . unmodifiableList ( new ArrayList < FlowResourceDescription > ( resources ) ) ; this . parameters = Collections . unmodifiableList ( new ArrayList < Parameter > ( parameters ) ) ; this . attributes = new HashMap < Class < ? extends FlowElementAttribute > , FlowElementAttribute > ( ) ; for ( FlowElementAttribute attribute : attributes ) { this . attributes . put ( attribute . getDeclaringClass ( ) , attribute ) ; } } @ Override public FlowElementKind getKind ( ) { return FlowElementKind . OPERATOR ; } public Declaration getDeclaration ( ) { return declaration ; } @ Override public String getName ( ) { if ( name == null ) { return MessageFormat . format ( "{0}.{1}" , declaration . getDeclaring ( ) . getSimpleName ( ) , declaration . getName ( ) ) ; } return name ; } @ Override public void setName ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } this . name = name ; } @ Override public List < FlowElementPortDescription > getInputPorts ( ) { return inputPorts ; } @ Override public List < FlowElementPortDescription > getOutputPorts ( ) { return outputPorts ; } @ Override public List < FlowResourceDescription > getResources ( ) { return resources ; } public List < Parameter > getParameters ( ) { return parameters ; } @ Override public < T extends FlowElementAttribute > T getAttribute ( Class < T > attributeClass ) { if ( attributeClass == null ) { throw new IllegalArgumentException ( "" ) ; } Object attribute = attributes . get ( attributeClass ) ; return attributeClass . cast ( attribute ) ; } public Set < FlowElementAttribute > getAttributes ( ) { return new HashSet < FlowElementAttribute > ( attributes . values ( ) ) ; } @ Override public String toString ( ) { return MessageFormat . format ( "{0}{1}" , getDeclaration ( ) , getParameters ( ) ) ; } public static class Declaration { private final Class < ? extends Annotation > annotationType ; private final Class < ? > declaring ; private final Class < ? > implementing ; private final String name ; private final List < Class < ? > > parameterTypes ; public Declaration ( Class < ? extends Annotation > annotationType , Class < ? > declaring , Class < ? > implementing , String name , List < Class < ? > > parameterTypes ) { if ( annotationType == null ) { throw new IllegalArgumentException ( "" ) ; } if ( declaring == null ) { throw new IllegalArgumentException ( "" ) ; } if ( implementing == null ) { throw new IllegalArgumentException ( "" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameterTypes == null ) { throw new IllegalArgumentException ( "" ) ; } this . annotationType = annotationType ; this . declaring = declaring ; this . implementing = implementing ; this . name = name ; this . parameterTypes = parameterTypes ; } public Class < ? extends Annotation > getAnnotationType ( ) { return annotationType ; } public Class < ? > getDeclaring ( ) { return declaring ; } public Class < ? > getImplementing ( ) { return implementing ; } public String getName ( ) { return name ; } public List < Class < ? > > getParameterTypes ( ) { return parameterTypes ; } public Method toMethod ( ) { Class < ? > [ ] params = parameterTypes . toArray ( new Class < ? > [ parameterTypes . size ( ) ] ) ; try { return declaring . getMethod ( name , params ) ; } catch ( Exception e ) { return null ; } } @ Override public String toString ( ) { return MessageFormat . format ( "{0}#{1}({2})" , declaring . getName ( ) , name , parameterTypes ) ; } } public static class Parameter { private final String name ; private final Type type ; private final Object value ; public Parameter ( String name , Type type , Object value ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } this . name = name ; this . type = type ; this . value = value ; } public String getName ( ) { return name ; } public Type getType ( ) { return type ; } public Object getValue ( ) { return value ; } @ Override public String toString ( ) { return MessageFormat . format ( "{0}[{1}]={2}" , getName ( ) , getType ( ) , getValue ( ) ) ; } } public static
1,011
<s> package de . fuberlin . wiwiss . d2rq . server ; import java . io . IOException ; import java . util . Map ; import java . util . TreeMap ; import javax . servlet . ServletException ; import javax . servlet . http . HttpServlet ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import org . apache . velocity . context . Context ; import de . fuberlin . wiwiss . d2rq . ClassMapLister ; public class RootServlet extends HttpServlet { public void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { D2RServer server = D2RServer . fromServletContext ( getServletContext ( ) ) ;
1,012
<s> package net . sf . sveditor . core . tests . parser ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBScopeItem ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . SVDBUtil ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; import net . sf . sveditor . core . parser . ParserSVDBFileFactory ; import net . sf . sveditor . core . parser . SVParseException ; public class TestParseFunction extends TestCase { private SVDBTask parse_tf ( String content , String name ) throws SVParseException { SVDBScopeItem scope = new SVDBScopeItem ( ) ; ParserSVDBFileFactory parser = new ParserSVDBFileFactory ( null ) ; parser . init ( new StringInputStream ( content ) , name ) ; parser . parsers ( ) . taskFuncParser ( ) . parse ( scope , null , 0 ) ; return ( SVDBTask ) scope . getChildren ( ) . iterator ( ) . next ( ) ; } private SVDBClassDecl parse_class ( String content , String name ) throws SVParseException { SVDBScopeItem scope = new SVDBScopeItem ( ) ; ParserSVDBFileFactory parser = new ParserSVDBFileFactory ( null ) ; parser . init ( new StringInputStream ( content ) , name ) ; parser . parsers ( ) . classParser ( ) . parse ( scope , 0 ) ; return ( SVDBClassDecl ) scope . getChildren ( ) . iterator ( ) . next ( ) ; } public void testBasicFunction ( ) throws SVParseException { String content = "" + " a = 5;n" + "endfunctionn" ; parse_tf ( content , "" ) ; } public void testReturnOnlyFunction ( ) throws SVParseException { String content = "" + "" + "" + "endfunctionn" + "endclassn" ; parse_class ( content , "" ) ; } public void testKRParameters ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "" + "" + "beginn" + "endn" + "endfunctionn" ; parse_tf ( content , testname ) ; } public void testKRParameters2 ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "tbeginn" + "" + "tendn" + "tendtaskn" ; parse_tf ( content , testname ) ; } public void testTaskWithParam ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "" + "" + "ttbeginn" + "" + "ttendn" + "tendtaskn" ; parse_tf ( content , testname ) ; } public void testLocalVarsWithCast ( ) throws SVParseException { String content = "" + "" + "" + " a = 5;n" + "endfunctionn" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBTask func = parse_tf ( content , "" ) ; assertEquals ( 3 , SVDBUtil . getChildrenSize ( func ) ) ; SVDBVarDeclItem a = null , b = null ; for ( ISVDBItemBase it_t : func . getChildren ( ) ) { if ( it_t . getType ( ) == SVDBItemType . VarDeclStmt ) { SVDBVarDeclStmt v = ( SVDBVarDeclStmt ) it_t ; for ( ISVDBChildItem vi : v . getChildren ( ) ) { if ( SVDBItem . getName ( vi ) . equals ( "a" ) ) { a = ( SVDBVarDeclItem ) vi ; } else if ( SVDBItem . getName ( vi ) . equals ( "b" ) ) { b = ( SVDBVarDeclItem ) vi ; } } } } assertNotNull ( a ) ; assertNotNull ( b ) ; } public void testLocalTimeVar ( ) throws SVParseException { String content = "" + "" + "" + "endfunctionn" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; SVDBTask func = parse_tf ( content , "" ) ; assertEquals ( 2 , SVDBUtil . getChildrenSize ( func ) ) ; assertTrue ( SVDBUtil . getFirstChildItem ( func ) . getType ( ) == SVDBItemType . VarDeclStmt ) ; SVDBVarDeclStmt stmt = ( SVDBVarDeclStmt ) SVDBUtil . getFirstChildItem ( func ) ; SVDBVarDeclItem vi = ( SVDBVarDeclItem ) stmt . getChildren ( ) . iterator ( ) . next ( ) ; assertEquals ( "t" , vi . getName ( ) ) ; } public void testLocalTypedef ( ) throws SVParseException
1,013
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . PurchaseTranError ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class PurchaseTranErrorModelInput implements ModelInput < PurchaseTranError > { private final RecordParser parser ; public PurchaseTranErrorModelInput ( RecordParser parser ) { if ( parser == null ) { throw new IllegalArgumentException ( ) ; } this . parser = parser ; } @ Override public boolean readTo ( PurchaseTranError model ) throws IOException { if ( parser . next ( ) == false
1,014
<s> package org . rubypeople . rdt . refactoring . core . formatsource ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; public class FormatSourceConditionChecker extends RefactoringConditionChecker { private FormatSourceConfig config ; public FormatSourceConditionChecker ( FormatSourceConfig config ) { super ( config ) ; }
1,015
<s> package org . rubypeople . rdt . internal . ui . wizards . dialogfields ; import org . eclipse . swt . events . KeyEvent ; public interface ITreeListAdapter { void customButtonPressed ( TreeListDialogField field , int index ) ; void selectionChanged ( TreeListDialogField field ) ; void doubleClicked ( TreeListDialogField field ) ; void keyPressed ( TreeListDialogField field , KeyEvent event ) ; Object [
1,016
<s> package com . aptana . rdt . internal . core . parser . warnings ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . internal . parser . warnings . EnumerableInclusionVisitor ; public class TC_EnumerableInclusionVisitor
1,017
<s> package net . sf . sveditor . core . db ; public class SVDBLocation { public int fLine ; public int fPos ; public SVDBLocation ( int line , int pos ) { fLine = line ; fPos = pos ; } public SVDBLocation ( SVDBLocation other ) { fLine = other . fLine ; fPos = other . fPos ; } public int getLine ( ) { return fLine ; } public int getPos ( )
1,018
<s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jface . operation . IRunnableContext ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . rubypeople . rdt . core . ElementChangedEvent ; import org . rubypeople . rdt . core . IElementChangedListener ; import org . rubypeople . rdt . core . IRegion ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyElementDelta ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . ITypeHierarchyChangedListener ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . codeassist . RubyElementRequestor ; import org . rubypeople . rdt . internal . core . LogicalType ; import org . rubypeople . rdt . internal . corext . util . RubyModelUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class TypeHierarchyLifeCycle implements ITypeHierarchyChangedListener , IElementChangedListener { private boolean fHierarchyRefreshNeeded ; private ITypeHierarchy fHierarchy ; private IRubyElement fInputElement ; private boolean fIsSuperTypesOnly ; private List fChangeListeners ; public TypeHierarchyLifeCycle ( ) { this ( false ) ; } public TypeHierarchyLifeCycle ( boolean isSuperTypesOnly ) { fHierarchy = null ; fInputElement = null ; fIsSuperTypesOnly = isSuperTypesOnly ; fChangeListeners = new ArrayList ( 2 ) ; } public ITypeHierarchy getHierarchy ( ) { return fHierarchy ; } public IRubyElement getInputElement ( ) { return fInputElement ; } public void freeHierarchy ( ) { if ( fHierarchy != null ) { fHierarchy . removeTypeHierarchyChangedListener ( this ) ; RubyCore . removeElementChangedListener ( this ) ; fHierarchy = null ; fInputElement = null ; } } public void removeChangedListener ( ITypeHierarchyLifeCycleListener listener ) { fChangeListeners . remove ( listener ) ; } public void addChangedListener ( ITypeHierarchyLifeCycleListener listener ) { if ( ! fChangeListeners . contains ( listener ) ) { fChangeListeners . add ( listener ) ; } } private void fireChange ( IType [ ] changedTypes ) { for ( int i = fChangeListeners . size ( ) - 1 ; i >= 0 ; i -- ) { ITypeHierarchyLifeCycleListener curr = ( ITypeHierarchyLifeCycleListener ) fChangeListeners . get ( i ) ; curr . typeHierarchyChanged ( this , changedTypes ) ; } } public void ensureRefreshedTypeHierarchy ( final IRubyElement element , IRunnableContext context ) throws InvocationTargetException , InterruptedException { if ( element == null || ! element . exists ( ) ) { freeHierarchy ( ) ; return ; } boolean hierachyCreationNeeded = ( fHierarchy == null || ! element . equals ( fInputElement ) ) ; if ( hierachyCreationNeeded || fHierarchyRefreshNeeded ) { IRunnableWithProgress op = new IRunnableWithProgress ( ) { public void run ( IProgressMonitor pm ) throws InvocationTargetException , InterruptedException { try { doHierarchyRefresh ( element , pm ) ; } catch ( RubyModelException e ) { throw new InvocationTargetException ( e ) ; } catch ( OperationCanceledException e ) { throw new InterruptedException ( ) ; } } } ; fHierarchyRefreshNeeded = true ; context . run ( true , true , op ) ; fHierarchyRefreshNeeded = false ; } } private IType getLogicalType ( IType type , String name ) { RubyElementRequestor requestor = new RubyElementRequestor ( type . getRubyScript ( ) ) ; IType [ ] types = requestor . findType ( name ) ; if ( types == null || types . length == 0 ) return null ; return new LogicalType ( types ) ; } private ITypeHierarchy createTypeHierarchy ( IRubyElement element , IProgressMonitor pm ) throws RubyModelException { if ( element . getElementType ( ) == IRubyElement . TYPE ) { IType type = ( IType ) element ; type = getLogicalType ( type , type . getFullyQualifiedName ( ) ) ; if ( fIsSuperTypesOnly ) { return type . newSupertypeHierarchy ( pm ) ; } else { return type . newTypeHierarchy ( pm ) ; } } else { IRegion region = RubyCore . newRegion ( ) ; if ( element . getElementType ( ) == IRubyElement . RUBY_PROJECT ) { ISourceFolderRoot [ ] roots = ( ( IRubyProject ) element ) . getSourceFolderRoots ( ) ; for ( int i = 0 ; i < roots . length ; i ++ ) { if ( ! roots [ i ] . isExternal ( ) ) { region . add ( roots [ i ] ) ; } } } else if ( element . getElementType ( ) == IRubyElement . SOURCE_FOLDER ) { ISourceFolderRoot [ ] roots = element . getRubyProject ( ) . getSourceFolderRoots ( ) ; String name = element . getElementName ( ) ; for ( int i = 0 ; i < roots . length ; i ++ ) { ISourceFolder pack = roots [ i ] . getSourceFolder ( name ) ; if ( pack . exists ( ) ) { region . add ( pack ) ; } } } else { region . add ( element ) ; } IRubyProject jproject = element . getRubyProject ( ) ; return jproject . newTypeHierarchy ( region , pm ) ; } } public synchronized void doHierarchyRefresh ( IRubyElement element , IProgressMonitor pm ) throws RubyModelException { boolean hierachyCreationNeeded = ( fHierarchy == null || ! element . equals ( fInputElement ) ) ; if ( fHierarchy != null ) { fHierarchy . removeTypeHierarchyChangedListener ( this ) ; RubyCore . removeElementChangedListener ( this ) ; } if ( hierachyCreationNeeded ) { fHierarchy = createTypeHierarchy ( element , pm ) ; if ( pm != null && pm . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } fInputElement = element ; } else { fHierarchy . refresh ( pm ) ; } if ( fHierarchy != null ) { fHierarchy . addTypeHierarchyChangedListener ( this ) ; RubyCore . addElementChangedListener ( this ) ; fHierarchyRefreshNeeded = false ; } } public void typeHierarchyChanged ( ITypeHierarchy typeHierarchy ) { fHierarchyRefreshNeeded = true ; fireChange ( null ) ; } public void elementChanged ( ElementChangedEvent event ) { if ( fChangeListeners . isEmpty ( ) ) { return ; } if ( fHierarchyRefreshNeeded ) { return ; } else { ArrayList changedTypes = new ArrayList ( ) ; processDelta ( event . getDelta ( )
1,019
<s> package com . asakusafw . compiler . bulkloader . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . bulkloader . testing . model . Cached ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class CachedOutput implements ModelOutput < Cached > { private final RecordEmitter emitter ; public CachedOutput ( RecordEmitter emitter
1,020
<s> package com . asakusafw . dmdl . java . emitter ; import java . io . IOException ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . Set ; import org . apache . hadoop . io . Text ; import com . asakusafw . dmdl . java . Configuration ; import com . asakusafw . dmdl . java . util . JavaName ; import com . asakusafw . dmdl . java . util . NameUtil ; import com . asakusafw . dmdl . model . AstDescription ; import com . asakusafw . dmdl . model . AstName ; import com . asakusafw . dmdl . model . AstSimpleName ; import com . asakusafw . dmdl . model . BasicTypeKind ; import com . asakusafw . dmdl . semantics . Declaration ; import com . asakusafw . dmdl . semantics . DmdlSemantics ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . ModelSymbol ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . semantics . trait . NamespaceTrait ; import com . asakusafw . dmdl . semantics . type . BasicType ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . 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 ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . QualifiedName ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . Models ; public final class EmitContext { private final DmdlSemantics semantics ; private final Configuration config ; private final ModelFactory factory ; private final SimpleName typeName ; private final ImportBuilder imports ; private final Set < String > fieldNames ; public EmitContext ( DmdlSemantics semantics , Configuration config , ModelDeclaration model , String categoryName , String typeNamePattern ) { if ( semantics == null ) { throw new IllegalArgumentException ( "" ) ; } if ( config == null ) { throw new IllegalArgumentException ( "" ) ; } if ( model == null ) { throw new IllegalArgumentException ( "" ) ; } if ( categoryName == null ) { throw new IllegalArgumentException ( "" ) ; } this . semantics = semantics ; this . config = config ; this . factory = config . getFactory ( ) ; this . typeName = getTypeName ( model , typeNamePattern ) ; Name namespace = getNamespace ( model ) ; this . imports = new ImportBuilder ( factory , factory . newPackageDeclaration ( Models . append ( factory , config . getBasePackage ( ) , namespace , factory . newSimpleName ( categoryName ) ) ) , ImportBuilder . Strategy . TOP_LEVEL ) ; this . imports . resolvePackageMember ( this . typeName ) ; this . fieldNames = collectFieldNames ( model ) ; } private Set < String > collectFieldNames ( ModelDeclaration model ) { assert model != null ; Set < String > results = Sets . create ( ) ; for ( PropertyDeclaration property : model . getDeclaredProperties ( ) ) { results . add ( getFieldName ( property ) . getToken ( ) ) ; } return results ; } public ModelFactory getModelFactory ( ) { return factory ; } public DmdlSemantics getSemantics ( ) { return semantics ; } public Configuration getConfiguration ( ) { return config ; } private SimpleName getTypeName ( ModelDeclaration model , String namePattern ) { assert model != null ; assert namePattern != null ; return factory . newSimpleName ( MessageFormat . format ( namePattern , JavaName . of ( model . getName ( ) ) . toTypeName ( ) ) ) ; } private Name getNamespace ( ModelDeclaration model ) { assert model != null ; NamespaceTrait trait = model . getTrait ( NamespaceTrait . class ) ; AstName name ; if ( trait == null ) { name = new AstSimpleName ( null , NameConstants . DEFAULT_NAMESPACE ) ; } else { name = trait . getNamespace ( ) ; } return Models . toName ( factory , NameUtil . toPackageName ( name ) ) ; } public SimpleName getTypeName ( ) { return typeName ; } public QualifiedName getQualifiedTypeName ( ) { return factory . newQualifiedName ( imports . getPackageDeclaration ( ) . getName ( ) , typeName ) ; } public void emit ( TypeDeclaration type ) throws IOException { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } CompilationUnit compilationUnit = factory . newCompilationUnit ( imports . getPackageDeclaration ( ) , imports . toImportDeclarations ( ) , Collections . singletonList ( type ) , Collections . < Comment > emptyList ( ) ) ; PrintWriter writer = config . getOutput ( ) . openFor ( compilationUnit ) ; try { Models . emit ( compilationUnit , writer ) ; } finally { writer . close ( ) ; } } public Type resolve ( ModelSymbol model ) { if ( model == null ) { throw new IllegalArgumentException ( "" ) ; } ModelDeclaration decl = model . findDeclaration ( ) ; if ( decl == null ) { throw new IllegalArgumentException ( ) ; } Name qualifiedName = Models . append ( factory , config . getBasePackage
1,021
<s> package org . rubypeople . rdt . internal . ui . preferences ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . viewers . IFontProvider ; import org . eclipse . jface . viewers . ITableLabelProvider ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Font ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . preferences . IWorkbenchPreferenceContainer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . IStatusChangeListener ; 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 . ListDialogField ; import org . rubypeople . rdt . ui . PreferenceConstants ; public class KeywordConfigurationBlock extends OptionsConfigurationBlock { private static final Key PREF_COMPILER_TASK_TAGS = getRDTUIKey ( PreferenceConstants . EDITOR_USER_KEYWORDS ) ; private static final String ENABLED = RubyCore . ENABLED ; private static final String DISABLED = RubyCore . DISABLED ; public static class Keyword { public String name ; } private class KeywordLabelProvider extends LabelProvider implements ITableLabelProvider , IFontProvider { public KeywordLabelProvider ( ) { } public Image getImage ( Object element ) { return null ; } public String getText ( Object element ) { return getColumnText ( element , 0 ) ; } public Image getColumnImage ( Object element , int columnIndex ) { return null ; } public String getColumnText ( Object element , int columnIndex ) { Keyword task = ( Keyword ) element ; if ( columnIndex == 0 ) { return task . name ; } return "" ; } public Font getFont ( Object element ) { return null ; } } private static class TodoTaskSorter extends ViewerSorter { public int compare ( Viewer viewer , Object e1 , Object e2 ) { return collator . compare ( ( ( Keyword ) e1 ) . name , ( ( Keyword ) e2 ) . name ) ; } } private static final int IDX_ADD = 0 ; private static final int IDX_EDIT = 1 ; private static final int IDX_REMOVE = 2 ; private IStatus fTaskTagsStatus ; private ListDialogField fTodoTasksList ; public KeywordConfigurationBlock ( IStatusChangeListener context , IProject project , IWorkbenchPreferenceContainer container ) { super ( context , project , getKeys ( ) , container ) ; KeywordAdapter adapter = new KeywordAdapter ( ) ; String [ ] buttons = new String [ ] { PreferencesMessages . TodoTaskConfigurationBlock_markers_tasks_add_button , PreferencesMessages . TodoTaskConfigurationBlock_markers_tasks_edit_button , PreferencesMessages . TodoTaskConfigurationBlock_markers_tasks_remove_button } ; fTodoTasksList = new ListDialogField ( adapter , buttons , new KeywordLabelProvider ( ) ) ; fTodoTasksList . setDialogFieldListener ( adapter ) ; fTodoTasksList . setRemoveButtonIndex ( IDX_REMOVE ) ; String [ ] columnsHeaders = new String [ ] { PreferencesMessages . TodoTaskConfigurationBlock_markers_tasks_name_column } ; fTodoTasksList . setTableColumns ( new ListDialogField . ColumnsDescription ( columnsHeaders , true ) ) ; fTodoTasksList . setViewerSorter ( new TodoTaskSorter ( ) ) ; unpackTodoTasks ( ) ; if ( fTodoTasksList . getSize ( ) > 0 ) { fTodoTasksList . selectFirstElement ( ) ; } else { fTodoTasksList . enableButton ( IDX_EDIT , false ) ; } fTaskTagsStatus = new StatusInfo ( ) ; } public void setEnabled ( boolean isEnabled ) { fTodoTasksList . setEnabled ( isEnabled ) ; } private static Key [ ] getKeys ( ) { return new Key [ ] { PREF_COMPILER_TASK_TAGS } ; } public class KeywordAdapter implements IListAdapter , IDialogFieldListener { private boolean canEdit ( List selectedElements ) { return selectedElements . size ( ) == 1 ; } public void customButtonPressed ( ListDialogField field , int index ) { doTodoButtonPressed ( index ) ; } public void selectionChanged ( ListDialogField field ) { List selectedElements = field . getSelectedElements ( ) ; field . enableButton ( IDX_EDIT , canEdit ( selectedElements ) ) ; } public void doubleClicked ( ListDialogField field ) { if ( canEdit ( field . getSelectedElements ( ) ) ) { doTodoButtonPressed ( IDX_EDIT ) ; } } public void dialogFieldChanged ( DialogField field ) { updateModel ( field ) ; } } protected Control createContents ( Composite parent ) { setShell ( parent . getShell ( ) ) ; Composite markersComposite = createMarkersTabContent ( parent ) ; validateSettings ( null , null , null ) ; return markersComposite ; } private Composite createMarkersTabContent ( Composite folder ) { GridLayout layout = new GridLayout ( ) ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; layout
1,022
<s> package com . asakusafw . compiler . fileio . flow ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . vocabulary . external . FileExporterDescription ; public class Out3ExporterDesc extends FileExporterDescription { @ Override public Class < ? > getModelType ( ) {
1,023
<s> package org . rubypeople . rdt . refactoring . ui . pages . extractmethod ; import org . eclipse . swt . widgets . Table ; public class ParametersButtonUpListener extends ParametersButtonListener { public ParametersButtonUpListener ( Table table ) { super ( table ) ; } @ Override protected void buttonPressed ( MethodArgumentTableItem item , int position ) { if ( position < 1 ) { return ; } if ( item . isMoveable ( ) ) { table . remove ( position ) ; new MethodArgumentTableItem ( table , item . getItemName ( ) , true , item . getOriginalPosition ( ) , position -
1,024
<s> package org . oddjob . persist ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . arooa . registry . Path ; public class MockPersisterBase extends PersisterBase { @
1,025
<s> package de . fuberlin . wiwiss . d2rq . sql ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import d2rq . d2r_query ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . algebra . Join ; import de . fuberlin . wiwiss . d2rq . algebra . OrderSpec ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . algebra . RelationName ; import de . fuberlin . wiwiss . d2rq . expr . Conjunction ; import de . fuberlin . wiwiss . d2rq . expr . Equality ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; public class SelectStatementBuilder { private static final Log log = LogFactory . getLog ( d2r_query . class ) ; private ConnectedDB database ; private List < ProjectionSpec > selectSpecs = new ArrayList < ProjectionSpec > ( 10 ) ; private List < Expression > conditions = new ArrayList < Expression > ( ) ; private Expression cachedCondition = null ; private boolean eliminateDuplicates = false ; private AliasMap aliases = AliasMap . NO_ALIASES ; private Collection < RelationName > mentionedTables = new HashSet < RelationName > ( 5 ) ; private List < OrderSpec > orderSpecs ; private int limit ; public SelectStatementBuilder ( Relation relation ) { if ( relation . isTrivial ( ) ) { throw new IllegalArgumentException ( "" ) ; } if ( relation . equals ( Relation . EMPTY ) ) { throw new IllegalArgumentException ( "" ) ; } database = relation . database ( ) ; this . limit = Relation . combineLimits ( relation . limit ( ) , database . limit ( ) ) ; this . orderSpecs = relation . orderSpecs ( ) ; this . aliases = this . aliases . applyTo ( relation . aliases ( ) ) ; for ( Join join : relation . joinConditions ( ) ) { for ( Attribute attribute1 : join . attributes1 ( ) ) {
1,026
<s> package org . oddjob . designer . view ; import org . oddjob . arooa . design . screem . TextInput ; public class TextInputDummy implements DummyItemView { private TextInput textInput ;
1,027
<s> package og . android . tether ; import og . android . tether . data . ClientData ; import og . android . tether . system . BluetoothService ; import android . app . Service ; import android . app . Notification ; import android . bluetooth . BluetoothAdapter ; import android . net . Uri ; import android . net . wifi . WifiManager ; import android . content . Context ; import android . content . Intent ; import android . os . Binder ; import android . os . IBinder ; import android . os . Message ; import android . os . Build ; import android . util . Log ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . util . ArrayList ; import java . util . Date ; import java . util . Enumeration ; import java . util . Hashtable ; import com . google . analytics . tracking . android . EasyTracker ; public class TetherService extends Service { public static final String MSG_TAG = "" ; public static final int MANAGE_START = 1 ; public static final int MANAGE_STARTED = 5 ; public static final int MANAGE_STOP = 0 ; public static final int MANAGE_STOPPED = 6 ; public static final int STATE_STARTING = 3 ; public static final int STATE_RUNNING = 0 ; public static final int STATE_STOPPING = 4 ; public static final int STATE_IDLE = 11 ; public static final int STATE_RESTARTING = 9 ; public static final int STATE_FAIL_EXEC_START = 2 ; public static final int STATE_FAIL_EXEC_STOP = 7 ; public static final int STATE_FAIL_LOG = 1 ; public static final String INTENT_STATE = "" ; public static final String INTENT_MANAGE = "" ; public static final String INTENT_TRAFFIC = "" ; public static TetherService singleton = null ; private int serviceState = STATE_IDLE ; private TetherApplication application = null ; private final ServiceBinder serviceBinder ; private static final Class < ? > [ ] startForegroundSignature = new Class [ ] { int . class , Notification . class } ; private static final Class < ? > [ ] stopForegroundSignature = new Class [ ] { boolean . class } ; private Method startForeground ; private Object [ ] startForegroundArgs = new Object [ 2 ] ; private Method stopForeground ; private Object [ ] stopForegroundArgs = new Object [ 1 ] ; private WifiManager wifiManager = null ; BluetoothService bluetoothService = null ; private static boolean origWifiState = false ; private static boolean origBluetoothState = false ; private Thread clientConnectThread = null ; private Thread trafficCounterThread = null ; private Thread dnsUpdateThread = null ; public static DataCount dataCount = null ; private boolean configAdv = false ; private boolean offeredMeshclient = false ; public TetherService ( ) { this . serviceBinder = new ServiceBinder ( ) ; } public static TetherService getInstance ( ) { return TetherService . singleton ; } public int getState ( ) { return this . serviceState ; } @ Override public IBinder onBind ( Intent intent ) { return this . serviceBinder ; } class ServiceBinder extends Binder { public ServiceBinder ( ) { } TetherService getService ( ) { return TetherService . this ; } } @ Override public void onCreate ( ) { Log . d ( MSG_TAG , "onCreate()" ) ; super . onCreate ( ) ; TetherService . singleton = this ; this . application = ( TetherApplication ) getApplication ( ) ; this . configAdv = this . application . isConfigurationAdv ( ) ; this . wifiManager = ( WifiManager ) this . getSystemService ( Context . WIFI_SERVICE ) ; this . bluetoothService = BluetoothService . getInstance ( ) ; this . bluetoothService . setApplication ( this . application ) ; try { startForeground = getClass ( ) . getMethod ( "" , startForegroundSignature ) ; stopForeground = getClass ( ) . getMethod ( "" , stopForegroundSignature ) ; } catch ( NoSuchMethodException e ) { startForeground = stopForeground = null ; Log . d ( MSG_TAG , "" ) ; } if ( this . application . coretask . getProp ( "" ) . equals ( "running" ) ) { Log . d ( MSG_TAG , "" ) ; this . serviceState = STATE_RUNNING ; } sendBroadcastManage ( MANAGE_STARTED ) ; } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { Log . d ( MSG_TAG , "" + flags + ", startid: " + startId ) ; return START_STICKY ; } @ Override public void onDestroy ( ) { Log . d ( MSG_TAG , "onDestroy()" ) ; if ( this . serviceState == STATE_RUNNING ) stopTether ( ) ; TetherService . singleton = null ; super . onDestroy ( ) ; } private void sendBroadcastManage ( int state ) { Intent intent = new Intent ( INTENT_MANAGE ) ; intent . putExtra ( "state" , state ) ; Log . d ( MSG_TAG , "" + state ) ; sendBroadcast ( intent ) ; } private void sendBroadcastState ( int state ) { Intent intent = new Intent ( INTENT_STATE ) ; intent . putExtra ( "state" , state ) ; sendBroadcast ( intent ) ; } private void sendBroadcastTraffic ( long [ ] trafficCount ) { Intent intent = new Intent ( TetherService . INTENT_TRAFFIC ) ; intent . putExtra ( "" , trafficCount ) ; sendBroadcast ( intent ) ; } public void startTether ( ) { Log . d ( MSG_TAG , "" ) ; sendBroadcastState ( this . serviceState = STATE_STARTING
1,028
<s> package org . oddjob . state ; import junit . framework . TestCase ; public class IsContineableTest extends TestCase { public void testAllStates ( ) { IsContinueable test = new IsContinueable (
1,029
<s> package org . rubypeople . rdt . refactoring . ui . pages ; public class ConverterPageParameters { private boolean inCurrentMethodRadioEnabled = true ; private boolean inClassConstructorRadioEnabled = true ; private boolean deaclareAsClassFieldEnabled = true ; public ConverterPageParameters ( boolean inCurrentMethodRadioEnabled , boolean inClassConstructorRadioEnabled , boolean deaclareAsClassField ) { this . inCurrentMethodRadioEnabled = inCurrentMethodRadioEnabled ; this . inClassConstructorRadioEnabled = inClassConstructorRadioEnabled ; this . deaclareAsClassFieldEnabled = deaclareAsClassField ; } public ConverterPageParameters ( ) { } public boolean isDeaclareAsClassField ( ) { return deaclareAsClassFieldEnabled ; }
1,030
<s> package org . vaadin . teemu . clara . inflater ; @ SuppressWarnings ( "serial" ) public class ComponentInstantiationException extends RuntimeException { public ComponentInstantiationException ( ) { super ( ) ; } public ComponentInstantiationException ( String message ) { super ( message ) ; } public ComponentInstantiationException (
1,031
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . BasicType ; import com . asakusafw . utils . java . model . syntax . BasicTypeKind ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class BasicTypeImpl extends ModelRoot implements BasicType { private BasicTypeKind typeKind ; @ Override public BasicTypeKind getTypeKind ( ) { return this . typeKind ; } public void
1,032
<s> package net . sf . sveditor . ui . views . objects ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; public class SVObjectsViewerSorter extends ViewerSorter { @ Override public int compare
1,033
<s> package org . oddjob . jmx . client ; import java . util . LinkedList ; import javax . management . Notification ; import javax . management . NotificationListener ; public class Synchronizer implements NotificationListener { private final NotificationListener listener ; private LinkedList < Notification > pending = new LinkedList < Notification > ( ) ; public Synchronizer ( NotificationListener listener ) { this . listener = listener ; } public void handleNotification ( Notification notification , Object handback ) { synchronized ( this ) { if ( pending != null ) { pending . addLast ( notification ) ; return ; } }
1,034
<s> package edsdk ; import com . sun . jna . NativeLong ; import com . sun . jna . Structure ; public class EdsCapacity extends Structure { public NativeLong numberOfFreeClusters ; public NativeLong bytesPerSector ; public int reset ; public EdsCapacity ( ) { super ( ) ; initFieldOrder ( ) ; } protected void initFieldOrder ( ) { setFieldOrder ( new java . lang . String [ ] { "" , "" , "reset" }
1,035
<s> package com . asakusafw . yaess . paralleljob ; import java . io . IOException ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw .
1,036
<s> package com . asakusafw . vocabulary . flow . testing ; import com . asakusafw . vocabulary . flow . Out ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowElement ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . OutputDescription ; import com . asakusafw . vocabulary . flow . graph . PortConnection ; public class MockOut < T > implements Out < T > { private FlowElementResolver resolver ; public MockOut ( Class < T > type , String name ) { OutputDescription desc = new OutputDescription ( name , type ) ; resolver = new FlowElementResolver ( desc ) ; } public static < T >
1,037
<s> package journal . io . api ; import java . io . File ; import java . io . IOException ; import java . util . Iterator ; import java . util . NoSuchElementException ; import java . util . concurrent . * ; import java . util . concurrent . atomic . AtomicInteger ; import org . junit . After ; import org . junit . Before ; import org . junit . Test ; import static org . junit . Assert . * ; public class JournalTest { private Journal journal ; private File dir ; @ Before public void setUp ( ) throws Exception { dir = new File ( "" ) ; if ( dir . exists ( ) ) { deleteFilesInDirectory ( dir ) ; } else { dir . mkdirs ( ) ; } journal = new Journal ( ) ; journal . setDirectory ( dir ) ; configure ( journal ) ; journal . open ( ) ; } @ After public void tearDown ( ) throws Exception { journal . close ( ) ; deleteFilesInDirectory ( dir ) ; dir . delete ( ) ; } @ Test ( expected = IOException . class ) public void testAsyncSpeculativeReadWorksButSyncReadRaisesException ( ) throws Exception { Location data = journal . write ( new String ( "DATA" ) . getBytes ( "UTF-8" ) , Journal . WriteType . SYNC ) ; journal . delete ( data ) ; assertEquals ( "DATA" , journal . read ( data , Journal . ReadType . ASYNC ) ) ; journal . read ( data , Journal . ReadType . SYNC ) ; } @ Test public void testSyncLogWritingAndRedoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , Journal . WriteType . SYNC ) ; } int i = 0 ; for ( Location location : journal . redo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . ASYNC ) ; assertEquals ( "DATA" + i ++ , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testSyncLogWritingAndUndoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , Journal . WriteType . SYNC ) ; } int i = 10 ; for ( Location location : journal . undo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . ASYNC ) ; assertEquals ( "DATA" + -- i , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testAsyncLogWritingAndRedoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; } int i = 0 ; for ( Location location : journal . redo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . SYNC ) ; assertEquals ( "DATA" + i ++ , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testAsyncLogWritingAndUndoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; } int i = 10 ; for ( Location location : journal . undo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . ASYNC ) ; assertEquals ( "DATA" + -- i , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testMixedSyncAsyncLogWritingAndRedoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { Journal . WriteType sync = i % 2 == 0 ? Journal . WriteType . SYNC : Journal . WriteType . ASYNC ; journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , sync ) ; } int i = 0 ; for ( Location location : journal . redo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . ASYNC ) ; assertEquals ( "DATA" + i ++ , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testMixedSyncAsyncLogWritingAndUndoing ( ) throws Exception { int iterations = 10 ; for ( int i = 0 ; i < iterations ; i ++ ) { Journal . WriteType sync = i % 2 == 0 ? Journal . WriteType . SYNC : Journal . WriteType . ASYNC ; journal . write ( new String ( "DATA" + i ) . getBytes ( "UTF-8" ) , sync ) ; } int i = 10 ; for ( Location location : journal . undo ( ) ) { byte [ ] buffer = journal . read ( location , Journal . ReadType . ASYNC ) ; assertEquals ( "DATA" + -- i , new String ( buffer , "UTF-8" ) ) ; } } @ Test public void testRedoForwardOrder ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > redo = journal . redo ( ) . iterator ( ) ; assertTrue ( redo . hasNext ( ) ) ; assertEquals ( "A" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( redo . hasNext ( ) ) ; assertEquals ( "B" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( redo . hasNext ( ) ) ; assertEquals ( "C" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertFalse ( redo . hasNext ( ) ) ; } @ Test public void testRedoForwardOrderWithStartingLocation ( ) throws Exception { Location a = journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Location b = journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Location c = journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > redo = journal . redo ( b ) . iterator ( ) ; assertTrue ( redo . hasNext ( ) ) ; assertEquals ( "B" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( redo . hasNext ( ) ) ; assertEquals ( "C" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertFalse ( redo . hasNext ( ) ) ; } @ Test public void testRedoEmptyJournal ( ) throws Exception { int iterations = 0 ; for ( Location loc : journal . redo ( ) ) { iterations ++ ; } assertEquals ( 0 , iterations ) ; } @ Test public void testRedoLargeChunksOfData ( ) throws Exception { byte parts = 127 ; for ( byte i = 0 ; i < parts ; i ++ ) { journal . write ( new byte [ ] { i } , Journal . WriteType . ASYNC ) ; } parts = 0 ; for ( Location loc : journal . redo ( ) ) { assertArrayEquals ( new byte [ ] { parts ++ } , journal . read ( loc , Journal . ReadType . ASYNC ) ) ; } assertEquals ( 127 , parts ) ; } @ Test public void testRedoTakesNewWritesIntoAccount ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > redo = journal . redo ( ) . iterator ( ) ; journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; assertEquals ( "A" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertEquals ( "B" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertEquals ( "C" , new String ( journal . read ( redo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; } @ Test public void testRemoveThroughRedo ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > itr = journal . redo ( ) . iterator ( ) ; int iterations = 0 ; while ( itr . hasNext ( ) ) { itr . next ( ) ; itr . remove ( ) ; iterations ++ ; } assertEquals ( 3 , iterations ) ; iterations = 0 ; for ( Location loc : journal . redo ( ) ) { iterations ++ ; } assertEquals ( 0 , iterations ) ; } @ Test ( expected = NoSuchElementException . class ) public void testNoSuchElementExceptionWithRedoIterator ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > itr = journal . redo ( ) . iterator ( ) ; assertTrue ( itr . hasNext ( ) ) ; itr . next ( ) ; assertFalse ( itr . hasNext ( ) ) ; itr . next ( ) ; } @ Test ( expected = IllegalStateException . class ) public void testIllegalStateExceptionIfTheSameLocationIsRemovedThroughRedoMoreThanOnce ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > itr = journal . redo ( ) . iterator ( ) ; itr . next ( ) ; itr . remove ( ) ; itr . remove ( ) ; } @ Test ( expected = IllegalStateException . class ) public void testIllegalStateExceptionIfCallingRemoveBeforeNextWithRedo ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > itr = journal . redo ( ) . iterator ( ) ; itr . remove ( ) ; } @ Test public void testUndoBackwardOrder ( ) throws Exception { journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > undo = journal . undo ( ) . iterator ( ) ; assertTrue ( undo . hasNext ( ) ) ; assertEquals ( "C" , new String ( journal . read ( undo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( undo . hasNext ( ) ) ; assertEquals ( "B" , new String ( journal . read ( undo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( undo . hasNext ( ) ) ; assertEquals ( "A" , new String ( journal . read ( undo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertFalse ( undo . hasNext ( ) ) ; } @ Test public void testUndoBackwardOrderWithEndingLocation ( ) throws Exception { Location a = journal . write ( "A" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Location b = journal . write ( "B" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Location c = journal . write ( "C" . getBytes ( "UTF-8" ) , Journal . WriteType . ASYNC ) ; Iterator < Location > undo = journal . undo ( b ) . iterator ( ) ; assertTrue ( undo . hasNext ( ) ) ; assertEquals ( "C" , new String ( journal . read ( undo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertTrue ( undo . hasNext ( ) ) ; assertEquals ( "B" , new String ( journal . read ( undo . next ( ) , Journal . ReadType . ASYNC ) , "UTF-8" ) ) ; assertFalse ( undo . hasNext ( ) ) ; } @ Test public void testUndoEmptyJournal ( ) throws Exception { int iterations = 0 ; for ( Location loc : journal . undo ( ) ) { iterations ++ ; } assertEquals ( 0 , iterations ) ; } @ Test public void testUndoLargeChunksOfData ( ) throws Exception { byte parts = 127 ; for ( byte i = 0 ; i < parts ; i ++ ) { journal
1,038
<s> package org . springframework . samples . petclinic . aspects ; import org . aspectj . lang . JoinPoint ; import org . aspectj . lang . annotation . Aspect ; import org . aspectj . lang . annotation . Before ; import org . aspectj . lang . annotation . Pointcut ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; @ Aspect public abstract class AbstractTraceAspect { private static final Logger logger = LoggerFactory . getLogger ( AbstractTraceAspect . class ) ; @ Pointcut public abstract void traced ( ) ; @ Before ( "traced()" ) public void trace
1,039
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . dialogs . ProgressMonitorDialog ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . jface . viewers . IDoubleClickListener ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . util . CoreUtility ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; 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 . launching . RubyRuntime ; import com . aptana . rdt . launching . IGemRuntime ; public class VariableBlock { private ListDialogField fVariablesList ; private Control fControl ; private boolean fHasChanges ; private List fSelectedElements ; private boolean fAskToBuild ; private boolean fInPreferencePage ; public VariableBlock ( boolean inPreferencePage , String initSelection ) { fSelectedElements = new ArrayList ( 0 ) ; fInPreferencePage = inPreferencePage ; fAskToBuild = true ; String [ ] buttonLabels = new String [ ] { NewWizardMessages . VariableBlock_vars_add_button , NewWizardMessages . VariableBlock_vars_edit_button , NewWizardMessages . VariableBlock_vars_remove_button } ; VariablesAdapter adapter = new VariablesAdapter ( ) ; CPVariableElementLabelProvider labelProvider = new CPVariableElementLabelProvider ( ! inPreferencePage ) ; fVariablesList = new ListDialogField ( adapter , buttonLabels , labelProvider ) ; fVariablesList . setDialogFieldListener ( adapter ) ; fVariablesList . setLabelText ( NewWizardMessages . VariableBlock_vars_label ) ; fVariablesList . setRemoveButtonIndex ( 2 ) ; fVariablesList . enableButton ( 1 , 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 ) ; } } ) ; refresh ( initSelection ) ; } public boolean hasChanges ( ) { return fHasChanges ; } public void setChanges ( boolean hasChanges ) { fHasChanges = hasChanges ; } private String [ ] getReservedVariableNames ( ) { return new String [ ] { RubyRuntime . RUBYLIB_VARIABLE , IGemRuntime . GEMLIB_VARIABLE } ; } public Control createContents ( Composite parent ) { Composite composite = new Composite ( parent , SWT . NONE ) ; composite . setFont ( parent . getFont
1,040
<s> package com . lmax . disruptor . support ; import com . lmax . disruptor . BatchHandler ; public final class FunctionHandler implements BatchHandler < FunctionEntry > { private final FunctionStep functionStep ; private
1,041
<s> package com . asakusafw . testdriver . windgate ; import java . io . IOException ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . windgate . core . resource . SourceDriver ; public class WindGateSource < T > implements DataModelSource { private final SourceDriver < T > driver ; private final DataModelDefinition < T > definition ; public WindGateSource ( SourceDriver < T > driver , DataModelDefinition < T > definition ) { if ( driver == null ) { throw new IllegalArgumentException ( "" ) ; } if ( definition == null )
1,042
<s> package net . ggtools . grand . ui . graph . draw2d ; import net . ggtools . grand . ui . Application ; import org . eclipse . draw2d . AbstractBorder ; import org . eclipse . draw2d . ColorConstants ; import org . eclipse . draw2d . Figure ; import org . eclipse . draw2d . Graphics ; import org . eclipse . draw2d . IFigure ; import org . eclipse . draw2d . MarginBorder ; import org . eclipse . draw2d . ToolbarLayout ; import org . eclipse . draw2d . geometry . Insets ; import org . eclipse . draw2d . geometry . Rectangle ; import org . eclipse . draw2d . text . FlowPage ; abstract class AbstractGraphTooltip extends Figure { public class SectionBorder extends AbstractBorder { public Insets getInsets ( final IFigure figure ) { return new Insets ( 1 , 0 , 0 , 0 ) ; } public void paint ( final IFigure figure , final Graphics graphics , final Insets insets ) { final Rectangle paintRectangle = getPaintRectangle ( figure , insets ) ; graphics . drawLine ( paintRectangle . getTopLeft ( ) , paintRectangle . getTopRight ( ) ) ; } } static final int TOOLTIP_WIDTH = 400 ; public AbstractGraphTooltip ( ) { setForegroundColor ( ColorConstants . tooltipForeground ) ; setBackgroundColor ( ColorConstants . tooltipBackground ) ; setOpaque ( true
1,043
<s> package org . rubypeople . rdt . internal . debug . ui . launcher ; import org . eclipse . debug . ui . AbstractLaunchConfigurationTabGroup ; import org . eclipse . debug . ui . CommonTab ; import org . eclipse . debug . ui . ILaunchConfigurationDialog ; import org . eclipse . debug . ui . ILaunchConfigurationTab ; import org . eclipse . debug . ui . sourcelookup . SourceLookupTab ; import org . rubypeople . rdt . debug . ui . launchConfigurations . RubyConnectTab ; public class RemoteRubyApplicationTabGroup extends AbstractLaunchConfigurationTabGroup {
1,044
<s> package net . ggtools . grand . ui . event ; import java . lang . reflect . Method ;
1,045
<s> package org . rubypeople . rdt . internal . ui . filters ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; import org . rubypeople . rdt . core . IImportContainer ; import org . rubypeople . rdt . core . IImportDeclaration ; public class ImportDeclarationFilter
1,046
<s> package com . asakusafw . compiler . testing . flow ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . Update ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; @ JobFlow ( name = "job" ) public class IndependentOutputJob extends FlowDescription { private final In < Ex1 > input ; private final Out < Ex1 > output ; private final Out < Ex1 > independent ; public IndependentOutputJob ( @ Import ( name = "input" , description = Ex1MockImporterDescription . class ) In < Ex1 > input , @ Export ( name = "output" , description = Out1ExporterDesc . class ) Out < Ex1 > output , @ Export ( name = "independent" , description = IndependentOutExporterDesc . class ) Out < Ex1 > independent ) { this . input
1,047
<s> package org . rubypeople . rdt . internal . corext . util ; import java . io . File ; import java . net . URI ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . core . filesystem . EFS ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceStatus ; import org . eclipse . core . resources . ResourceAttributes ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . MultiStatus ; import org . eclipse . core . runtime . Status ; import org . rubypeople . rdt . internal . corext . CorextMessages ; import org . rubypeople . rdt . internal . ui . IRubyStatusConstants ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyUIStatus ; public class Resources { private Resources ( ) { } public static IStatus checkInSync ( IResource resource ) { return checkInSync ( new IResource [ ] { resource } ) ; } public static IStatus checkInSync ( IResource [ ] resources ) { IStatus result = null ; for ( int i = 0 ; i < resources . length ; i ++ ) { IResource resource = resources [ i ] ; if ( ! resource . isSynchronized ( IResource . DEPTH_INFINITE ) ) { result = addOutOfSync ( result , resource ) ; } } if ( result != null ) return result ; return new Status ( IStatus . OK , RubyPlugin . getPluginId ( ) , IStatus . OK , "" , null ) ; } public static IStatus makeCommittable ( IResource resource , Object context ) { return makeCommittable ( new IResource [ ] { resource } , context ) ; } public static IStatus makeCommittable ( IResource [ ] resources , Object context ) { List readOnlyFiles = new ArrayList ( ) ; for ( int i = 0 ; i < resources . length ; i ++ ) { IResource resource = resources [ i ] ; if ( resource . getType ( ) == IResource . FILE && isReadOnly ( resource ) ) readOnlyFiles . add ( resource ) ; } if ( readOnlyFiles . size ( ) == 0 ) return new Status ( IStatus . OK , RubyPlugin . getPluginId ( ) , IStatus . OK , "" , null ) ; Map oldTimeStamps = createModificationStampMap ( readOnlyFiles ) ; IStatus status = ResourcesPlugin . getWorkspace ( ) . validateEdit ( ( IFile [ ] ) readOnlyFiles . toArray ( new IFile [ readOnlyFiles . size ( ) ] ) , context ) ; if ( ! status . isOK ( ) ) return status ; IStatus modified = null ; Map newTimeStamps = createModificationStampMap ( readOnlyFiles ) ; for ( Iterator iter = oldTimeStamps . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { IFile file = ( IFile ) iter . next ( ) ; if ( ! oldTimeStamps . get ( file ) . equals ( newTimeStamps . get ( file ) ) ) modified = addModified ( modified , file ) ; } if ( modified != null ) return modified ; return new Status ( IStatus . OK , RubyPlugin . getPluginId ( ) , IStatus . OK , "" , null ) ; } private static Map createModificationStampMap ( List files ) { Map map = new HashMap ( ) ; for ( Iterator iter = files . iterator ( ) ; iter . hasNext ( ) ; ) { IFile file = ( IFile ) iter . next ( ) ; map . put ( file , new Long ( file
1,048
<s> package com . mcbans . firestar . mcbans . pluginInterface ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . request . JsonHandler ; import java . util . HashMap ; public class Disconnect implements Runnable { private BukkitInterface MCBans ; private String PlayerName ; public Disconnect ( BukkitInterface p , String Player ) { MCBans = p ; PlayerName = Player ; } @ Override public void run ( ) { while ( MCBans . notSelectedServer ) { try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } MCBans . log ( PlayerName + "" ) ; JsonHandler webhandle = new JsonHandler ( MCBans ) ; HashMap < String
1,049
<s> package com . asakusafw . testdriver . testing . jobflow ; import com . asakusafw . compiler . testing . TemporaryOutputDescription ;
1,050
<s> package org . rubypeople . rdt . refactoring . action ; import org . rubypeople . rdt . refactoring . core . encapsulatefield . EncapsulateFieldRefactoring ; public class EncapsulateFieldAction extends WorkbenchWindowActionDelegate
1,051
<s> package org . rubypeople . rdt . refactoring . core . generateaccessors ; import org . rubypeople . rdt .
1,052
<s> package com . asakusafw . testdriver . testing . io ; import java . io . IOException ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; import com . asakusafw . testdriver . testing . model . Projection ; public final class ProjectionOutput implements ModelOutput < Projection > { private final RecordEmitter emitter ; public ProjectionOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException
1,053
<s> package net . sf . sveditor . core . db . index ; import java . io . InputStream ; import java . util . List ; public interface ISVDBFileSystemProvider { String MARKER_TYPE_ERROR = "ERROR" ; String MARKER_TYPE_WARNING = "WARNING" ;
1,054
<s> package org . rubypeople . rdt . internal . core . buffer ; import java . text . NumberFormat ; import java . util . Enumeration ; import java . util . Iterator ; public abstract class OverflowingLRUCache extends LRUCache { protected int fOverflow = 0 ; protected boolean fTimestampsOn = true ; protected double fLoadFactor = 0.333 ; public OverflowingLRUCache ( int size ) { this ( size , 0 ) ; } public OverflowingLRUCache ( int size , int overflow ) { super ( size ) ; fOverflow = overflow ; } public Object clone ( ) { OverflowingLRUCache newCache = ( OverflowingLRUCache ) newInstance ( fSpaceLimit , fOverflow ) ; LRUCacheEntry qEntry ; qEntry = this . fEntryQueueTail ; while ( qEntry != null ) { newCache . privateAdd ( qEntry . _fKey , qEntry . _fValue , qEntry . _fSpace ) ; qEntry = qEntry . _fPrevious ; } return newCache ; } protected abstract boolean close ( LRUCacheEntry entry ) ; public Enumeration elements ( ) { if ( fEntryQueue == null ) return new LRUCacheEnumerator ( null ) ; LRUCacheEnumerator . LRUEnumeratorElement head = new LRUCacheEnumerator . LRUEnumeratorElement ( fEntryQueue . _fValue ) ; LRUCacheEntry currentEntry = fEntryQueue . _fNext ; LRUCacheEnumerator . LRUEnumeratorElement currentElement = head ; while ( currentEntry != null ) { currentElement . fNext = new LRUCacheEnumerator . LRUEnumeratorElement ( currentEntry . _fValue ) ; currentElement = currentElement . fNext ; currentEntry = currentEntry . _fNext ; } return new LRUCacheEnumerator ( head ) ; } public double fillingRatio ( ) { return ( fCurrentSpace + fOverflow ) * 100.0 / fSpaceLimit ; } public java . util . Hashtable getEntryTable ( ) { return fEntryTable ; } public double getLoadFactor ( ) { return fLoadFactor ; } public int getOverflow ( ) { return fOverflow ; } protected boolean makeSpace ( int space ) { int limit = fSpaceLimit ; if ( fOverflow == 0 ) { if ( fCurrentSpace + space <= limit ) { return true ; } } int spaceNeeded = ( int ) ( ( 1 - fLoadFactor ) * fSpaceLimit ) ; spaceNeeded = ( spaceNeeded > space ) ? spaceNeeded : space ; LRUCacheEntry entry = fEntryQueueTail ; try { fTimestampsOn = false ; while ( fCurrentSpace + spaceNeeded > limit && entry != null ) { this . privateRemoveEntry ( entry , false , false ) ; entry = entry . _fPrevious ; } } finally { fTimestampsOn = true ; } if ( fCurrentSpace + space <= limit ) { fOverflow = 0 ; return true ; } fOverflow = fCurrentSpace + space - limit ; return false ; } protected abstract LRUCache newInstance ( int size , int overflow ) ; public Object peek ( Object key ) { LRUCacheEntry entry = ( LRUCacheEntry ) fEntryTable . get ( key ) ; if ( entry == null ) { return null ; } return entry . _fValue ; } public void printStats ( ) { int forwardListLength = 0 ; LRUCacheEntry entry = fEntryQueue ; while ( entry != null ) { forwardListLength ++ ; entry = entry . _fNext ; } System . out . println ( "" + forwardListLength ) ; int backwardListLength = 0 ; entry = fEntryQueueTail ; while ( entry
1,055
<s> package de . fuberlin . wiwiss . d2rq . sql . types ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Types ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import de . fuberlin . wiwiss . d2rq . sql . vendor . Vendor ; public abstract class DataType { public final static Log log = LogFactory . getLog ( DataType . class ) ; public enum GenericType { CHARACTER ( Types . VARCHAR , "VARCHAR" ) , BINARY ( Types . VARBINARY , "VARBINARY" ) , NUMERIC ( Types . NUMERIC , "NUMERIC" ) , BOOLEAN ( Types . BOOLEAN , "BOOLEAN" ) , DATE ( Types . DATE , "DATE" ) , TIME ( Types . TIME , "TIME" ) , TIMESTAMP ( Types . TIMESTAMP , "TIMESTAMP" ) , INTERVAL ( Types . VARCHAR , "INTERVAL" ) , BIT ( Types . BIT , "BIT" ) ; private final int jdbcType ; private final
1,056
<s> package net . sf . sveditor . core . db . persistence ; import java . io . DataOutput ; import java . util . Collection ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBItemType ; @ SuppressWarnings ( "rawtypes" ) public interface IDBWriter { void init ( DataOutput out ) ; void setDebugEn ( boolean en ) ; void close ( ) ; void writeInt ( int val ) throws DBWriteException ; void writeLong ( long val ) throws
1,057
<s> package net . sf . sveditor . core . db . project ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import java . util . WeakHashMap ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . index . plugin_lib . SVDBPluginLibDescriptor ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . IResourceDelta ; import org . eclipse . core . resources . IResourceDeltaVisitor ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; public class SVDBProjectManager implements IResourceChangeListener { private WeakHashMap < IPath , SVDBProjectData > fProjectMap ; private List < ISVDBProjectSettingsListener > fListeners ; public SVDBProjectManager ( ) { fProjectMap = new WeakHashMap < IPath , SVDBProjectData > ( ) ; fListeners = new ArrayList < ISVDBProjectSettingsListener > ( ) ; ResourcesPlugin . getWorkspace ( ) . addResourceChangeListener ( this ) ; } public void init ( ) { fProjectMap . clear ( ) ; } public void addProjectSettingsListener ( ISVDBProjectSettingsListener l ) { synchronized ( fListeners ) { fListeners . add ( l ) ; } } public void removeProjectSettingsListener ( ISVDBProjectSettingsListener l ) { synchronized ( fListeners ) { fListeners . remove ( l ) ; } } void projectSettingsChanged ( SVDBProjectData data ) { synchronized ( fListeners ) { for ( int i = 0 ; i < fListeners . size ( ) ; i ++ ) { fListeners . get ( i ) . projectSettingsChanged ( data ) ; } } } public List < SVDBProjectData > getProjectList ( ) { List < SVDBProjectData > ret = new ArrayList < SVDBProjectData > ( ) ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; for ( IProject p : root . getProjects ( ) ) { if ( p . isOpen ( ) && p . getFile ( ".svproject" ) . exists ( ) ) { SVDBProjectData pd = getProjectData ( p ) ; if ( pd != null ) {
1,058
<s> package org . rubypeople . rdt . refactoring . tests . core . mergeclasspartsinfile . conditionchecks ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . InFileClassPartsMerger ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . MergeClassPartInFileConfig ; import org . rubypeople . rdt . refactoring . core .
1,059
<s> package br . com . caelum . vraptor . dash . hibernate . stats ; import br . com . caelum . vraptor . InterceptionException ; import br . com . caelum . vraptor . core . InterceptorStack ; import br . com . caelum . vraptor . interceptor . Interceptor ; import br . com . caelum . vraptor . ioc
1,060
<s> package org . oddjob . designer . elements . schedule ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . schedules . schedules . YearlySchedule ; import org . oddjob . schedules . units . Month ; public class YearlyScheduleDETest extends TestCase { private static final Logger logger = Logger . getLogger ( YearlyScheduleDETest . class ) ; public void setUp ( ) {
1,061
<s> package org . rubypeople . rdt . internal . ui . packageview ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . ui . ISharedImages ; import org . eclipse . ui . ide . IDE ; import org . eclipse . ui . model . IWorkbenchAdapter ; import org . rubypeople . rdt . core . ILoadpathContainer ; 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 . LoadpathContainerInitializer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; public class LoadPathContainer implements IAdaptable , IWorkbenchAdapter { private IRubyProject fProject ; private ILoadpathEntry fClassPathEntry ; private ILoadpathContainer fContainer ; public static class RequiredProjectWrapper implements IAdaptable , IWorkbenchAdapter { private final IRubyElement fProject ; private static ImageDescriptor DESC_OBJ_PROJECT ; { ISharedImages images = RubyPlugin . getDefault ( ) . getWorkbench ( ) . getSharedImages ( ) ; DESC_OBJ_PROJECT = images . getImageDescriptor ( IDE . SharedImages . IMG_OBJ_PROJECT ) ; } public RequiredProjectWrapper ( IRubyElement project ) { this . fProject = project ; } public IRubyElement getProject (
1,062
<s> package org . rubypeople . rdt . refactoring . action ; import org . rubypeople . rdt . internal . refactoring . RefactoringMessages ; import org . rubypeople . rdt . refactoring . core . extractconstant . ExtractConstantRefactoring ; public class ExtractConstantAction extends WorkbenchWindowActionDelegate { @ Override public void run ( )
1,063
<s> package com . asakusafw . compiler . flow . join . processor ; import java . lang . reflect . Method ; import java . util . List ; import com . asakusafw . compiler . common . EnumUtil ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . flow . LineEndProcessor ; import com . asakusafw . compiler . flow . join . JoinResourceDescription ; import com . asakusafw . compiler . flow . join . operator . SideDataBranch ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Tuple2 ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; import com . asakusafw . vocabulary . flow . graph . FlowResourceDescription ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; @ TargetOperator ( SideDataBranch . class )
1,064
<s> package net . sf . sveditor . core . parser ; import net . sf . sveditor . core . db . IFieldItemAttr ; import net . sf . sveditor . core . db . ISVDBAddChildItem ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBLocation ; import net . sf . sveditor . core . db . SVDBTypeInfoClassType ; public class SVClassDeclParser extends SVParserBase { public SVClassDeclParser ( ISVParser parser ) { super ( parser ) ; } public void parse ( ISVDBAddChildItem parent , int qualifiers ) throws SVParseException { SVDBClassDecl cls = null ; SVDBTypeInfoClassType cls_type ; String cls_type_name = null ; if ( fDebugEn ) { debug ( "" ) ; } SVDBLocation start_loc = fLexer . getStartLocation ( ) ; fLexer . readKeyword ( "class" ) ; if ( fLexer . peekKeyword ( "automatic" , "static" ) ) { fLexer . eatToken ( ) ; } cls_type_name = parsers ( ) . SVParser ( ) . scopedIdentifier ( ( ( qualifiers & IFieldItemAttr . FieldAttr_SvBuiltin ) != 0 ) ) ; cls = new SVDBClassDecl ( cls_type_name ) ; cls . setLocation ( start_loc ) ; cls_type = new SVDBTypeInfoClassType ( cls_type_name ) ; cls . setClassType ( cls_type ) ; if ( fLexer . peekOperator ( "#" ) ) { cls . addParameters ( parsers ( ) . paramPortListParser (
1,065
<s> package net . sf . sveditor . ui ; import net . sf . sveditor . ui . wizards . NewSVClassWizard ; import net . sf . sveditor . ui . wizards . NewSVInterfaceWizard ; import net . sf . sveditor . ui . wizards . NewSVModuleWizard ; import net . sf . sveditor . ui . wizards . NewSVPackageWizard ; import net . sf . sveditor . ui . wizards . templates . SVTemplateWizard ; import org . eclipse . ui . IFolderLayout ; import org . eclipse . ui . IPageLayout ; import org . eclipse . ui . IPerspectiveFactory ; import org . eclipse . ui . navigator . resources . ProjectExplorer ; import org .
1,066
<s> package org . oddjob ; import javax . swing . ImageIcon ; import org . oddjob . images . IconListener ; public interface Iconic {
1,067
<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 . Target ; @ Target ( { ElementType . PARAMETER } ) @ Retention ( RetentionPolicy
1,068
<s> package com . asakusafw . yaess . jsch ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import org . junit . Assume ; import org . junit . Before ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionPhase ; import com . asakusafw . yaess . core . VariableResolver ; import com . jcraft . jsch . JSchException ; public class JschProcessExecutorTest { @ Rule public final TemporaryFolder folder = new TemporaryFolder ( ) ; private File privateKey ; @ Before public void setUp ( ) throws Exception { File home = new File ( System . getProperty ( "user.home" ) ) ; privateKey = new File ( home , ".ssh/id_dsa" ) . getCanonicalFile ( ) ; if ( privateKey . isFile ( ) == false ) { System . err . printf ( "" , privateKey ) ; Assume . assumeTrue ( false ) ; } if ( new File ( "/bin/sh" ) . canExecute ( ) == false ) { System . err . printf ( "" , "/bin/sh" ) ; Assume . assumeTrue ( false ) ; } } @ Test public void extract ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "tester" ) ; config . put ( JschProcessExecutor . KEY_HOST , "example.com" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , privateKey . getAbsolutePath ( ) ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor extracted = JschProcessExecutor . extract ( "testing" , config , resolver ) ; assertThat ( extracted . getUser ( ) , is ( "tester" ) ) ; assertThat ( extracted . getHost ( ) , is ( "example.com" ) ) ; assertThat ( extracted . getPort ( ) , is ( nullValue ( ) ) ) ; assertThat ( extracted . getPrivateKey ( ) , is ( privateKey . getAbsolutePath ( ) ) ) ; assertThat ( extracted . getPassPhrase ( ) , is ( nullValue ( ) ) ) ; } @ Test public void extract_with_port ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "tester" ) ; config . put ( JschProcessExecutor . KEY_HOST , "example.com" ) ; config . put ( JschProcessExecutor . KEY_PORT , "10022" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , privateKey . getAbsolutePath ( ) ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor extracted = JschProcessExecutor . extract ( "testing" , config , resolver ) ; assertThat ( extracted . getUser ( ) , is ( "tester" ) ) ; assertThat ( extracted . getHost ( ) , is ( "example.com" ) ) ; assertThat ( extracted . getPort ( ) , is ( 10022 ) ) ; assertThat ( extracted . getPrivateKey ( ) , is ( privateKey . getAbsolutePath ( ) ) ) ; assertThat ( extracted . getPassPhrase ( ) , is ( nullValue ( ) ) ) ; } @ Test public void extract_with_passphrase ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "tester" ) ; config . put ( JschProcessExecutor . KEY_HOST , "example.com" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , privateKey . getAbsolutePath ( ) ) ; config . put ( JschProcessExecutor . KEY_PASS_PHRASE , "" ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor extracted = JschProcessExecutor . extract ( "testing" , config , resolver ) ; assertThat ( extracted . getUser ( ) , is ( "tester" ) ) ; assertThat ( extracted . getHost ( ) , is ( "example.com" ) ) ; assertThat ( extracted . getPort ( ) , is ( nullValue ( ) ) ) ; assertThat ( extracted . getPrivateKey ( ) , is ( privateKey . getAbsolutePath ( ) ) ) ; assertThat ( extracted . getPassPhrase ( ) , is ( "" ) ) ; } @ Test public void extract_variables ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "${user}" ) ; config . put ( JschProcessExecutor . KEY_HOST , "${host}" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , "${id}" ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; variables . put ( "user" , "variable" ) ; variables . put ( "host" , "" ) ; variables . put ( "id" , privateKey . getAbsolutePath ( ) ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor extracted = JschProcessExecutor . extract ( "testing" , config , resolver ) ; assertThat ( extracted . getUser ( ) , is ( "variable" ) ) ; assertThat ( extracted . getHost ( ) , is ( "" ) ) ; assertThat ( extracted . getPrivateKey ( ) , is ( privateKey . getAbsolutePath ( ) ) ) ; } @ Test ( expected = IllegalArgumentException . class ) public void extract_without_user ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_HOST , "example.com" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , privateKey . getAbsolutePath ( ) ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor . extract ( "testing" , config , resolver ) ; } @ Test ( expected = IllegalArgumentException . class ) public void extract_without_host ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "tester" ) ; config . put ( JschProcessExecutor . KEY_PRIVATE_KEY , privateKey . getAbsolutePath ( ) ) ; Map < String , String > variables = new HashMap < String , String > ( ) ; VariableResolver resolver = new VariableResolver ( variables ) ; JschProcessExecutor . extract ( "testing" , config , resolver ) ; } @ Test ( expected = IllegalArgumentException . class ) public void extract_without_id ( ) throws Exception { Map < String , String > config = new HashMap < String , String > ( ) ; config . put ( JschProcessExecutor . KEY_USER , "tester"
1,069
<s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . widgets . Display ; import org . rubypeople . rdt . core . IMember ; 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 . core . RubyModelException ; import org . rubypeople
1,070
<s> package com . asakusafw . dmdl . thundergate . model ; import java . text . MessageFormat ; public class ModelProperty { private String name ; private Source from ; private Source joined ; public ModelProperty ( String name , Source from ) { this . name = name ; this . from = from ; } public ModelProperty ( String name , Source from , Source joined ) { this . name = name ; if ( from == null && joined == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , name ) ) ; } this . from = from ; this . joined = joined ; } public String getName ( ) { return name ; } public PropertyType getType ( ) { Source source = getSource ( ) ; return source . getAggregator ( ) . inferType ( source . getType ( ) ) ; } public Source getSource ( ) { if ( from != null ) { return from ; } assert joined != null ; return joined ; } public Source getFrom ( ) { return from ; } public Source getJoined ( ) { return joined ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( from == null ) ? 0 : from . hashCode ( ) ) ; result = prime * result + ( ( joined == null ) ? 0 : joined . hashCode ( ) ) ; result = prime * result + ( ( name == null ) ? 0 : name . hashCode ( ) ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } ModelProperty other = ( ModelProperty ) obj ; if ( name . equals ( other . name ) == false ) { return false ; } if ( from == null ) { if ( other . from != null ) { return false ; } } else if ( from . equals ( other .
1,071
<s> package org . rubypeople . rdt . internal . ui . packageview ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . ui . IWorkingSet ; import org . rubypeople . rdt . internal . ui . viewsupport . TreeHierarchyLayoutProblemsDecorator ; import org . rubypeople . rdt . ui . RubyElementImageDescriptor ; public class PackageExplorerProblemsDecorator extends TreeHierarchyLayoutProblemsDecorator { public PackageExplorerProblemsDecorator ( ) { super ( ) ; } public PackageExplorerProblemsDecorator ( boolean isFlatLayout ) { super ( isFlatLayout ) ; } protected
1,072
<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 . EnumConstantDeclaration ; import com . asakusafw . utils . java . model . syntax . EnumDeclaration ; 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 . Visitor ; public final class EnumDeclarationImpl extends ModelRoot implements EnumDeclaration { private Javadoc javadoc ; private List < ? extends Attribute > modifiers ; private SimpleName name ; private List < ? extends Type > superInterfaceTypes ; private List < ? extends EnumConstantDeclaration > constantDeclarations ; 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 Type > getSuperInterfaceTypes ( ) { return this . superInterfaceTypes ; } public void setSuperInterfaceTypes ( List < ? extends Type > superInterfaceTypes ) { Util . notNull ( superInterfaceTypes , "" ) ; Util . notContainNull ( superInterfaceTypes , "" ) ; this . superInterfaceTypes = Util . freeze ( superInterfaceTypes ) ; } @ Override public List < ? extends EnumConstantDeclaration
1,073
<s> package journal . io . api ; import java . io . File ; import org . junit . Before ; import org . junit . Test ; import static org . junit . Assert . * ; public class ApiTest { private static File JOURNAL_DIR ; @ Test public void api ( ) throws Exception { Journal journal = new Journal ( ) ; journal . setDirectory ( JOURNAL_DIR ) ; journal . setArchiveFiles ( false ) ; journal . setChecksum ( true ) ; journal . setMaxFileLength ( 1024 * 1024 ) ; journal . setMaxWriteBatchSize ( 1024 * 10 ) ; journal . open ( ) ; int iterations = 1000 ; for ( int i = 0 ; i < iterations ; i ++ ) { Journal . WriteType writeType = i % 2 == 0 ? Journal . WriteType
1,074
<s> package com . asakusafw . utils . java . model . syntax ; import java . util . List ; public interface ModelFactory { AlternateConstructorInvocation newAlternateConstructorInvocation ( Expression ... arguments ) ; AlternateConstructorInvocation newAlternateConstructorInvocation ( List < ? extends Expression > arguments ) ; AlternateConstructorInvocation newAlternateConstructorInvocation ( List < ? extends Type > typeArguments , List < ? extends Expression > arguments ) ; AnnotationDeclaration newAnnotationDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; AnnotationElement newAnnotationElement ( SimpleName name , Expression expression ) ; AnnotationElementDeclaration newAnnotationElementDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , Type type , SimpleName name , Expression defaultExpression ) ; ArrayAccessExpression newArrayAccessExpression ( Expression array , Expression index ) ; ArrayCreationExpression newArrayCreationExpression ( ArrayType type , ArrayInitializer arrayInitializer ) ; ArrayCreationExpression newArrayCreationExpression ( ArrayType type , List < ? extends Expression > dimensionExpressions , ArrayInitializer arrayInitializer ) ; ArrayInitializer newArrayInitializer ( Expression ... elements ) ; ArrayInitializer newArrayInitializer ( List < ? extends Expression > elements ) ; ArrayType newArrayType ( Type componentType ) ; AssertStatement newAssertStatement ( Expression expression ) ; AssertStatement newAssertStatement ( Expression expression , Expression message ) ; AssignmentExpression newAssignmentExpression ( Expression leftHandSide , Expression rightHandSide ) ; AssignmentExpression newAssignmentExpression ( Expression leftHandSide , InfixOperator operator , Expression rightHandSide ) ; BasicType newBasicType ( BasicTypeKind typeKind ) ; Block newBlock ( Statement ... statements ) ; Block newBlock ( List < ? extends Statement > statements ) ; BlockComment newBlockComment ( String string ) ; BreakStatement newBreakStatement ( ) ; BreakStatement newBreakStatement ( SimpleName target ) ; CastExpression newCastExpression ( Type type , Expression expression ) ; CatchClause newCatchClause ( FormalParameterDeclaration parameter , Block body ) ; ClassBody newClassBody ( List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; ClassDeclaration newClassDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , Type superClass , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; ClassDeclaration newClassDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeParameterDeclaration > typeParameters , Type superClass , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; ClassInstanceCreationExpression newClassInstanceCreationExpression ( Type type , Expression ... arguments ) ; ClassInstanceCreationExpression newClassInstanceCreationExpression ( Type type , List < ? extends Expression > arguments ) ; ClassInstanceCreationExpression newClassInstanceCreationExpression ( Expression qualifier , List < ? extends Type > typeArguments , Type type , List < ? extends Expression > arguments , ClassBody body ) ; ClassLiteral newClassLiteral ( Type type ) ; CompilationUnit newCompilationUnit ( PackageDeclaration packageDeclaration , List < ? extends ImportDeclaration > importDeclarations , List < ? extends TypeDeclaration > typeDeclarations , List < ? extends Comment > comments ) ; ConditionalExpression newConditionalExpression ( Expression condition , Expression thenExpression , Expression elseExpression ) ; ConstructorDeclaration newConstructorDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends FormalParameterDeclaration > formalParameters , List < ? extends Statement > statements ) ; ConstructorDeclaration newConstructorDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , List < ? extends TypeParameterDeclaration > typeParameters , SimpleName name , List < ? extends FormalParameterDeclaration > formalParameters , List < ? extends Type > exceptionTypes , Block body ) ; ContinueStatement newContinueStatement ( ) ; ContinueStatement newContinueStatement ( SimpleName target ) ; DoStatement newDoStatement ( Statement body , Expression condition ) ; DocBlock newDocBlock ( String tag , List < ? extends DocElement > elements ) ; DocField newDocField ( Type type , SimpleName name ) ; DocMethod newDocMethod ( Type type , SimpleName name , List < ? extends DocMethodParameter > formalParameters ) ; DocMethodParameter newDocMethodParameter ( Type type , SimpleName name , boolean variableArity ) ; DocText newDocText ( String string ) ; EmptyStatement newEmptyStatement ( ) ; EnhancedForStatement newEnhancedForStatement ( FormalParameterDeclaration parameter , Expression expression , Statement body ) ; EnumConstantDeclaration newEnumConstantDeclaration ( Javadoc javadoc , SimpleName name , Expression ... arguments ) ; EnumConstantDeclaration newEnumConstantDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends Expression > arguments , ClassBody body ) ; EnumDeclaration newEnumDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends EnumConstantDeclaration > constantDeclarations , TypeBodyDeclaration ... bodyDeclarations ) ; EnumDeclaration newEnumDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends Type > superInterfaceTypes , List < ? extends EnumConstantDeclaration > constantDeclarations , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; ExpressionStatement newExpressionStatement ( Expression expression ) ; FieldAccessExpression newFieldAccessExpression ( Expression qualifier , SimpleName name ) ; FieldDeclaration newFieldDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , Type type , SimpleName name , Expression initializer ) ; FieldDeclaration newFieldDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , Type type , List < ? extends VariableDeclarator > variableDeclarators ) ; ForStatement newForStatement ( ForInitializer initialization , Expression condition , StatementExpressionList update , Statement body ) ; FormalParameterDeclaration newFormalParameterDeclaration ( Type type , SimpleName name ) ; FormalParameterDeclaration newFormalParameterDeclaration ( List < ? extends Attribute > modifiers , Type type , boolean variableArity , SimpleName name , int extraDimensions ) ; IfStatement newIfStatement ( Expression condition , Statement thenStatement ) ; IfStatement newIfStatement ( Expression condition , Statement thenStatement , Statement elseStatement ) ; ImportDeclaration newImportDeclaration ( ImportKind importKind , Name name ) ; InfixExpression newInfixExpression ( Expression leftOperand , InfixOperator operator , Expression rightOperand ) ; InitializerDeclaration newInitializerDeclaration ( List < ? extends Statement > body ) ; InitializerDeclaration newInitializerDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , Block body ) ; InstanceofExpression newInstanceofExpression ( Expression expression , Type type ) ; InterfaceDeclaration newInterfaceDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; InterfaceDeclaration newInterfaceDeclaration ( Javadoc javadoc , List < ? extends Attribute > modifiers , SimpleName name , List < ? extends TypeParameterDeclaration > typeParameters , List < ? extends Type > superInterfaceTypes , List < ? extends TypeBodyDeclaration > bodyDeclarations ) ; Javadoc newJavadoc ( List < ? extends DocBlock >
1,075
<s> package com . asakusafw . thundergate . runtime . cache ; import java . text . MessageFormat ; import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Calendar ; import java . util . Collection ; import java . util . Collections ; import java . util . Date ; import java . util . Iterator ; import java . util . Properties ; import java . util . Set ; import java . util . TreeSet ; public class CacheInfo { private static final String COLUMN_SEPARATOR = "," ; public static final String FEATURE_VERSION = "0.1.0" ; public static final String KEY_FEATURE_VERSION = "" ; public static final String KEY_ID = "cache-id" ; public static final String KEY_TIMESTAMP = "" ; public static final String KEY_TABLE_NAME = "table-name" ; public static final String KEY_COLUMN_NAMES = "" ; public static final String KEY_MODEL_CLASS_NAME = "" ; public static final String KEY_MODEL_CLASS_VERSION = "" ; public static final String FORMAT_TIMESTAMP = "" ; private final String featureVersion ; private final String id ; private final Calendar timestamp ; private final String tableName ; private final Set < String > columnNames ; private final String modelClassName ; private final long modelClassVersion ; public CacheInfo ( String featureVersion , String id , Calendar timestamp , String tableName , Collection < String > columnNames , String modelClassName , long modelClassVersion ) { if ( featureVersion == null ) { throw new IllegalArgumentException ( "" ) ; } if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } if ( timestamp == null ) { throw new IllegalArgumentException ( "" ) ; } if ( tableName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( columnNames == null ) { throw new IllegalArgumentException ( "" ) ; } if ( modelClassName == null ) { throw new IllegalArgumentException ( "" ) ; } this . featureVersion = featureVersion ; this . id = id ; this . timestamp = ( Calendar ) timestamp . clone ( ) ; this . timestamp . set ( Calendar . MILLISECOND , 0 ) ; this . tableName = tableName ; this . columnNames = new TreeSet < String > ( columnNames ) ; this . modelClassName = modelClassName ; this . modelClassVersion = modelClassVersion ; } public String getFeatureVersion ( ) { return featureVersion ; } public String getId ( ) { return id ; } public Calendar getTimestamp ( ) { return ( Calendar ) timestamp . clone ( ) ; } public String getTableName ( ) { return tableName ; } public Set < String > getColumnNames ( ) { return columnNames ; } public String getModelClassName ( ) { return modelClassName ; } public long getModelClassVersion ( ) { return modelClassVersion ; } public static CacheInfo loadFrom ( Properties properties ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } String featureVersion = loadProperty ( properties , KEY_FEATURE_VERSION ) ; String id = loadProperty ( properties , KEY_ID ) ; String timestampString = loadProperty ( properties , KEY_TIMESTAMP ) ; String tableName = loadProperty ( properties , KEY_TABLE_NAME ) ; String columnNamesString = loadProperty ( properties , KEY_COLUMN_NAMES ) ; String modelClassName = loadProperty ( properties , KEY_MODEL_CLASS_NAME ) ; String modelClassVersionString = loadProperty ( properties , KEY_MODEL_CLASS_VERSION ) ; Calendar timestamp ; try { Date date = new SimpleDateFormat ( FORMAT_TIMESTAMP ) . parse ( timestampString ) ; timestamp = Calendar . getInstance ( ) ; timestamp . setTime ( date ) ; } catch ( ParseException e ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , KEY_TIMESTAMP , FORMAT_TIMESTAMP , timestampString ) , e ) ; } Set < String > columnNames = split ( columnNamesString ) ; long modelClassVersion ; try { modelClassVersion = Long . parseLong ( modelClassVersionString ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , KEY_MODEL_CLASS_VERSION , modelClassVersionString ) , e ) ; } return new CacheInfo ( featureVersion , id , timestamp , tableName , columnNames , modelClassName , modelClassVersion ) ; } private static String loadProperty ( Properties properties , String key ) { assert properties != null ; assert key != null ; String property = properties . getProperty ( key ) ; if ( property == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , key ) ) ; } return property . trim ( ) ; } public void storeTo ( Properties properties ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } properties . setProperty ( KEY_FEATURE_VERSION , featureVersion ) ; properties . setProperty ( KEY_ID , id ) ; properties . setProperty ( KEY_TIMESTAMP , new SimpleDateFormat ( FORMAT_TIMESTAMP ) . format ( timestamp . getTime ( ) ) ) ; properties . setProperty ( KEY_TABLE_NAME , tableName ) ; properties . setProperty ( KEY_COLUMN_NAMES , join ( columnNames ) ) ; properties . setProperty ( KEY_MODEL_CLASS_NAME , modelClassName ) ; properties . setProperty ( KEY_MODEL_CLASS_VERSION , String . valueOf ( modelClassVersion ) ) ; } private static Set < String > split ( String packed ) { assert packed != null ; Set < String > results = new TreeSet < String >
1,076
<s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; public abstract class IrDocMember extends AbstractIrDocElement implements IrDocFragment { private static final long serialVersionUID = - 7631714928819729918L ; private IrDocNamedType declaringType ;
1,077
<s> package org . oddjob . state ; public class IsSaveable implements StateCondition { @ Override public boolean test ( State state ) { return state . isReady ( ) || state . isComplete ( ) || state . isIncomplete
1,078
<s> package og . android . tether ; import java . io . UnsupportedEncodingException ; import java . net . URLEncoder ; import android . R . drawable ; import android . annotation . TargetApi ; import android . app . Activity ; import android . app . AlertDialog ; import android . app . Dialog ; import android . app . ProgressDialog ; import android . app . AlertDialog . Builder ; import android . content . ActivityNotFoundException ; import android . content . BroadcastReceiver ; import android . content . Context ; import android . content . DialogInterface ; import android . content . Intent ; import android . content . IntentFilter ; import android . net . Uri ; import android . os . Bundle ; import android . os . Handler ; import android . os . Message ; import android . text . Html ; import android . text . Spanned ; import android . util . Log ; import android . view . KeyEvent ; import android . view . LayoutInflater ; import android . view . Menu ; import android . view . MenuItem ; import android . view . MotionEvent ; import android . view . SubMenu ; import android . view . View ; import android . view . View . OnClickListener ; import android . view . animation . Animation ; import android . view . animation . BounceInterpolator ; import android . view . animation . ScaleAnimation ; import android . widget . AdapterView ; import android . widget . AdapterView . OnItemClickListener ; import android . widget . ArrayAdapter ; import android . widget . Button ; import android . widget . CompoundButton ; import android . widget . CompoundButton . OnCheckedChangeListener ; import android . widget . CheckBox ; import android . widget . ImageView ; import android . widget . LinearLayout ; import android . widget . ListView ; import android . widget . ProgressBar ; import android . widget . RelativeLayout ; import android . widget . TableRow ; import android . widget . TextView ; import com . google . analytics . tracking . android . EasyTracker ; import com . google . analytics . tracking . android . TrackedActivity ; import com . google . android . c2dm . C2DMessaging ; import org . json . JSONArray ; import org . json . JSONException ; import org . json . JSONObject ; import org . miscwidgets . widget . Panel ; import org . miscwidgets . widget . Panel . OnPanelListener ; public class MainActivity extends TrackedActivity { private TetherApplication application = null ; private ProgressDialog progressDialog ; private ImageView startBtn = null ; private OnClickListener startBtnListener = null ; private ImageView stopBtn = null ; private OnClickListener stopBtnListener = null ; private CompoundButton lockBtn = null ; private OnCheckedChangeListener lockBtnListener = null ; private TextView radioModeLabel = null ; private ImageView radioModeImage = null ; private TextView progressTitle = null ; private TextView progressText = null ; private ProgressBar progressBar = null ; private RelativeLayout downloadUpdateLayout = null ; private RelativeLayout batteryTemperatureLayout = null ; private CheckBox lockButtonCheckbox = null ; private RelativeLayout trafficRow = null ; private TextView downloadText = null ; private TextView uploadText = null ; private TextView downloadRateText = null ; private TextView uploadRateText = null ; private TextView batteryTemperature = null ; private TableRow startTblRow = null ; private TableRow stopTblRow = null ; private ScaleAnimation animation = null ; private RSSReader rssReader = null ; private ListView rssView = null ; private ArrayAdapter < Spanned > rssAdapter = null ; private JSONArray jsonRssArray = null ; private Panel rssPanel = null ; private TextView communityText = null ; private LinearLayout bottomButtonLayout = null ; private static int ID_DIALOG_STARTING = 0 ; private static int ID_DIALOG_STOPPING = 1 ; public static final int MESSAGE_CHECK_LOG = 1 ; public static final int MESSAGE_CANT_START_TETHER = 2 ; public static final int MESSAGE_DOWNLOAD_STARTING = 3 ; public static final int MESSAGE_DOWNLOAD_PROGRESS = 4 ; public static final int MESSAGE_DOWNLOAD_COMPLETE = 5 ; public static final int MESSAGE_DOWNLOAD_BLUETOOTH_COMPLETE = 6 ; public static final int MESSAGE_DOWNLOAD_BLUETOOTH_FAILED = 7 ; public static final int MESSAGE_TRAFFIC_START = 8 ; public static final int MESSAGE_TRAFFIC_COUNT = 9 ; public static final int MESSAGE_TRAFFIC_RATE = 10 ; public static final int MESSAGE_TRAFFIC_END = 11 ; public static final String MSG_TAG = "" ; public static MainActivity currentInstance = null ; private static void setCurrent ( MainActivity current ) { MainActivity . currentInstance = current ; } String tagURL ( String url , String medium , String content , String campaign ) { String p = url . contains ( "?" ) ? "&" : "?" ; String source = "" + application . getVersionNumber ( ) ; try { source = URLEncoder . encode ( source , "UTF-8" ) ; medium = URLEncoder . encode ( medium , "UTF-8" ) ; content = URLEncoder . encode ( content , "UTF-8" ) ; campaign = URLEncoder . encode ( campaign , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { } return url + p + "utm_source=" + source + "&utm_medium=" + medium + "" + content + "" + campaign ; } @ TargetApi ( 4 ) @ Override public void onCreate ( Bundle savedInstanceState ) { Log . d ( MSG_TAG , "" ) ; super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . main ) ; this . application = ( TetherApplication ) this . getApplication ( ) ; MainActivity . setCurrent ( this ) ; this . startTblRow = ( TableRow ) findViewById ( R . id . startRow ) ; this . stopTblRow = ( TableRow ) findViewById ( R . id . stopRow ) ; this . radioModeImage = ( ImageView ) findViewById ( R . id . radioModeImage ) ; this . progressBar = ( ProgressBar ) findViewById ( R . id . progressBar ) ; this . progressText = ( TextView ) findViewById ( R . id . progressText ) ; this . progressTitle = ( TextView ) findViewById ( R . id . progressTitle ) ; this . downloadUpdateLayout = ( RelativeLayout ) findViewById ( R . id . layoutDownloadUpdate ) ; this . batteryTemperatureLayout = ( RelativeLayout ) findViewById ( R . id . layoutBatteryTemp ) ; this . lockButtonCheckbox = ( CheckBox ) findViewById ( R . id . lockButton ) ; this . trafficRow = ( RelativeLayout ) findViewById ( R . id . trafficRow ) ; this . downloadText = ( TextView ) findViewById ( R . id . trafficDown ) ; this . uploadText = ( TextView ) findViewById ( R . id . trafficUp ) ; this . downloadRateText = ( TextView ) findViewById ( R . id . trafficDownRate ) ; this . uploadRateText = ( TextView ) findViewById ( R . id . trafficUpRate ) ; this . batteryTemperature = ( TextView ) findViewById ( R . id . batteryTempText ) ; animation = new ScaleAnimation ( 0.9f , 1 , 0.9f , 1 , ScaleAnimation . RELATIVE_TO_SELF , 0.5f , ScaleAnimation . RELATIVE_TO_SELF , 0.5f ) ; animation . setDuration ( 600 ) ; animation . setFillAfter ( true ) ; animation . setStartOffset ( 0 ) ; animation . setRepeatCount ( 1 ) ; animation . setRepeatMode ( Animation . REVERSE ) ; if ( this . application . startupCheckPerformed == false ) { if ( this . application . settings . getLong ( "" , - 1 ) == - 1 ) { long t = System . currentTimeMillis ( ) / 1000 ; this . application . preferenceEditor . putLong ( "" , t ) ; } } this . application . reportStats ( - 1 , false ) ; if ( this . application . startupCheckPerformed == false ) { this . application . startupCheckPerformed = true ; String regId = C2DMessaging . getRegistrationId ( this ) ; boolean registered = this . application . settings . getBoolean ( "" , false ) ; if ( ! registered || regId == null || "" . equals ( regId ) ) { Log . d ( MSG_TAG , "" ) ; C2DMessaging . register ( this , DeviceRegistrar . SENDER_ID ) ; } else { Log . d ( MSG_TAG , "" ) ; } if ( ! this . application . coretask . isNetfilterSupported ( ) ) { this . openNoNetfilterDialog ( ) ; this . application . accessControlSupported = false ; this . application . whitelist . remove ( ) ; } else { if ( ! this . application . coretask . isAccessControlSupported ( ) ) { if ( this . application . settings . getBoolean ( "" , false ) == false ) { this . openNoAccessControlDialog ( ) ; this . application . preferenceEditor . putBoolean ( "" , true ) ; this . application . preferenceEditor . commit ( ) ; } this . application . accessControlSupported = false ; this . application . whitelist . remove ( ) ; } } if ( this . application . binariesExists ( ) == false || this . application . coretask . filesetOutdated ( ) ) { if ( this . application . coretask . hasRootPermission ( ) ) { this . application . installFiles ( ) ; } } this . openDonateDialog ( ) ; this . application . checkForUpdate ( ) ; } if ( ! this . application . coretask . hasRootPermission ( ) ) openLaunchedDialog ( true ) ; this . rssReader = new RSSReader ( getApplicationContext ( ) , TetherApplication . FORUM_RSS_URL ) ; this . rssView = ( ListView ) findViewById ( R . id . RSSView ) ; this . rssAdapter = new ArrayAdapter < Spanned > ( this , R . layout . rss_item ) ; this . rssView . setAdapter ( this . rssAdapter ) ; this . rssView . setOnItemClickListener ( new OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { Log . d ( MSG_TAG , parent + ":" + view + ":" + position + ":" + id ) ; MainActivity . this . application . statRSSClicks ( ) ; String url = null ; try { url = MainActivity . this . jsonRssArray . getJSONObject ( position ) . getString ( "link" ) ; } catch ( JSONException e ) { url = TetherApplication . FORUM_URL ; } url = tagURL ( url , "android" , "rss" , "community" ) ; Intent viewRssLink = new Intent ( Intent . ACTION_VIEW ) . setData ( Uri . parse ( url ) ) ; try { startActivity ( viewRssLink ) ; } catch ( ActivityNotFoundException e ) { url = tagURL ( TetherApplication . FORUM_URL , "android" , "rss" , "community" ) ; viewRssLink = new Intent ( Intent . ACTION_VIEW ) . setData ( Uri . parse ( url ) ) ; try { startActivity ( viewRssLink ) ; } catch ( ActivityNotFoundException e2 ) { e2 . printStackTrace ( ) ; } } } } ) ; this . rssPanel = ( Panel ) findViewById ( R . id . RSSPanel ) ; this . rssPanel . setInterpolator ( new BounceInterpolator ( ) ) ; this . rssPanel . setOnPanelListener ( new OnPanelListener ( ) { public void onPanelClosed ( Panel panel ) { hideCommunityText ( true ) ; MainActivity . this . application . preferenceEditor . putBoolean ( "rss_closed" , true ) . commit ( ) ; } public void onPanelOpened ( Panel panel ) { hideCommunityText ( false ) ; MainActivity . this . application . preferenceEditor . putBoolean ( "rss_closed" , false ) . commit ( ) ; } } ) ; this . communityText = ( TextView ) findViewById ( R . id . communityHeader ) ; this . communityText . setOnClickListener ( new OnClickListener ( ) { public void onClick ( View v ) { MainActivity . this . rssPanel . setOpen ( ! MainActivity . this . rssPanel . isOpen ( ) , true ) ; } } ) ; hideCommunityText ( ! this . rssPanel . isOpen ( ) ) ; this . bottomButtonLayout = ( LinearLayout ) findViewById ( R . id . bottomButtonLayout ) ; ( ( Button ) findViewById ( R . id . anchorLinkButton ) ) . setOnClickListener ( new OnClickListener ( ) { public void onClick ( View v ) { startGooglePlayMeshclient ( "" ) ; } } ) ; ( ( Button ) findViewById ( R . id . configButton ) ) . setOnClickListener ( new OnClickListener ( ) { public void onClick ( View v ) { startActivityForResult ( new Intent ( MainActivity . this , SetupActivity . class ) . setAction ( "FOO" ) , 33 ) ; } } ) ; this . startBtn = ( ImageView ) findViewById ( R . id . startTetherBtn ) ; this . startBtnListener = new OnClickListener ( ) { public void onClick ( View v ) { Log . d ( MSG_TAG , "" ) ; new Thread ( new Runnable ( ) { public void run ( ) { Intent intent = new Intent ( TetherService . INTENT_MANAGE ) ; intent . putExtra ( "state" , TetherService . MANAGE_START ) ; Log . d ( MSG_TAG , "" + intent ) ; MainActivity . this . sendBroadcast ( intent ) ; } } ) . start ( ) ; } } ; this . startBtn . setOnClickListener ( this . startBtnListener ) ; this . stopBtn = ( ImageView ) findViewById ( R . id . stopTetherBtn ) ; this . stopBtnListener = new OnClickListener ( ) { public void onClick ( View v ) { Log . d ( MSG_TAG , "" ) ; if ( MainActivity . this . lockBtn . isChecked ( ) ) { Log . d ( MSG_TAG , "" ) ; MainActivity . this . application . displayToastMessage ( getString ( R . string . main_activity_locked ) ) ; return ; } new Thread ( new Runnable ( ) { public void run ( ) { Intent intent = new Intent ( TetherService . INTENT_MANAGE ) ; intent . setAction ( TetherService . INTENT_MANAGE ) ; intent . putExtra ( "state" , TetherService . MANAGE_STOP ) ; Log . d ( MSG_TAG , "" + intent ) ; MainActivity . this . sendBroadcast ( intent ) ; } } ) . start ( ) ; } } ; this . stopBtn . setOnClickListener ( this . stopBtnListener ) ; this . lockBtn = ( CompoundButton ) findViewById ( R . id . lockButton ) ; this . lockBtnListener = new OnCheckedChangeListener ( ) { public void onCheckedChanged ( CompoundButton buttonView , boolean isChecked ) { Log . d ( MSG_TAG , "" ) ; } } ; this . lockBtn . setOnCheckedChangeListener ( this . lockBtnListener ) ; this . toggleStartStop ( ) ; } @ Override public boolean onTrackballEvent ( MotionEvent event ) { if ( event . getAction ( ) == MotionEvent . ACTION_DOWN ) { Log . d ( MSG_TAG , "" ) ; String tetherStatus = this . application . coretask . getProp ( "" ) ; if ( ! tetherStatus . equals ( "running" ) ) { new AlertDialog . Builder ( this ) . setMessage ( getString ( R . string . main_activity_trackball_pressed_start ) ) . setPositiveButton ( getString ( R . string . main_activity_confirm ) , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Log . d ( MSG_TAG , "" ) ; MainActivity . currentInstance . startBtnListener . onClick ( MainActivity . currentInstance . startBtn ) ; } } ) . setNegativeButton ( getString ( R . string . main_activity_cancel ) , null ) . show ( ) ; } else { if ( MainActivity . this . lockBtn . isChecked ( ) ) { Log . d ( MSG_TAG , "" ) ; MainActivity . this . application . displayToastMessage ( getString ( R . string . main_activity_locked ) ) ; return false ; } new AlertDialog . Builder ( this ) . setMessage ( getString ( R . string . main_activity_trackball_pressed_stop ) ) . setPositiveButton ( getString ( R . string . main_activity_confirm ) , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Log . d ( MSG_TAG , "" ) ; MainActivity . currentInstance . stopBtnListener . onClick ( MainActivity . currentInstance . startBtn ) ; } } ) . setNegativeButton ( getString ( R . string . main_activity_cancel ) , null ) . show ( ) ; } } return true ; } public void onStop ( ) { Log . d ( MSG_TAG , "" ) ; super . onStop ( ) ; } public void onDestroy ( ) { Log . d ( MSG_TAG , "" ) ; super . onDestroy ( ) ; } public void onPause ( ) { Log . d ( MSG_TAG , "" ) ; try { unregisterReceiver ( this . intentReceiver ) ; } catch ( Exception ex ) { ; } super . onPause ( ) ; } protected void onNewIntent ( Intent intent ) { Log . d ( MSG_TAG , "" + intent ) ; setIntent ( intent ) ; } public void onResume ( ) { Log . d ( MSG_TAG , "" ) ; Log . d ( MSG_TAG , "ADVCONFIG " + this . application . settings . getBoolean ( "configadv" , false ) ) ; try { if ( getIntent ( ) . getData ( ) .
1,079
<s> package com . lmax . disruptor . support ; import java . util . concurrent . BlockingQueue ; public final class FunctionQueueConsumer implements Runnable { private final FunctionStep functionStep ; private final BlockingQueue < long [ ] > stepOneQueue ; private final BlockingQueue < Long > stepTwoQueue ; private final BlockingQueue < Long > stepThreeQueue ; private volatile boolean running ; private volatile long sequence ; private long stepThreeCounter ; public FunctionQueueConsumer ( final FunctionStep functionStep , final BlockingQueue < long [ ] > stepOneQueue , final BlockingQueue < Long > stepTwoQueue , final BlockingQueue < Long > stepThreeQueue ) { this . functionStep = functionStep ; this . stepOneQueue = stepOneQueue ; this . stepTwoQueue = stepTwoQueue ; this . stepThreeQueue = stepThreeQueue ; } public long getStepThreeCounter ( ) { return stepThreeCounter ; } public void reset ( ) { stepThreeCounter = 0L ; sequence = - 1L ; } public long getSequence ( ) { return sequence ; } public
1,080
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . action . IMenuListener ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . action . Separator ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . search . ui . IContextMenuConstants ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . INewWizard ; import org . eclipse . ui . IViewPart ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . actions . ActionGroup ; import org . eclipse . ui . part . Page ; import org . eclipse . ui . texteditor . IUpdate ; 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 . buildpath . LoadpathModifier ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . actions . ActionMessages ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . AddSourceFolderWizard ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . CPListElement ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . EditFilterWizard ; import org . rubypeople . rdt . ui . actions . AbstractOpenWizardAction ; public class GenerateBuildPathActionGroup extends ActionGroup { public static final String MENU_ID = "" ; public static final String GROUP_BUILDPATH = "" ; public static final String GROUP_FILTER = "filterGroup" ; public static final String GROUP_CUSTOMIZE = "" ; private static class NoActionAvailable extends Action { public NoActionAvailable ( ) { setEnabled ( false ) ; setText ( NewWizardMessages . GenerateBuildPathActionGroup_no_action_available ) ; } } private Action fNoActionAvailable = new NoActionAvailable ( ) ; private static abstract class OpenBuildPathWizardAction extends AbstractOpenWizardAction implements ISelectionChangedListener { public void selectionChanged ( SelectionChangedEvent event ) { ISelection selection = event . getSelection ( ) ; if ( selection instanceof IStructuredSelection ) { setEnabled ( selectionChanged ( ( IStructuredSelection ) selection ) ) ; } else { setEnabled ( selectionChanged ( StructuredSelection . EMPTY ) ) ; } } public abstract boolean selectionChanged ( IStructuredSelection selection ) ; } private abstract static class CreateSourceFolderAction extends OpenBuildPathWizardAction { private AddSourceFolderWizard fAddSourceFolderWizard ; private IRubyProject fSelectedProject ; private final boolean fIsLinked ; public CreateSourceFolderAction ( boolean isLinked ) { fIsLinked = isLinked ; } protected INewWizard createWizard ( ) throws CoreException { CPListElement newEntrie = new CPListElement ( fSelectedProject , ILoadpathEntry . CPE_SOURCE ) ; CPListElement [ ] existing = CPListElement . createFromExisting ( fSelectedProject ) ; boolean isProjectSrcFolder = CPListElement . isProjectSourceFolder ( existing , fSelectedProject ) ; fAddSourceFolderWizard = new AddSourceFolderWizard ( existing , newEntrie , fIsLinked , false , false , isProjectSrcFolder , isProjectSrcFolder ) ; return fAddSourceFolderWizard ; } public boolean selectionChanged ( IStructuredSelection selection ) { if ( selection . size ( ) == 1 && selection . getFirstElement ( ) instanceof IRubyProject ) { fSelectedProject = ( IRubyProject ) selection . getFirstElement ( ) ; return true ; } return false ; } public List getCPListElements ( ) { return fAddSourceFolderWizard . getExistingEntries ( ) ; } } public static class CreateLocalSourceFolderAction extends CreateSourceFolderAction { public CreateLocalSourceFolderAction ( ) { super ( false ) ; setText ( ActionMessages . OpenNewSourceFolderWizardAction_text2 ) ; setDescription ( ActionMessages . OpenNewSourceFolderWizardAction_description ) ; setToolTipText ( ActionMessages . OpenNewSourceFolderWizardAction_tooltip ) ; setImageDescriptor ( RubyPluginImages . DESC_TOOL_NEWPACKROOT ) ; } } public static class CreateLinkedSourceFolderAction extends CreateSourceFolderAction { public CreateLinkedSourceFolderAction ( ) { super ( true ) ; setText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Link_label ) ; setToolTipText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Link_tooltip ) ; setImageDescriptor ( RubyPluginImages . DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH ) ; setDescription ( NewWizardMessages . PackageExplorerActionGroup_FormText_createLinkedFolder ) ; } } public static class EditFilterAction extends OpenBuildPathWizardAction { private IRubyProject fSelectedProject ; private IRubyElement fSelectedElement ; private EditFilterWizard fEditFilterWizard ; public EditFilterAction ( ) { setText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Edit_label ) ; setDescription ( NewWizardMessages . PackageExplorerActionGroup_FormText_Edit ) ; setToolTipText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip ) ; setImageDescriptor ( RubyPluginImages . DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS ) ;
1,081
<s> package com . asakusafw . runtime . core ; public interface Result < T > { void add ( T result ) ; class OutputException extends RuntimeException { private static final long serialVersionUID = 1L ;
1,082
<s> package org . rubypeople . rdt . internal . launching ; import java . io . File ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . debug . core . RubyDebuggerProxy ; import org . rubypeople . rdt . internal . debug . core . model . RubyDebugTarget ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . RubyRuntime ; import org . rubypeople . rdt . launching . VMRunnerConfiguration ; public class RDebugVMDebugger extends StandardVMDebugger { private static final String PORT_SWITCH = "--port" ; private static final String VERBOSE_FLAG = "-d" ; private static final String RDEBUG_EXECUTABLE = "rdebug-ide" ; @ Override protected List < String > constructProgramString ( VMRunnerConfiguration config , IProgressMonitor monitor ) throws CoreException { String [ ] args = config . getProgramArguments ( ) ; List < String > argList = new ArrayList < String > ( ) ; argList . add ( StandardVMDebugger . END_OF_OPTIONS_DELIMITER ) ; for ( int i = 0 ; i < args . length ; i ++ ) { argList . add ( args [ i ] ) ; } config . setProgramArguments ( argList . toArray ( new String [ argList . size ( ) ] ) ) ; return super . constructProgramString ( config , monitor ) ; } @ Override protected List < String > debugSpecificVMArgs ( RubyDebugTarget debugTarget ) { return new ArrayList < String > ( ) ; } protected List < String > debugArgs ( RubyDebugTarget debugTarget ) throws CoreException { List < String > arguments = new ArrayList < String > ( ) ; String rdebug = findRDebugExecutable ( fVMInstance . getInstallLocation ( ) ) ; if (
1,083
<s> package com . asakusafw . compiler . bulkloader . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . bulkloader . testing . model . MockTableModel ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw .
1,084
<s> package de . fuberlin . wiwiss . d2rq . jena ; import com . hp . hpl . jena . enhanced . BuiltinPersonalities ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . impl . ModelCom ; import com . hp . hpl . jena . util . FileManager ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; import de . fuberlin . wiwiss . d2rq . parser . MapParser ; public class ModelD2RQ
1,085
<s> package org . rubypeople . rdt . refactoring . core . encapsulatefield ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . BlockNode ; import org . jruby . ast . CommentNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . editprovider . DeleteEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . EditProvider ; import org . rubypeople . rdt . refactoring . editprovider . InsertEditProvider ; import org . rubypeople . rdt . refactoring . editprovider . MultiEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . AttrAccessorNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . VisibilityNodeWrapper ; import org . rubypeople . rdt . refactoring . offsetprovider . AfterLastMethodInClassOffsetProvider ; import org . rubypeople . rdt . refactoring . offsetprovider . IOffsetProvider ; public class FieldEncapsulator extends MultiEditProvider { public static enum ACCESSOR { ATTR_ACCESSOR , PROTECTED , PUBLIC } private VisibilityNodeWrapper . METHOD_VISIBILITY readerVisibility ; private VisibilityNodeWrapper . METHOD_VISIBILITY writerVisibility ; private EncapsulateFieldConfig config ; public FieldEncapsulator ( EncapsulateFieldConfig config ) { this . config = config ; initVisibilities ( ) ; initGenerationFields ( ) ; } private void initVisibilities ( ) { writerVisibility = ( ! config . hasSelectedAccessor ( ) || ! config . getSelectedAccessor ( ) . isWriter ( ) ? VisibilityNodeWrapper . METHOD_VISIBILITY . PRIVATE : VisibilityNodeWrapper . METHOD_VISIBILITY . PUBLIC ) ; readerVisibility = ( ! config . hasSelectedAccessor ( ) || ! config . getSelectedAccessor ( ) . isReader ( ) ? VisibilityNodeWrapper . METHOD_VISIBILITY . PRIVATE : VisibilityNodeWrapper . METHOD_VISIBILITY . PUBLIC ) ; } private void initGenerationFields ( ) { config . setReaderGenerationDisabled ( isReaderGenerationOptional ( ) ) ; config . setWriterGenerationDisabled ( isWriterGenerationOptional ( ) ) ; } @ Override public Collection < EditProvider > getEditProviders ( ) { Collection < EditProvider > providers = new ArrayList < EditProvider > ( ) ; if ( !
1,086
<s> package org . rubypeople . rdt . refactoring . nodewrapper ; import org . jruby . ast . ClassVarAsgnNode ; import org . jruby . ast . ClassVarDeclNode ; import org . jruby . ast . ClassVarNode ; import org . jruby . ast . InstAsgnNode ; import org . jruby . ast . InstVarNode ; import org . jruby . ast . Node ; import org . jruby . ast . SymbolNode ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class FieldNodeWrapper implements INodeWrapper { public static final int INVALID_TYPE = - 1 ; public static final int INST_ASGN_NODE = 1 ; public static final int INST_VAR_NODE = 2 ; public static final int CLASS_VAR_ASGN_NODE = 3 ; public static final int CLASS_VAR_NODE = 4 ; public static final int SYMBOL_NODE = 5 ; public static final int
1,087
<s> package com . asakusafw . modelgen . source ; import java . io . Closeable ; import java . io . IOException ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . modelgen . Constants ; import com . asakusafw . modelgen . ModelMatcher ; import com . asakusafw . modelgen . model . Attribute ; import com . asakusafw . modelgen . model . DecimalType ; import com . asakusafw . modelgen . model . ModelDescription ; import com . asakusafw . modelgen . model . ModelRepository ; import com . asakusafw . modelgen . model . PropertyTypeKind ; import com . asakusafw . modelgen . model . StringType ; import com . asakusafw . modelgen . util . TableModelBuilder ; import com . asakusafw . modelgen . view . ViewAnalyzer ; import com . asakusafw . modelgen . view . ViewDefinition ; import com . asakusafw . modelgen . view . ViewParser ; import com . asakusafw . modelgen . view . model . CreateView ; public class DatabaseSource implements Closeable { @ SuppressWarnings ( "unused" ) private static final String STR_IS_PK = "PRI" ; private static final String STR_NOT_NULL = "NO" ; static final Logger LOG = LoggerFactory . getLogger ( DatabaseSource . class ) ; private Connection conn ; private String databaseName ; public DatabaseSource ( String jdbcDriver , String jdbcUrl , String user , String password , String databaseName ) throws IOException , SQLException { if ( jdbcDriver == null ) { throw new IllegalArgumentException ( "" ) ; } if ( jdbcUrl == null ) { throw new IllegalArgumentException ( "" ) ; } if ( user == null ) { throw new IllegalArgumentException ( "" ) ; } if ( password == null ) { throw new IllegalArgumentException ( "" ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "" ) ; } this . databaseName = databaseName ; try { Class . forName ( jdbcDriver ) ; } catch ( ClassNotFoundException e ) { throw new IOException ( "" , e ) ; } conn = DriverManager . getConnection ( jdbcUrl , user , password ) ; } public List < ModelDescription > collectTables ( ModelMatcher filter ) throws IOException , SQLException { String sql = "" + "SELECT" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" ; List < ModelDescription > results = new ArrayList < ModelDescription > ( ) ; PreparedStatement ps = null ; ResultSet rs = null ; try { ps = conn . prepareStatement ( sql ) ; ps . setString ( 1 , databaseName ) ; rs = ps . executeQuery ( ) ; String prevTableName = null ; TableModelBuilder builder = null ; while ( rs . next ( ) ) { String tableName = rs . getString ( 1 ) ; String columnName = rs . getString ( 2 ) ; String columnComment = rs . getString ( 3 ) ; String dataType =
1,088
<s> package com . sun . tools . hat . internal . oql ; import com . sun . tools . hat . internal . model . * ; import java . io . * ; import java . util . * ; import javax . script . * ; public class OQLEngine { static { ScriptEngineManager manager = new ScriptEngineManager ( ) ; ScriptEngine jse = manager . getEngineByName ( "rhino-nonjdk" ) ; oqlSupported = jse != null ; } public static boolean isOQLSupported ( ) { return oqlSupported ; } public OQLEngine ( Snapshot snapshot ) { if ( ! isOQLSupported ( ) ) { throw new UnsupportedOperationException ( "" ) ; } init ( snapshot ) ; } public synchronized void executeQuery ( String query , ObjectVisitor visitor ) throws OQLException { debugPrint ( "query : " + query ) ; StringTokenizer st = new StringTokenizer ( query ) ; if ( st . hasMoreTokens ( ) ) { String first = st . nextToken ( ) ; if ( ! first . equals ( "select" ) ) { try { Object res = evalScript ( query ) ; visitor . visit ( res ) ; } catch ( Exception e ) { throw new OQLException ( e ) ; } return ; } } else { throw new OQLException ( "" ) ; } String selectExpr = "" ; boolean seenFrom = false ; while ( st . hasMoreTokens ( ) ) { String tok = st . nextToken ( ) ; if ( tok . equals ( "from" ) ) { seenFrom = true ; break ; } selectExpr += " " + tok ; } if ( selectExpr . equals ( "" )
1,089
<s> package org . oddjob . launch ; import java . io . File ; import org . apache . log4j . Logger ; import junit . framework . TestCase ; public class PathParserTest extends TestCase { private static final Logger logger = Logger . getLogger ( PathParserTest . class ) ; String pathToParse = null ; String result1 = null ; String result2 = null ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . info ( "" + getName ( ) + "-----------" ) ; } void pathSetUp (
1,090
<s> package org . oddjob . jobs . structural ; import org . oddjob .
1,091
<s> package org . rubypeople . rdt . internal . ui . text . spelling ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . contentassist . IContextInformation ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . Point ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . RubyUIMessages ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellCheckEngine ; import org . rubypeople . rdt . internal . ui . text . spelling . engine . ISpellChecker ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . ruby . IInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public class AddWordProposal implements IRubyCompletionProposal { private
1,092
<s> package org . rubypeople . rdt . internal . core ; import java . util . HashSet ; import java . util . Set ; public class RubyMethodElementInfo extends MemberElementInfo { protected String selector ; protected int visibility ; private Set < String > blockVars = new HashSet < String > ( ) ; protected String [ ] argumentNames ; private boolean isSingleton ; public String [ ] getArgumentNames ( ) { return this . argumentNames ; } public String getSelector ( ) { return this . selector ; } public int getVisibility ( ) { return this . visibility ; } protected void setVisibility ( int visibility ) { this . visibility = visibility ; } public boolean isConstructor ( ) { return selector == "initialize" ; } protected void setArgumentNames ( String [ ] names ) { this . argumentNames = names ; } protected void setIsSingleton ( boolean b ) { isSingleton = b ; } public boolean isSingleton
1,093
<s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . PlatformObject ; import org . eclipse . ui . model . IWorkbenchAdapter ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . internal . ui . callhierarchy . MethodWrapperWorkbenchAdapter ; public abstract class MethodWrapper extends PlatformObject { private Map fElements = null ; private Map fMethodCache ; private MethodCall fMethodCall ; private MethodWrapper fParent ; private int fLevel ; public MethodWrapper ( MethodWrapper parent , MethodCall methodCall ) { Assert . isNotNull ( methodCall ) ; if ( parent == null ) { setMethodCache ( new HashMap ( ) ) ; fLevel = 1 ; } else { setMethodCache ( parent . getMethodCache ( ) ) ; fLevel = parent . getLevel ( ) + 1 ; } this . fMethodCall = methodCall ; this . fParent = parent ; } public Object getAdapter ( Class adapter ) { if ( adapter == IRubyElement . class ) { return getMember ( ) ; } else if ( adapter == IWorkbenchAdapter . class ) { return new MethodWrapperWorkbenchAdapter ( this ) ; } else { return null ; } } public MethodWrapper [ ] getCalls ( IProgressMonitor progressMonitor ) { if ( fElements == null ) { doFindChildren ( progressMonitor ) ; } MethodWrapper [ ] result = new MethodWrapper [ fElements . size ( ) ] ; int i = 0 ; for ( Iterator iter = fElements . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { MethodCall methodCall = getMethodCallFromMap ( fElements , iter . next ( ) ) ; result [ i ++ ] = createMethodWrapper ( methodCall ) ; } return result ; } public int getLevel ( ) { return fLevel ; } public IMember getMember ( ) { return getMethodCall ( ) . getMember ( ) ; } public MethodCall getMethodCall ( ) { return fMethodCall ; } public String getName ( ) { if ( getMethodCall ( ) != null ) { return getMethodCall ( ) . getMember ( ) . getElementName ( ) ; } else { return "" ; } } public MethodWrapper getParent ( ) { return fParent ; } public boolean equals ( Object oth ) { if ( this == oth ) { return true ; } if ( oth == null ) { return false ; } if ( oth instanceof MethodWrapperWorkbenchAdapter ) { oth = ( ( MethodWrapperWorkbenchAdapter ) oth ) . getMethodWrapper ( ) ; } if ( oth . getClass ( ) != getClass ( ) ) { return false ; } MethodWrapper other = ( MethodWrapper ) oth ; if ( this . fParent == null ) { if ( other . fParent != null ) { return false ; } } else { if ( ! this . fParent . equals ( other . fParent ) ) { return false ; } } if ( this . getMethodCall ( ) == null ) { if ( other . getMethodCall ( ) != null ) { return false ; } } else { if ( ! this . getMethodCall ( ) . equals ( other . getMethodCall ( ) ) ) { return false ; } } return true ; } public int hashCode ( ) { final int PRIME = 1000003 ; int result = 0 ; if ( fParent != null ) { result = ( PRIME * result ) + fParent . hashCode ( ) ; } if ( getMethodCall ( ) != null ) { result = ( PRIME * result ) + getMethodCall ( ) . getMember ( ) . hashCode ( ) ; } return result ; } private void setMethodCache ( Map methodCache ) { fMethodCache = methodCache ; } protected abstract String getTaskName ( ) ; private void addCallToCache ( MethodCall methodCall ) { Map cachedCalls = lookupMethod ( this . getMethodCall ( ) ) ; cachedCalls . put ( methodCall . getKey ( ) , methodCall ) ; } protected abstract MethodWrapper createMethodWrapper ( MethodCall methodCall ) ; private void doFindChildren ( IProgressMonitor progressMonitor ) { Map existingResults = lookupMethod ( getMethodCall ( ) ) ; if ( existingResults != null ) { fElements = new HashMap ( ) ; fElements . putAll ( existingResults ) ; } else { initCalls ( ) ; if ( progressMonitor != null ) { progressMonitor . beginTask ( getTaskName ( ) , 100 ) ; } try { performSearch ( progressMonitor ) ; } finally { if (
1,094
<s> package com . asakusafw . modelgen . view ; import java . io . IOException ; import java . io . StringReader ; import java . text . MessageFormat ; import com . asakusafw . modelgen . view . model . CreateView ; public final class ViewParser { public static CreateView parse ( ViewDefinition definition ) throws IOException { if ( definition == null ) { throw new IllegalArgumentException ( "" ) ; } StringReader stream = new StringReader ( definition . statement ) ;
1,095
<s> package com . asakusafw . testdriver . bulkloader ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . sql . Connection ; import org . junit . Rule ; import org . junit . Test ; public class ConfigurationTest { @ Rule public H2Resource h2 = new H2Resource ( "config" ) { @ Override protected void before ( ) throws Exception { execute ( "" + "" + "" + "" + ")" ) ; } } ; @ Rule public ConfigurationContext context = new ConfigurationContext ( ) ; @ Test ( expected = IOException . class ) public void missing ( ) throws Exception { Configuration . load ( "" ) ; } @ Test ( expected = IOException . class ) public void mismatch ( ) throws Exception { context . put ( "mismatch" , "config" ) ; Configuration . load ( "config" ) ; } @ Test public void target ( ) throws Exception { context . put ( "config" , "config" ) ; Configuration conf = Configuration . load ( "config" ) ; Connection conn = conf . open ( ) ; try { conn . createStatement ( ) . execute ( "" ) ; conn . commit ( ) ; } finally { conn . close ( ) ; } assertThat ( h2 . count ( "TESTING" ) , is ( 1 ) ) ; }
1,096
<s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jface . viewers . IColorProvider ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . core . IImportDeclaration ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . ui . RubyElementLabels ; public class SortingLabelProvider extends SearchLabelProvider implements IColorProvider { public static final int SHOW_ELEMENT_CONTAINER = 1 ; public static final int SHOW_CONTAINER_ELEMENT = 2 ; public static final int SHOW_PATH = 3 ; public SortingLabelProvider ( RubySearchResultPage page ) { super ( page ) ; } public Image getImage ( Object element ) { Image image = null ; if ( element instanceof IRubyElement || element instanceof IResource )
1,097
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . DeductionTran ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class DeductionTranModelInput implements ModelInput < DeductionTran > { private final RecordParser parser ; public DeductionTranModelInput ( RecordParser parser ) { if (
1,098
<s> package net . sf . sveditor . core . db . project ; public class SVDBPath { private String fPath ; private boolean fPhantom ; public SVDBPath ( String path ) { fPath = path ; fPhantom = false ; } public SVDBPath ( String path , boolean is_phantom ) { fPath = path ; fPhantom = is_phantom ; } public boolean getIsPhantom ( ) { return fPhantom ; } public void setIsPhantom ( boolean is_phantom
1,099
<s> package com . aptana . rdt . internal . rake ; 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 Task implements ISourceReference { private String className ; private int offset ; private int length ; Task ( String className , int offset , int length ) { this . className