idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
119,700 | public static IConjunct either ( IConjunct conjunct1 , IConjunct conjunct2 ) { IConjunct conjunct ; if ( conjunct1 . getDisjunctCount ( ) == 0 ) { conjunct = conjunct2 ; } else if ( conjunct2 . getDisjunctCount ( ) == 0 ) { conjunct = conjunct1 ; } else { Conjunction conjunction = new Conjunction ( ) ; for ( Iterator <... | Returns the logical OR of the given CNF conditions . |
119,701 | public static IConjunct refactor ( IConjunct conjunct ) { Iterator < IDisjunct > disjuncts = conjunct . getDisjuncts ( ) ; IAssertion assertion = null ; while ( disjuncts . hasNext ( ) && ( assertion = toAssertion ( disjuncts . next ( ) ) ) == null ) ; return assertion == null ? conjunct : simplify ( new Conjunction ( ... | Return refactored conjunction formed by removing superfluous terms . |
119,702 | public static IConjunct remainder ( IConjunct conjunct , IAssertion assertion ) { Conjunction rest = new Conjunction ( ) ; for ( Iterator < IDisjunct > disjuncts = conjunct . getDisjuncts ( ) ; disjuncts . hasNext ( ) ; ) { IDisjunct disjunct = disjuncts . next ( ) ; if ( ! disjunct . contains ( assertion ) ) { rest . ... | Returns the remainder after removing all terms that contain the given assertion . |
119,703 | public static IAssertion toAssertion ( IDisjunct disjunct ) { return disjunct . getAssertionCount ( ) == 1 ? disjunct . getAssertions ( ) . next ( ) : null ; } | If the given disjunction consists of a single assertion returns the equivalent assertion . Otherwise return null . |
119,704 | public static IConjunct simplify ( IConjunct conjunct ) { return conjunct . getDisjunctCount ( ) == 1 ? conjunct . getDisjuncts ( ) . next ( ) : conjunct ; } | Returns the simple form of the given conjunction . |
119,705 | public static IDisjunct simplify ( IDisjunct disjunct ) { IAssertion assertion = toAssertion ( disjunct ) ; return assertion == null ? disjunct : assertion ; } | Returns the simple form of the given disjunction . |
119,706 | public static boolean isTautology ( IDisjunct disjunct ) { boolean tautology = false ; if ( disjunct != null ) { IAssertion [ ] assertions = IteratorUtils . toArray ( disjunct . getAssertions ( ) , IAssertion . class ) ; int max = assertions . length ; int maxCompared = max - 1 ; for ( int compared = 0 ; ! tautology &&... | Returns true if the given disjunction is universally true . |
119,707 | public static boolean satisfiesSome ( IConjunct condition , PropertySet properties ) { boolean satisfies ; Iterator < IDisjunct > disjuncts ; for ( disjuncts = condition . getDisjuncts ( ) , satisfies = ! disjuncts . hasNext ( ) ; ! satisfies && disjuncts . hasNext ( ) ; satisfies = disjuncts . next ( ) . satisfied ( p... | Returns true if the given properties partially satisfy the given condition . |
119,708 | public static IConjunct getUnsatisfied ( IConjunct condition , PropertySet properties ) { Conjunction unsatisfied = new Conjunction ( ) ; for ( Iterator < IDisjunct > disjuncts = condition . getDisjuncts ( ) ; disjuncts . hasNext ( ) ; ) { IDisjunct disjunct = disjuncts . next ( ) ; if ( ! disjunct . satisfied ( proper... | Returns the part of the given condition unsatisfied by the given properties . |
119,709 | public FunctionInputDef addVarDef ( IVarDef varDef ) { assert varDef != null ; assert varDef . getName ( ) != null ; if ( findVarDef ( varDef . getName ( ) ) >= 0 ) { throw new IllegalStateException ( "Variable=" + varDef . getName ( ) + " already defined for function=" + getName ( ) ) ; } vars_ . add ( varDef ) ; retu... | Adds a new variable definition . |
119,710 | public FunctionInputDef removeVarDef ( String name ) { int i = findVarDef ( name ) ; if ( i >= 0 ) { vars_ . remove ( i ) ; } return this ; } | Removes a variable definition . |
119,711 | public IVarDef getVarDef ( String name ) { int i = findVarDef ( name ) ; return i >= 0 ? vars_ . get ( i ) : null ; } | Returns the variable definition with the given name . |
119,712 | protected int findVarDef ( String name ) { int varCount = name == null ? 0 : vars_ . size ( ) ; int i ; for ( i = 0 ; i < varCount && ! name . equals ( vars_ . get ( i ) . getName ( ) ) ; i ++ ) ; return i < varCount ? i : - 1 ; } | Returns the index of the variable definition with the given name . |
119,713 | public IVarDef findVarPath ( String pathName ) { String [ ] path = DefUtils . toPath ( pathName ) ; IVarDef var ; return path == null ? null : ( var = getVarDef ( StringUtils . trimToNull ( path [ 0 ] ) ) ) == null ? null : var . find ( Arrays . copyOfRange ( path , 1 , path . length ) ) ; } | Returns the variable definition with the given path name . |
119,714 | public VarDef findVarDefPath ( String pathName ) { IVarDef var = findVarPath ( pathName ) ; return var != null && var . getClass ( ) . equals ( VarDef . class ) ? ( VarDef ) var : null ; } | Returns the individual variable definition with the given path name . |
119,715 | public void addConfiguredParam ( Parameter param ) { options_ . getTransformParams ( ) . put ( param . getName ( ) , param . getValue ( ) ) ; } | Adds a transform parameter . |
119,716 | public void setTransformDef ( File transformDef ) { options_ . setTransformDef ( transformDef ) ; if ( transformDef != null ) { options_ . setTransformType ( Options . TransformType . CUSTOM ) ; } } | Changes the transform file . |
119,717 | public static VarBinding create ( IVarDef varDef , VarValueDef valueDef ) { VarBinding binding = valueDef . isNA ( ) ? new VarNaBinding ( varDef . getPathName ( ) , varDef . getType ( ) ) : new VarBinding ( varDef . getPathName ( ) , varDef . getType ( ) , valueDef . getName ( ) ) ; binding . setValueValid ( valueDef .... | Creates a new VarBinding object . |
119,718 | public static String getProjectName ( File inputDefFile ) { String projectName = null ; if ( inputDefFile != null ) { String inputBase = FilenameUtils . getBaseName ( inputDefFile . getName ( ) ) ; projectName = inputBase . toLowerCase ( ) . endsWith ( "-input" ) ? inputBase . substring ( 0 , inputBase . length ( ) - "... | Returns the name of the project for the given input definition file . |
119,719 | public static String getVersion ( ) { Properties tcasesProperties = new Properties ( ) ; String tcasesPropertyFileName = "/tcases.properties" ; InputStream tcasesPropertyFile = null ; try { tcasesPropertyFile = Tcases . class . getResourceAsStream ( tcasesPropertyFileName ) ; tcasesProperties . load ( tcasesPropertyFil... | Returns a description of the current version . |
119,720 | public static Map < String , Collection < VarBindingDef > > getPropertySources ( FunctionInputDef function ) { SetValuedMap < String , VarBindingDef > sources = MultiMapUtils . newSetValuedHashMap ( ) ; toStream ( new VarDefIterator ( function ) ) . flatMap ( var -> toStream ( var . getValues ( ) ) . map ( value -> new... | Maps every property in the given function input definition to the variable value definitions that contribute it . |
119,721 | public static Map < String , Collection < IConditional > > getPropertyReferences ( FunctionInputDef function ) { SetValuedMap < String , IConditional > refs = MultiMapUtils . newSetValuedHashMap ( ) ; conditionals ( function ) . forEach ( conditional -> propertiesReferenced ( conditional . getCondition ( ) ) . forEach ... | Maps every property in the given FunctionInputDef to the conditional elements that reference it . |
119,722 | public static Map < String , Collection < VarBindingDef > > getPropertiesUnused ( FunctionInputDef function ) { Map < String , Collection < VarBindingDef > > sources = getPropertySources ( function ) ; Collection < String > unused = CollectionUtils . subtract ( sources . keySet ( ) , getPropertyReferences ( function ) ... | For every property in the given function input definition that is defined but never referenced maps the property to the variable value definitions that contribute it . |
119,723 | public static Map < String , Collection < IConditional > > getPropertiesUndefined ( FunctionInputDef function ) { Map < String , Collection < IConditional > > refs = getPropertyReferences ( function ) ; Collection < String > undefined = CollectionUtils . subtract ( refs . keySet ( ) , getPropertySources ( function ) . ... | For every property in the given function input definition that is referenced but never defined maps the property to the conditional elements that reference it . |
119,724 | public static String getReferenceName ( IConditional conditional ) { return conditional instanceof IVarDef ? String . format ( "variable=%s" , ( ( IVarDef ) conditional ) . getPathName ( ) ) : conditional instanceof VarBindingDef ? String . format ( "variable=%s, value=%s" , ( ( VarBindingDef ) conditional ) . getVarDe... | Returns the full reference name for the given IConditional . |
119,725 | private static Stream < IConditional > conditionals ( FunctionInputDef function ) { return toStream ( function . getVarDefs ( ) ) . flatMap ( var -> conditionals ( var ) ) ; } | Returns the IConditional instances defined by the given function input definition . |
119,726 | private static Stream < IConditional > conditionals ( IVarDef var ) { return Stream . concat ( Stream . of ( var ) , Stream . concat ( Optional . ofNullable ( var . getMembers ( ) ) . map ( members -> toStream ( members ) . flatMap ( member -> conditionals ( member ) ) ) . orElse ( Stream . empty ( ) ) , Optional . ofN... | Returns the IConditional instances defined by the given variable definition . |
119,727 | public static < K , V > MapBuilder < K , V > of ( K key , V value ) { return new MapBuilder < K , V > ( ) . put ( key , value ) ; } | Returns a new MapBuilder with the given entry . |
119,728 | public MapBuilder < K , V > put ( K key , V value ) { map_ . put ( key , value ) ; return this ; } | Adds an entry to the map for this builder . |
119,729 | public MapBuilder < K , V > putIf ( K key , Optional < V > value ) { value . ifPresent ( v -> map_ . put ( key , v ) ) ; return this ; } | Adds an entry to the map for this builder if the given value is present . |
119,730 | public < T > List < T > reorder ( List < T > sequence ) { int elementCount = sequence . size ( ) ; if ( elementCount > 1 ) { List < T > elements = new ArrayList < T > ( sequence ) ; sequence . clear ( ) ; for ( ; elementCount > 0 ; elementCount -- ) { sequence . add ( elements . remove ( generator_ . nextInt ( elementC... | Returns the given list with its elements rearranged in a random order . |
119,731 | public < T > Iterator < T > reorder ( Iterator < T > sequence ) { return reorder ( IteratorUtils . toList ( sequence ) ) . iterator ( ) ; } | Returns an iterator that visits the elements of the given sequence in a random order . |
119,732 | public void setTupleSize ( int tupleSize ) { Integer onceSize = onceTuples_ . isEmpty ( ) ? null : getOnceTuples ( ) . next ( ) . size ( ) ; if ( ! ( onceSize == null || onceSize == tupleSize ) ) { throw new IllegalArgumentException ( "Tuple size=" + tupleSize + " is not compatible with existing once-only tuple size=" ... | Changes the tuple size for input variable combinations . A non - positive tupleSize specifies all permutations . |
119,733 | public String [ ] getIncluded ( ) { return IteratorUtils . toArray ( IteratorUtils . transformedIterator ( includedVars_ . iterator ( ) , VarNamePattern :: toString ) , String . class ) ; } | Returns the set of input variables to be included in this combination . |
119,734 | public String [ ] getExcluded ( ) { return IteratorUtils . toArray ( IteratorUtils . transformedIterator ( excludedVars_ . iterator ( ) , VarNamePattern :: toString ) , String . class ) ; } | Returns the set of input variables to be excluded from this combination . |
119,735 | public TupleCombiner addOnceTuple ( TupleRef tupleRef ) { if ( tupleRef != null ) { if ( tupleRef . size ( ) != getTupleSize ( ) ) { throw new IllegalArgumentException ( "Once-only tuple=" + tupleRef + " has size=" + tupleRef . size ( ) + ", expected size=" + getTupleSize ( ) ) ; } onceTuples_ . add ( tupleRef ) ; } re... | Adds a once - only tuple to this combination . |
119,736 | public Collection < Tuple > getTuples ( FunctionInputDef inputDef ) { List < VarDef > combinedVars = getCombinedVars ( inputDef ) ; return getCombinedTuples ( combinedVars , getTuples ( combinedVars , getTupleSize ( ) ) ) ; } | Returns all valid N - tuples of values for the included input variables . |
119,737 | public static Collection < Tuple > getTuples ( List < VarDef > varDefs , int tupleSize ) { if ( tupleSize < 1 ) { tupleSize = varDefs . size ( ) ; } int varEnd = varDefs . size ( ) - tupleSize + 1 ; if ( varEnd <= 0 ) { throw new IllegalArgumentException ( "Can't create " + tupleSize + "-tuples for " + varDefs . size (... | Returns all valid N - tuples of values for the given input variables . A non - positive tupleSize specifies all permutations . |
119,738 | private static Collection < Tuple > getTuples ( List < VarDef > varDefs , int varStart , int varEnd , int tupleSize ) { Collection < Tuple > tuples = new ArrayList < Tuple > ( ) ; for ( int i = varStart ; i < varEnd ; i ++ ) { VarDef nextVar = varDefs . get ( i ) ; Iterator < VarValueDef > values = nextVar . getValidVa... | Returns all valid tuples of values for the given input variables . |
119,739 | private Collection < Tuple > getCombinedTuples ( List < VarDef > combinedVars , Collection < Tuple > tuples ) { Set < Tuple > onceTuples = getOnceTupleDefs ( combinedVars ) ; if ( ! onceTuples . isEmpty ( ) ) { for ( Tuple tuple : tuples ) { tuple . setOnce ( onceTuples . contains ( tuple ) ) ; } } return tuples ; } | Returns all fully - combined N - tuples of values for the included input variables . |
119,740 | private Set < Tuple > getOnceTupleDefs ( final List < VarDef > combinedVars ) { try { return new HashSet < Tuple > ( IteratorUtils . toList ( IteratorUtils . transformedIterator ( getOnceTuples ( ) , tupleRef -> toTuple ( combinedVars , tupleRef ) ) ) ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Inv... | Returns the set of once - only tuple definitions for this combiner . |
119,741 | private Tuple toTuple ( List < VarDef > combinedVars , TupleRef tupleRef ) { if ( tupleRef . size ( ) != getTupleSize ( ) ) { throw new IllegalStateException ( String . valueOf ( tupleRef ) + " does not match combiner tuple size=" + getTupleSize ( ) ) ; } Tuple tuple = new Tuple ( ) ; for ( Iterator < VarBinding > bind... | Converts a reference to a tuple of combined variables . |
119,742 | private VarDef findVarPath ( List < VarDef > combinedVars , String varPath ) { int i ; for ( i = 0 ; i < combinedVars . size ( ) && ! varPath . equals ( combinedVars . get ( i ) . getPathName ( ) ) ; i ++ ) ; return i < combinedVars . size ( ) ? combinedVars . get ( i ) : null ; } | Returns the member of the given variable list with the given path . |
119,743 | public List < VarDef > getCombinedVars ( FunctionInputDef inputDef ) { assertApplicable ( inputDef ) ; List < VarDef > combinedVars = new ArrayList < VarDef > ( ) ; for ( VarDefIterator varDefs = new VarDefIterator ( inputDef ) ; varDefs . hasNext ( ) ; ) { VarDef varDef = varDefs . next ( ) ; if ( isEligible ( varDef ... | Returns the set of input variables to be combined . |
119,744 | private boolean isExcluded ( VarNamePattern varNamePath ) { boolean excluded = false ; Iterator < VarNamePattern > excludedVars = getExcludedVars ( ) . iterator ( ) ; while ( excludedVars . hasNext ( ) && ! ( excluded = excludedVars . next ( ) . matches ( varNamePath ) ) ) ; return excluded ; } | Returns true if the given variable matches any excluded input variable . |
119,745 | private boolean isIncluded ( VarNamePattern varNamePath ) { boolean included = getIncludedVars ( ) . isEmpty ( ) ; if ( ! included ) { Iterator < VarNamePattern > includedVars = getIncludedVars ( ) . iterator ( ) ; while ( includedVars . hasNext ( ) && ! ( included = includedVars . next ( ) . matches ( varNamePath ) ) ... | Returns true if the given variable matches any included input variable . |
119,746 | private void assertApplicable ( FunctionInputDef inputDef , VarNamePattern varNamePattern ) throws IllegalArgumentException { if ( ! varNamePattern . isApplicable ( inputDef ) ) { throw new IllegalArgumentException ( "Can't find variable matching pattern=" + varNamePattern ) ; } } | Throws an exception if the given variable pattern is not applicable to the given input definition . |
119,747 | public boolean isEligible ( IVarDef varDef ) { VarNamePattern varNamePath = new VarNamePattern ( varDef . getPathName ( ) ) ; return ! isExcluded ( varNamePath ) && isIncluded ( varNamePath ) ; } | Returns true if the given input variable is eligible to be combined . |
119,748 | public void setTarget ( File target ) { try { OutputStream targetStream = target == null ? null : new FileOutputStream ( target ) ; setTarget ( targetStream ) ; } catch ( Exception e ) { throw new RuntimeException ( "Can't create target stream" , e ) ; } } | Changes the target for filter output . |
119,749 | private OutputStream initializeSource ( ) { try { PipedOutputStream pipeOut = new PipedOutputStream ( ) ; PipedInputStream pipeIn = new PipedInputStream ( pipeOut ) ; filterInput_ = pipeIn ; return new FilterSourceStream ( pipeOut ) ; } catch ( Exception e ) { throw new RuntimeException ( "Can't initialize source strea... | Initializes the source for filter input . |
119,750 | protected OutputStream getFilterOutput ( ) { OutputStream target = getTarget ( ) ; return target == null ? System . out : target ; } | Returns the stream that provides output from the filter . |
119,751 | private void start ( ) { try { initializeFilter ( getFilterInput ( ) , getFilterOutput ( ) ) ; failure_ = null ; thread_ = new Thread ( this , String . valueOf ( this ) ) ; thread_ . start ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Can't start filtering" , e ) ; } } | Starts filter output . |
119,752 | public void close ( ) { IOUtils . closeQuietly ( source_ ) ; try { complete ( ) ; } catch ( Exception e ) { logger_ . error ( "Can't complete filtering" , e ) ; } } | Terminates filter output . |
119,753 | private void complete ( ) throws IOException { if ( source_ != null ) { try { thread_ . join ( ) ; } catch ( Exception e ) { logger_ . error ( "Thread=" + thread_ + " not completed" , e ) ; } IOException failure = failure_ == null ? null : new IOException ( "Can't write filter output" , failure_ ) ; failure_ = null ; f... | Completes filter output . |
119,754 | public void setCondition ( ICondition condition ) { super . setCondition ( condition ) ; if ( members_ != null ) { for ( IVarDef member : members_ ) { member . setParent ( this ) ; } } } | Changes the condition that defines when this element is applicable . |
119,755 | public IVarDef find ( String ... path ) { return path == null || path . length == 0 ? this : getDescendant ( path ) ; } | Returns the descendant variable with the given name path relative to this variable . |
119,756 | public VarSet addMember ( IVarDef var ) { assert var != null ; assert var . getName ( ) != null ; if ( findMember ( var . getName ( ) ) >= 0 ) { throw new IllegalStateException ( "Member=" + var . getName ( ) + " already defined for varSet=" + getPathName ( ) ) ; } members_ . add ( var ) ; var . setParent ( this ) ; va... | Adds an input variable to this set . |
119,757 | public VarSet removeMember ( String name ) { int i = findMember ( name ) ; if ( i >= 0 ) { members_ . remove ( i ) . setParent ( null ) ; } return this ; } | Removes an input variable from this set . |
119,758 | public IVarDef getMember ( String name ) { int i = findMember ( name ) ; return i >= 0 ? members_ . get ( i ) : null ; } | Returns the member variable with the given name . |
119,759 | private IVarDef getDescendant ( String [ ] path ) { int pathLength = path == null ? 0 : path . length ; int parentPathLength = pathLength - 1 ; int i ; VarSet parent ; IVarDef descendant ; for ( i = 0 , parent = this , descendant = null ; i < parentPathLength && ( descendant = parent . getMember ( StringUtils . trimToN... | Returns the descendant variable with the given path relative to this set . |
119,760 | protected int findMember ( String name ) { int memberCount = name == null ? 0 : members_ . size ( ) ; int i ; for ( i = 0 ; i < memberCount && ! name . equals ( members_ . get ( i ) . getName ( ) ) ; i ++ ) ; return i < memberCount ? i : - 1 ; } | Returns the index of the member variable with the given name . |
119,761 | public static < T > Stream < T > toStream ( Iterator < T > iterator ) { Iterable < T > iterable = ( ) -> iterator ; return toStream ( iterable ) ; } | Returns a stream that produces the sequence defined by the given Iterator . |
119,762 | public static < T > List < T > iterableOf ( Optional < T > value ) { return value . map ( Arrays :: asList ) . orElse ( Collections . emptyList ( ) ) ; } | If the given value is present returns it as a singleton list . Otherwise returns an empty list . |
119,763 | public static < T > Stream < T > streamOf ( Optional < T > value ) { return value . map ( Stream :: of ) . orElse ( Stream . empty ( ) ) ; } | If the given value is present returns it as a single - element stream . Otherwise returns an empty stream . |
119,764 | public static < T , C extends Collection < T > > Stream < T > membersOf ( C collection ) { return collection == null ? Stream . empty ( ) : collection . stream ( ) ; } | Returns a stream containing the members of the given collection . |
119,765 | public static < K , V , M extends Map < K , V > > Stream < Map . Entry < K , V > > entriesOf ( M map ) { return map == null ? Stream . empty ( ) : map . entrySet ( ) . stream ( ) ; } | Returns a stream containing the entries of the given map . |
119,766 | protected InputStream open ( ) { try { if ( getType ( ) == null ) { throw new IllegalStateException ( String . format ( "Unknown type for %s" , this ) ) ; } URL location = getLocation ( ) ; return location == null ? System . in : ( stream_ = location . openStream ( ) ) ; } catch ( Exception e ) { throw new IllegalState... | Opens a stream to read the contents of this resource . |
119,767 | public static < T extends Resource > T withDefaultType ( T resource , Type defaultType ) { if ( resource . getType ( ) == null ) { resource . setType ( defaultType ) ; } return resource ; } | Returns the given resource assigning the default type if no type yet defined . |
119,768 | public static File withDefaultType ( File file , Type defaultType ) { return file != null && FilenameUtils . getExtension ( file . getName ( ) ) . isEmpty ( ) ? new File ( String . format ( "%s.%s" , file . getPath ( ) , String . valueOf ( defaultType ) . toLowerCase ( ) ) ) : file ; } | Returns the given file name assigning the default type if no type defined . |
119,769 | public VarValueDef addProperties ( Collection < String > properties ) { if ( properties != null ) { assertPropertyIdentifiers ( properties ) ; properties_ . addAll ( properties ) ; } return this ; } | Adds to the set of test case properties contributed by this value . |
119,770 | public void write ( Project project ) { JsonWriterFactory writerFactory = Json . createWriterFactory ( MapBuilder . of ( PRETTY_PRINTING , true ) . build ( ) ) ; JsonWriter jsonWriter = writerFactory . createWriter ( getWriter ( ) ) ; jsonWriter . write ( ProjectJson . toJson ( project ) ) ; } | Writes the given project definition the form of a JSON document . |
119,771 | public static Tuple of ( Collection < VarBindingDef > tupleBindings ) { Tuple tuple = new Tuple ( ) ; boolean bindingsCompatible ; Iterator < VarBindingDef > bindings ; VarBindingDef nextBinding ; for ( bindings = tupleBindings . iterator ( ) , bindingsCompatible = true ; bindings . hasNext ( ) && ( bindingsCompatible ... | Returns null if all of the given bindings cannot be included in compatible Tuple . Otherwise returns a new compatible Tuple containing all of the given bindings . |
119,772 | private static boolean isBindingCompatible ( Tuple tuple , VarBindingDef binding ) { VarValueDef currentValue = tuple . getBinding ( binding . getVarDef ( ) ) ; return ( currentValue == null || currentValue . equals ( binding . getValueDef ( ) ) ) ; } | Returns true if the given binding can be added to the give tuple . |
119,773 | public void setBindings ( Collection < VarBindingDef > bindings ) { bindings_ = new HashMap < VarDef , VarBindingDef > ( ) ; properties_ = new PropertySet ( ) ; if ( bindings != null ) { for ( VarBindingDef binding : bindings ) { add ( binding ) ; } } } | Changes the variable bindings for this tuple . |
119,774 | public VarValueDef getBinding ( VarDef var ) { VarBindingDef binding = bindings_ . get ( var ) ; return binding == null ? null : binding . getValueDef ( ) ; } | Returns the value bound by this tuple for the given variable . |
119,775 | public Tuple add ( VarBindingDef binding ) { if ( binding != null ) { VarDef var = binding . getVarDef ( ) ; if ( var == null ) { throw new IllegalArgumentException ( "Invalid binding=" + binding + ": variable undefined" ) ; } VarValueDef value = binding . getValueDef ( ) ; if ( value == null ) { throw new IllegalArgum... | Adds a binding to this tuple . |
119,776 | public Tuple addAll ( Tuple tuple ) { if ( tuple != null ) { for ( Iterator < VarBindingDef > bindings = tuple . getBindings ( ) ; bindings . hasNext ( ) ; ) { add ( bindings . next ( ) ) ; } } return this ; } | Adds all bindings from the given tuple . |
119,777 | public Tuple remove ( VarDef var ) { VarBindingDef binding = bindings_ . remove ( var ) ; if ( binding != null ) { properties_ . removeAll ( binding . getValueDef ( ) . getProperties ( ) . iterator ( ) ) ; } return this ; } | Removes a binding from this tuple . |
119,778 | public boolean isCompatible ( ) { boolean compatible ; Iterator < VarBindingDef > bindings ; VarBindingDef binding = null ; for ( compatible = true , bindings = getBindings ( ) ; compatible && bindings . hasNext ( ) ; compatible = ( binding = bindings . next ( ) ) . getEffectiveCondition ( ) . compatible ( properties_ ... | Returns true if this tuple contains compatible variable bindings . |
119,779 | private boolean makeSatisfied ( TestCaseDef testCase , VarTupleSet tuples ) { boolean satisfied = testCase . isSatisfied ( ) ; if ( ! satisfied ) { int prevBindings = testCase . getBindingCount ( ) ; for ( Iterator < Tuple > satisfyingTuples = getSatisfyingTuples ( testCase , tuples ) ; satisfyingTuples . hasNext ( ) &... | Using selections from the given set of tuples completes bindings to satisfy all current test case conditions . Returns true if and only if all conditions satisfied . |
119,780 | private boolean makeSatisfied ( TestCaseDef testCase , VarTupleSet tuples , Tuple satisfyingTuple ) { return testCase . addCompatible ( satisfyingTuple ) != null && ! testCase . isInfeasible ( ) && makeSatisfied ( testCase , tuples ) ; } | Starting with the given tuple completes bindings to satisfy all current test case conditions using additional selections from the given set of tuples if necessary . Returns true if and only if all conditions satisfied . |
119,781 | private Iterator < Tuple > getBindingsFor ( VarTupleSet tuples , VarDef var ) { return IteratorUtils . chainedIterator ( tuples . getUnused ( var ) , IteratorUtils . chainedIterator ( tuples . getUsed ( var ) , tuples . getUsedOnce ( var ) ) ) ; } | Returns a set of 1 - tuples containing the bindings for the given variable that are applicable to the given test case . |
119,782 | private Iterator < Tuple > getSatisfyingTuples ( final TestCaseDef testCase , VarTupleSet varTupleSet ) { final Comparator < VarBindingDef > byUsage = byUsage ( varTupleSet ) ; return IteratorUtils . transformedIterator ( new CartesianProduct < VarBindingDef > ( new ArrayList < Set < VarBindingDef > > ( CollectionUtils... | Returns the set of tuples that could satisfy conditions required by the given test case . |
119,783 | private List < VarDef > getVarsRemaining ( FunctionInputDef inputDef , TestCaseDef testCase ) { return getVarsRemaining ( new VarDefIterator ( inputDef ) , testCase ) ; } | Returns the set of input variables not yet bound by the given test case . |
119,784 | private VarTupleSet getValidTupleSet ( RandSeq randSeq , FunctionInputDef inputDef ) { List < Tuple > validTuples = new ArrayList < Tuple > ( ) ; getCombiners ( ) . stream ( ) . sorted ( byTupleSize_ ) . forEach ( combiner -> validTuples . addAll ( RandSeq . order ( randSeq , combiner . getTuples ( inputDef ) ) ) ) ; L... | Returns the all valid input tuples required for generated test cases . |
119,785 | private Collection < Tuple > getUncombinedTuples ( List < VarDef > uncombinedVars , int defaultTupleSize ) { Collection < Tuple > tuples = TupleCombiner . getTuples ( uncombinedVars , defaultTupleSize ) ; if ( defaultTupleSize == 1 ) { for ( Tuple tuple : tuples ) { VarValueDef value = tuple . getBindings ( ) . next ( ... | Returns default tuples for all uncombined variables . |
119,786 | private VarTupleSet getFailureTupleSet ( RandSeq randSeq , FunctionInputDef inputDef ) { List < Tuple > failureTuples = new ArrayList < Tuple > ( ) ; for ( VarDefIterator vars = new VarDefIterator ( inputDef ) ; vars . hasNext ( ) ; ) { VarDef var = vars . next ( ) ; for ( Iterator < VarValueDef > failures = var . getF... | Returns the all failure input tuples required for generated test cases . |
119,787 | private MultiValuedMap < String , VarBindingDef > createPropertyProviders ( FunctionInputDef inputDef ) { propertyProviders_ = MultiMapUtils . newListValuedHashMap ( ) ; for ( VarDefIterator varDefs = new VarDefIterator ( inputDef . getVarDefs ( ) ) ; varDefs . hasNext ( ) ; ) { VarDef varDef = varDefs . next ( ) ; for... | Return a map that associates each value property with the set of bindings that provide it . |
119,788 | private Set < VarBindingDef > getPropertyProviders ( Set < String > properties ) { Set < VarBindingDef > bindings = new HashSet < VarBindingDef > ( ) ; for ( String property : properties ) { bindings . addAll ( propertyProviders_ . get ( property ) ) ; } return bindings ; } | Returns the set of bindings that provide at least one of the given properties |
119,789 | private Comparator < VarBindingDef > byUsage ( final VarTupleSet varTupleSet ) { return new Comparator < VarBindingDef > ( ) { public int compare ( VarBindingDef binding1 , VarBindingDef binding2 ) { int resultScore = getScore ( binding2 ) . compareTo ( getScore ( binding1 ) ) ; return resultScore == 0 ? varBindingDefS... | Returns a comparator that orders bindings by decreasing preference preferring bindings that are less used . |
119,790 | public GeneratorSetBuilder generator ( String functionName , ITestCaseGenerator generator ) { generatorSet_ . addGenerator ( functionName , generator ) ; return this ; } | Adds a generator to this set for the given function . |
119,791 | public VarBindingBuilder start ( VarBinding binding ) { varBinding_ = binding == null ? new VarBinding ( "V" , IVarDef . ARG , "?" ) : binding ; return this ; } | Starts building a new binding . |
119,792 | public VarBindingBuilder has ( String name , Object value ) { varBinding_ . setAnnotation ( name , Objects . toString ( value , null ) ) ; return this ; } | Adds a binding annotation . |
119,793 | public VarBindingBuilder hasIf ( String name , Object value ) { return value != null ? has ( name , value ) : this ; } | Adds a binding annotation if the given value is non - null |
119,794 | public VarValueDefBuilder has ( String name , Object value ) { varValueDef_ . setAnnotation ( name , Objects . toString ( value , null ) ) ; return this ; } | Adds a value annotation . |
119,795 | public VarValueDefBuilder hasIf ( String name , Object value ) { return value != null ? has ( name , value ) : this ; } | Adds a value annotation if the given value is non - null |
119,796 | public VarValueDefBuilder hasIf ( String name , Optional < Object > value ) { return hasIf ( name , value . orElse ( null ) ) ; } | Adds a value annotation if the given value is defined |
119,797 | public VarValueDefBuilder properties ( Optional < String > property ) { property . ifPresent ( p -> varValueDef_ . addProperties ( p ) ) ; return this ; } | Adds a value property if present . |
119,798 | public VarSetBuilder has ( String name , Object value ) { varSet_ . setAnnotation ( name , Objects . toString ( value , null ) ) ; return this ; } | Adds a variable set annotation . |
119,799 | public VarSetBuilder hasIf ( String name , Object value ) { return value != null ? has ( name , value ) : this ; } | Adds a variable set annotation if the given value is non - null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.