idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
17,200 | public ArrayList < SameLengthMotifs > classifyMotifs ( double lengthThreshold , GrammarRules grammarRules ) { ArrayList < SameLengthMotifs > allClassifiedMotifs = new ArrayList < SameLengthMotifs > ( ) ; ArrayList < SAXMotif > allMotifs = getAllMotifs ( grammarRules ) ; int currentIndex = 0 ; for ( SAXMotif tmpMotif : ... | Classify the motifs based on their length . |
17,201 | protected ArrayList < SAXMotif > getAllMotifs ( GrammarRules grammarRules ) { ArrayList < SAXMotif > allMotifs = new ArrayList < SAXMotif > ( ) ; int ruleNumber = grammarRules . size ( ) ; for ( int i = 0 ; i < ruleNumber ; i ++ ) { ArrayList < RuleInterval > arrPos = grammarRules . getRuleRecord ( i ) . getRuleInterva... | Stores all the sub - sequences that generated by Sequitur rules into an array list sorted by sub - sequence length in ascending order . |
17,202 | protected ArrayList < SameLengthMotifs > removeOverlappingInSimiliar ( ArrayList < SameLengthMotifs > allClassifiedMotifs , GrammarRules grammarRules , double [ ] ts , double thresouldCom ) { ArrayList < SAXMotif > motifsBeDeleted = new ArrayList < SAXMotif > ( ) ; SAXPointsNumber [ ] pointsNumberRemoveStrategy = count... | Removes overlapping rules in similar rule set . |
17,203 | protected boolean decideRemove ( SAXMotif motif1 , SAXMotif motif2 , SAXPointsNumber [ ] pointsNumberRemoveStrategy ) { int motif1Start = motif1 . getPos ( ) . getStart ( ) ; int motif1End = motif1 . getPos ( ) . getEnd ( ) - 1 ; int length1 = motif1End - motif1Start ; int motif2Start = motif2 . getPos ( ) . getStart (... | Decide which one from overlapping subsequences should be removed . The decision rule is that each sub - sequence has a weight the one with the smaller weight should be removed . |
17,204 | protected ArrayList < SameLengthMotifs > refinePatternsByClustering ( GrammarRules grammarRules , double [ ] ts , ArrayList < SameLengthMotifs > allClassifiedMotifs , double fractionTopDist ) { DistanceComputation dc = new DistanceComputation ( ) ; double [ ] origTS = ts ; ArrayList < SameLengthMotifs > newAllClassifie... | Refines patterns by clustering . |
17,205 | private ArrayList < String [ ] > findCluster ( Cluster cluster , double cutDist , int minPatternPerCls ) { ArrayList < String [ ] > clusterTSIdx = new ArrayList < String [ ] > ( ) ; if ( cluster . getDistance ( ) != null ) { if ( cluster . getDistanceValue ( ) > cutDist ) { if ( cluster . getChildren ( ) . size ( ) > 0... | Finds clusters . |
17,206 | private ArrayList < String > getNameInCluster ( Cluster cluster ) { ArrayList < String > itemsInCluster = new ArrayList < String > ( ) ; String nodeName ; if ( cluster . isLeaf ( ) ) { nodeName = cluster . getName ( ) ; itemsInCluster . add ( nodeName ) ; } else { } for ( Cluster child : cluster . getChildren ( ) ) { A... | Finds out cluster names . |
17,207 | private ArrayList < SameLengthMotifs > SeparateMotifsByClustering ( ArrayList < String [ ] > clusterTSIdx , SameLengthMotifs sameLenMotifs ) { ArrayList < SameLengthMotifs > newResult = new ArrayList < SameLengthMotifs > ( ) ; if ( clusterTSIdx . size ( ) > 1 ) { ArrayList < SAXMotif > subsequences = sameLenMotifs . ge... | Separates motifs via clustering . |
17,208 | public BtrpOperand go ( BtrPlaceTree parent ) { String cname = getText ( ) ; if ( catalog == null ) { return ignoreError ( "No constraints available" ) ; } SatConstraintBuilder b = catalog . getConstraint ( cname ) ; if ( b == null ) { ignoreError ( "Unknown constraint '" + cname + "'" ) ; } int i = 0 ; boolean discret... | Build the constraint . The constraint is built if it exists in the catalog and if the parameters are compatible with the constraint signature . |
17,209 | public static Process runProcess ( String ... cmdParts ) throws IOException { return new ProcessBuilder ( buildCommandline ( cmdParts ) ) . inheritIO ( ) . start ( ) ; } | Execute a command with the following arguments . |
17,210 | public static String getXMLValidString ( final String input , final boolean replace , final char replacement ) { if ( input == null ) { return null ; } if ( "" . equals ( input ) ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; for ( char c : input . toCharArray ( ) ) { if ( XMLStringUtil . isXMLValid ( c )... | Remove or replace XML invalid chars from input . |
17,211 | public boolean release ( ) { if ( this . released ) { return false ; } this . released = true ; if ( this . childCount == 0 ) { if ( this . parent == null ) { return true ; } else { assert ( this . parent . childCount > 0 ) ; this . parent . childCount -- ; if ( ( this . parent . childCount == 0 ) && ( this . parent . ... | This method marks this array to be released . |
17,212 | public static < T > ApprovalBuilder < T > of ( Class < T > clazz ) { return new ApprovalBuilder < T > ( clazz ) ; } | Create a new approval builder that will be able to approve objects from the specified class type . |
17,213 | public static Path getApprovalPath ( Path filePath ) { Pre . notNull ( filePath , "filePath" ) ; String s = filePath . toString ( ) ; int extensionIndex = s . lastIndexOf ( '.' ) ; if ( extensionIndex == - 1 ) { return Paths . get ( s + FOR_APPROVAL_EXTENSION ) ; } int lastPartOfPath = s . lastIndexOf ( '/' ) ; if ( la... | Get the path for approval from the original file path . |
17,214 | public static Point fromUniformlyDistributedRandomPoints ( final Random randomGenerator ) { checkNonnull ( "randomGenerator" , randomGenerator ) ; final double unitRand1 = randomGenerator . nextDouble ( ) ; final double unitRand2 = randomGenerator . nextDouble ( ) ; final double theta0 = ( 2.0 * Math . PI ) * unitRand1... | Create a random point uniformly distributed over the surface of the Earth . |
17,215 | public static double distanceInMeters ( final Point p1 , final Point p2 ) { checkNonnull ( "p1" , p1 ) ; checkNonnull ( "p2" , p2 ) ; final Point from ; final Point to ; if ( p1 . getLonDeg ( ) <= p2 . getLonDeg ( ) ) { from = p1 ; to = p2 ; } else { from = p2 ; to = p1 ; } final double avgLat = ( from . getLatDeg ( ) ... | Calculate the distance between two points . This algorithm does not take the curvature of the Earth into account so it only works for small distance up to say 200 km and not too close to the poles . |
17,216 | public List < ? extends SatConstraint > buildConstraint ( BtrPlaceTree t , List < BtrpOperand > args ) { if ( ! checkConformance ( t , args ) ) { return Collections . emptyList ( ) ; } @ SuppressWarnings ( "unchecked" ) List < VM > s = ( List < VM > ) params [ 0 ] . transform ( this , t , args . get ( 0 ) ) ; if ( s ==... | Build a precedence constraint . |
17,217 | public void remove ( ) { BasicDoubleLinkedNode < V > next = getNext ( ) ; if ( next != null ) { next . previous = this . previous ; } if ( this . previous != null ) { this . previous . setNext ( next ) ; } } | This method removes this node from the double linked list . |
17,218 | public boolean applyAction ( Model i ) { Mapping c = i . getMapping ( ) ; return c . isRunning ( vm ) && c . getVMLocation ( vm ) . equals ( src ) && ! src . equals ( dst ) && c . addRunningVM ( vm , dst ) ; } | Make the VM running on the destination node in the given model . |
17,219 | public static void resetCaches ( int size ) { nodesCache = new LinkedHashMap < String , List < Node > > ( ) { protected boolean removeEldestEntry ( Map . Entry < String , List < Node > > foo ) { return size ( ) == size ; } } ; vmsCache = new LinkedHashMap < String , List < VM > > ( ) { protected boolean removeEldestEnt... | Reset the cache of element sets . |
17,220 | public static int requiredInt ( JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; try { return ( Integer ) o . get ( id ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a int from string '" + id + "'" , e ) ; } } | Read an expected integer . |
17,221 | public static int optInt ( JSONObject o , String id , int def ) throws JSONConverterException { if ( o . containsKey ( id ) ) { try { return ( Integer ) o . get ( id ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a int from string '" + id + "'" , e ) ; } } return def ; } | Read an optional integer . |
17,222 | public static void checkKeys ( JSONObject o , String ... keys ) throws JSONConverterException { for ( String k : keys ) { if ( ! o . containsKey ( k ) ) { throw new JSONConverterException ( "Missing key '" + k + "'" ) ; } } } | Check if some keys are present . |
17,223 | public static String requiredString ( JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; Object x = o . get ( id ) ; return x . toString ( ) ; } | Read an expected string . |
17,224 | public static double requiredDouble ( JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof Number ) ) { throw new JSONConverterException ( "Number expected at key '" + id + "' but was '" + x . getClass ( ) + "'." ) ; } return ( ( Number ) x ... | Read an expected double . |
17,225 | public static boolean requiredBoolean ( JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof Boolean ) ) { throw new JSONConverterException ( "Boolean expected at key '" + id + "' but was '" + x . getClass ( ) + "'." ) ; } return ( Boolean )... | Read an expected boolean . |
17,226 | public static List < VM > vmsFromJSON ( Model mo , JSONArray a ) throws JSONConverterException { String json = a . toJSONString ( ) ; List < VM > s = vmsCache . get ( json ) ; if ( s != null ) { return s ; } s = new ArrayList < > ( a . size ( ) ) ; for ( Object o : a ) { s . add ( getVM ( mo , ( int ) o ) ) ; } vmsCach... | Convert an array of VM identifiers to a set of VMs . This operation uses a cache of previously converted set of VMs . |
17,227 | public static List < Node > nodesFromJSON ( Model mo , JSONArray a ) throws JSONConverterException { String json = a . toJSONString ( ) ; List < Node > s = nodesCache . get ( json ) ; if ( s != null ) { return s ; } s = new ArrayList < > ( a . size ( ) ) ; for ( Object o : a ) { s . add ( getNode ( mo , ( int ) o ) ) ;... | Convert an array of VM identifiers to a set of VMs . This operation uses a cache of previously converted set of nodes . |
17,228 | public static JSONArray vmsToJSON ( Collection < VM > s ) { JSONArray a = new JSONArray ( ) ; for ( Element e : s ) { a . add ( e . id ( ) ) ; } return a ; } | Convert a collection of VMs to an array of VM identifiers . |
17,229 | public static JSONArray nodesToJSON ( Collection < Node > s ) { JSONArray a = new JSONArray ( ) ; for ( Element e : s ) { a . add ( e . id ( ) ) ; } return a ; } | Convert a collection nodes to an array of nodes identifiers . |
17,230 | public static List < VM > requiredVMs ( Model mo , JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "integers expected at key '" + id + "'" ) ; } return vmsFromJSON ( mo , ( JSONArray ) ... | Read an expected list of VMs . |
17,231 | public static List < Node > requiredNodes ( Model mo , JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "integers expected at key '" + id + "'" ) ; } return nodesFromJSON ( mo , ( JSONAr... | Read an expected list of nodes . |
17,232 | public static Set < Collection < VM > > requiredVMPart ( Model mo , JSONObject o , String id ) throws JSONConverterException { Set < Collection < VM > > vms = new HashSet < > ( ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "Set of identifiers sets expected at k... | Read partitions of VMs . |
17,233 | public static Set < Collection < Node > > requiredNodePart ( Model mo , JSONObject o , String id ) throws JSONConverterException { Set < Collection < Node > > nodes = new HashSet < > ( ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "Set of identifiers sets expec... | Read partitions of nodes . |
17,234 | public static VM requiredVM ( Model mo , JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; try { return getVM ( mo , ( Integer ) o . get ( id ) ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a VM identifier from string at key '" + id + "'" , e )... | Read an expected VM . |
17,235 | public static Node requiredNode ( Model mo , JSONObject o , String id ) throws JSONConverterException { checkKeys ( o , id ) ; try { return getNode ( mo , ( Integer ) o . get ( id ) ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a Node identifier from string at key '" + id + "... | Read an expected node . |
17,236 | public static VM getVM ( Model mo , int vmID ) throws JSONConverterException { VM vm = new VM ( vmID ) ; if ( ! mo . contains ( vm ) ) { throw new JSONConverterException ( "Undeclared vm '" + vmID + "'" ) ; } return vm ; } | Get a VM from its identifier . The VM is already a part of the model . |
17,237 | public static Node getNode ( Model mo , int nodeID ) throws JSONConverterException { Node n = new Node ( nodeID ) ; if ( ! mo . contains ( n ) ) { throw new JSONConverterException ( "Undeclared node '" + nodeID + "'" ) ; } return n ; } | Get a node from its identifier . The node is already a part of the model |
17,238 | public void postCostConstraints ( ) { if ( ! costActivated ) { costActivated = true ; rp . getLogger ( ) . debug ( "Post the cost-oriented constraints" ) ; List < IntVar > mttrs = Stream . concat ( rp . getVMActions ( ) . stream ( ) , rp . getNodeActions ( ) . stream ( ) ) . map ( Transition :: getEnd ) . collect ( Col... | Post the constraints related to the objective . |
17,239 | @ SuppressWarnings ( "PointlessArithmeticExpression" ) int getDataFirstRecord ( final int territoryNumber ) { assert ( 0 <= territoryNumber ) && ( territoryNumber <= Territory . AAA . getNumber ( ) ) ; return index [ territoryNumber + POS_INDEX_FIRST_RECORD ] ; } | Low - level routines for data access . |
17,240 | public List < Script > getScripts ( String name ) throws ScriptBuilderException { List < Script > scripts = new ArrayList < > ( ) ; if ( ! name . endsWith ( ".*" ) ) { String toSearch = name . replaceAll ( "\\." , File . separator ) + Script . EXTENSION ; for ( File path : paths ) { File f = new File ( path . getPath (... | Get the script associated to a given identifier by browsing the given paths . The first script having a matching identifier is selected whatever the parsing process result will be |
17,241 | public VMConsumptionComparator append ( ShareableResource r , boolean asc ) { rcs . add ( r ) ; ascs . add ( asc ? 1 : - 1 ) ; return this ; } | Append a new resource to use to make the comparison |
17,242 | public void register ( RoutingConverter < ? extends Routing > r ) { java2json . put ( r . getSupportedRouting ( ) , r ) ; json2java . put ( r . getJSONId ( ) , r ) ; } | Register a routing converter . |
17,243 | public JSONObject switchToJSON ( Switch s ) { JSONObject o = new JSONObject ( ) ; o . put ( "id" , s . id ( ) ) ; o . put ( CAPACITY_LABEL , s . getCapacity ( ) ) ; return o ; } | Convert a Switch to a JSON object . |
17,244 | public JSONArray switchesToJSON ( Collection < Switch > c ) { JSONArray a = new JSONArray ( ) ; for ( Switch s : c ) { a . add ( switchToJSON ( s ) ) ; } return a ; } | Convert a collection of switches to an array of JSON switches objects . |
17,245 | public JSONObject physicalElementToJSON ( PhysicalElement pe ) { JSONObject o = new JSONObject ( ) ; if ( pe instanceof Node ) { o . put ( "type" , NODE_LABEL ) ; o . put ( "id" , ( ( Node ) pe ) . id ( ) ) ; } else if ( pe instanceof Switch ) { o . put ( "type" , SWITCH_LABEL ) ; o . put ( "id" , ( ( Switch ) pe ) . i... | Convert a PhysicalElement to a JSON object . |
17,246 | public JSONObject linkToJSON ( Link s ) { JSONObject o = new JSONObject ( ) ; o . put ( "id" , s . id ( ) ) ; o . put ( CAPACITY_LABEL , s . getCapacity ( ) ) ; o . put ( SWITCH_LABEL , s . getSwitch ( ) . id ( ) ) ; o . put ( "physicalElement" , physicalElementToJSON ( s . getElement ( ) ) ) ; return o ; } | Convert a Link to a JSON object . |
17,247 | public JSONArray linksToJSON ( Collection < Link > c ) { JSONArray a = new JSONArray ( ) ; for ( Link l : c ) { a . add ( linkToJSON ( l ) ) ; } return a ; } | Convert a collection of links to an array of JSON links objects . |
17,248 | public Routing routingFromJSON ( Model mo , JSONObject o ) throws JSONConverterException { String type = requiredString ( o , "type" ) ; RoutingConverter < ? extends Routing > c = json2java . get ( type ) ; if ( c == null ) { throw new JSONConverterException ( "No converter available for a routing of type '" + type + "... | Convert a JSON routing object into the corresponding java Routing implementation . |
17,249 | public Switch switchFromJSON ( JSONObject o ) throws JSONConverterException { return new Switch ( requiredInt ( o , "id" ) , readCapacity ( o ) ) ; } | Convert a JSON switch object to a Switch . |
17,250 | public void switchesFromJSON ( Network net , JSONArray a ) throws JSONConverterException { for ( Object o : a ) { net . newSwitch ( requiredInt ( ( JSONObject ) o , "id" ) , readCapacity ( ( JSONObject ) o ) ) ; } } | Convert a JSON array of switches to a Java List of switches . |
17,251 | public PhysicalElement physicalElementFromJSON ( Model mo , Network net , JSONObject o ) throws JSONConverterException { String type = requiredString ( o , "type" ) ; switch ( type ) { case NODE_LABEL : return requiredNode ( mo , o , "id" ) ; case SWITCH_LABEL : return getSwitch ( net , requiredInt ( o , "id" ) ) ; def... | Convert a JSON physical element object to a Java PhysicalElement object . |
17,252 | public void linkFromJSON ( Model mo , Network net , JSONObject o ) throws JSONConverterException { net . connect ( requiredInt ( o , "id" ) , readCapacity ( o ) , getSwitch ( net , requiredInt ( o , SWITCH_LABEL ) ) , physicalElementFromJSON ( mo , net , ( JSONObject ) o . get ( "physicalElement" ) ) ) ; } | Convert a JSON link object into a Java Link object . |
17,253 | public void linksFromJSON ( Model mo , Network net , JSONArray a ) throws JSONConverterException { for ( Object o : a ) { linkFromJSON ( mo , net , ( JSONObject ) o ) ; } } | Convert a JSON array of links to a Java List of links . |
17,254 | public List < SatConstraint > makeConstraints ( ) { List < SatConstraint > cstrs = new ArrayList < > ( ) ; cstrs . add ( new Spread ( new HashSet < > ( Arrays . asList ( vms . get ( 1 ) , vms . get ( 2 ) ) ) ) ) ; cstrs . add ( new Preserve ( vms . get ( 0 ) , "cpu" , 3 ) ) ; cstrs . add ( new Offline ( nodes . get ( 3... | Declare some constraints . |
17,255 | private boolean verifyWithOfColumns ( ColumnState [ ] columnStates , TextTableInfo tableInfo ) { int tableWidth = tableInfo . getWidth ( ) ; if ( tableWidth != TextColumnInfo . WIDTH_AUTO_ADJUST ) { int calculatedWidth = 0 ; for ( ColumnState columnState : columnStates ) { if ( columnState . width < 0 ) { throw new Ass... | This method verifies that the width of the columns are sane . |
17,256 | public Switch newSwitch ( int id , int capacity ) { Switch s = swBuilder . newSwitch ( id , capacity ) ; switches . add ( s ) ; return s ; } | Create a new switch with a specific identifier and a given maximal capacity |
17,257 | public List < Link > connect ( int bandwidth , Switch sw , Node ... nodes ) { List < Link > l = new ArrayList < > ( ) ; for ( Node n : nodes ) { l . add ( connect ( bandwidth , sw , n ) ) ; } return l ; } | Create connections between a single switch and multiple nodes |
17,258 | public List < Link > getConnectedLinks ( PhysicalElement pe ) { List < Link > myLinks = new ArrayList < > ( ) ; for ( Link l : this . links ) { if ( l . getElement ( ) . equals ( pe ) ) { myLinks . add ( l ) ; } else if ( l . getSwitch ( ) . equals ( pe ) ) { myLinks . add ( l ) ; } } return myLinks ; } | Get the list of links connected to a given physical element |
17,259 | public List < Node > getConnectedNodes ( ) { List < Node > nodes = new ArrayList < > ( ) ; for ( Link l : links ) { if ( l . getElement ( ) instanceof Node ) { nodes . add ( ( Node ) l . getElement ( ) ) ; } } return nodes ; } | Get the full list of nodes that have been connected into the network |
17,260 | public void addInclusion ( SVar < T > s1 , SVar < T > s2 ) { this . add ( new LtConstraint < SVar < T > , Set < T > > ( s1 , s2 ) ) ; } | Adds an inclusion constraints between two sets . |
17,261 | private int randomWithRankedValues ( IntVar x ) { TIntArrayList [ ] values = new TIntArrayList [ ranks . length ] ; DisposableValueIterator ite = x . getValueIterator ( true ) ; try { while ( ite . hasNext ( ) ) { int v = ite . next ( ) ; int i ; for ( i = 0 ; i < ranks . length ; i ++ ) { if ( ranks [ i ] . contains (... | Random value but that consider the rank of nodes . So values are picked up from the first rank possible . |
17,262 | private int randomValue ( IntVar x ) { int i = rnd . nextInt ( x . getDomainSize ( ) ) ; DisposableValueIterator ite = x . getValueIterator ( true ) ; int pos = - 1 ; try { while ( i >= 0 ) { pos = ite . next ( ) ; i -- ; } } finally { ite . dispose ( ) ; } return pos ; } | Pick a random value inside the variable domain . |
17,263 | public static SAXRule runSequitur ( String inputString ) throws Exception { LOGGER . trace ( "digesting the string " + inputString ) ; SAXRule . numRules = new AtomicInteger ( 0 ) ; SAXRule . theRules . clear ( ) ; SAXSymbol . theDigrams . clear ( ) ; SAXSymbol . theSubstituteTable . clear ( ) ; SAXRule resRule = new S... | Digests a string of terminals separated by a space . |
17,264 | public static GrammarRules series2SequiturRules ( double [ ] timeseries , int saxWindowSize , int saxPAASize , int saxAlphabetSize , NumerosityReductionStrategy numerosityReductionStrategy , double normalizationThreshold ) throws Exception , IOException { LOGGER . debug ( "Discretizing time series..." ) ; SAXRecords sa... | Takes a time series and returns a grammar . |
17,265 | public static ArrayList < RuleInterval > getRulePositionsByRuleNum ( int ruleIdx , SAXRule grammar , SAXRecords saxFrequencyData , double [ ] originalTimeSeries , int saxWindowSize ) { ArrayList < RuleInterval > resultIntervals = new ArrayList < RuleInterval > ( ) ; GrammarRuleRecord ruleContainer = grammar . getRuleRe... | Recovers start and stop coordinates of a rule subsequences . |
17,266 | public static List < Preserve > newPreserve ( Collection < VM > vms , String r , int q ) { return vms . stream ( ) . map ( v -> new Preserve ( v , r , q ) ) . collect ( Collectors . toList ( ) ) ; } | Make multiple constraints |
17,267 | private Node < E > _link ( Node < E > node1 , Node < E > node2 ) { if ( node1 == node2 ) return node2 ; if ( node1 . rank > node2 . rank ) { node2 . parent = node1 ; node1 . nbElems += node2 . nbElems ; return node1 ; } else { node1 . parent = node2 ; if ( node1 . rank == node2 . rank ) { node2 . rank ++ ; } node2 . nb... | Unifies the tree rooted in node1 with the tree rooted in node2 by making one of them the subtree of the other one ; returns the root of the new tree . |
17,268 | public static void reset ( ) { SAXRule . numRules = new AtomicInteger ( 0 ) ; SAXSymbol . theDigrams . clear ( ) ; SAXSymbol . theSubstituteTable . clear ( ) ; SAXRule . arrRuleRecords = new ArrayList < GrammarRuleRecord > ( ) ; } | Cleans up data structures . |
17,269 | protected void assignLevel ( ) { int lvl = Integer . MAX_VALUE ; SAXSymbol sym ; for ( sym = this . first ( ) ; ( ! sym . isGuard ( ) ) ; sym = sym . n ) { if ( sym . isNonTerminal ( ) ) { SAXRule referedTo = ( ( SAXNonTerminal ) sym ) . r ; lvl = Math . min ( referedTo . level + 1 , lvl ) ; } else { level = 1 ; return... | This traces the rule level . |
17,270 | private static void expandRules ( ) { for ( GrammarRuleRecord ruleRecord : arrRuleRecords ) { if ( ruleRecord . getRuleNumber ( ) == 0 ) { continue ; } String curString = ruleRecord . getRuleString ( ) ; StringBuilder resultString = new StringBuilder ( 8192 ) ; String [ ] split = curString . split ( " " ) ; for ( Strin... | Manfred s cool trick to get out all expanded rules . Expands the rule of each SAX container into SAX words string . Can be rewritten recursively though . |
17,271 | private int [ ] getIndexes ( ) { int [ ] res = new int [ this . indexes . size ( ) ] ; int i = 0 ; for ( Integer idx : this . indexes ) { res [ i ] = idx ; i ++ ; } return res ; } | Get all the rule occurrences . |
17,272 | public Action fromJSON ( JSONObject in ) throws JSONConverterException { String id = requiredString ( in , ACTION_ID_LABEL ) ; Action a ; switch ( id ) { case "bootVM" : a = bootVMFromJSON ( in ) ; break ; case "shutdownVM" : a = shutdownVMFromJSON ( in ) ; break ; case "shutdownNode" : a = shutdownNodeFromJSON ( in ) ... | decode a json - encoded action . |
17,273 | private void attachEvents ( Action a , JSONObject in ) throws JSONConverterException { if ( in . containsKey ( HOOK_LABEL ) ) { JSONObject hooks = ( JSONObject ) in . get ( HOOK_LABEL ) ; for ( Map . Entry < String , Object > e : hooks . entrySet ( ) ) { String k = e . getKey ( ) ; try { Action . Hook h = Action . Hook... | Decorate the action with optional events . |
17,274 | private JSONObject makeActionSkeleton ( Action a ) { JSONObject o = new JSONObject ( ) ; o . put ( START_LABEL , a . getStart ( ) ) ; o . put ( END_LABEL , a . getEnd ( ) ) ; JSONObject hooks = new JSONObject ( ) ; for ( Action . Hook k : Action . Hook . values ( ) ) { JSONArray arr = new JSONArray ( ) ; for ( Event e ... | Just create the JSONObject and set the consume and the end attribute . |
17,275 | public List < Action > listFromJSON ( JSONArray in ) throws JSONConverterException { List < Action > l = new ArrayList < > ( in . size ( ) ) ; for ( Object o : in ) { if ( ! ( o instanceof JSONObject ) ) { throw new JSONConverterException ( "Expected an array of JSONObject but got an array of " + o . getClass ( ) . get... | Convert a list of json - encoded actions . |
17,276 | static String decodeUTF16 ( final String mapcode ) { String result ; final StringBuilder asciiBuf = new StringBuilder ( ) ; for ( final char ch : mapcode . toCharArray ( ) ) { if ( ch == '.' ) { asciiBuf . append ( ch ) ; } else if ( ( ch >= 1 ) && ( ch <= 'z' ) ) { asciiBuf . append ( ch ) ; } else { boolean found = f... | This method decodes a Unicode string to ASCII . Package private for access by other modules . |
17,277 | private static int decodeBase31 ( final String code ) { int value = 0 ; for ( final char c : code . toCharArray ( ) ) { if ( c == '.' ) { return value ; } if ( DECODE_CHARS [ c ] < 0 ) { return - 1 ; } value = ( value * 31 ) + DECODE_CHARS [ c ] ; } return value ; } | returns negative in case of error |
17,278 | public boolean declareImmutable ( String label , BtrpOperand t ) { if ( isDeclared ( label ) ) { return false ; } level . put ( label , - 1 ) ; type . put ( label , t ) ; return true ; } | Declare an immutable variable . The variable must not has been already declared . |
17,279 | public boolean remove ( String label ) { if ( ! isDeclared ( label ) ) { return false ; } level . remove ( label ) ; type . remove ( label ) ; return true ; } | Remove a symbol from the table . |
17,280 | public final boolean declare ( String label , BtrpOperand t ) { if ( isDeclared ( label ) && level . get ( label ) < 0 ) { return false ; } if ( ! isDeclared ( label ) ) { level . put ( label , currentLevel ) ; } type . put ( label , t ) ; return true ; } | Declare a new variable . The variable is inserted into the current script . |
17,281 | protected List < JSSourceFile > getJSSource ( String mid , IResource resource , HttpServletRequest request , List < ICacheKeyGenerator > keyGens ) throws IOException { List < JSSourceFile > result = new ArrayList < JSSourceFile > ( 1 ) ; InputStream in = resource . getInputStream ( ) ; JSSourceFile sf = JSSourceFile . ... | Overrideable method for getting the source modules to compile |
17,282 | protected String moduleNameIdEncodingBeginLayer ( HttpServletRequest request ) { StringBuffer sb = new StringBuffer ( ) ; if ( request . getParameter ( AbstractHttpTransport . SCRIPTS_REQPARAM ) != null ) { sb . append ( "var " + EXPDEPS_VARNAME + ";" ) ; } return sb . toString ( ) ; } | Returns the text to be included at the beginning of the layer if module name id encoding is enabled . |
17,283 | protected String getTail ( ) { String tail = "" ; if ( this . offset < this . limit ) { tail = new String ( this . buffer , this . offset , this . limit - this . offset + 1 ) ; } return tail ; } | This method gets the tail of this scanner without changing the state . |
17,284 | public String getOriginalString ( ) { if ( this . string != null ) { this . string = new String ( this . buffer , this . initialOffset , getLength ( ) ) ; } return this . string ; } | This method gets the original string to parse . |
17,285 | public boolean applyAction ( Model m ) { Mapping map = m . getMapping ( ) ; return map . isRunning ( vm ) && map . getVMLocation ( vm ) . equals ( src ) && map . addSleepingVM ( vm , dst ) ; } | Apply the action by putting the VM into the sleeping state on its destination node in a given model |
17,286 | public StaticRouting . NodesMap nodesMapFromJSON ( Model mo , JSONObject o ) throws JSONConverterException { return new StaticRouting . NodesMap ( requiredNode ( mo , o , "src" ) , requiredNode ( mo , o , "dst" ) ) ; } | Convert a JSON nodes map object into a Java NodesMap object |
17,287 | public static ConstraintSplitterMapper newBundle ( ) { ConstraintSplitterMapper mapper = new ConstraintSplitterMapper ( ) ; mapper . register ( new AmongSplitter ( ) ) ; mapper . register ( new BanSplitter ( ) ) ; mapper . register ( new FenceSplitter ( ) ) ; mapper . register ( new GatherSplitter ( ) ) ; mapper . regi... | Make a new bridge and register every splitters supported by default . |
17,288 | public boolean register ( ConstraintSplitter < ? extends Constraint > ccb ) { return builders . put ( ccb . getKey ( ) , ccb ) == null ; } | Register a splitter . |
17,289 | protected void generateDefaultConstructor ( SourceWriter sourceWriter , String simpleName ) { generateSourcePublicConstructorDeclaration ( sourceWriter , simpleName ) ; sourceWriter . println ( "super();" ) ; generateSourceCloseBlock ( sourceWriter ) ; } | Generates the the default constructor . |
17,290 | protected final void generateSourcePublicMethodDeclaration ( SourceWriter sourceWriter , JMethod method ) { StringBuilder arguments = new StringBuilder ( ) ; for ( JParameter parameter : method . getParameters ( ) ) { if ( arguments . length ( ) > 0 ) { arguments . append ( ", " ) ; } arguments . append ( parameter . g... | This method generates the source code for a public method declaration including the opening brace and indentation . |
17,291 | protected final void generateSourcePublicMethodDeclaration ( SourceWriter sourceWriter , String returnType , String methodName , String arguments , boolean override ) { if ( override ) { sourceWriter . println ( "@Override" ) ; } sourceWriter . print ( "public " ) ; if ( returnType != null ) { sourceWriter . print ( re... | This method generates the source code for a public method or constructor including the opening brace and indentation . |
17,292 | protected void notifyInit ( ) { final String sourceMethod = "notifyInit" ; IServiceReference [ ] refs = null ; try { if ( _aggregator != null && _aggregator . getPlatformServices ( ) != null ) { refs = _aggregator . getPlatformServices ( ) . getServiceReferences ( ICacheManagerListener . class . getName ( ) , "(name=" ... | Notify listeners that the cache manager is initialized . |
17,293 | public int getStatus ( ) { int result = status ; if ( status > 0 ) { if ( skip . getAndDecrement ( ) <= 0 ) { if ( count . getAndDecrement ( ) <= 0 ) { result = status = - 1 ; } } else { result = 0 ; } } return result ; } | Returns the error response status that should be returned for the current response . If the value is zero then the normal response should be returned and this method should be called again for the next response . If the value is less than 0 then this error response status object is spent and may be discarded . |
17,294 | public static boolean deleteMMapGraph ( String path ) { String directory = ensureDirectory ( path ) ; File f = new File ( directory ) ; boolean ok = true ; if ( f . exists ( ) ) { ok = new File ( directory + "nodes.mmap" ) . delete ( ) ; ok = new File ( directory + "edges.mmap" ) . delete ( ) && ok ; ok = new File ( di... | Delete a graph from the given path . |
17,295 | public void mapConstraint ( Class < ? extends Constraint > c , Class < ? extends ChocoConstraint > cc ) { constraints . put ( c , cc ) ; } | Register a mapping between an api - side constraint and its choco implementation . It is expected from the implementation to exhibit a constructor that takes the api - side constraint as argument . |
17,296 | public void mapView ( Class < ? extends ModelView > c , Class < ? extends ChocoView > cc ) { views . put ( c , cc ) ; } | Register a mapping between an api - side view and its choco implementation . It is expected from the implementation to exhibit a constructor that takes the api - side constraint as argument . |
17,297 | public List < Link > getStaticRoute ( NodesMap nm ) { Map < Link , Boolean > route = routes . get ( nm ) ; if ( route == null ) { return null ; } return new ArrayList < > ( route . keySet ( ) ) ; } | Get the static route between two given nodes . |
17,298 | public void setStaticRoute ( NodesMap nm , Map < Link , Boolean > links ) { routes . put ( nm , links ) ; } | Manually add a static route between two nodes . |
17,299 | private IntVar getMovingVM ( ) { for ( int i = move . nextSetBit ( 0 ) ; i >= 0 ; i = move . nextSetBit ( i + 1 ) ) { if ( starts [ i ] != null && ! starts [ i ] . isInstantiated ( ) && oldPos [ i ] != hosts [ i ] . getValue ( ) ) { return starts [ i ] ; } } return null ; } | Get the start moment for a VM that moves |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.