method2testcases stringlengths 118 6.63k |
|---|
### Question:
CsnFactory { public Csn newInstance() { int tmpChangeCount; synchronized ( lock ) { long newTimestamp = System.currentTimeMillis(); if ( lastTimestamp == newTimestamp ) { changeCount++; } else { lastTimestamp = newTimestamp; changeCount = 0; } tmpChangeCount = changeCount; } return new Csn( lastTimestamp,... |
### Question:
Csn implements Comparable<Csn> { public Csn( long timestamp, int changeCount, int replicaId, int operationNumber ) { this.timestamp = timestamp; this.replicaId = replicaId; this.operationNumber = operationNumber; this.changeCount = changeCount; sdf.setTimeZone( UTC_TIME_ZONE ); } Csn( long timestamp, int ... |
### Question:
CsnComparator extends LdapComparator<Object> { @Override public int compare( Object csnObj1, Object csnObj2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13745_COMPARING_CSN, csnObj1, csnObj2 ) ); } if ( csnObj1 == csnObj2 ) { return 0; } if ( csnObj1 == null ) { return -1; } if ( csnObj... |
### Question:
IntegerComparator extends LdapComparator<Object> implements Serializable { @Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( St... |
### Question:
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { ret... |
### Question:
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1... |
### Question:
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }### Answer:
@Test public void testBothNull() { assertEquals( 0, new ByteArrayComparator( null ).co... |
### Question:
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 ... |
### Question:
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalized... |
### Question:
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { ret... |
### Question:
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean b... |
### Question:
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { retu... |
### Question:
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } } GeneralizedTime( Date date ); GeneralizedT... |
### Question:
NameForm extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } NameForm( String oid ); String getStructuralObjectClassOid(); ObjectClass getStructuralObjectClass(); void setStructuralObjectClassOid( String structuralObje... |
### Question:
MatchingRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } MatchingRule( String oid ); LdapSyntax getSyntax(); void setSyntax( LdapSyntax ldapSyntax ); String getSyntaxOid(); void setSyntaxOid( String oid ); Ldap... |
### Question:
LdapSyntax extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } LdapSyntax( String oid ); LdapSyntax( String oid, String description ); LdapSyntax( String oid, String description, boolean isHumanReadable ); boolean is... |
### Question:
GeneralizedTime implements Comparable<GeneralizedTime> { public Date getDate() { return calendar.getTime(); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneral... |
### Question:
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\... |
### Question:
SchemaUtils { static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescr... |
### Question:
SchemaUtils { public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' )... |
### Question:
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.si... |
### Question:
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ... |
### Question:
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOi... |
### Question:
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids )... |
### Question:
ObjectClass extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oid... |
### Question:
OidRegistry implements Iterable<T> { public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; } boolean contains( String oid ); String getPrimaryName( String oid ); T getSchemaObject( String oid ); List<String> getNameSet( String oid ); Iterator... |
### Question:
AttributeType extends AbstractSchemaObject implements Cloneable { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } AttributeType( String oid ); boolean isSingleValued(); void setSingleValued( boolean singleValued ); boolean isUserModifiable(); vo... |
### Question:
DitStructureRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } DitStructureRule( int ruleId ); String getForm(); void setForm( String form ); int getRuleId(); void setRuleId( int ruleId ); List<Integer> getSuperR... |
### Question:
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String va... |
### Question:
BooleanNormalizer extends Normalizer { @Override public String normalize( String value ) throws LdapInvalidDnException { if ( value == null ) { return null; } return Strings.upperCase( value.trim() ); } BooleanNormalizer(); @Override String normalize( String value ); @Override String normalize( String val... |
### Question:
SyntaxChecker extends LoadableSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } return o instanceof SyntaxChecker; } protected SyntaxChecker( String oid ); protected SyntaxChecker(); boolean isValidSyntax( Object value ); void setSchemaManager( Sche... |
### Question:
PrepareString { public static String normalize( String value ) { if ( !Normalizer.isNormalized( value, Normalizer.Form.NFKC ) ) { return Normalizer.normalize( value, Normalizer.Form.NFKC ); } else { return value; } } private PrepareString(); static String transcode( byte[] bytes ); static String normaliz... |
### Question:
DitContentRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } DitContentRule( String oid ); List<String> getAuxObjectClassOids(); void addAuxObjectClassOidOids( String oid ); void addAuxObjectClasses( ObjectClass ... |
### Question:
MatchingRuleUse extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } MatchingRuleUse( String oid ); List<String> getApplicableAttributeOids(); List<AttributeType> getApplicableAttributes(); void setApplicableAttributeOi... |
### Question:
Ava implements Externalizable, Cloneable, Comparable<Ava> { public String getName() { return upName; } Ava(); Ava( SchemaManager schemaManager ); Ava( SchemaManager schemaManager, Ava ava ); Ava( String upType, byte[] upValue ); Ava( SchemaManager schemaManager, String upType, byte[] upValue ); Ava( ... |
### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { @Override public String toString() { return upName == null ? "" : upName; } Rdn(); Rdn( SchemaManager schemaManager ); Rdn( SchemaManager schemaManager, String rdn ); Rdn( String rdn ); Rdn( SchemaManager schemaManager, String ... |
### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { public Object getValue( String type ) throws LdapInvalidDnException { String normalizedType = Strings.lowerCaseAscii( Strings.trim( type ) ); if ( schemaManager != null ) { AttributeType attributeType = schemaManager.getAttributeTy... |
### Question:
Oid { public static boolean isOid( String oidString ) { try { Oid.fromString( oidString ); return true; } catch ( DecoderException e ) { return false; } } private Oid( String oidString, byte[] oidBytes ); @Override boolean equals( Object other ); static Oid fromBytes( byte[] oidBytes ); static Oid fromSt... |
### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { public String getType() { switch ( nbAvas ) { case 0: return null; case 1: return ava.getType(); default: return avas.get( 0 ).getType(); } } Rdn(); Rdn( SchemaManager schemaManager ); Rdn( SchemaManager schemaManager, String rdn... |
### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { public int size() { return nbAvas; } Rdn(); Rdn( SchemaManager schemaManager ); Rdn( SchemaManager schemaManager, String rdn ); Rdn( String rdn ); Rdn( SchemaManager schemaManager, String upType, String upValue ); Rdn( String ... |
### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { @Override public Iterator<Ava> iterator() { if ( nbAvas < 2 ) { return new Iterator<Ava>() { private boolean hasMoreElement = nbAvas == 1; @Override public boolean hasNext() { return hasMoreElement; } @Override public Ava next() { ... |
### Question:
OsgiUtils { public static Set<File> getClasspathCandidates( FileFilter filter ) { Set<File> candidates = new HashSet<>(); String separator = System.getProperty( "path.separator" ); String[] cpElements = System.getProperty( "java.class.path" ).split( separator ); for ( String element : cpElements ) { File ... |
### Question:
LdifRevertor { public static LdifEntry reverseAdd( Dn dn ) { LdifEntry entry = new LdifEntry(); entry.setChangeType( ChangeType.Delete ); entry.setDn( dn ); return entry; } private LdifRevertor(); static LdifEntry reverseAdd( Dn dn ); static LdifEntry reverseDel( Dn dn, Entry deletedEntry ); static LdifE... |
### Question:
LdifRevertor { public static LdifEntry reverseDel( Dn dn, Entry deletedEntry ) throws LdapException { LdifEntry entry = new LdifEntry(); entry.setDn( dn ); entry.setChangeType( ChangeType.Add ); for ( Attribute attribute : deletedEntry ) { entry.addAttribute( attribute ); } return entry; } private LdifRe... |
### Question:
OsgiUtils { public static Set<String> getAllBundleExports( FileFilter filter, Set<String> pkgs ) { if ( pkgs == null ) { pkgs = new HashSet<>(); } Set<File> candidates = getClasspathCandidates( filter ); for ( File candidate : candidates ) { String exports = getBundleExports( candidate ); if ( exports == ... |
### Question:
LdifRevertor { public static LdifEntry reverseMove( Dn newSuperiorDn, Dn modifiedDn ) throws LdapException { LdifEntry entry = new LdifEntry(); Dn currentParent; Rdn currentRdn; Dn newDn; if ( newSuperiorDn == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13466_NEW_SUPERIOR_DN_NULL ) ); ... |
### Question:
Unicode { public static char bytesToChar( byte[] bytes ) { return bytesToChar( bytes, 0 ); } private Unicode(); static int countBytesPerChar( byte[] bytes, int pos ); static char bytesToChar( byte[] bytes ); static char bytesToChar( byte[] bytes, int pos ); static int countNbBytesPerChar( char car ); sta... |
### Question:
BitString { public boolean getBit( int pos ) { if ( pos > nbBits ) { throw new IndexOutOfBoundsException( I18n.err( I18n.ERR_00002_CANNOT_FIND_BIT, pos, nbBits ) ); } int posBytes = pos >>> 3; int bitNumber = 7 - pos % 8; byte mask = ( byte ) ( 1 << bitNumber ); int res = bytes[posBytes] & mask; return re... |
### Question:
LdifUtils { public static Attributes createJndiAttributes( Object... avas ) throws LdapException { StringBuilder sb = new StringBuilder(); int pos = 0; boolean valueExpected = false; for ( Object ava : avas ) { if ( !valueExpected ) { if ( !( ava instanceof String ) ) { throw new LdapInvalidAttributeValue... |
### Question:
Unicode { public static byte[] charToBytes( char car ) { if ( car <= 0x007F ) { byte[] bytes = new byte[1]; bytes[0] = ( byte ) car; return bytes; } else if ( car <= 0x07FF ) { byte[] bytes = new byte[2]; bytes[0] = ( byte ) ( 0x00C0 + ( ( car & 0x07C0 ) >> 6 ) ); bytes[1] = ( byte ) ( 0x0080 + ( car & 0x... |
### Question:
LdapConnectionConfig { public void setTrustManagers( TrustManager... trustManagers ) { if ( ( trustManagers == null ) || ( trustManagers.length == 0 ) || ( trustManagers.length == 1 && trustManagers[0] == null ) ) { throw new IllegalArgumentException( "TrustManagers must not be null or empty" ); } this.tr... |
### Question:
UnaryFilter extends AbstractFilter { public static UnaryFilter not() { return new UnaryFilter(); } private UnaryFilter(); static UnaryFilter not(); static UnaryFilter not( Filter filter ); @Override StringBuilder build( StringBuilder builder ); }### Answer:
@Test public void testNot() { AttributeDescrip... |
### Question:
SetOfFiltersFilter extends AbstractFilter { public static SetOfFiltersFilter and( Filter... filters ) { return new SetOfFiltersFilter( FilterOperator.AND ).addAll( filters ); } private SetOfFiltersFilter( FilterOperator operator ); SetOfFiltersFilter add( Filter filter ); SetOfFiltersFilter addAll( Filte... |
### Question:
SetOfFiltersFilter extends AbstractFilter { public static SetOfFiltersFilter or( Filter... filters ) { return new SetOfFiltersFilter( FilterOperator.OR ).addAll( filters ); } private SetOfFiltersFilter( FilterOperator operator ); SetOfFiltersFilter add( Filter filter ); SetOfFiltersFilter addAll( Filter.... |
### Question:
FilterBuilder { public static MatchingRuleAssertionFilterBuilder extensible( String value ) { return new MatchingRuleAssertionFilterBuilder( null, value ); } FilterBuilder( Filter filter ); static FilterBuilder and( FilterBuilder... filters ); static FilterBuilder approximatelyEqual( String attribute, Str... |
### Question:
FilterBuilder { FilterBuilder( Filter filter ) { this.filter = filter; } FilterBuilder( Filter filter ); static FilterBuilder and( FilterBuilder... filters ); static FilterBuilder approximatelyEqual( String attribute, String value ); static FilterBuilder equal( String attribute, String value ); static Mat... |
### Question:
MatchingRuleAssertionFilter extends AbstractFilter { public static MatchingRuleAssertionFilter extensible( String value ) { return new MatchingRuleAssertionFilter( null, value, FilterOperator.EXTENSIBLE_EQUAL ); } MatchingRuleAssertionFilter( String attribute, String value,
FilterOperator operato... |
### Question:
AttributeDescriptionFilter extends AbstractFilter { public static AttributeDescriptionFilter present( String attribute ) { return new AttributeDescriptionFilter( attribute ); } private AttributeDescriptionFilter( String attribute ); static AttributeDescriptionFilter present( String attribute ); @Override... |
### Question:
JarLdifSchemaLoader extends AbstractSchemaLoader { public JarLdifSchemaLoader() throws IOException, LdapException { initializeSchemas(); } JarLdifSchemaLoader(); @Override List<Entry> loadComparators( Schema... schemas ); @Override List<Entry> loadSyntaxCheckers( Schema... schemas ); @Override List<Entry>... |
### Question:
Hex { public static String decodeHexString( String str ) throws InvalidNameException { if ( str == null || str.length() == 0 ) { throw new InvalidNameException( I18n.err( I18n.ERR_17037_MUST_START_WITH_SHARP ) ); } char[] chars = str.toCharArray(); if ( chars[0] != '#' ) { throw new InvalidNameException( ... |
### Question:
DnNode { public synchronized DnNode<N> add( Dn dn ) throws LdapException { return add( dn, null ); } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getEle... |
### Question:
DnNode { public synchronized boolean hasChildren() { return ( children != null ) && children.size() != 0; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N... |
### Question:
Asn1Buffer2 { public void put( byte b ) { if ( pos == size ) { extend(); } currentBuffer.buffer[size - pos - 1] = b; pos++; } Asn1Buffer2(); int getPos(); void put( byte b ); void put( byte[] bytes ); byte[] getBytes(); int getSize(); void clear(); @Override String toString(); }### Answer:
@Test @Disable... |
### Question:
DnNode { public synchronized boolean isLeaf() { return !hasChildren(); } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); synchronized ... |
### Question:
DnNode { public synchronized N getElement() { return nodeElement; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); synchronized boole... |
### Question:
DnNode { public synchronized boolean hasElement() { return nodeElement != null; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); sync... |
### Question:
DnNode { public synchronized int size() { int size = 1; if ( children.size() != 0 ) { for ( DnNode<N> node : children.values() ) { size += node.size(); } } return size; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synch... |
### Question:
DnNode { public synchronized DnNode<N> getParent() { return parent; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); synchronized boo... |
### Question:
DnNode { public synchronized boolean hasParent() { return parent != null; } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); synchroniz... |
### Question:
DnNode { public synchronized boolean contains( Rdn rdn ) { return children.containsKey( rdn.getNormName() ); } DnNode(); DnNode( N element ); DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronize... |
### Question:
DnNode { public synchronized boolean hasParentElement( Dn dn ) { List<Rdn> rdns = dn.getRdns(); DnNode<N> currentNode = this; boolean hasElement = false; for ( int i = rdns.size() - 1; i >= 0; i-- ) { Rdn rdn = rdns.get( i ); if ( currentNode.hasChildren() ) { currentNode = currentNode.children.get( rdn.g... |
### Question:
DnNode { public synchronized void rename( Rdn newRdn ) throws LdapException { Dn temp = nodeDn.getParent(); temp = temp.add( newRdn ); Rdn oldRdn = nodeRdn; nodeRdn = temp.getRdn(); nodeDn = temp; if ( parent != null ) { parent.children.remove( oldRdn.getNormName() ); parent.children.put( nodeRdn.getNormN... |
### Question:
MaxValueCountItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( MaxValueCountElem item : items ) { if ( item != null ) { hash = hash * 17 + item.hashCode(); } else { hash = hash * 17 + 37; } } } return hash; } MaxValueCountItem( Set<MaxValueCountElem... |
### Question:
SpringCloudFunctionInvoker implements FunctionInvoker, Closeable { @Override public Optional<OutputEvent> tryInvoke(InvocationContext ctx, InputEvent evt) { SpringCloudMethod method = loader.getFunction(); Object[] userFunctionParams = coerceParameters(ctx, method, evt); Object result = tryInvoke(method, ... |
### Question:
RemoteFlowApiClient implements CompleterClient { @Override public CompletionId supply(FlowId flowId, Serializable supplier, CodeLocation codeLocation) { return addStageWithClosure(APIModel.CompletionOperation.SUPPLY, flowId, supplier, codeLocation, Collections.emptyList()); } RemoteFlowApiClient(String ap... |
### Question:
Headers implements Serializable { public static String canonicalKey(String key) { if (!headerName.matcher(key).matches()) { return key; } String parts[] = key.split("-", -1); for (int i = 0; i < parts.length; i++) { String p = parts[i]; if (p.length() > 0) { parts[i] = p.substring(0, 1).toUpperCase() + p.... |
### Question:
InputHandler { Map<String, InterceptorInstance> resolveInputInterceptors(String algorithmClassName) { Map<String,InterceptorInstance> result = new HashMap<String, InterceptorInstance>(); Class<?> clazz; try { clazz = Class.forName(algorithmClassName, false, getClass().getClassLoader()); } catch (ClassNotF... |
### Question:
ExecutionContext { public List<OutputDefinitionType> getOutputs() { return this.outputDefinitionTypes; } ExecutionContext(); ExecutionContext(OutputDefinitionType output); ExecutionContext(List< ? extends OutputDefinitionType> outputs); String getTempDirectoryPath(); List<OutputDefinitionType> getOutput... |
### Question:
InputHandler { InputDescriptionType getInputReferenceDescriptionType(String inputId) { for (InputDescriptionType tempDesc : this.processDesc.getDataInputs().getInputArray()) { if (inputId.equals(tempDesc.getIdentifier().getStringValue())) { return tempDesc; } } return null; } private InputHandler(Builder... |
### Question:
ExecuteRequest extends Request implements IObserver { public void updateStatusError(String errorMessage) { StatusType status = StatusType.Factory.newInstance(); net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport excRep = status .addNewProcessFailed().addNewExceptionReport(); excRep.setVersion("1.... |
### Question:
OutputDataItem extends ResponseData { public void updateResponseForLiteralData(ExecuteResponseDocument res, String dataTypeReference){ OutputDataType output = prepareOutput(res); String processValue = BasicXMLTypeFactory.getStringRepresentation(dataTypeReference, obj); LiteralDataType literalData = output... |
### Question:
RawData extends ResponseData { public InputStream getAsStream() throws ExceptionReport { try { if(obj instanceof ILiteralData){ return new ByteArrayInputStream(String.valueOf(obj.getPayload()).getBytes(Charsets.UTF_8)); } if(obj instanceof IBBOXData){ IBBOXData bbox = (IBBOXData) obj; StringBuilder builde... |
### Question:
MainViewModel extends AndroidViewModel { void init() { rmConnector.connect(getApplication()); rmConnector.setOnDataReceiveListener(event -> receiveColourMessage(event)); rmConnector.setOnPeerChangedListener(event -> liveDataPeerChangedEvent.postValue(event)); rmConnector.setOnConnectSuccessListener(meshId... |
### Question:
MainViewModel extends AndroidViewModel { void toRightMeshWalletActivty() { try { rmConnector.toRightMeshWalletActivty(); } catch (RightMeshException e) { Log.e(TAG, e.toString()); } } MainViewModel(@NonNull Application application); void setRightMeshConnector(RightMeshConnector rmConnector); }### Answer:... |
### Question:
MainViewModel extends AndroidViewModel { void sendColorMsg(MeshId targetMeshId, Colour msgColor) { try { if (targetMeshId != null) { String payload = targetMeshId.toString() + ":" + msgColor.toString(); rmConnector.sendDataReliable(targetMeshId, payload); } } catch (RightMeshException.RightMeshServiceDisc... |
### Question:
MainViewModel extends AndroidViewModel { @Override protected void onCleared() { try { rmConnector.stop(); } catch (RightMeshException.RightMeshServiceDisconnectedException e) { Log.e(TAG, "Service disconnected before stopping AndroidMeshManager with message" + e.getMessage()); } } MainViewModel(@NonNull A... |
### Question:
RightMeshConnector implements MeshStateListener { @Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED... |
### Question:
RightMeshConnector implements MeshStateListener { public void stop() throws RightMeshException.RightMeshServiceDisconnectedException { androidMeshManager.stop(); } RightMeshConnector(int meshPort); void connect(Context context); @Override void meshStateChanged(MeshId meshId, int state); void stop(); void ... |
### Question:
RightMeshConnector implements MeshStateListener { public void toRightMeshWalletActivty() throws RightMeshException { this.androidMeshManager.showSettingsActivity(); } RightMeshConnector(int meshPort); void connect(Context context); @Override void meshStateChanged(MeshId meshId, int state); void stop(); vo... |
### Question:
RightMeshConnector implements MeshStateListener { public void sendDataReliable(MeshId targetMeshId, String payload) throws RightMeshException, RightMeshException.RightMeshServiceDisconnectedException { androidMeshManager.sendDataReliable(androidMeshManager.getNextHopPeer(targetMeshId), meshPort, payload.g... |
### Question:
ParseBoolean { public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAll("\\*", " && " ); e... |
### Question:
ParseBooleanOriginal { public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.... |
### Question:
SecretSantaFinder { public Map<String, String> pair() { List<Family> families = new ArrayList<Family>(); if(2*maxFamilyMembers > totalNames){ return null; } for(String key: familyMembers.keySet()) { families.add(familyMembers.get(key)) ; } Collections.sort(families); List<String> receiveList = new ArrayLi... |
### Question:
CyclicWordsKata { public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<Str... |
### Question:
ParseRomanNumerals { public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix... |
### Question:
StateMachine { public String execute(String input) { String startState = entryState; for(int i = 0; i < input.length();i++){ char event = input.charAt(i) ; if(_symbols.indexOf(event) < 0) { return null; } String key = startState + "_" + event; if (endStates.containsKey(key)) { startState = endStates.get(k... |
### Question:
ShellMode { public static ShellMode from(String... arguments) { if (runInBatchMode(arguments)) { return new BatchMode(extractCommand(arguments)); } return new InteractiveMode(); } static String usage(); static ShellMode from(String... arguments); static ShellMode batch(String command); static ShellMode i... |
### Question:
Script extends ShellCommand implements Iterable<ShellCommand> { public Script(List<ShellCommand> commands) { this.commands = new ArrayList<ShellCommand>(commands); } Script(List<ShellCommand> commands); @Override void execute(ShellCommandHandler handler); Iterator<ShellCommand> iterator(); @Override int h... |
### Question:
AuthResource { public TempTokenResponse temporaryAuthToken(String scope) throws StorageException, UnsupportedEncodingException { if (Strings.isNullOrEmpty(scope)) { scope = "all"; } String tempToken = sessionManager.storeNewTempToken(); String xanauthURL = "xanauth: + URLEncoder.encode(scope, "UTF-8"); Te... |
### Question:
RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeights... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.