idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
5,000
private List < ODocument > recursivePathSearch ( String start , String end , List < String > ids , ODocument ... steps ) { List < ODocument > neighbors = getNeighborsOfModel ( start ) ; for ( ODocument neighbor : neighbors ) { if ( alreadyVisited ( neighbor , steps ) || ! OrientModelGraphUtils . getActiveFieldValue ( n...
Recursive path search function . It performs a depth first search with integrated loop check to find a path from the start model to the end model . If the id list is not empty then the function only returns a path as valid if all transformations defined with the id list are in the path . It also takes care of models wh...
396
78
5,001
private ODocument getEdgeWithPossibleId ( String start , String end , List < String > ids ) { List < ODocument > edges = getEdgesBetweenModels ( start , end ) ; for ( ODocument edge : edges ) { if ( ids . contains ( OrientModelGraphUtils . getIdFieldValue ( edge ) ) ) { return edge ; } } return edges . size ( ) != 0 ? ...
Returns an edge between the start and the end model . If there is an edge which has an id which is contained in the given id list then this transformation is returned . If not then the first found is returned .
99
43
5,002
private boolean alreadyVisited ( ODocument neighbor , ODocument [ ] steps ) { for ( ODocument step : steps ) { ODocument out = graph . getOutVertex ( step ) ; if ( out . equals ( neighbor ) ) { return true ; } } return false ; }
Checks if a model is already visited in the path search algorithm . Needed for the loop detection .
59
21
5,003
public boolean isModelActive ( ModelDescription model ) { lockingMechanism . readLock ( ) . lock ( ) ; try { ODocument node = getModel ( model . toString ( ) ) ; return OrientModelGraphUtils . getActiveFieldValue ( node ) ; } finally { lockingMechanism . readLock ( ) . unlock ( ) ; } }
Returns true if the model is currently active returns false if not .
74
13
5,004
protected com . sun . jersey . api . client . Client getJerseyClient ( ) { final ClientConfig clientConfig = new DefaultClientConfig ( ) ; clientConfig . getFeatures ( ) . put ( JSONConfiguration . FEATURE_POJO_MAPPING , Boolean . TRUE ) ; com . sun . jersey . api . client . Client client = com . sun . jersey . api . c...
Return a configured Jersey client for Galaxy API code to interact with . If this method is overridden ensure FEATURE_POJO_MAPPING is enabled .
119
32
5,005
public static boolean isEmpty ( final Collection < String > c ) { if ( c == null || c . isEmpty ( ) ) { return false ; } for ( final String text : c ) { if ( isNotEmpty ( text ) ) { return false ; } } return true ; }
Check if a collection of a string is empty .
60
10
5,006
public static boolean isBlank ( final Collection < String > c ) { if ( c == null || c . isEmpty ( ) ) { return false ; } for ( final String text : c ) { if ( isNotBlank ( text ) ) { return false ; } } return true ; }
Check if a collection of a string is blank .
62
10
5,007
private boolean hello ( InetAddress broadcast ) { if ( socket == null ) return false ; Command hello = new Command ( ) ; byte [ ] helloMsg = hello . create ( ) ; DatagramPacket packet ; if ( ip == null ) { if ( this . acceptableModels == null ) return false ; packet = new DatagramPacket ( helloMsg , helloMsg . length ,...
Try to connect to a device or discover it .
516
10
5,008
public boolean discover ( ) { boolean helloResponse = false ; for ( int helloRetries = this . retries ; helloRetries >= 0 ; helloRetries -- ) { List < InetAddress > broadcast = listAllBroadcastAddresses ( ) ; if ( broadcast == null ) return false ; for ( InetAddress i : broadcast ) { if ( hello ( i ) ) { helloResponse ...
Connect to a device and send a Hello message . If no IP has been specified this will try do discover a device on the network .
102
27
5,009
public String send ( String payload ) throws CommandExecutionException { if ( payload == null ) throw new CommandExecutionException ( CommandExecutionException . Error . INVALID_PARAMETERS ) ; if ( deviceID == - 1 || timeStamp == - 1 || token == null || ip == null ) { if ( ! discover ( ) ) throw new CommandExecutionExc...
Send an arbitrary string as payload to the device .
397
10
5,010
public boolean update ( String url , String md5 ) throws CommandExecutionException { if ( url == null || md5 == null ) throw new CommandExecutionException ( CommandExecutionException . Error . INVALID_PARAMETERS ) ; if ( md5 . length ( ) != 32 ) throw new CommandExecutionException ( CommandExecutionException . Error . ...
Command the device to update
181
5
5,011
public int updateProgress ( ) throws CommandExecutionException { int resp = sendToArray ( "miIO.get_ota_progress" ) . optInt ( 0 , - 1 ) ; if ( ( resp < 0 ) || ( resp > 100 ) ) throw new CommandExecutionException ( CommandExecutionException . Error . INVALID_RESPONSE ) ; return resp ; }
Request the update progress as a percentage value from 0 to 100
82
12
5,012
public String updateStatus ( ) throws CommandExecutionException { String resp = sendToArray ( "miIO.get_ota_state" ) . optString ( 0 , null ) ; if ( resp == null ) throw new CommandExecutionException ( CommandExecutionException . Error . INVALID_RESPONSE ) ; return resp ; }
Request the update status .
73
5
5,013
public String model ( ) throws CommandExecutionException { JSONObject in = info ( ) ; if ( in == null ) throw new CommandExecutionException ( CommandExecutionException . Error . INVALID_RESPONSE ) ; return in . optString ( "model" ) ; }
Get the devices model id .
61
6
5,014
public static byte [ ] hexToBytes ( String s ) { try { if ( s == null ) return new byte [ 0 ] ; s = s . toUpperCase ( ) ; int len = s . length ( ) ; byte [ ] data = new byte [ len / 2 ] ; for ( int i = 0 ; i < len ; i += 2 ) { data [ i / 2 ] = ( byte ) ( ( Character . digit ( s . charAt ( i ) , 16 ) << 4 ) + Character ...
Convert a hexadecimal string to a byte array .
147
13
5,015
public static byte [ ] append ( byte [ ] first , byte [ ] second ) { if ( ( first == null ) || ( second == null ) ) return null ; byte [ ] output = new byte [ first . length + second . length ] ; System . arraycopy ( first , 0 , output , 0 , first . length ) ; System . arraycopy ( second , 0 , output , first . length ,...
Add two byte arrays to each other .
94
8
5,016
public static byte [ ] toBytes ( long value , int length ) { if ( length <= 0 ) return new byte [ 0 ] ; if ( length > 8 ) length = 8 ; byte [ ] out = new byte [ length ] ; for ( int i = length - 1 ; i >= 0 ; i -- ) { out [ i ] = ( byte ) ( value & 0xFF L ) ; value = value >> 8 ; } return out ; }
Convert a long to a byte array .
94
9
5,017
public static long fromBytes ( byte [ ] value ) { if ( value == null ) return 0 ; long out = 0 ; int length = value . length ; if ( length > 8 ) length = 8 ; for ( int i = 0 ; i < length ; i ++ ) { out = ( out << 8 ) + ( value [ i ] & 0xff ) ; } return out ; }
Convert a byte array to a long .
81
9
5,018
protected final void acceptAnnotations ( final MethodVisitor mv ) { int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { TypeAnnotationNode an = visibleTypeAnnotations . get ( i ) ; an . accept ( mv . visitInsnAnnotation ( an . typeRef , an . typePath , an ...
Makes the given visitor visit the annotations of this instruction .
183
12
5,019
protected final AbstractInsnNode cloneAnnotations ( final AbstractInsnNode insn ) { if ( insn . visibleTypeAnnotations != null ) { this . visibleTypeAnnotations = new ArrayList < TypeAnnotationNode > ( ) ; for ( int i = 0 ; i < insn . visibleTypeAnnotations . size ( ) ; ++ i ) { TypeAnnotationNode src = insn . visibleT...
Clones the annotations of the given instruction into this instruction .
271
12
5,020
public String getDebugInfo ( ) { StringBuilder sb = new StringBuilder ( "\r\n========BeanBox Debug for " + this + "===========\r\n" ) ; sb . append ( "target=" + this . target ) . append ( "\r\n" ) ; sb . append ( "pureValue=" + this . pureValue ) . append ( "\r\n" ) ; sb . append ( "type=" + this . type ) . append ( "...
For debug only will delete in future version
481
8
5,021
public synchronized BeanBox addBeanAop ( Object aop , String methodNameRegex ) { checkOrCreateMethodAopRules ( ) ; aopRules . add ( new Object [ ] { BeanBoxUtils . checkAOP ( aop ) , methodNameRegex } ) ; return this ; }
Add an AOP to Bean
66
6
5,022
public BeanBox injectField ( String fieldName , Object inject ) { BeanBox box = BeanBoxUtils . wrapParamToBox ( inject ) ; checkOrCreateFieldInjects ( ) ; Field f = ReflectionUtils . findField ( beanClass , fieldName ) ; box . setType ( f . getType ( ) ) ; ReflectionUtils . makeAccessible ( f ) ; this . getFieldInjects...
Inject class BeanBox class or instance
105
8
5,023
public BeanBox injectValue ( String fieldName , Object constValue ) { checkOrCreateFieldInjects ( ) ; Field f = ReflectionUtils . findField ( beanClass , fieldName ) ; BeanBox inject = new BeanBox ( ) ; inject . setTarget ( constValue ) ; inject . setType ( f . getType ( ) ) ; inject . setPureValue ( true ) ; Reflectio...
Inject a pure value to Field
117
7
5,024
public void updateIndex ( final int index ) { int newTypeRef = 0x42000000 | ( index << 8 ) ; if ( visibleTypeAnnotations != null ) { for ( TypeAnnotationNode tan : visibleTypeAnnotations ) { tan . typeRef = newTypeRef ; } } if ( invisibleTypeAnnotations != null ) { for ( TypeAnnotationNode tan : invisibleTypeAnnotation...
Updates the index of this try catch block in the method s list of try catch block nodes . This index maybe stored in the target field of the type annotations of this block .
98
36
5,025
public void accept ( final MethodVisitor mv ) { mv . visitTryCatchBlock ( start . getLabel ( ) , end . getLabel ( ) , handler == null ? null : handler . getLabel ( ) , type ) ; int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { TypeAnnotationNode an = vis...
Makes the given visitor visit this try catch block .
221
11
5,026
@ Override public void visitFormalTypeParameter ( final String name ) { if ( type == TYPE_SIGNATURE || ( state != EMPTY && state != FORMAL && state != BOUND ) ) { throw new IllegalStateException ( ) ; } CheckMethodAdapter . checkIdentifier ( name , "formal type parameter" ) ; state = FORMAL ; if ( sv != null ) { sv . v...
class and method signatures
95
4
5,027
static void appendConstant ( final StringBuffer buf , final Object cst ) { if ( cst == null ) { buf . append ( "null" ) ; } else if ( cst instanceof String ) { appendString ( buf , ( String ) cst ) ; } else if ( cst instanceof Type ) { buf . append ( "Type.getType(\"" ) ; buf . append ( ( ( Type ) cst ) . getDescriptor...
Appends a string representation of the given constant to the given buffer .
625
14
5,028
public static void verify ( final ClassReader cr , final ClassLoader loader , final boolean dump , final PrintWriter pw ) { ClassNode cn = new ClassNode ( ) ; cr . accept ( new CheckClassAdapter ( cn , false ) , ClassReader . SKIP_DEBUG ) ; Type syperType = cn . superName == null ? null : Type . getObjectType ( cn . su...
Checks a given class .
341
6
5,029
public static void verify ( final ClassReader cr , final boolean dump , final PrintWriter pw ) { verify ( cr , null , dump , pw ) ; }
Checks a given class
34
5
5,030
static void checkAccess ( final int access , final int possibleAccess ) { if ( ( access & ~ possibleAccess ) != 0 ) { throw new IllegalArgumentException ( "Invalid access flags: " + access ) ; } int pub = ( access & Opcodes . ACC_PUBLIC ) == 0 ? 0 : 1 ; int pri = ( access & Opcodes . ACC_PRIVATE ) == 0 ? 0 : 1 ; int pr...
Checks that the given access flags do not contain invalid flags . This method also checks that mutually incompatible flags are not set simultaneously .
219
26
5,031
public static void checkClassSignature ( final String signature ) { // ClassSignature: // FormalTypeParameters? ClassTypeSignature ClassTypeSignature* int pos = 0 ; if ( getChar ( signature , 0 ) == ' ' ) { pos = checkFormalTypeParameters ( signature , pos ) ; } pos = checkClassTypeSignature ( signature , pos ) ; while...
Checks a class signature .
139
6
5,032
public static void checkMethodSignature ( final String signature ) { // MethodTypeSignature: // FormalTypeParameters? ( TypeSignature* ) ( TypeSignature | V ) ( // ^ClassTypeSignature | ^TypeVariableSignature )* int pos = 0 ; if ( getChar ( signature , 0 ) == ' ' ) { pos = checkFormalTypeParameters ( signature , pos ) ...
Checks a method signature .
280
6
5,033
public static void checkFieldSignature ( final String signature ) { int pos = checkFieldTypeSignature ( signature , 0 ) ; if ( pos != signature . length ( ) ) { throw new IllegalArgumentException ( signature + ": error at index " + pos ) ; } }
Checks a field signature .
59
6
5,034
static void checkTypeRefAndPath ( int typeRef , TypePath typePath ) { int mask = 0 ; switch ( typeRef >>> 24 ) { case TypeReference . CLASS_TYPE_PARAMETER : case TypeReference . METHOD_TYPE_PARAMETER : case TypeReference . METHOD_FORMAL_PARAMETER : mask = 0xFFFF0000 ; break ; case TypeReference . FIELD : case TypeRefer...
Checks the reference to a type in a type annotation .
596
12
5,035
private static int checkFormalTypeParameters ( final String signature , int pos ) { // FormalTypeParameters: // < FormalTypeParameter+ > pos = checkChar ( ' ' , signature , pos ) ; pos = checkFormalTypeParameter ( signature , pos ) ; while ( getChar ( signature , pos ) != ' ' ) { pos = checkFormalTypeParameter ( signat...
Checks the formal type parameters of a class or method signature .
91
13
5,036
private static int checkFormalTypeParameter ( final String signature , int pos ) { // FormalTypeParameter: // Identifier : FieldTypeSignature? (: FieldTypeSignature)* pos = checkIdentifier ( signature , pos ) ; pos = checkChar ( ' ' , signature , pos ) ; if ( "L[T" . indexOf ( getChar ( signature , pos ) ) != - 1 ) { p...
Checks a formal type parameter of a class or method signature .
135
13
5,037
private static int checkFieldTypeSignature ( final String signature , int pos ) { // FieldTypeSignature: // ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature // // ArrayTypeSignature: // [ TypeSignature switch ( getChar ( signature , pos ) ) { case ' ' : return checkClassTypeSignature ( signature , pos ) ...
Checks a field type signature .
110
7
5,038
private static int checkClassTypeSignature ( final String signature , int pos ) { // ClassTypeSignature: // L Identifier ( / Identifier )* TypeArguments? ( . Identifier // TypeArguments? )* ; pos = checkChar ( ' ' , signature , pos ) ; pos = checkIdentifier ( signature , pos ) ; while ( getChar ( signature , pos ) == '...
Checks a class type signature .
196
7
5,039
private static int checkTypeArguments ( final String signature , int pos ) { // TypeArguments: // < TypeArgument+ > pos = checkChar ( ' ' , signature , pos ) ; pos = checkTypeArgument ( signature , pos ) ; while ( getChar ( signature , pos ) != ' ' ) { pos = checkTypeArgument ( signature , pos ) ; } return pos + 1 ; }
Checks the type arguments in a class type signature .
86
11
5,040
private static int checkTypeArgument ( final String signature , int pos ) { // TypeArgument: // * | ( ( + | - )? FieldTypeSignature ) char c = getChar ( signature , pos ) ; if ( c == ' ' ) { return pos + 1 ; } else if ( c == ' ' || c == ' ' ) { pos ++ ; } return checkFieldTypeSignature ( signature , pos ) ; }
Checks a type argument in a class type signature .
92
11
5,041
private static int checkTypeVariableSignature ( final String signature , int pos ) { // TypeVariableSignature: // T Identifier ; pos = checkChar ( ' ' , signature , pos ) ; pos = checkIdentifier ( signature , pos ) ; return checkChar ( ' ' , signature , pos ) ; }
Checks a type variable signature .
65
7
5,042
private static int checkTypeSignature ( final String signature , int pos ) { // TypeSignature: // Z | C | B | S | I | F | J | D | FieldTypeSignature switch ( getChar ( signature , pos ) ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : return pos + 1 ; default : return checkFie...
Checks a type signature .
106
6
5,043
private static int checkIdentifier ( final String signature , int pos ) { if ( ! Character . isJavaIdentifierStart ( getChar ( signature , pos ) ) ) { throw new IllegalArgumentException ( signature + ": identifier expected at index " + pos ) ; } ++ pos ; while ( Character . isJavaIdentifierPart ( getChar ( signature , ...
Checks an identifier .
88
5
5,044
private static int checkChar ( final char c , final String signature , int pos ) { if ( getChar ( signature , pos ) == c ) { return pos + 1 ; } throw new IllegalArgumentException ( signature + ": '" + c + "' expected at index " + pos ) ; }
Checks a single character .
63
6
5,045
private static char getChar ( final String signature , int pos ) { return pos < signature . length ( ) ? signature . charAt ( pos ) : ( char ) 0 ; }
Returns the signature car at the given index .
37
9
5,046
public void accept ( final MethodVisitor mv , boolean visible ) { Label [ ] start = new Label [ this . start . size ( ) ] ; Label [ ] end = new Label [ this . end . size ( ) ] ; int [ ] index = new int [ this . index . size ( ) ] ; for ( int i = 0 ; i < start . length ; ++ i ) { start [ i ] = this . start . get ( i ) ....
Makes the given visitor visit this type annotation .
166
10
5,047
public static void appendString ( final StringBuffer buf , final String s ) { buf . append ( ' ' ) ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { char c = s . charAt ( i ) ; if ( c == ' ' ) { buf . append ( "\\n" ) ; } else if ( c == ' ' ) { buf . append ( "\\r" ) ; } else if ( c == ' ' ) { buf . append ( "\\\\" ) ;...
Appends a quoted string to a given buffer .
253
10
5,048
static void printList ( final PrintWriter pw , final List < ? > l ) { for ( int i = 0 ; i < l . size ( ) ; ++ i ) { Object o = l . get ( i ) ; if ( o instanceof List ) { printList ( pw , ( List < ? > ) o ) ; } else { pw . print ( o . toString ( ) ) ; } } }
Prints the given string tree .
90
7
5,049
public JettyBootstrap startServer ( Boolean join ) throws JettyBootstrapException { LOG . info ( "Starting Server..." ) ; IJettyConfiguration iJettyConfiguration = getInitializedConfiguration ( ) ; initServer ( iJettyConfiguration ) ; try { server . start ( ) ; } catch ( Exception e ) { throw new JettyBootstrapExceptio...
Starts the Jetty Server and join the calling thread .
243
12
5,050
public JettyBootstrap joinServer ( ) throws JettyBootstrapException { try { if ( isServerStarted ( ) ) { LOG . debug ( "Joining Server..." ) ; server . join ( ) ; } else { LOG . warn ( "Can't join Server. Not started" ) ; } } catch ( InterruptedException e ) { throw new JettyBootstrapException ( e ) ; } return this ; }
Blocks the calling thread until the server stops .
89
9
5,051
public JettyBootstrap stopServer ( ) throws JettyBootstrapException { LOG . info ( "Stopping Server..." ) ; try { if ( isServerStarted ( ) ) { handlers . stop ( ) ; server . stop ( ) ; LOG . info ( "Server stopped." ) ; } else { LOG . warn ( "Can't stop server. Already stopped" ) ; } } catch ( Exception e ) { throw new...
Stops the Jetty server .
103
7
5,052
public WebAppContext addWarApp ( String war , String contextPath ) throws JettyBootstrapException { WarAppJettyHandler warAppJettyHandler = new WarAppJettyHandler ( getInitializedConfiguration ( ) ) ; warAppJettyHandler . setWar ( war ) ; warAppJettyHandler . setContextPath ( contextPath ) ; WebAppContext webAppContext...
Add a War application specifying the context path .
107
9
5,053
public WebAppContext addWarAppFromClasspath ( String warFromClasspath , String contextPath ) throws JettyBootstrapException { WarAppFromClasspathJettyHandler warAppFromClasspathJettyHandler = new WarAppFromClasspathJettyHandler ( getInitializedConfiguration ( ) ) ; warAppFromClasspathJettyHandler . setWarFromClasspath ...
Add a War application from the current classpath specifying the context path .
137
14
5,054
private void createShutdownHook ( ) { LOG . trace ( "Creating Jetty ShutdownHook..." ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ( ) -> { try { LOG . debug ( "Shutting Down..." ) ; stopServer ( ) ; } catch ( Exception e ) { LOG . error ( "Shutdown" , e ) ; } } ) ) ; }
Create Shutdown Hook .
87
4
5,055
public static Method [ ] getAllDeclaredMethods ( Class < ? > leafClass ) { final List < Method > methods = new ArrayList < Method > ( 32 ) ; doWithMethods ( leafClass , new MethodCallback ( ) { public void doWith ( Method method ) { methods . add ( method ) ; } } ) ; return methods . toArray ( new Method [ methods . si...
Get all declared methods on the leaf class and all superclasses . Leaf class methods are included first .
87
20
5,056
public static List < Field > getSelfAndSuperClassFields ( Class < ? > clazz ) { //YongZ added this method List < Field > fields = new ArrayList < Field > ( ) ; for ( Field field : clazz . getDeclaredFields ( ) ) fields . ( field ) ; Class < ? > superclass = clazz . getSuperclass ( ) ; while ( superclass != null ) { if ...
Get all fields of a class includes its super class s fields
145
12
5,057
public void check ( final int api ) { if ( api == Opcodes . ASM4 ) { if ( visibleTypeAnnotations != null && visibleTypeAnnotations . size ( ) > 0 ) { throw new RuntimeException ( ) ; } if ( invisibleTypeAnnotations != null && invisibleTypeAnnotations . size ( ) > 0 ) { throw new RuntimeException ( ) ; } int n = tryCatc...
Checks that this method node is compatible with the given ASM API version . This methods checks that this node and all its nodes recursively do not contain elements that were introduced in more recent versions of the ASM API than the given version .
434
50
5,058
public void accept ( final ClassVisitor cv ) { String [ ] exceptions = new String [ this . exceptions . size ( ) ] ; this . exceptions . toArray ( exceptions ) ; MethodVisitor mv = cv . visitMethod ( access , name , desc , signature , exceptions ) ; if ( mv != null ) { accept ( mv ) ; } }
Makes the given class visitor visit this method .
78
10
5,059
public void accept ( final AnnotationVisitor av ) { if ( av != null ) { if ( values != null ) { for ( int i = 0 ; i < values . size ( ) ; i += 2 ) { String name = ( String ) values . get ( i ) ; Object value = values . get ( i + 1 ) ; accept ( av , name , value ) ; } } av . visitEnd ( ) ; } }
Makes the given visitor visit this annotation .
91
9
5,060
static void accept ( final AnnotationVisitor av , final String name , final Object value ) { if ( av != null ) { if ( value instanceof String [ ] ) { String [ ] typeconst = ( String [ ] ) value ; av . visitEnum ( name , typeconst [ 0 ] , typeconst [ 1 ] ) ; } else if ( value instanceof AnnotationNode ) { AnnotationNode...
Makes the given visitor visit a given annotation value .
207
11
5,061
public static String getJarDir ( Class < ? > clazz ) { return decodeUrl ( new File ( clazz . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ) . getParent ( ) ) ; }
Get Jar location
56
3
5,062
public void accept ( final MethodVisitor mv ) { mv . visitLocalVariable ( name , desc , signature , start . getLabel ( ) , end . getLabel ( ) , index ) ; }
Makes the given visitor visit this local variable declaration .
43
11
5,063
public List < SherdogBaseObject > parse ( String url ) throws IOException { Document document = ParserUtils . parseDocument ( url ) ; Elements select = document . select ( ".fightfinder_result tr" ) ; //removing the first one as it's the header if ( select . size ( ) > 0 ) { select . remove ( 0 ) ; } return select . st...
PArses a search page results
310
7
5,064
@ Override public Promise < Void > undeploy ( String deploymentID ) { return adapter . toPromise ( handler -> vertx . undeploy ( deploymentID , handler ) ) ; }
Undeploy a verticle
39
6
5,065
protected File transformInputFile ( File from ) throws MojoExecutionException { // create a temp file File tempFile ; try { tempFile = File . createTempFile ( "dotml-tmp" , ".xml" ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "error creating temp file to hold DOTML to DOT translation" , e ) ; } // ...
when we are using DOTML files we need to transform them to DOT files first .
230
17
5,066
public static ConstraintSecurityHandler getConstraintSecurityHandlerConfidential ( ) { Constraint constraint = new Constraint ( ) ; constraint . setDataConstraint ( Constraint . DC_CONFIDENTIAL ) ; ConstraintMapping constraintMapping = new ConstraintMapping ( ) ; constraintMapping . setConstraint ( constraint ) ; const...
Create constraint which redirect to Secure Port
133
7
5,067
@ Override public < T > Promise < Message < T > > send ( String address , Object message ) { return adapter . toPromise ( handler -> eventBus . send ( address , message , handler ) ) ; }
Send a message
46
3
5,068
void set ( final String name , final String desc , final Handle bsm , final Object [ ] bsmArgs ) { this . type = ' ' ; this . strVal1 = name ; this . strVal2 = desc ; this . objVal3 = bsm ; this . objVals = bsmArgs ; int hashCode = ' ' + name . hashCode ( ) * desc . hashCode ( ) * bsm . hashCode ( ) ; for ( int i = 0 ;...
Set this item to an InvokeDynamic item .
148
10
5,069
void checkFrameValue ( final Object value ) { if ( value == Opcodes . TOP || value == Opcodes . INTEGER || value == Opcodes . FLOAT || value == Opcodes . LONG || value == Opcodes . DOUBLE || value == Opcodes . NULL || value == Opcodes . UNINITIALIZED_THIS ) { return ; } if ( value instanceof String ) { checkInternalNam...
Checks a stack frame value .
152
7
5,070
static void checkOpcode ( final int opcode , final int type ) { if ( opcode < 0 || opcode > 199 || TYPE [ opcode ] != type ) { throw new IllegalArgumentException ( "Invalid opcode: " + opcode ) ; } }
Checks that the type of the given opcode is equal to the given type .
57
17
5,071
static void checkSignedByte ( final int value , final String msg ) { if ( value < Byte . MIN_VALUE || value > Byte . MAX_VALUE ) { throw new IllegalArgumentException ( msg + " (must be a signed byte): " + value ) ; } }
Checks that the given value is a signed byte .
59
11
5,072
static void checkSignedShort ( final int value , final String msg ) { if ( value < Short . MIN_VALUE || value > Short . MAX_VALUE ) { throw new IllegalArgumentException ( msg + " (must be a signed short): " + value ) ; } }
Checks that the given value is a signed short .
59
11
5,073
static void checkUnqualifiedName ( int version , final String name , final String msg ) { if ( ( version & 0xFFFF ) < Opcodes . V1_5 ) { checkIdentifier ( name , msg ) ; } else { for ( int i = 0 ; i < name . length ( ) ; ++ i ) { if ( ".;[/" . indexOf ( name . charAt ( i ) ) != - 1 ) { throw new IllegalArgumentExceptio...
Checks that the given string is a valid unqualified name .
124
13
5,074
static void checkIdentifier ( final String name , final int start , final int end , final String msg ) { if ( name == null || ( end == - 1 ? name . length ( ) <= start : end <= start ) ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must not be null or empty)" ) ; } if ( ! Character . isJavaIdentifierSta...
Checks that the given substring is a valid Java identifier .
207
13
5,075
static void checkMethodIdentifier ( int version , final String name , final String msg ) { if ( name == null || name . length ( ) == 0 ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must not be null or empty)" ) ; } if ( ( version & 0xFFFF ) >= Opcodes . V1_5 ) { for ( int i = 0 ; i < name . length ( ) ...
Checks that the given string is a valid Java identifier .
299
12
5,076
static void checkInternalName ( final String name , final String msg ) { if ( name == null || name . length ( ) == 0 ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must not be null or empty)" ) ; } if ( name . charAt ( 0 ) == ' ' ) { checkDesc ( name , false ) ; } else { checkInternalName ( name , 0 , -...
Checks that the given string is a valid internal class name .
96
13
5,077
static void checkInternalName ( final String name , final int start , final int end , final String msg ) { int max = end == - 1 ? name . length ( ) : end ; try { int begin = start ; int slash ; do { slash = name . indexOf ( ' ' , begin + 1 ) ; if ( slash == - 1 || slash > max ) { slash = max ; } checkIdentifier ( name ...
Checks that the given substring is a valid internal class name .
153
14
5,078
static void checkDesc ( final String desc , final boolean canBeVoid ) { int end = checkDesc ( desc , 0 , canBeVoid ) ; if ( end != desc . length ( ) ) { throw new IllegalArgumentException ( "Invalid descriptor: " + desc ) ; } }
Checks that the given string is a valid type descriptor .
62
12
5,079
static int checkDesc ( final String desc , final int start , final boolean canBeVoid ) { if ( desc == null || start >= desc . length ( ) ) { throw new IllegalArgumentException ( "Invalid type descriptor (must not be null or empty)" ) ; } int index ; switch ( desc . charAt ( start ) ) { case ' ' : if ( canBeVoid ) { ret...
Checks that a the given substring is a valid type descriptor .
341
14
5,080
static void checkMethodDesc ( final String desc ) { if ( desc == null || desc . length ( ) == 0 ) { throw new IllegalArgumentException ( "Invalid method descriptor (must not be null or empty)" ) ; } if ( desc . charAt ( 0 ) != ' ' || desc . length ( ) < 3 ) { throw new IllegalArgumentException ( "Invalid descriptor: " ...
Checks that the given string is a valid method descriptor .
218
12
5,081
void checkLabel ( final Label label , final boolean checkVisited , final String msg ) { if ( label == null ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must not be null)" ) ; } if ( checkVisited && labels . get ( label ) == null ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must be vi...
Checks that the given label is not null . This method can also check that the label has been visited .
89
22
5,082
private static void checkNonDebugLabel ( final Label label ) { Field f = getLabelStatusField ( ) ; int status = 0 ; try { status = f == null ? 0 : ( ( Integer ) f . get ( label ) ) . intValue ( ) ; } catch ( IllegalAccessException e ) { throw new Error ( "Internal error" ) ; } if ( ( status & 0x01 ) != 0 ) { throw new ...
Checks that the given label is not a label used only for debug purposes .
113
16
5,083
private static Field getLabelStatusField ( ) { if ( labelStatusField == null ) { labelStatusField = getLabelField ( "a" ) ; if ( labelStatusField == null ) { labelStatusField = getLabelField ( "status" ) ; } } return labelStatusField ; }
Returns the Field object corresponding to the Label . status field .
62
12
5,084
private static Field getLabelField ( final String name ) { try { Field f = Label . class . getDeclaredField ( name ) ; f . setAccessible ( true ) ; return f ; } catch ( NoSuchFieldException e ) { return null ; } }
Returns the field of the Label class whose name is given .
56
12
5,085
public void loadStoreFile ( ) { try { BufferedInputStream bis = new BufferedInputStream ( new FileInputStream ( this . storeFile ) ) ; JSONTokener jsonTokener = new JSONTokener ( new InputStreamReader ( bis ) ) ; JSONArray array = new JSONArray ( jsonTokener ) ; bis . close ( ) ; // Init our keys array with the correct...
Read the instance s associated keystore file into memory .
304
11
5,086
private void search ( ) throws IOException { String url = String . format ( SEARCH_URL , term , ( weightClass != null ) ? weightClass . getValue ( ) : "" , page ) ; dryEvents = new ArrayList <> ( ) ; dryFighters = new ArrayList <> ( ) ; List < SherdogBaseObject > parse = new SearchParser ( ) . parse ( url ) ; parse . f...
Triggers the actual search
172
6
5,087
public List < Fighter > getFightersWithCompleteData ( ) { return dryFighters . stream ( ) . map ( f -> { try { return sherdog . getFighter ( f . getSherdogUrl ( ) ) ; } catch ( IOException | ParseException | SherdogParserException e ) { return null ; } } ) . filter ( Objects :: nonNull ) . collect ( Collectors . toList...
Gets the fighter with the full data This method can be long as it will query each fighter page
92
20
5,088
public List < Event > getEventsWithCompleteData ( ) { return dryEvents . stream ( ) . map ( f -> { try { return sherdog . getEvent ( f . getSherdogUrl ( ) ) ; } catch ( IOException | ParseException | SherdogParserException e ) { return null ; } } ) . filter ( Objects :: nonNull ) . collect ( Collectors . toList ( ) ) ;...
Gets the events with the full data This method can be long as it will query each event page
89
20
5,089
public Frame < V > init ( final Frame < ? extends V > src ) { returnValue = src . returnValue ; System . arraycopy ( src . values , 0 , values , 0 , values . length ) ; top = src . top ; return this ; }
Copies the state of the given frame into this frame .
55
12
5,090
public void setLocal ( final int i , final V value ) throws IndexOutOfBoundsException { if ( i >= locals ) { throw new IndexOutOfBoundsException ( "Trying to access an inexistant local variable " + i ) ; } values [ i ] = value ; }
Sets the value of the given local variable .
61
10
5,091
public void push ( final V value ) throws IndexOutOfBoundsException { if ( top + locals >= values . length ) { throw new IndexOutOfBoundsException ( "Insufficient maximum stack size." ) ; } values [ top ++ + locals ] = value ; }
Pushes a value into the operand stack of this frame .
57
13
5,092
public boolean merge ( final Frame < ? extends V > frame , final Interpreter < V > interpreter ) throws AnalyzerException { if ( top != frame . top ) { throw new AnalyzerException ( null , "Incompatible stack heights" ) ; } boolean changes = false ; for ( int i = 0 ; i < locals + top ; ++ i ) { V v = interpreter . merg...
Merges this frame with the given frame .
126
9
5,093
public byte [ ] decrypt ( byte [ ] msg ) { if ( msg == null ) return null ; try { Cipher cipher = Cipher . getInstance ( ENCRYPTION_ALGORITHM_IMPLEMENTATION ) ; SecretKeySpec key = new SecretKeySpec ( getMd5 ( ) , ENCRYPTION_ALGORITHM ) ; IvParameterSpec iv = new IvParameterSpec ( getIv ( ) ) ; cipher . init ( Cipher ....
Decrypt a message with this token .
133
8
5,094
Stream < String > getRessourceLines ( Class < ? > clazz , String filepath ) { try ( final BufferedReader fileReader = new BufferedReader ( new InputStreamReader ( clazz . getResourceAsStream ( filepath ) , StandardCharsets . UTF_8 ) ) ) { // Collect the read lines before converting back to a Java stream // so that we c...
Package protected for testing purposes
134
5
5,095
public int count ( final String word ) { if ( word == null ) { throw new NullPointerException ( "the word parameter was null." ) ; } else if ( word . length ( ) == 0 ) { return 0 ; } else if ( word . length ( ) == 1 ) { return 1 ; } final String lowerCase = word . toLowerCase ( Locale . ENGLISH ) ; if ( exceptions . co...
Main point of this library . Method to count the number of syllables of a word using a fallback method as documented at the class level of this documentation .
321
32
5,096
public static void reset ( ) { globalBeanBoxContext . close ( ) ; globalNextAllowAnnotation = true ; globalNextAllowSpringJsrAnnotation = true ; globalNextValueTranslator = new DefaultValueTranslator ( ) ; CREATE_METHOD = "create" ; CONFIG_METHOD = "config" ; globalBeanBoxContext = new BeanBoxContext ( ) ; }
Reset global variants setting note this method only close globalBeanBoxContext if created many BeanBoxContext instance need close them manually
81
26
5,097
public void close ( ) { for ( Entry < Object , Object > singletons : singletonCache . entrySet ( ) ) { Object key = singletons . getKey ( ) ; Object obj = singletons . getValue ( ) ; if ( key instanceof BeanBox ) { BeanBox box = ( BeanBox ) key ; if ( box . getPreDestroy ( ) != null ) try { box . getPreDestroy ( ) . in...
Close current BeanBoxContext clear singlton cache call predestory methods for each singleton if they have
143
22
5,098
public RequestOptions addHeader ( String name , String value ) { if ( headers == null ) { headers = new CaseInsensitiveHeaders ( ) ; } headers . add ( name , value ) ; return this ; }
Add a header to the request . Can be called multiple times to add multiple headers
45
16
5,099
public static Document parseDocument ( String url ) throws IOException { return Jsoup . connect ( url ) . timeout ( Constants . PARSING_TIMEOUT ) . userAgent ( "Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" ) . referrer ( "http://www.google.com" ) . get ( ) ; }
PArses a URL with all the required parameters
109
10