idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
33,100 | @ OperationsPerInvocation ( 20 ) public void benchmarkJdkProxy ( Blackhole blackHole ) { blackHole . consume ( jdkProxyInstance . method ( booleanValue ) ) ; blackHole . consume ( jdkProxyInstance . method ( byteValue ) ) ; blackHole . consume ( jdkProxyInstance . method ( shortValue ) ) ; blackHole . consume ( jdkProx... | Performs a benchmark for a trivial class creation using the Java Class Library s utilities . |
33,101 | public static UsingLookup of ( Object lookup ) { if ( ! DISPATCHER . isAlive ( ) ) { throw new IllegalStateException ( "The current VM does not support class definition via method handle lookups" ) ; } else if ( ! JavaType . METHOD_HANDLES_LOOKUP . isInstance ( lookup ) ) { throw new IllegalArgumentException ( "Not a m... | Creates class injector that defines a class using a method handle lookup . |
33,102 | public static ClassInjector of ( File folder , Target target , Instrumentation instrumentation ) { return new UsingInstrumentation ( folder , target , instrumentation , new RandomString ( ) ) ; } | Creates an instrumentation - based class injector . |
33,103 | public static ClassReader of ( byte [ ] binaryRepresentation ) { if ( EXPERIMENTAL ) { byte [ ] actualVersion = new byte [ ] { binaryRepresentation [ 4 ] , binaryRepresentation [ 5 ] , binaryRepresentation [ 6 ] , binaryRepresentation [ 7 ] } ; binaryRepresentation [ 4 ] = ( byte ) ( Opcodes . V12 >>> 24 ) ; binaryRepr... | Creates a class reader for the given binary representation of a class file . |
33,104 | private List < StackManipulation > argumentValuesOf ( MethodDescription instrumentedMethod ) { TypeList . Generic parameterTypes = instrumentedMethod . getParameters ( ) . asTypeList ( ) ; List < StackManipulation > instruction = new ArrayList < StackManipulation > ( parameterTypes . size ( ) ) ; int currentIndex = 1 ;... | Returns a list of stack manipulations that loads all arguments of an instrumented method . |
33,105 | protected ByteCodeAppender . Size apply ( MethodVisitor methodVisitor , Context implementationContext , MethodDescription instrumentedMethod , StackManipulation preparingManipulation , FieldDescription fieldDescription ) { if ( instrumentedMethod . isStatic ( ) ) { throw new IllegalStateException ( "It is not possible ... | Applies an implementation that delegates to a invocation handler . |
33,106 | public TypeReferenceAdjustment filter ( ElementMatcher < ? super TypeDescription > filter ) { return new TypeReferenceAdjustment ( strict , this . filter . < TypeDescription > or ( filter ) ) ; } | Excludes all matched types from being added as an attribute . |
33,107 | public static StackManipulation of ( TypeDescription typeDescription ) { if ( typeDescription . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Cannot check an instance against a primitive type: " + typeDescription ) ; } return new InstanceCheck ( typeDescription ) ; } | Creates a new instance check . |
33,108 | protected boolean onCacheMiss ( T target ) { boolean cached = matcher . matches ( target ) ; map . put ( target , cached ) ; return cached ; } | Invoked if the cache is not hit . |
33,109 | public static String hashOf ( int value ) { char [ ] buffer = new char [ ( Integer . SIZE / KEY_BITS ) + ( ( Integer . SIZE % KEY_BITS ) == 0 ? 0 : 1 ) ] ; for ( int index = 0 ; index < buffer . length ; index ++ ) { buffer [ index ] = SYMBOL [ ( value >>> index * KEY_BITS ) & ( - 1 >>> ( Integer . SIZE - KEY_BITS ) ) ... | Represents an integer value as a string hash . This string is not technically random but generates a fixed character sequence based on the hash provided . |
33,110 | public static CanCache of ( MethodDescription . InDefinedShape methodDescription ) { if ( methodDescription . isTypeInitializer ( ) ) { return CanCacheIllegal . INSTANCE ; } else if ( methodDescription . isConstructor ( ) ) { return new ForConstructor ( methodDescription ) ; } else { return new ForMethod ( methodDescri... | Creates a stack manipulation that loads a method constant onto the operand stack . |
33,111 | protected static List < StackManipulation > typeConstantsFor ( List < TypeDescription > parameterTypes ) { List < StackManipulation > typeConstants = new ArrayList < StackManipulation > ( parameterTypes . size ( ) ) ; for ( TypeDescription parameterType : parameterTypes ) { typeConstants . add ( ClassConstant . of ( pa... | Returns a list of type constant load operations for the given list of parameters . |
33,112 | @ SuppressFBWarnings ( value = "GC_UNRELATED_TYPES" , justification = "Cross-comparison is intended" ) public Class < ? > insert ( ClassLoader classLoader , T key , Class < ? > type ) { ConcurrentMap < T , Reference < Class < ? > > > storage = cache . get ( new LookupKey ( classLoader ) ) ; if ( storage == null ) { sto... | Inserts a new type into the cache . If a type with the same class loader and key was inserted previously the cache is not updated . |
33,113 | @ OperationsPerInvocation ( 20 ) public void benchmarkByteBuddyWithProxy ( Blackhole blackHole ) { blackHole . consume ( byteBuddyWithProxyInstance . method ( booleanValue ) ) ; blackHole . consume ( byteBuddyWithProxyInstance . method ( byteValue ) ) ; blackHole . consume ( byteBuddyWithProxyInstance . method ( shortV... | Performs a benchmark of a super method invocation using Byte Buddy . This benchmark uses an annotation - based approach which is more difficult to optimize by the JIT compiler . |
33,114 | @ OperationsPerInvocation ( 20 ) public void benchmarkByteBuddyWithAccessor ( Blackhole blackHole ) { blackHole . consume ( byteBuddyWithAccessorInstance . method ( booleanValue ) ) ; blackHole . consume ( byteBuddyWithAccessorInstance . method ( byteValue ) ) ; blackHole . consume ( byteBuddyWithAccessorInstance . met... | Performs a benchmark of a super method invocation using Byte Buddy . This benchmark also uses the annotation - based approach but creates delegation methods which do not require the creation of additional classes . |
33,115 | @ OperationsPerInvocation ( 20 ) public void benchmarkByteBuddyWithPrefix ( Blackhole blackHole ) { blackHole . consume ( byteBuddyWithPrefixInstance . method ( booleanValue ) ) ; blackHole . consume ( byteBuddyWithPrefixInstance . method ( byteValue ) ) ; blackHole . consume ( byteBuddyWithPrefixInstance . method ( sh... | Performs a benchmark of a super method invocation using Byte Buddy . This benchmark also uses the annotation - based approach but hard - codes the super method call subsequently to the method . |
33,116 | @ OperationsPerInvocation ( 20 ) public void benchmarkByteBuddySpecialized ( Blackhole blackHole ) { blackHole . consume ( byteBuddySpecializedInstance . method ( booleanValue ) ) ; blackHole . consume ( byteBuddySpecializedInstance . method ( byteValue ) ) ; blackHole . consume ( byteBuddySpecializedInstance . method ... | Performs a benchmark of a super method invocation using Byte Buddy . This benchmark uses a specialized interception strategy which is easier to inline by the compiler . |
33,117 | public MemberSubstitution replaceWithField ( ElementMatcher < ? super FieldDescription > matcher ) { return replaceWith ( new Substitution . ForFieldAccess . OfMatchedField ( matcher ) ) ; } | Replaces any interaction with a matched byte code element with a non - static field access on the first parameter of the matched element . When matching a non - static field access or method invocation the substituted field is located on the same receiver type as the original access . For static access the first argume... |
33,118 | public MemberSubstitution replaceWithMethod ( ElementMatcher < ? super MethodDescription > matcher , MethodGraph . Compiler methodGraphCompiler ) { return replaceWith ( new Substitution . ForMethodInvocation . OfMatchedMethod ( matcher , methodGraphCompiler ) ) ; } | Replaces any interaction with a matched byte code element with a non - static method access on the first parameter of the matched element . When matching a non - static field access or method invocation the substituted method is located on the same receiver type as the original access . For static access the first argu... |
33,119 | public Plugin . Factory . UsingReflection . ArgumentResolver toArgumentResolver ( ) { return new Plugin . Factory . UsingReflection . ArgumentResolver . ForIndex . WithDynamicType ( index , value ) ; } | Resolves this plugin argument to an argument resolver . |
33,120 | public static < S > List < S > of ( S left , List < ? extends S > right ) { if ( right . isEmpty ( ) ) { return Collections . singletonList ( left ) ; } else { List < S > list = new ArrayList < S > ( 1 + right . size ( ) ) ; list . add ( left ) ; list . addAll ( right ) ; return list ; } } | Creates a list of a single element and another list . |
33,121 | public static < S > List < S > of ( List < ? extends S > left , List < ? extends S > right ) { List < S > list = new ArrayList < S > ( left . size ( ) + right . size ( ) ) ; list . addAll ( left ) ; list . addAll ( right ) ; return list ; } | Creates a list of a left and right list . |
33,122 | private void onOwnableType ( Generic ownableType ) { Generic ownerType = ownableType . getOwnerType ( ) ; if ( ownerType != null && ownerType . getSort ( ) . isParameterized ( ) ) { onOwnableType ( ownerType ) ; signatureVisitor . visitInnerClassType ( ownableType . asErasure ( ) . getSimpleName ( ) ) ; } else { signat... | Visits a type which might define an owner type . |
33,123 | public static StackManipulation of ( Serializable value ) { if ( value == null ) { return NullConstant . INSTANCE ; } try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; ObjectOutputStream objectOutputStream = new ObjectOutputStream ( byteArrayOutputStream ) ; try { objectOutputStream . ... | Creates a new stack manipulation to load the supplied value onto the stack . |
33,124 | public void addReads ( Instrumentation instrumentation , JavaModule module ) { DISPATCHER . addReads ( instrumentation , this . module , module . unwrap ( ) ) ; } | Adds a read - edge to this module to the supplied module using the instrumentation API . |
33,125 | public EntryPoint getEntryPoint ( ClassLoaderResolver classLoaderResolver , File root , Iterable < ? extends File > classPath ) { if ( entryPoint == null || entryPoint . length ( ) == 0 ) { throw new GradleException ( "Entry point name is not defined" ) ; } for ( EntryPoint . Default entryPoint : EntryPoint . Default .... | Resolves this initialization to an entry point instance . |
33,126 | public void transformation ( Closure < ? > closure ) { transformations . add ( ( Transformation ) project . configure ( new Transformation ( project ) , closure ) ) ; } | Adds a transformation to apply . |
33,127 | public void initialization ( Closure < ? > closure ) { if ( initialization != null ) { throw new GradleException ( "Initialization is already set" ) ; } initialization = ( Initialization ) project . configure ( new Initialization ( ) , closure ) ; } | Adds an initialization to apply . |
33,128 | public MethodNameTransformer getMethodNameTransformer ( ) { return suffix == null || suffix . length ( ) == 0 ? MethodNameTransformer . Suffixing . withRandomSuffix ( ) : new MethodNameTransformer . Suffixing ( suffix ) ; } | Returns the method name transformer to use . |
33,129 | public void setup ( ) { baseClassDescription = TypePool . Default . ofSystemLoader ( ) . describe ( baseClass . getName ( ) ) . resolve ( ) ; } | Sets up this benchmark . |
33,130 | public ExampleInterface baseline ( ) { return new ExampleInterface ( ) { public boolean method ( boolean arg ) { return false ; } public byte method ( byte arg ) { return 0 ; } public short method ( short arg ) { return 0 ; } public int method ( int arg ) { return 0 ; } public char method ( char arg ) { return 0 ; } pu... | Creates a baseline for the benchmark . |
33,131 | public ExampleInterface benchmarkByteBuddy ( ) throws Exception { return new ByteBuddy ( ) . with ( TypeValidation . DISABLED ) . ignore ( none ( ) ) . subclass ( baseClass ) . method ( isDeclaredBy ( baseClass ) ) . intercept ( StubMethod . INSTANCE ) . make ( ) . load ( newClassLoader ( ) , ClassLoadingStrategy . Def... | Performs a benchmark of an interface implementation using Byte Buddy . |
33,132 | public ExampleInterface benchmarkCglib ( ) { Enhancer enhancer = new Enhancer ( ) ; enhancer . setUseCache ( false ) ; enhancer . setClassLoader ( newClassLoader ( ) ) ; enhancer . setSuperclass ( baseClass ) ; CallbackHelper callbackHelper = new CallbackHelper ( Object . class , new Class [ ] { baseClass } ) { protect... | Performs a benchmark of an interface implementation using cglib . |
33,133 | public ExampleInterface benchmarkJavassist ( ) throws Exception { ProxyFactory proxyFactory = new ProxyFactory ( ) { protected ClassLoader getClassLoader ( ) { return newClassLoader ( ) ; } } ; proxyFactory . setUseCache ( false ) ; proxyFactory . setUseWriteReplace ( false ) ; proxyFactory . setSuperclass ( Object . c... | Performs a benchmark of an interface implementation using javassist proxies . |
33,134 | public ExampleInterface benchmarkJdkProxy ( ) throws Exception { return ( ExampleInterface ) Proxy . newProxyInstance ( newClassLoader ( ) , new Class < ? > [ ] { baseClass } , new InvocationHandler ( ) { public Object invoke ( Object proxy , Method method , Object [ ] args ) { Class < ? > returnType = method . getRetu... | Performs a benchmark of an interface implementation using the Java Class Library s utilities . |
33,135 | private InstrumentedType applyConstructorStrategy ( InstrumentedType instrumentedType ) { if ( ! instrumentedType . isInterface ( ) ) { for ( MethodDescription . Token token : constructorStrategy . extractConstructors ( instrumentedType ) ) { instrumentedType = instrumentedType . withMethod ( token ) ; } } return instr... | Applies this builder s constructor strategy to the given instrumented type . |
33,136 | private void adjustStack ( int delta , int offset ) { if ( delta > 2 ) { throw new IllegalStateException ( "Cannot push multiple values onto the operand stack: " + delta ) ; } else if ( delta > 0 ) { int position = current . size ( ) ; while ( offset > 0 && position > 0 ) { offset -= current . get ( -- position ) . get... | Adjusts the current state of the operand stack . |
33,137 | public int drainStack ( int store , int load , StackSize size ) { int difference = current . get ( current . size ( ) - 1 ) . getSize ( ) - size . getSize ( ) ; if ( current . size ( ) == 1 && difference == 0 ) { return 0 ; } else { super . visitVarInsn ( store , freeIndex ) ; if ( difference == 1 ) { super . visitInsn... | Drains the stack to only contain the top value . For this the value on top of the stack is temporarily stored in the local variable array until all values on the stack are popped off . Subsequently the top value is pushed back onto the operand stack . |
33,138 | private void doDrain ( List < StackSize > stackSizes ) { ListIterator < StackSize > iterator = stackSizes . listIterator ( stackSizes . size ( ) ) ; while ( iterator . hasPrevious ( ) ) { StackSize current = iterator . previous ( ) ; switch ( current ) { case SINGLE : super . visitInsn ( Opcodes . POP ) ; break ; case ... | Drains all supplied elements of the operand stack . |
33,139 | public void register ( Label label , List < StackSize > stackSizes ) { sizes . put ( label , stackSizes ) ; } | Explicitly registers a label to define a given stack state . |
33,140 | public static AssignerConfigurable value ( TypeDescription fixedValue ) { return new ForPoolValue ( ClassConstant . of ( fixedValue ) , TypeDescription . CLASS ) ; } | Returns the given type in form of a loaded type . The value is loaded from the written class s constant pool . |
33,141 | protected ByteCodeAppender . Size apply ( MethodVisitor methodVisitor , Context implementationContext , MethodDescription instrumentedMethod , TypeDescription . Generic fixedValueType , StackManipulation valueLoadingInstruction ) { StackManipulation assignment = assigner . assign ( fixedValueType , instrumentedMethod .... | Blueprint method that for applying the actual implementation . |
33,142 | @ SuppressFBWarnings ( value = "REC_CATCH_EXCEPTION" , justification = "Applies Maven exception wrapper" ) public EntryPoint getEntryPoint ( ClassLoaderResolver classLoaderResolver , String groupId , String artifactId , String version , String packaging ) throws MojoExecutionException { if ( entryPoint == null || entry... | Resolves the described entry point . |
33,143 | public Class < ? > defineClass ( String name , byte [ ] binaryRepresentation ) throws ClassNotFoundException { return defineClasses ( Collections . singletonMap ( name , binaryRepresentation ) ) . get ( name ) ; } | Defines a new type to be loaded by this class loader . |
33,144 | public void setup ( ) { proxyInterceptor = MethodDelegation . to ( ByteBuddyProxyInterceptor . class ) ; accessInterceptor = MethodDelegation . to ( ByteBuddyAccessInterceptor . class ) ; prefixInterceptor = MethodDelegation . to ( ByteBuddyPrefixInterceptor . class ) ; baseClassDescription = TypePool . Default . ofSys... | A setup method to create precomputed delegator . |
33,145 | public ExampleClass benchmarkByteBuddyWithProxyAndReusedDelegator ( ) throws Exception { return new ByteBuddy ( ) . with ( TypeValidation . DISABLED ) . ignore ( none ( ) ) . subclass ( baseClass ) . method ( isDeclaredBy ( baseClass ) ) . intercept ( proxyInterceptor ) . make ( ) . load ( newClassLoader ( ) , ClassLoa... | Performs a benchmark of a class extension using Byte Buddy . This benchmark also uses the annotation - based approach but creates delegation methods which do not require the creation of additional classes . This benchmark reuses a precomputed delegator . |
33,146 | public ExampleClass benchmarkByteBuddyWithAccessorWithTypePool ( ) throws Exception { return ( ExampleClass ) new ByteBuddy ( ) . with ( TypeValidation . DISABLED ) . ignore ( none ( ) ) . subclass ( baseClassDescription ) . method ( isDeclaredBy ( baseClassDescription ) ) . intercept ( MethodDelegation . to ( accessCl... | Performs a benchmark of a class extension using Byte Buddy . This benchmark also uses the annotation - based approach but creates delegation methods which do not require the creation of additional classes . This benchmark uses a type pool to compare against usage of the reflection API . |
33,147 | public ExampleClass benchmarkByteBuddyWithAccessorAndReusedDelegatorWithTypePool ( ) throws Exception { return ( ExampleClass ) new ByteBuddy ( ) . with ( TypeValidation . DISABLED ) . ignore ( none ( ) ) . subclass ( baseClassDescription ) . method ( isDeclaredBy ( baseClassDescription ) ) . intercept ( accessIntercep... | Performs a benchmark of a class extension using Byte Buddy . This benchmark also uses the annotation - based approach but creates delegation methods which do not require the creation of additional classes . This benchmark reuses a precomputed delegator . This benchmark uses a type pool to compare against usage of the r... |
33,148 | public ExampleClass benchmarkCglib ( ) { Enhancer enhancer = new Enhancer ( ) ; enhancer . setUseCache ( false ) ; enhancer . setUseFactory ( false ) ; enhancer . setInterceptDuringConstruction ( true ) ; enhancer . setClassLoader ( newClassLoader ( ) ) ; enhancer . setSuperclass ( baseClass ) ; CallbackHelper callback... | Performs a benchmark of a class extension using cglib . |
33,149 | public ExampleClass benchmarkJavassist ( ) throws Exception { ProxyFactory proxyFactory = new ProxyFactory ( ) { protected ClassLoader getClassLoader ( ) { return newClassLoader ( ) ; } } ; proxyFactory . setUseCache ( false ) ; proxyFactory . setUseWriteReplace ( false ) ; proxyFactory . setSuperclass ( baseClass ) ; ... | Performs a benchmark of a class extension using javassist proxies . |
33,150 | public < T > DynamicType . Builder < T > rebase ( TypeDescription type , ClassFileLocator classFileLocator , MethodNameTransformer methodNameTransformer ) { if ( type . isArray ( ) || type . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Cannot rebase array or primitive type: " + type ) ; } return new Rebase... | Rebases the given type where any intercepted method that is declared by the redefined type is preserved within the rebased type s class such that the class s original can be invoked from the new method implementations . Rebasing a type can be seen similarly to creating a subclass where the subclass is later merged with... |
33,151 | protected static Implementation . Target of ( TypeDescription instrumentedType , MethodGraph . Linked methodGraph , ClassFileVersion classFileVersion , MethodRebaseResolver methodRebaseResolver ) { return new RebaseImplementationTarget ( instrumentedType , methodGraph , DefaultMethodInvocation . of ( classFileVersion )... | Creates a new rebase implementation target . |
33,152 | private Implementation . SpecialMethodInvocation invokeSuper ( MethodGraph . Node node ) { return node . getSort ( ) . isResolved ( ) ? Implementation . SpecialMethodInvocation . Simple . of ( node . getRepresentative ( ) , instrumentedType . getSuperClass ( ) . asErasure ( ) ) : Implementation . SpecialMethodInvocatio... | Creates a special method invocation for the given node . |
33,153 | private Implementation . SpecialMethodInvocation invokeSuper ( MethodRebaseResolver . Resolution resolution ) { return resolution . isRebased ( ) ? RebasedMethodInvocation . of ( resolution . getResolvedMethod ( ) , instrumentedType , resolution . getAdditionalArguments ( ) ) : Implementation . SpecialMethodInvocation ... | Creates a special method invocation for the given rebase resolution . |
33,154 | @ SuppressWarnings ( "all" ) public static boolean register ( ClassFileTransformer classFileTransformer , Object classFileFactory ) { try { TypeDescription typeDescription = TypeDescription . ForLoadedType . of ( LambdaFactory . class ) ; Class < ? > lambdaFactory = ClassInjector . UsingReflection . ofSystemClassLoader... | Registers a class file transformer together with a factory for creating a lambda expression . It is possible to call this method independently of the class loader s context as the supplied injector makes sure that the manipulated collection is the one that is held by the system class loader . |
33,155 | @ SuppressWarnings ( "all" ) public static boolean release ( ClassFileTransformer classFileTransformer ) { try { @ SuppressWarnings ( "unchecked" ) Map < ClassFileTransformer , ? > classFileTransformers = ( Map < ClassFileTransformer , ? > ) ClassLoader . getSystemClassLoader ( ) . loadClass ( LambdaFactory . class . g... | Releases a class file transformer . |
33,156 | private byte [ ] invoke ( Object caller , String invokedName , Object invokedType , Object samMethodType , Object implMethod , Object instantiatedMethodType , boolean serializable , List < Class < ? > > markerInterfaces , List < ? > additionalBridges , Collection < ClassFileTransformer > classFileTransformers ) { try {... | Applies this lambda meta factory . |
33,157 | public static byte [ ] make ( Object caller , String invokedName , Object invokedType , Object samMethodType , Object implMethod , Object instantiatedMethodType , boolean serializable , List < Class < ? > > markerInterfaces , List < ? > additionalBridges ) { return CLASS_FILE_TRANSFORMERS . values ( ) . iterator ( ) . ... | Dispatches the creation of a new class representing a class file . |
33,158 | public ModifierAdjustment withMethodModifiers ( ElementMatcher < ? super MethodDescription > matcher , List < ? extends ModifierContributor . ForMethod > modifierContributors ) { return withInvokableModifiers ( isMethod ( ) . and ( matcher ) , modifierContributors ) ; } | Adjusts a method s modifiers if it fulfills the supplied matcher . |
33,159 | public ModifierAdjustment withInvokableModifiers ( ElementMatcher < ? super MethodDescription > matcher , List < ? extends ModifierContributor . ForMethod > modifierContributors ) { return new ModifierAdjustment ( typeAdjustments , fieldAdjustments , CompoundList . of ( new Adjustment < MethodDescription > ( matcher , ... | Adjusts a method s or constructor s modifiers if it fulfills the supplied matcher . |
33,160 | public ClassLoader resolve ( MavenCoordinate mavenCoordinate ) throws MojoFailureException , MojoExecutionException { ClassLoader classLoader = classLoaders . get ( mavenCoordinate ) ; if ( classLoader == null ) { classLoader = doResolve ( mavenCoordinate ) ; classLoaders . put ( mavenCoordinate , classLoader ) ; } ret... | Resolves a Maven coordinate to a class loader that can load all of the coordinates classes . If a Maven coordinate was resolved previously the previously created class loader is returned . |
33,161 | private ClassLoader doResolve ( MavenCoordinate mavenCoordinate ) throws MojoExecutionException , MojoFailureException { List < URL > urls = new ArrayList < URL > ( ) ; log . info ( "Resolving transformer dependency: " + mavenCoordinate ) ; try { DependencyNode root = repositorySystem . collectDependencies ( repository... | Resolves a Maven coordinate to a class loader that can load all of the coordinates classes . |
33,162 | public static Map < TypeDescription , Class < ? > > load ( ClassLoader classLoader , Map < TypeDescription , byte [ ] > types ) { return load ( classLoader , types , ClassLoadingStrategy . NO_PROTECTION_DOMAIN , PersistenceHandler . LATENT , PackageDefinitionStrategy . Trivial . INSTANCE , false , true ) ; } | Loads a given set of class descriptions and their binary representations . |
33,163 | @ SuppressFBWarnings ( value = "DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" , justification = "Privilege is explicit user responsibility" ) public static Map < TypeDescription , Class < ? > > load ( ClassLoader classLoader , Map < TypeDescription , byte [ ] > types , ProtectionDomain protectionDomain , PersistenceHandl... | Loads a given set of class descriptions and their binary representations using a child - first class loader . |
33,164 | private boolean isShadowed ( String resourceName ) { if ( persistenceHandler . isManifest ( ) || ! resourceName . endsWith ( CLASS_FILE_SUFFIX ) ) { return false ; } synchronized ( this ) { String typeName = resourceName . replace ( '/' , '.' ) . substring ( 0 , resourceName . length ( ) - CLASS_FILE_SUFFIX . length ( ... | Checks if a resource name represents a class file of a class that was loaded by this class loader . |
33,165 | public static MethodDelegation toMethodReturnOf ( String name , MethodGraph . Compiler methodGraphCompiler ) { return withDefaultConfiguration ( ) . toMethodReturnOf ( name , methodGraphCompiler ) ; } | Delegates any intercepted method to invoke a method on an instance that is returned by a parameterless method of the given name . To be considered a valid delegation target a method must be visible and accessible to the instrumented type . This is the case if the method s declaring type is either public or in the same ... |
33,166 | public Implementation . Composable withAssigner ( Assigner assigner ) { return new MethodDelegation ( implementationDelegate , parameterBinders , ambiguityResolver , terminationHandler , bindingResolver , assigner ) ; } | Applies an assigner to the method delegation that is used for assigning method return and parameter types . |
33,167 | public static void main ( String [ ] args ) throws RunnerException { new Runner ( new OptionsBuilder ( ) . include ( WILDCARD + SuperClassInvocationBenchmark . class . getSimpleName ( ) + WILDCARD ) . include ( WILDCARD + StubInvocationBenchmark . class . getSimpleName ( ) + WILDCARD ) . include ( WILDCARD + ClassByImp... | Executes the benchmark . |
33,168 | public static Action < AbstractCompile > of ( Project project ) { return new PostCompilationAction ( project , project . getExtensions ( ) . create ( "byteBuddy" , ByteBuddyExtension . class , project ) ) ; } | Creates a post compilation action . |
33,169 | private ClassLoader doResolve ( Set < ? extends File > classPath ) { List < URL > urls = new ArrayList < URL > ( classPath . size ( ) ) ; for ( File file : classPath ) { try { urls . add ( file . toURI ( ) . toURL ( ) ) ; } catch ( MalformedURLException exception ) { throw new GradleException ( "Cannot resolve " + file... | Resolves a class path to a class loader . |
33,170 | public static Weighted < Arborescence < Node > > getMaxArborescence ( WeightedGraph graph , Node root ) { return getMaxArborescence ( graph . filterEdges ( not ( DirectedEdge . hasDestination ( root ) ) ) ) ; } | Find an optimal arborescence of the given graph graph rooted in the given node root . |
33,171 | public static Weighted < Arborescence < Node > > getMaxArborescence ( WeightedGraph graph ) { final PartialSolution partialSolution = PartialSolution . initialize ( graph . filterEdges ( not ( DirectedEdge . isAutoCycle ( ) ) ) ) ; final Deque < Node > componentsWithNoInEdges = new ArrayDeque < > ( partialSolution . ge... | Find an optimal arborescence of the given graph . |
33,172 | public static < DESERIALISED > Serialiser < DESERIALISED , ? > of ( AttributeType . DataType < DESERIALISED > dataType ) { Serialiser < ? , ? > serialiser = serialisers . get ( dataType ) ; if ( serialiser == null ) { throw new UnsupportedOperationException ( "Unsupported DataType: " + dataType . toString ( ) ) ; } ret... | accessed via the constant properties defined above . |
33,173 | private AttributeAtom rewriteWithRelationVariable ( Atom parentAtom ) { if ( parentAtom . isResource ( ) && ( ( AttributeAtom ) parentAtom ) . getRelationVariable ( ) . isReturned ( ) ) return rewriteWithRelationVariable ( ) ; return this ; } | rewrites the atom to one with relation variable |
33,174 | Set < List < Fragment > > allFragmentOrders ( ) { Collection < List < EquivalentFragmentSet > > fragmentSetPermutations = Collections2 . permutations ( equivalentFragmentSets ) ; return fragmentSetPermutations . stream ( ) . flatMap ( ConjunctionQuery :: cartesianProduct ) . collect ( toSet ( ) ) ; } | Get all possible orderings of fragments |
33,175 | private static double branchWeight ( Node node , Arborescence < Node > arborescence , Map < Node , Set < Node > > edgesParentToChild , Map < Node , Map < Node , Fragment > > edgeFragmentChildToParent ) { Double nodeWeight = node . getNodeWeight ( ) ; if ( nodeWeight == null ) { nodeWeight = getEdgeFragmentCost ( node ,... | recursively compute the weight of a branch |
33,176 | private static double nodeFragmentWeight ( Node node ) { double costFragmentsWithoutDependency = node . getFragmentsWithoutDependency ( ) . stream ( ) . mapToDouble ( Fragment :: fragmentCost ) . sum ( ) ; double costFragmentsWithDependencyVisited = node . getFragmentsWithDependencyVisited ( ) . stream ( ) . mapToDoubl... | compute the total cost of a node |
33,177 | private static double getEdgeFragmentCost ( Node node , Arborescence < Node > arborescence , Map < Node , Map < Node , Fragment > > edgeToFragment ) { Fragment fragment = getEdgeFragment ( node , arborescence , edgeToFragment ) ; if ( fragment != null ) return fragment . fragmentCost ( ) ; return 0D ; } | get edge fragment cost in order to map branch cost |
33,178 | public boolean add ( ConceptMap answer , ConceptMap answerIndex ) { Index ind = Index . of ( answerIndex . vars ( ) ) ; if ( ind . equals ( index ) ) { return indexedAnswers . put ( answerIndex , answer ) ; } throw new IllegalStateException ( "Illegal index: " + answerIndex + " indices: " + index ) ; } | add answer with specific index |
33,179 | public Map < Variable , ConceptId > idTransform ( ReasonerQueryImpl query , Unifier unifier ) { Map < Variable , ConceptId > transform = new HashMap < > ( ) ; this . getAtoms ( IdPredicate . class ) . forEach ( thisP -> { Collection < Variable > vars = unifier . get ( thisP . getVarName ( ) ) ; Variable var = ! vars . ... | returns id transform that would convert this query to a query alpha - equivalent to the query provided they are structurally equivalent |
33,180 | public ConceptMap getSubstitution ( ) { if ( substitution == null ) { Set < Variable > varNames = getVarNames ( ) ; Set < IdPredicate > predicates = getAtoms ( IsaAtomBase . class ) . map ( IsaAtomBase :: getTypePredicate ) . filter ( Objects :: nonNull ) . filter ( p -> varNames . contains ( p . getVarName ( ) ) ) . c... | Does id predicates - > answer conversion |
33,181 | public Stream < Casting > castingsRelation ( Role ... roles ) { Set < Role > roleSet = new HashSet < > ( Arrays . asList ( roles ) ) ; if ( roleSet . isEmpty ( ) ) { return vertex ( ) . getEdgesOfType ( Direction . OUT , Schema . EdgeLabel . ROLE_PLAYER ) . map ( edge -> Casting . withRelation ( edge , owner ) ) ; } Se... | Castings are retrieved from the perspective of the Relation |
33,182 | public Explanation childOf ( ConceptMap ans ) { return new Explanation ( getPattern ( ) , ans . explanation ( ) . getAnswers ( ) ) ; } | produce a new explanation with a provided parent answer |
33,183 | private void validate ( Concept concept ) { validateParam ( concept , TYPE , Thing . class , Thing :: type ) ; validateParam ( concept , SUPER_CONCEPT , SchemaConcept . class , SchemaConcept :: sup ) ; validateParam ( concept , LABEL , SchemaConcept . class , SchemaConcept :: label ) ; validateParam ( concept , ID , Co... | Check if this pre - existing concept conforms to all specified parameters |
33,184 | private < S extends Concept , T > void validateParam ( Concept concept , BuilderParam < T > param , Class < S > conceptType , Function < S , T > getter ) { if ( has ( param ) ) { T value = use ( param ) ; boolean isInstance = conceptType . isInstance ( concept ) ; if ( ! isInstance || ! Objects . equals ( getter . appl... | Check if the concept is of the given type and has a property that matches the given parameter . |
33,185 | public static void setSuper ( SchemaConcept subConcept , SchemaConcept superConcept ) { if ( superConcept . isEntityType ( ) ) { subConcept . asEntityType ( ) . sup ( superConcept . asEntityType ( ) ) ; } else if ( superConcept . isRelationType ( ) ) { subConcept . asRelationType ( ) . sup ( superConcept . asRelationTy... | Make the second argument the super of the first argument |
33,186 | public void markForDeduplication ( KeyspaceImpl keyspace , String index , ConceptId conceptId ) { Attribute attribute = Attribute . create ( keyspace , index , conceptId ) ; LOG . trace ( "insert({})" , attribute ) ; queue . insert ( attribute ) ; } | Marks an attribute for deduplication . The attribute will be inserted to an internal queue to be processed by the de - duplicator daemon in real - time . The attribute must have been inserted to the database prior to calling this method . |
33,187 | public static < T > Partition < T > singletons ( Collection < T > nodes ) { final Map < T , T > parents = Maps . newHashMap ( ) ; final Map < T , Integer > ranks = Maps . newHashMap ( ) ; for ( T node : nodes ) { parents . put ( node , node ) ; ranks . put ( node , 0 ) ; } return new Partition < T > ( parents , ranks )... | Constructs a new partition of singletons |
33,188 | public V componentOf ( V i ) { final V parent = parents . getOrDefault ( i , i ) ; if ( parent . equals ( i ) ) { return i ; } else { parents . put ( i , componentOf ( parent ) ) ; } return parents . get ( i ) ; } | Find the representative for the given item |
33,189 | public V merge ( V a , V b ) { final V aHead = componentOf ( a ) ; final V bHead = componentOf ( b ) ; if ( aHead . equals ( bHead ) ) return aHead ; final int aRank = ranks . getOrDefault ( aHead , 0 ) ; final int bRank = ranks . getOrDefault ( bHead , 0 ) ; if ( aRank > bRank ) { parents . put ( bHead , aHead ) ; ret... | Merges the given components and returns the representative of the new component |
33,190 | public boolean sameComponent ( V a , V b ) { return componentOf ( a ) . equals ( componentOf ( b ) ) ; } | Determines whether the two items are in the same component or not |
33,191 | private void validateRelationType ( RelationType relationType ) { ValidateGlobalRules . validateHasMinimumRoles ( relationType ) . ifPresent ( errorsFound :: add ) ; errorsFound . addAll ( ValidateGlobalRules . validateRelationTypesToRolesSchema ( relationType ) ) ; } | Validation rules exclusive to relation types |
33,192 | public void link ( ConceptImpl concept ) { concept . vertex ( ) . addEdge ( vertex ( ) , Schema . EdgeLabel . ISA ) ; } | Links a new concept to this shard . |
33,193 | static boolean isAlive ( Vertex vertex ) { if ( vertex == null ) return false ; try { return Sets . newHashSet ( Schema . BaseType . values ( ) ) . contains ( Schema . BaseType . valueOf ( vertex . label ( ) ) ) ; } catch ( IllegalStateException e ) { return false ; } } | The state of the vertex in the database . This may detect ghost nodes and allow them to be excluded from computations . If the vertex is alive it is likely to be a valid Grakn concept . |
33,194 | static < T > Set < T > reduceSet ( Iterator < Set < T > > values ) { Set < T > set = new HashSet < > ( ) ; while ( values . hasNext ( ) ) { set . addAll ( values . next ( ) ) ; } return set ; } | A helper method for set MapReduce . It simply combines sets into one set . |
33,195 | static < K , V > Map < K , V > keyValuesToMap ( Iterator < KeyValue < K , V > > keyValues ) { Map < K , V > map = new HashMap < > ( ) ; keyValues . forEachRemaining ( pair -> map . put ( pair . getKey ( ) , pair . getValue ( ) ) ) ; return map ; } | Transforms an iterator of key - value pairs into a map |
33,196 | private static boolean mayHaveResourceEdge ( TransactionOLTP graknGraph , ConceptId conceptId1 , ConceptId conceptId2 ) { Concept concept1 = graknGraph . getConcept ( conceptId1 ) ; Concept concept2 = graknGraph . getConcept ( conceptId2 ) ; return concept1 != null && concept2 != null && ( concept1 . isAttribute ( ) ||... | Check whether it is possible that there is a resource edge between the two given concepts . |
33,197 | public static ConceptId getResourceEdgeId ( TransactionOLTP graph , ConceptId conceptId1 , ConceptId conceptId2 ) { if ( mayHaveResourceEdge ( graph , conceptId1 , conceptId2 ) ) { Optional < Concept > firstConcept = graph . stream ( Graql . match ( var ( "x" ) . id ( conceptId1 . getValue ( ) ) , var ( "y" ) . id ( co... | Get the resource edge id if there is one . Return null if not . |
33,198 | public static Server createServer ( boolean benchmark ) { ServerID serverID = ServerID . me ( ) ; Config config = Config . create ( ) ; JanusGraphFactory janusGraphFactory = new JanusGraphFactory ( config ) ; LockManager lockManager = new ServerLockManager ( ) ; KeyspaceManager keyspaceStore = new KeyspaceManager ( jan... | Create a Server configured for Grakn Core . |
33,199 | public static Server createServer ( ServerID serverID , io . grpc . Server rpcServer , LockManager lockManager , AttributeDeduplicatorDaemon attributeDeduplicatorDaemon , KeyspaceManager keyspaceStore ) { Server server = new Server ( serverID , lockManager , rpcServer , attributeDeduplicatorDaemon , keyspaceStore ) ; R... | Allows the creation of a Server instance with various configurations |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.