signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class EnglishTreebankParserParams { /** * This method does language - specific tree transformations such
* as annotating particular nodes with language - relevant features .
* Such parameterizations should be inside the specific
* TreebankLangParserParams class . This method is recursively
* applied to each node in the tree ( depth first , left - to - right ) ,
* so you shouldn ' t write this method to apply recursively to tree
* members . This method is allowed to ( and in some cases does )
* destructively change the input tree < code > t < / code > . It changes both
* labels and the tree shape .
* @ param t The input tree ( with non - language - specific annotation already
* done , so you need to strip back to basic categories )
* @ param root The root of the current tree ( can be null for words )
* @ return The fully annotated tree node ( with daughters still as you
* want them in the final result ) */
@ Override public Tree transformTree ( Tree t , Tree root ) { } }
|
if ( t == null || t . isLeaf ( ) ) { return t ; } Tree parent ; String parentStr ; String grandParentStr ; if ( root == null || t . equals ( root ) ) { parent = null ; parentStr = "" ; } else { parent = t . parent ( root ) ; parentStr = parent . label ( ) . value ( ) ; } if ( parent == null || parent . equals ( root ) ) { grandParentStr = "" ; } else { Tree grandParent = parent . parent ( root ) ; grandParentStr = grandParent . label ( ) . value ( ) ; } String baseParentStr = tlp . basicCategory ( parentStr ) ; String baseGrandParentStr = tlp . basicCategory ( grandParentStr ) ; CoreLabel lab = ( CoreLabel ) t . label ( ) ; String word = lab . word ( ) ; String tag = lab . tag ( ) ; String baseTag = tlp . basicCategory ( tag ) ; String cat = lab . value ( ) ; String baseCat = tlp . basicCategory ( cat ) ; if ( t . isPreTerminal ( ) ) { if ( englishTrain . correctTags ) { if ( baseParentStr . equals ( "NP" ) ) { if ( baseCat . equals ( "IN" ) ) { if ( word . equalsIgnoreCase ( "a" ) || word . equalsIgnoreCase ( "that" ) ) { cat = changeBaseCat ( cat , "DT" ) ; } else if ( word . equalsIgnoreCase ( "so" ) || word . equalsIgnoreCase ( "about" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } else if ( word . equals ( "fiscal" ) || word . equalsIgnoreCase ( "next" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } } else if ( baseCat . equals ( "RB" ) ) { if ( word . equals ( "McNally" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "multifamily" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equals ( "MORE" ) ) { cat = changeBaseCat ( cat , "JJR" ) ; } else if ( word . equals ( "hand" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equals ( "fist" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } } else if ( baseCat . equals ( "RP" ) ) { if ( word . equals ( "Howard" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "whole" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } } else if ( baseCat . equals ( "JJ" ) ) { if ( word . equals ( "U.S." ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "ours" ) ) { cat = changeBaseCat ( cat , "PRP" ) ; } else if ( word . equals ( "mine" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equals ( "Sept." ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } } else if ( baseCat . equals ( "NN" ) ) { if ( word . equals ( "Chapman" ) || word . equals ( "Jan." ) || word . equals ( "Sept." ) || word . equals ( "Oct." ) || word . equals ( "Nov." ) || word . equals ( "Dec." ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "members" ) || word . equals ( "bureaus" ) || word . equals ( "days" ) || word . equals ( "outfits" ) || word . equals ( "institutes" ) || word . equals ( "innings" ) || word . equals ( "write-offs" ) || word . equals ( "wines" ) || word . equals ( "trade-offs" ) || word . equals ( "tie-ins" ) || word . equals ( "thrips" ) || word . equals ( "1980s" ) || word . equals ( "1920s" ) ) { cat = changeBaseCat ( cat , "NNS" ) ; } else if ( word . equals ( "this" ) ) { cat = changeBaseCat ( cat , "DT" ) ; } } else if ( baseCat . equals ( ":" ) ) { if ( word . equals ( "'" ) ) { cat = changeBaseCat ( cat , "''" ) ; } } else if ( baseCat . equals ( "NNS" ) ) { if ( word . equals ( "start-up" ) || word . equals ( "ground-handling" ) || word . equals ( "word-processing" ) || word . equals ( "T-shirt" ) || word . equals ( "co-pilot" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equals ( "Sens." ) || word . equals ( "Aichi" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; // not clear why Sens not NNPS
} } else if ( baseCat . equals ( "VBZ" ) ) { if ( word . equals ( "'s" ) ) { cat = changeBaseCat ( cat , "POS" ) ; } else if ( ! word . equals ( "kills" ) ) { // a worse PTB error
cat = changeBaseCat ( cat , "NNS" ) ; } } else if ( baseCat . equals ( "VBG" ) ) { if ( word . equals ( "preferred" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } } else if ( baseCat . equals ( "VB" ) ) { if ( word . equals ( "The" ) ) { cat = changeBaseCat ( cat , "DT" ) ; } else if ( word . equals ( "allowed" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } else if ( word . equals ( "short" ) || word . equals ( "key" ) || word . equals ( "many" ) || word . equals ( "last" ) || word . equals ( "further" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( word . equals ( "lower" ) ) { cat = changeBaseCat ( cat , "JJR" ) ; } else if ( word . equals ( "Nov." ) || word . equals ( "Jan." ) || word . equals ( "Dec." ) || word . equals ( "Tandy" ) || word . equals ( "Release" ) || word . equals ( "Orkem" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "watch" ) || word . equals ( "review" ) || word . equals ( "risk" ) || word . equals ( "realestate" ) || word . equals ( "love" ) || word . equals ( "experience" ) || word . equals ( "control" ) || word . equals ( "Transport" ) || word . equals ( "mind" ) || word . equals ( "term" ) || word . equals ( "program" ) || word . equals ( "gender" ) || word . equals ( "audit" ) || word . equals ( "blame" ) || word . equals ( "stock" ) || word . equals ( "run" ) || word . equals ( "group" ) || word . equals ( "affect" ) || word . equals ( "rent" ) || word . equals ( "show" ) || word . equals ( "accord" ) || word . equals ( "change" ) || word . equals ( "finish" ) || word . equals ( "work" ) || word . equals ( "schedule" ) || word . equals ( "influence" ) || word . equals ( "school" ) || word . equals ( "freight" ) || word . equals ( "growth" ) || word . equals ( "travel" ) || word . equals ( "call" ) || word . equals ( "autograph" ) || word . equals ( "demand" ) || word . equals ( "abuse" ) || word . equals ( "return" ) || word . equals ( "defeat" ) || word . equals ( "pressure" ) || word . equals ( "bank" ) || word . equals ( "notice" ) || word . equals ( "tax" ) || word . equals ( "ooze" ) || word . equals ( "network" ) || word . equals ( "concern" ) || word . equals ( "pit" ) || word . equals ( "contract" ) || word . equals ( "cash" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } } else if ( baseCat . equals ( "NNP" ) ) { if ( word . equals ( "Officials" ) ) { cat = changeBaseCat ( cat , "NNS" ) ; } else if ( word . equals ( "Currently" ) ) { cat = changeBaseCat ( cat , "RB" ) ; // should change NP - TMP to ADVP - TMP here too !
} } else if ( baseCat . equals ( "PRP" ) ) { if ( word . equals ( "her" ) && parent . numChildren ( ) > 1 ) { cat = changeBaseCat ( cat , "PRP$" ) ; } else if ( word . equals ( "US" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } } } else if ( baseParentStr . equals ( "WHNP" ) ) { if ( baseCat . equals ( "VBP" ) && ( word . equalsIgnoreCase ( "that" ) ) ) { cat = changeBaseCat ( cat , "WDT" ) ; } } else if ( baseParentStr . equals ( "UCP" ) ) { if ( word . equals ( "multifamily" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } } else if ( baseParentStr . equals ( "PRT" ) ) { if ( baseCat . equals ( "RBR" ) && word . equals ( "in" ) ) { cat = changeBaseCat ( cat , "RP" ) ; } else if ( baseCat . equals ( "NNP" ) && word . equals ( "up" ) ) { cat = changeBaseCat ( cat , "RP" ) ; } } else if ( baseParentStr . equals ( "PP" ) ) { if ( parentStr . equals ( "PP-TMP" ) ) { if ( baseCat . equals ( "RP" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } if ( word . equals ( "in" ) && ( baseCat . equals ( "RP" ) || baseCat . equals ( "NN" ) ) ) { cat = changeBaseCat ( cat , "IN" ) ; } else if ( baseCat . equals ( "RB" ) ) { if ( word . equals ( "for" ) || word . equals ( "After" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } else if ( word . equals ( "if" ) && baseCat . equals ( "JJ" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } else if ( baseParentStr . equals ( "VP" ) ) { if ( baseCat . equals ( "NNS" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( baseCat . equals ( "IN" ) ) { if ( word . equals ( "complicated" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } else if ( word . equals ( "post" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "like" ) ) { cat = changeBaseCat ( cat , "VB" ) ; // most are VB ; odd VBP
} else if ( word . equals ( "off" ) ) { cat = changeBaseCat ( cat , "RP" ) ; } } else if ( baseCat . equals ( "NN" ) ) { if ( word . endsWith ( "ing" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "bid" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "are" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "lure" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "cost" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "agreed" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "restructure" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "rule" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "fret" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "retort" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "draft" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "will" ) ) { cat = changeBaseCat ( cat , "MD" ) ; } else if ( word . equals ( "yield" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "lure" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "feel" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "institutes" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( word . equals ( "share" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "trade" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "beat" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "effect" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "speed" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "work" ) ) { cat = changeBaseCat ( cat , "VB" ) ; // though also one VBP
} else if ( word . equals ( "act" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "drop" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "stand" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "push" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "service" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "set" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; // or VBD sometimes , sigh
} else if ( word . equals ( "appeal" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; // 2 VBP , 1 VB in train
} else if ( word . equals ( "mold" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "mean" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "reconfirm" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "land" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "point" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "rise" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "pressured" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "smell" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "pay" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "hum" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "shape" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "benefit" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "abducted" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "look" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "fare" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "change" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "farm" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "increase" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "stem" ) ) { cat = changeBaseCat ( cat , "VB" ) ; // only done 200-700
} else if ( word . equals ( "rebounded" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } else if ( word . equals ( "face" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } } else if ( baseCat . equals ( "NNP" ) ) { if ( word . equals ( "GRAB" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "mature" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "Face" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "are" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "Urging" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "Finding" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "say" ) ) { cat = changeBaseCat ( cat , "VBP" ) ; } else if ( word . equals ( "Added" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } else if ( word . equals ( "Adds" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( word . equals ( "BRACED" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } else if ( word . equals ( "REQUIRED" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "SIZING" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "REVIEW" ) ) { cat = changeBaseCat ( cat , "VB" ) ; } else if ( word . equals ( "code-named" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "Printed" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "Rated" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "FALTERS" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( word . equals ( "Got" ) ) { cat = changeBaseCat ( cat , "VBN" ) ; } else if ( word . equals ( "JUMPING" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "Branching" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "Excluding" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } else if ( word . equals ( "Adds" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( word . equals ( "OKing" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } } else if ( baseCat . equals ( "POS" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( baseCat . equals ( "VBD" ) ) { if ( word . equals ( "heaves" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } } else if ( baseCat . equals ( "VB" ) ) { if ( word . equals ( "allowed" ) || word . equals ( "increased" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } } else if ( baseCat . equals ( "VBN" ) ) { if ( word . equals ( "has" ) ) { cat = changeBaseCat ( cat , "VBZ" ) ; } else if ( word . equals ( "grew" ) || word . equals ( "fell" ) ) { cat = changeBaseCat ( cat , "VBD" ) ; } } else if ( baseCat . equals ( "JJ" ) ) { if ( word . equals ( "own" ) ) { cat = changeBaseCat ( cat , "VB" ) ; // a couple should actually be VBP , but at least verb is closer
} } else if ( word . equalsIgnoreCase ( "being" ) ) { if ( ! cat . equals ( "VBG" ) ) { cat = changeBaseCat ( cat , "VBG" ) ; } } else if ( word . equalsIgnoreCase ( "all" ) ) { cat = changeBaseCat ( cat , "RB" ) ; // The below two lines seem in principle good but don ' t actually
// improve parser performance ; they degrade it on 2200-2219
// } else if ( baseGrandParentStr . equals ( " NP " ) & & baseCat . equals ( " VBD " ) ) {
// cat = changeBaseCat ( cat , " VBN " ) ;
} } else if ( baseParentStr . equals ( "S" ) ) { if ( word . equalsIgnoreCase ( "all" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } } else if ( baseParentStr . equals ( "ADJP" ) ) { if ( baseCat . equals ( "UH" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( baseCat . equals ( "JJ" ) ) { if ( word . equalsIgnoreCase ( "more" ) ) { cat = changeBaseCat ( cat , "JJR" ) ; } } else if ( baseCat . equals ( "RB" ) ) { if ( word . equalsIgnoreCase ( "free" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( word . equalsIgnoreCase ( "clear" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( word . equalsIgnoreCase ( "tight" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( word . equalsIgnoreCase ( "sure" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } else if ( word . equalsIgnoreCase ( "particular" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } // most uses of hard / RB should be JJ but not hard put / pressed exx .
} else if ( baseCat . equals ( "VB" ) ) { if ( word . equalsIgnoreCase ( "stock" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equalsIgnoreCase ( "secure" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } } } else if ( baseParentStr . equals ( "QP" ) ) { if ( word . equalsIgnoreCase ( "about" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } else if ( baseCat . equals ( "JJ" ) ) { if ( word . equalsIgnoreCase ( "more" ) ) { cat = changeBaseCat ( cat , "JJR" ) ; // this isn ' t right for " as much as X " constructions !
// } else if ( word . equalsIgnoreCase ( " as " ) ) {
// cat = changeBaseCat ( cat , " RB " ) ;
} } } else if ( baseParentStr . equals ( "ADVP" ) ) { if ( baseCat . equals ( "EX" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } else if ( baseCat . equals ( "NN" ) && word . equalsIgnoreCase ( "that" ) ) { cat = changeBaseCat ( cat , "DT" ) ; } else if ( baseCat . equals ( "NNP" ) && ( word . endsWith ( "ly" ) || word . equals ( "Overall" ) ) ) { cat = changeBaseCat ( cat , "RB" ) ; // This should be a sensible thing to do , but hurts on 2200-2219
// } else if ( baseCat . equals ( " RP " ) & & word . equalsIgnoreCase ( " around " ) ) {
// cat = changeBaseCat ( cat , " RB " ) ;
} } else if ( baseParentStr . equals ( "SBAR" ) ) { if ( ( word . equalsIgnoreCase ( "that" ) || word . equalsIgnoreCase ( "because" ) || word . equalsIgnoreCase ( "while" ) ) && ! baseCat . equals ( "IN" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } else if ( ( word . equals ( "Though" ) || word . equals ( "Whether" ) ) && baseCat . equals ( "NNP" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } else if ( baseParentStr . equals ( "SBARQ" ) ) { if ( baseCat . equals ( "S" ) ) { if ( word . equalsIgnoreCase ( "had" ) ) { cat = changeBaseCat ( cat , "SQ" ) ; } } } else if ( baseCat . equals ( "JJS" ) ) { if ( word . equalsIgnoreCase ( "less" ) ) { cat = changeBaseCat ( cat , "JJR" ) ; } } else if ( baseCat . equals ( "JJ" ) ) { if ( word . equalsIgnoreCase ( "%" ) ) { // nearly all % are NN , a handful are JJ which we ' correct '
cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equalsIgnoreCase ( "to" ) ) { cat = changeBaseCat ( cat , "TO" ) ; } } else if ( baseCat . equals ( "VB" ) ) { if ( word . equalsIgnoreCase ( "even" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } } else if ( baseCat . equals ( "," ) ) { if ( word . equals ( "2" ) ) { cat = changeBaseCat ( cat , "CD" ) ; } else if ( word . equals ( "an" ) ) { cat = changeBaseCat ( cat , "DT" ) ; } else if ( word . equals ( "Wa" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "section" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( word . equals ( "underwriters" ) ) { cat = changeBaseCat ( cat , "NNS" ) ; } } else if ( baseCat . equals ( "CD" ) ) { if ( word . equals ( "high-risk" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } } else if ( baseCat . equals ( "RB" ) ) { if ( word . equals ( "for" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } else if ( baseCat . equals ( "RP" ) ) { if ( word . equals ( "for" ) ) { cat = changeBaseCat ( cat , "IN" ) ; } } else if ( baseCat . equals ( "NN" ) ) { if ( word . length ( ) == 2 && word . charAt ( 1 ) == '.' && Character . isUpperCase ( word . charAt ( 0 ) ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } else if ( word . equals ( "Lorillard" ) ) { cat = changeBaseCat ( cat , "NNP" ) ; } } else if ( word . equals ( "for" ) || word . equals ( "at" ) ) { if ( ! baseCat . equals ( "IN" ) ) { // only non - prepositional taggings are mistaken
cat = changeBaseCat ( cat , "IN" ) ; } } else if ( word . equalsIgnoreCase ( "and" ) && ! baseCat . equals ( "CC" ) ) { cat = changeBaseCat ( cat , "CC" ) ; } else if ( word . equals ( "ago" ) ) { if ( ! baseCat . equals ( "RB" ) ) { cat = changeBaseCat ( cat , "RB" ) ; } } // put correct value into baseCat for later processing !
baseCat = tlp . basicCategory ( cat ) ; } if ( englishTrain . makePPTOintoIN > 0 && baseCat . equals ( "TO" ) ) { // CONJP is for " not to mention "
if ( ! ( baseParentStr . equals ( "VP" ) || baseParentStr . equals ( "CONJP" ) || baseParentStr . startsWith ( "S" ) ) ) { if ( englishTrain . makePPTOintoIN == 1 ) { cat = changeBaseCat ( cat , "IN" ) ; } else { cat = cat + "-IN" ; } } } if ( englishTrain . splitIN == 5 && baseCat . equals ( "TO" ) ) { if ( grandParentStr . charAt ( 0 ) == 'N' && ( parentStr . charAt ( 0 ) == 'P' || parentStr . charAt ( 0 ) == 'A' ) ) { // noun postmodifier PP ( or so - called ADVP like " outside India " )
cat = changeBaseCat ( cat , "IN" ) + "-N" ; } } if ( englishTrain . splitIN == 1 && baseCat . equals ( "IN" ) && parentStr . charAt ( 0 ) == 'S' ) { cat = cat + "^S" ; } else if ( englishTrain . splitIN == 2 && baseCat . equals ( "IN" ) ) { if ( parentStr . charAt ( 0 ) == 'S' ) { cat = cat + "^S" ; } else if ( grandParentStr . charAt ( 0 ) == 'N' ) { cat = cat + "^N" ; } } else if ( englishTrain . splitIN == 3 && baseCat . equals ( "IN" ) ) { // 6 classes seems good !
// but have played with joining first two , splitting out ADJP / ADVP ,
// and joining two SC cases
if ( grandParentStr . charAt ( 0 ) == 'N' && ( parentStr . charAt ( 0 ) == 'P' || parentStr . charAt ( 0 ) == 'A' ) ) { // noun postmodifier PP ( or so - called ADVP like " outside India " )
cat = cat + "-N" ; } else if ( parentStr . charAt ( 0 ) == 'Q' && ( grandParentStr . charAt ( 0 ) == 'N' || grandParentStr . startsWith ( "ADJP" ) ) ) { // about , than , between , etc . in a QP preceding head of NP
cat = cat + "-Q" ; } else if ( grandParentStr . equals ( "S" ) ) { // the distinction here shouldn ' t matter given parent annotation !
if ( baseParentStr . equals ( "SBAR" ) ) { // sentential subordinating conj : although , if , until , as , while
cat = cat + "-SCC" ; } else { // PP adverbial clause : among , in , for , after
cat = cat + "-SC" ; } } else if ( baseParentStr . equals ( "SBAR" ) || baseParentStr . equals ( "WHNP" ) ) { // that - clause complement of VP or NP ( or whether , if complement )
// but also VP adverbial because , until , as , etc .
cat = cat + "-T" ; } // all the rest under VP , PP , ADJP , ADVP , etc . are basic case
} else if ( englishTrain . splitIN >= 4 && englishTrain . splitIN <= 5 && baseCat . equals ( "IN" ) ) { if ( grandParentStr . charAt ( 0 ) == 'N' && ( parentStr . charAt ( 0 ) == 'P' || parentStr . charAt ( 0 ) == 'A' ) ) { // noun postmodifier PP ( or so - called ADVP like " outside India " )
cat = cat + "-N" ; } else if ( parentStr . charAt ( 0 ) == 'Q' && ( grandParentStr . charAt ( 0 ) == 'N' || grandParentStr . startsWith ( "ADJP" ) ) ) { // about , than , between , etc . in a QP preceding head of NP
cat = cat + "-Q" ; } else if ( baseGrandParentStr . charAt ( 0 ) == 'S' && ! baseGrandParentStr . equals ( "SBAR" ) ) { // the distinction here shouldn ' t matter given parent annotation !
if ( baseParentStr . equals ( "SBAR" ) ) { // sentential subordinating conj : although , if , until , as , while
cat = cat + "-SCC" ; } else if ( ! baseParentStr . equals ( "NP" ) && ! baseParentStr . equals ( "ADJP" ) ) { // PP adverbial clause : among , in , for , after
cat = cat + "-SC" ; } } else if ( baseParentStr . equals ( "SBAR" ) || baseParentStr . equals ( "WHNP" ) || baseParentStr . equals ( "WHADVP" ) ) { // that - clause complement of VP or NP ( or whether , if complement )
// but also VP adverbial because , until , as , etc .
cat = cat + "-T" ; } // all the rest under VP , PP , ADJP , ADVP , etc . are basic case
} else if ( englishTrain . splitIN == 6 && baseCat . equals ( "IN" ) ) { if ( grandParentStr . charAt ( 0 ) == 'V' || grandParentStr . charAt ( 0 ) == 'A' ) { cat = cat + "-V" ; } else if ( grandParentStr . charAt ( 0 ) == 'N' && ( parentStr . charAt ( 0 ) == 'P' || parentStr . charAt ( 0 ) == 'A' ) ) { // noun postmodifier PP ( or so - called ADVP like " outside India " )
// XXX experiment cat = cat + " - N " ;
} else if ( parentStr . charAt ( 0 ) == 'Q' && ( grandParentStr . charAt ( 0 ) == 'N' || grandParentStr . startsWith ( "ADJP" ) ) ) { // about , than , between , etc . in a QP preceding head of NP
cat = cat + "-Q" ; } else if ( baseGrandParentStr . charAt ( 0 ) == 'S' && ! baseGrandParentStr . equals ( "SBAR" ) ) { // the distinction here shouldn ' t matter given parent annotation !
if ( baseParentStr . equals ( "SBAR" ) ) { // sentential subordinating conj : although , if , until , as , while
cat = cat + "-SCC" ; } else if ( ! baseParentStr . equals ( "NP" ) && ! baseParentStr . equals ( "ADJP" ) ) { // PP adverbial clause : among , in , for , after
cat = cat + "-SC" ; } } else if ( baseParentStr . equals ( "SBAR" ) || baseParentStr . equals ( "WHNP" ) || baseParentStr . equals ( "WHADVP" ) ) { // that - clause complement of VP or NP ( or whether , if complement )
// but also VP adverbial because , until , as , etc .
cat = cat + "-T" ; } // all the rest under VP , PP , ADJP , ADVP , etc . are basic case
} if ( englishTrain . splitPercent && word . equals ( "%" ) ) { cat += "-%" ; } if ( englishTrain . splitNNP > 0 && baseCat . startsWith ( "NNP" ) ) { if ( englishTrain . splitNNP == 1 ) { if ( baseCat . equals ( "NNP" ) ) { if ( parent . numChildren ( ) == 1 ) { cat += "-S" ; } else if ( parent . firstChild ( ) . equals ( t ) ) { cat += "-L" ; } else if ( parent . lastChild ( ) . equals ( t ) ) { cat += "-R" ; } else { cat += "-I" ; } } } else if ( englishTrain . splitNNP == 2 ) { if ( word . matches ( "[A-Z]\\.?" ) ) { cat = cat + "-I" ; } else if ( firstOfSeveralNNP ( parent , t ) ) { cat = cat + "-B" ; } else if ( lastOfSeveralNNP ( parent , t ) ) { cat = cat + "-E" ; } } } if ( englishTrain . splitQuotes && ( word . equals ( "'" ) || word . equals ( "`" ) ) ) { cat += "-SG" ; } if ( englishTrain . splitSFP && baseTag . equals ( "." ) ) { if ( word . equals ( "?" ) ) { cat += "-QUES" ; } else if ( word . equals ( "!" ) ) { cat += "-EXCL" ; } } if ( englishTrain . tagRBGPA ) { if ( baseCat . equals ( "RB" ) ) { cat = cat + "^" + baseGrandParentStr ; } } if ( englishTrain . joinPound && baseCat . equals ( "#" ) ) { cat = changeBaseCat ( cat , "$" ) ; } if ( englishTrain . joinNounTags ) { if ( baseCat . equals ( "NNP" ) ) { cat = changeBaseCat ( cat , "NN" ) ; } else if ( baseCat . equals ( "NNPS" ) ) { cat = changeBaseCat ( cat , "NNS" ) ; } } if ( englishTrain . joinJJ && cat . startsWith ( "JJ" ) ) { cat = changeBaseCat ( cat , "JJ" ) ; } if ( englishTrain . splitPPJJ && cat . startsWith ( "JJ" ) && parentStr . startsWith ( "PP" ) ) { cat = cat + "^S" ; } if ( englishTrain . splitTRJJ && cat . startsWith ( "JJ" ) && ( parentStr . startsWith ( "PP" ) || parentStr . startsWith ( "ADJP" ) ) && headFinder ( ) . determineHead ( parent ) == t ) { // look for NP right sister of head JJ - - if so transitive adjective
Tree [ ] kids = parent . children ( ) ; boolean foundJJ = false ; int i = 0 ; for ( ; i < kids . length && ! foundJJ ; i ++ ) { if ( kids [ i ] . label ( ) . value ( ) . startsWith ( "JJ" ) ) { foundJJ = true ; } } for ( int j = i ; j < kids . length ; j ++ ) { if ( kids [ j ] . label ( ) . value ( ) . startsWith ( "NP" ) ) { cat = cat + "^T" ; break ; } } } if ( englishTrain . splitJJCOMP && cat . startsWith ( "JJ" ) && ( parentStr . startsWith ( "PP" ) || parentStr . startsWith ( "ADJP" ) ) && headFinder ( ) . determineHead ( parent ) == t ) { // look for _ anything _ right sister of JJ - - if so has comp ( I guess )
Tree [ ] kids = parent . children ( ) ; boolean foundJJ = false ; int i = 0 ; for ( ; i < kids . length && ! foundJJ ; i ++ ) { if ( kids [ i ] . label ( ) . value ( ) . startsWith ( "JJ" ) ) { break ; } } if ( i < kids . length - 1 ) { // there ' s still a complement to go .
cat = cat + "^CMPL" ; } } if ( englishTrain . splitMoreLess ) { char ch = cat . charAt ( 0 ) ; if ( ch == 'R' || ch == 'J' || ch == 'C' ) { // adverbs , adjectives and coordination - - what you ' d expect
if ( word . equalsIgnoreCase ( "more" ) || word . equalsIgnoreCase ( "most" ) || word . equalsIgnoreCase ( "less" ) || word . equalsIgnoreCase ( "least" ) ) { cat = cat + "-ML" ; } } } if ( englishTrain . unaryDT && cat . startsWith ( "DT" ) ) { if ( parent . children ( ) . length == 1 ) { cat = cat + "^U" ; } } if ( englishTrain . unaryRB && cat . startsWith ( "RB" ) ) { if ( parent . children ( ) . length == 1 ) { cat = cat + "^U" ; } } if ( englishTrain . markReflexivePRP && cat . startsWith ( "PRP" ) ) { if ( word . equalsIgnoreCase ( "itself" ) || word . equalsIgnoreCase ( "themselves" ) || word . equalsIgnoreCase ( "himself" ) || word . equalsIgnoreCase ( "herself" ) || word . equalsIgnoreCase ( "ourselves" ) || word . equalsIgnoreCase ( "yourself" ) || word . equalsIgnoreCase ( "yourselves" ) || word . equalsIgnoreCase ( "myself" ) || word . equalsIgnoreCase ( "thyself" ) ) { cat += "-SE" ; } } if ( englishTrain . unaryPRP && cat . startsWith ( "PRP" ) ) { if ( parent . children ( ) . length == 1 ) { cat = cat + "^U" ; } } if ( englishTrain . unaryIN && cat . startsWith ( "IN" ) ) { if ( parent . children ( ) . length == 1 ) { cat = cat + "^U" ; } } if ( englishTrain . splitCC > 0 && baseCat . equals ( "CC" ) ) { if ( englishTrain . splitCC == 1 && ( word . equals ( "and" ) || word . equals ( "or" ) ) ) { cat = cat + "-C" ; } else if ( englishTrain . splitCC == 2 ) { if ( word . equalsIgnoreCase ( "but" ) ) { cat = cat + "-B" ; } else if ( word . equals ( "&" ) ) { cat = cat + "-A" ; } } else if ( englishTrain . splitCC == 3 && word . equalsIgnoreCase ( "and" ) ) { cat = cat + "-A" ; } } if ( englishTrain . splitNOT && baseCat . equals ( "RB" ) && ( word . equalsIgnoreCase ( "n't" ) || word . equalsIgnoreCase ( "not" ) || word . equalsIgnoreCase ( "nt" ) ) ) { cat = cat + "-N" ; } else if ( englishTrain . splitRB && baseCat . equals ( "RB" ) && ( baseParentStr . equals ( "NP" ) || baseParentStr . equals ( "QP" ) || baseParentStr . equals ( "ADJP" ) ) ) { cat = cat + "^M" ; } if ( englishTrain . splitAux > 1 && ( baseCat . equals ( "VBZ" ) || baseCat . equals ( "VBP" ) || baseCat . equals ( "VBD" ) || baseCat . equals ( "VBN" ) || baseCat . equals ( "VBG" ) || baseCat . equals ( "VB" ) ) ) { if ( word . equalsIgnoreCase ( "'s" ) || word . equalsIgnoreCase ( "s" ) ) { // a few times the apostrophe is missing !
Tree [ ] sisters = parent . children ( ) ; boolean foundMe = false ; int i = 0 ; for ( ; i < sisters . length && ! foundMe ; i ++ ) { if ( sisters [ i ] . label ( ) . value ( ) . startsWith ( "VBZ" ) ) { foundMe = true ; } } boolean annotateHave = false ; // VBD counts as an erroneous VBN !
for ( int j = i ; j < sisters . length ; j ++ ) { if ( sisters [ j ] . label ( ) . value ( ) . startsWith ( "VP" ) ) { Tree [ ] kids = sisters [ j ] . children ( ) ; for ( int k = 0 ; k < kids . length ; k ++ ) { if ( kids [ k ] . label ( ) . value ( ) . startsWith ( "VBN" ) || kids [ k ] . label ( ) . value ( ) . startsWith ( "VBD" ) ) { annotateHave = true ; } } } } if ( annotateHave ) { cat = cat + "-HV" ; // System . out . println ( " Went with HAVE for " + parent ) ;
} else { cat = cat + "-BE" ; } } else { if ( word . equalsIgnoreCase ( "am" ) || word . equalsIgnoreCase ( "is" ) || word . equalsIgnoreCase ( "are" ) || word . equalsIgnoreCase ( "was" ) || word . equalsIgnoreCase ( "were" ) || word . equalsIgnoreCase ( "'m" ) || word . equalsIgnoreCase ( "'re" ) || word . equalsIgnoreCase ( "be" ) || word . equalsIgnoreCase ( "being" ) || word . equalsIgnoreCase ( "been" ) || word . equalsIgnoreCase ( "ai" ) ) { // allow " ai n ' t "
cat = cat + "-BE" ; } else if ( word . equalsIgnoreCase ( "have" ) || word . equalsIgnoreCase ( "'ve" ) || word . equalsIgnoreCase ( "having" ) || word . equalsIgnoreCase ( "has" ) || word . equalsIgnoreCase ( "had" ) || word . equalsIgnoreCase ( "'d" ) ) { cat = cat + "-HV" ; } else if ( englishTrain . splitAux >= 3 && ( word . equalsIgnoreCase ( "do" ) || word . equalsIgnoreCase ( "did" ) || word . equalsIgnoreCase ( "does" ) || word . equalsIgnoreCase ( "done" ) || word . equalsIgnoreCase ( "doing" ) ) ) { // both DO and HELP take VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 4 && ( word . equalsIgnoreCase ( "help" ) || word . equalsIgnoreCase ( "helps" ) || word . equalsIgnoreCase ( "helped" ) || word . equalsIgnoreCase ( "helping" ) ) ) { // both DO and HELP take VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 5 && ( word . equalsIgnoreCase ( "let" ) || word . equalsIgnoreCase ( "lets" ) || word . equalsIgnoreCase ( "letting" ) ) ) { // LET also takes VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 6 && ( word . equalsIgnoreCase ( "make" ) || word . equalsIgnoreCase ( "makes" ) || word . equalsIgnoreCase ( "making" ) || word . equalsIgnoreCase ( "made" ) ) ) { // MAKE can also take VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 7 && ( word . equalsIgnoreCase ( "watch" ) || word . equalsIgnoreCase ( "watches" ) || word . equalsIgnoreCase ( "watching" ) || word . equalsIgnoreCase ( "watched" ) || word . equalsIgnoreCase ( "see" ) || word . equalsIgnoreCase ( "sees" ) || word . equalsIgnoreCase ( "seeing" ) || word . equalsIgnoreCase ( "saw" ) || word . equalsIgnoreCase ( "seen" ) ) ) { // WATCH , SEE can also take VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 8 && ( word . equalsIgnoreCase ( "go" ) || word . equalsIgnoreCase ( "come" ) ) ) { // go , come , but not inflections can also take VB form complement VP
cat = cat + "-DO" ; } else if ( englishTrain . splitAux >= 9 && ( word . equalsIgnoreCase ( "get" ) || word . equalsIgnoreCase ( "gets" ) || word . equalsIgnoreCase ( "getting" ) || word . equalsIgnoreCase ( "got" ) || word . equalsIgnoreCase ( "gotten" ) ) ) { // GET also takes a VBN form complement VP
cat = cat + "-BE" ; } } } else if ( englishTrain . splitAux > 0 && ( baseCat . equals ( "VBZ" ) || baseCat . equals ( "VBP" ) || baseCat . equals ( "VBD" ) || baseCat . equals ( "VBN" ) || baseCat . equals ( "VBG" ) || baseCat . equals ( "VB" ) ) ) { if ( word . equalsIgnoreCase ( "is" ) || word . equalsIgnoreCase ( "am" ) || word . equalsIgnoreCase ( "are" ) || word . equalsIgnoreCase ( "was" ) || word . equalsIgnoreCase ( "were" ) || word . equalsIgnoreCase ( "'m" ) || word . equalsIgnoreCase ( "'re" ) || word . equalsIgnoreCase ( "'s" ) || // imperfect - - could be ( ha ) s
word . equalsIgnoreCase ( "being" ) || word . equalsIgnoreCase ( "be" ) || word . equalsIgnoreCase ( "been" ) ) { cat = cat + "-BE" ; } if ( word . equalsIgnoreCase ( "have" ) || word . equalsIgnoreCase ( "'ve" ) || word . equalsIgnoreCase ( "having" ) || word . equalsIgnoreCase ( "has" ) || word . equalsIgnoreCase ( "had" ) || word . equalsIgnoreCase ( "'d" ) ) { cat = cat + "-HV" ; } } if ( englishTrain . markDitransV > 0 && cat . startsWith ( "VB" ) ) { cat += ditrans ( parent ) ; } else if ( englishTrain . vpSubCat && cat . startsWith ( "VB" ) ) { cat = cat + subCatify ( parent ) ; } // VITAL : update tag to be same as cat for when new node is created below
tag = cat ; } else { // that is , if ( t . isPhrasal ( ) )
Tree [ ] kids = t . children ( ) ; if ( baseCat . equals ( "VP" ) ) { if ( englishTrain . gpaRootVP ) { if ( tlp . isStartSymbol ( baseGrandParentStr ) ) { cat = cat + "~ROOT" ; } } if ( englishTrain . splitVPNPAgr ) { // don ' t split on weirdo categories !
// but do preserve agreement distinctions
// note MD is like VBD - - any subject person / number okay
if ( baseTag . equals ( "VBD" ) || baseTag . equals ( "MD" ) ) { cat = cat + "-VBF" ; } else if ( baseTag . equals ( "VBZ" ) || baseTag . equals ( "TO" ) || baseTag . equals ( "VBG" ) || baseTag . equals ( "VBP" ) || baseTag . equals ( "VBN" ) || baseTag . equals ( "VB" ) ) { cat = cat + "-" + baseTag ; } else { System . err . println ( "XXXX Head of " + t + " is " + word + "/" + baseTag ) ; } } else if ( englishTrain . splitVP == 3 || englishTrain . splitVP == 4 ) { // don ' t split on weirdo categories but deduce
if ( baseTag . equals ( "VBZ" ) || baseTag . equals ( "VBD" ) || baseTag . equals ( "VBP" ) || baseTag . equals ( "MD" ) ) { cat = cat + "-VBF" ; } else if ( baseTag . equals ( "TO" ) || baseTag . equals ( "VBG" ) || baseTag . equals ( "VBN" ) || baseTag . equals ( "VB" ) ) { cat = cat + "-" + baseTag ; } else if ( englishTrain . splitVP == 4 ) { String dTag = deduceTag ( word ) ; cat = cat + "-" + dTag ; } } else if ( englishTrain . splitVP == 2 ) { if ( baseTag . equals ( "VBZ" ) || baseTag . equals ( "VBD" ) || baseTag . equals ( "VBP" ) || baseTag . equals ( "MD" ) ) { cat = cat + "-VBF" ; } else { cat = cat + "-" + baseTag ; } } else if ( englishTrain . splitVP == 1 ) { cat = cat + "-" + baseTag ; } } if ( englishTrain . dominatesV > 0 ) { if ( englishTrain . dominatesV == 2 ) { if ( hasClausalV ( t ) ) { cat = cat + "-v" ; } } else if ( englishTrain . dominatesV == 3 ) { if ( hasV ( t . preTerminalYield ( ) ) && ! baseCat . equals ( "WHPP" ) && ! baseCat . equals ( "RRC" ) && ! baseCat . equals ( "QP" ) && ! baseCat . equals ( "PRT" ) ) { cat = cat + "-v" ; } } else { if ( hasV ( t . preTerminalYield ( ) ) ) { cat = cat + "-v" ; } } } if ( englishTrain . dominatesI && hasI ( t . preTerminalYield ( ) ) ) { cat = cat + "-i" ; } if ( englishTrain . dominatesC && hasC ( t . preTerminalYield ( ) ) ) { cat = cat + "-c" ; } if ( englishTrain . splitNPpercent > 0 && word . equals ( "%" ) ) { if ( baseCat . equals ( "NP" ) || englishTrain . splitNPpercent > 1 && baseCat . equals ( "ADJP" ) || englishTrain . splitNPpercent > 2 && baseCat . equals ( "QP" ) || englishTrain . splitNPpercent > 3 ) { cat += "-%" ; } } if ( englishTrain . splitNPPRP && baseTag . equals ( "PRP" ) ) { cat += "-PRON" ; } if ( englishTrain . splitSbar > 0 && baseCat . equals ( "SBAR" ) ) { boolean foundIn = false ; boolean foundOrder = false ; boolean infinitive = baseTag . equals ( "TO" ) ; for ( int i = 0 ; i < kids . length ; i ++ ) { if ( kids [ i ] . isPreTerminal ( ) && kids [ i ] . children ( ) [ 0 ] . value ( ) . equalsIgnoreCase ( "in" ) ) { foundIn = true ; } if ( kids [ i ] . isPreTerminal ( ) && kids [ i ] . children ( ) [ 0 ] . value ( ) . equalsIgnoreCase ( "order" ) ) { foundOrder = true ; } } if ( englishTrain . splitSbar > 1 && infinitive ) { cat = cat + "-INF" ; } if ( ( englishTrain . splitSbar == 1 || englishTrain . splitSbar == 3 ) && foundIn && foundOrder ) { cat = cat + "-PURP" ; } } if ( englishTrain . splitNPNNP > 0 ) { if ( englishTrain . splitNPNNP == 1 && baseCat . equals ( "NP" ) && baseTag . equals ( "NNP" ) ) { cat = cat + "-NNP" ; } else if ( englishTrain . splitNPNNP == 2 && baseCat . equals ( "NP" ) && baseTag . startsWith ( "NNP" ) ) { cat = cat + "-NNP" ; } else if ( englishTrain . splitNPNNP == 3 && baseCat . equals ( "NP" ) ) { boolean split = false ; for ( int i = 0 ; i < kids . length ; i ++ ) { if ( kids [ i ] . value ( ) . startsWith ( "NNP" ) ) { split = true ; break ; } } if ( split ) { cat = cat + "-NNP" ; } } } if ( englishTrain . splitVPNPAgr && baseCat . equals ( "NP" ) && baseParentStr . startsWith ( "S" ) ) { if ( baseTag . equals ( "NNPS" ) || baseTag . equals ( "NNS" ) ) { cat = cat + "-PL" ; } else if ( word . equalsIgnoreCase ( "many" ) || word . equalsIgnoreCase ( "more" ) || word . equalsIgnoreCase ( "most" ) || word . equalsIgnoreCase ( "plenty" ) ) { cat = cat + "-PL" ; } else if ( baseTag . equals ( "NN" ) || baseTag . equals ( "NNP" ) || baseTag . equals ( "POS" ) || baseTag . equals ( "CD" ) || baseTag . equals ( "PRP$" ) || baseTag . equals ( "JJ" ) || baseTag . equals ( "EX" ) || baseTag . equals ( "$" ) || baseTag . equals ( "RB" ) || baseTag . equals ( "FW" ) || baseTag . equals ( "VBG" ) || baseTag . equals ( "JJS" ) || baseTag . equals ( "JJR" ) ) { } else if ( baseTag . equals ( "PRP" ) ) { if ( word . equalsIgnoreCase ( "they" ) || word . equalsIgnoreCase ( "them" ) || word . equalsIgnoreCase ( "we" ) || word . equalsIgnoreCase ( "us" ) ) { cat = cat + "-PL" ; } } else if ( baseTag . equals ( "DT" ) || baseTag . equals ( "WDT" ) ) { if ( word . equalsIgnoreCase ( "these" ) || word . equalsIgnoreCase ( "those" ) || word . equalsIgnoreCase ( "several" ) ) { cat += "-PL" ; } } else { System . err . println ( "XXXX Head of " + t + " is " + word + "/" + baseTag ) ; } } if ( englishTrain . splitSTag > 0 && ( baseCat . equals ( "S" ) || ( englishTrain . splitSTag <= 3 && ( baseCat . equals ( "SINV" ) || baseCat . equals ( "SQ" ) ) ) ) ) { if ( englishTrain . splitSTag == 1 ) { cat = cat + "-" + baseTag ; } else if ( baseTag . equals ( "VBZ" ) || baseTag . equals ( "VBD" ) || baseTag . equals ( "VBP" ) || baseTag . equals ( "MD" ) ) { cat = cat + "-VBF" ; } else if ( ( englishTrain . splitSTag == 3 || englishTrain . splitSTag == 5 ) && ( ( baseTag . equals ( "TO" ) || baseTag . equals ( "VBG" ) || baseTag . equals ( "VBN" ) || baseTag . equals ( "VB" ) ) ) ) { cat = cat + "-VBNF" ; } } if ( englishTrain . markContainedVP && containsVP ( t ) ) { cat = cat + "-vp" ; } if ( englishTrain . markCC > 0 ) { // was : for ( int i = 0 ; i < kids . length ; i + + ) {
// This second version takes an idea from Collins : don ' t count
// marginal conjunctions which don ' t conjoin 2 things .
for ( int i = 1 ; i < kids . length - 1 ; i ++ ) { String cat2 = kids [ i ] . label ( ) . value ( ) ; if ( cat2 . startsWith ( "CC" ) ) { String word2 = kids [ i ] . children ( ) [ 0 ] . value ( ) ; // get word
// added this if since - acl03pcfg
if ( ! ( word2 . equals ( "either" ) || word2 . equals ( "both" ) || word2 . equals ( "neither" ) ) ) { cat = cat + "-CC" ; break ; } else { // System . err . println ( " XXX Found non - marginal either / both / neither " ) ;
} } else if ( englishTrain . markCC > 1 && cat2 . startsWith ( "CONJP" ) ) { cat = cat + "-CC" ; break ; } } } if ( englishTrain . splitSGapped == 1 && baseCat . equals ( "S" ) && ! kids [ 0 ] . label ( ) . value ( ) . startsWith ( "NP" ) ) { // this doesn ' t handle predicative NPs right yet
// to do that , need to intervene before tree normalization
cat = cat + "-G" ; } else if ( englishTrain . splitSGapped == 2 && baseCat . equals ( "S" ) ) { // better version : you ' re gapped if there is no NP , or there is just
// one ( putatively predicative ) NP with no VP , ADJP , NP , PP , or UCP
boolean seenPredCat = false ; int seenNP = 0 ; for ( int i = 0 ; i < kids . length ; i ++ ) { String cat2 = kids [ i ] . label ( ) . value ( ) ; if ( cat2 . startsWith ( "NP" ) ) { seenNP ++ ; } else if ( cat2 . startsWith ( "VP" ) || cat2 . startsWith ( "ADJP" ) || cat2 . startsWith ( "PP" ) || cat2 . startsWith ( "UCP" ) ) { seenPredCat = true ; } } if ( seenNP == 0 || ( seenNP == 1 && ! seenPredCat ) ) { cat = cat + "-G" ; } } else if ( englishTrain . splitSGapped == 3 && baseCat . equals ( "S" ) ) { // better version : you ' re gapped if there is no NP , or there is just
// one ( putatively predicative ) NP with no VP , ADJP , NP , PP , or UCP
// NEW : but you ' re not gapped if you have an S and CC daughter ( coord )
boolean seenPredCat = false ; boolean seenCC = false ; boolean seenS = false ; int seenNP = 0 ; for ( int i = 0 ; i < kids . length ; i ++ ) { String cat2 = kids [ i ] . label ( ) . value ( ) ; if ( cat2 . startsWith ( "NP" ) ) { seenNP ++ ; } else if ( cat2 . startsWith ( "VP" ) || cat2 . startsWith ( "ADJP" ) || cat2 . startsWith ( "PP" ) || cat2 . startsWith ( "UCP" ) ) { seenPredCat = true ; } else if ( cat2 . startsWith ( "CC" ) ) { seenCC = true ; } else if ( cat2 . startsWith ( "S" ) ) { seenS = true ; } } if ( ( ! ( seenCC && seenS ) ) && ( seenNP == 0 || ( seenNP == 1 && ! seenPredCat ) ) ) { cat = cat + "-G" ; } } else if ( englishTrain . splitSGapped == 4 && baseCat . equals ( "S" ) ) { // better version : you ' re gapped if there is no NP , or there is just
// one ( putatively predicative ) NP with no VP , ADJP , NP , PP , or UCP
// But : not gapped if S ( BAR ) - NOM - SBJ constituent
// But : you ' re not gapped if you have two / ^ S / daughters
boolean seenPredCat = false ; boolean sawSBeforePredCat = false ; int seenS = 0 ; int seenNP = 0 ; for ( int i = 0 ; i < kids . length ; i ++ ) { String cat2 = kids [ i ] . label ( ) . value ( ) ; if ( cat2 . startsWith ( "NP" ) ) { seenNP ++ ; } else if ( cat2 . startsWith ( "VP" ) || cat2 . startsWith ( "ADJP" ) || cat2 . startsWith ( "PP" ) || cat2 . startsWith ( "UCP" ) ) { seenPredCat = true ; } else if ( cat2 . startsWith ( "S" ) ) { seenS ++ ; if ( ! seenPredCat ) { sawSBeforePredCat = true ; } } } if ( ( seenS < 2 ) && ( ! ( sawSBeforePredCat && seenPredCat ) ) && ( seenNP == 0 || ( seenNP == 1 && ! seenPredCat ) ) ) { cat = cat + "-G" ; } } if ( englishTrain . splitNumNP && baseCat . equals ( "NP" ) ) { boolean seenNum = false ; for ( int i = 0 ; i < kids . length ; i ++ ) { String cat2 = kids [ i ] . label ( ) . value ( ) ; if ( cat2 . startsWith ( "QP" ) || cat2 . startsWith ( "CD" ) || cat2 . startsWith ( "$" ) || cat2 . startsWith ( "#" ) || ( cat2 . startsWith ( "NN" ) && cat2 . indexOf ( "-%" ) >= 0 ) ) { seenNum = true ; break ; } } if ( seenNum ) { cat += "-NUM" ; } } if ( englishTrain . splitPoss > 0 && baseCat . equals ( "NP" ) && kids [ kids . length - 1 ] . label ( ) . value ( ) . startsWith ( "POS" ) ) { if ( englishTrain . splitPoss == 2 ) { // special case splice in a new node ! Do it all here
Label labelBot ; if ( t . isPrePreTerminal ( ) ) { labelBot = new CategoryWordTag ( "NP^POSSP-B" , word , tag ) ; } else { labelBot = new CategoryWordTag ( "NP^POSSP" , word , tag ) ; } t . setLabel ( labelBot ) ; List < Tree > oldKids = t . getChildrenAsList ( ) ; // could I use subList ( ) here or is a true copy better ?
// lose the last child
List < Tree > newKids = new ArrayList < Tree > ( ) ; for ( int i = 0 ; i < oldKids . size ( ) - 1 ; i ++ ) { newKids . add ( oldKids . get ( i ) ) ; } t . setChildren ( newKids ) ; cat = changeBaseCat ( cat , "POSSP" ) ; Label labelTop = new CategoryWordTag ( cat , word , tag ) ; List < Tree > newerChildren = new ArrayList < Tree > ( 2 ) ; newerChildren . add ( t ) ; // add POS dtr
Tree last = oldKids . get ( oldKids . size ( ) - 1 ) ; if ( ! last . value ( ) . equals ( "POS^NP" ) ) { System . err . println ( "Unexpected POS value (!): " + last ) ; } last . setValue ( "POS^POSSP" ) ; newerChildren . add ( last ) ; return categoryWordTagTreeFactory . newTreeNode ( labelTop , newerChildren ) ; } else { cat = cat + "-P" ; } } if ( englishTrain . splitBaseNP > 0 && baseCat . equals ( "NP" ) && t . isPrePreTerminal ( ) ) { if ( englishTrain . splitBaseNP == 2 ) { if ( parentStr . startsWith ( "NP" ) ) { // already got one above us
cat = cat + "-B" ; } else { // special case splice in a new node ! Do it all here
Label labelBot = new CategoryWordTag ( "NP^NP-B" , word , tag ) ; t . setLabel ( labelBot ) ; Label labelTop = new CategoryWordTag ( cat , word , tag ) ; List < Tree > newerChildren = new ArrayList < Tree > ( 1 ) ; newerChildren . add ( t ) ; return categoryWordTagTreeFactory . newTreeNode ( labelTop , newerChildren ) ; } } else { cat = cat + "-B" ; } } if ( englishTrain . rightPhrasal && rightPhrasal ( t ) ) { cat = cat + "-RX" ; } } t . setLabel ( new CategoryWordTag ( cat , word , tag ) ) ; return t ;
|
public class KeyVaultClientBaseImpl { /** * Lists deleted storage accounts for the specified vault .
* The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted for a vault enabled for soft - delete . This operation requires the storage / list permission .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < DeletedStorageAccountItem > > getDeletedStorageAccountsNextAsync ( final String nextPageLink , final ServiceFuture < List < DeletedStorageAccountItem > > serviceFuture , final ListOperationCallback < DeletedStorageAccountItem > serviceCallback ) { } }
|
return AzureServiceFuture . fromPageResponse ( getDeletedStorageAccountsNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponse < Page < DeletedStorageAccountItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DeletedStorageAccountItem > > > call ( String nextPageLink ) { return getDeletedStorageAccountsNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ;
|
public class CmsObject { /** * Writes a list of access control entries as new access control entries of a given resource . < p >
* Already existing access control entries of this resource are removed before . < p >
* @ param resource the resource to attach the control entries to
* @ param acEntries a list of < code > { @ link CmsAccessControlEntry } < / code > objects
* @ throws CmsException if something goes wrong */
public void importAccessControlEntries ( CmsResource resource , List < CmsAccessControlEntry > acEntries ) throws CmsException { } }
|
m_securityManager . importAccessControlEntries ( m_context , resource , acEntries ) ;
|
public class CnvTfsDouble { /** * < p > Convert from string . < / p >
* @ param pAddParam additional params , e . g . IRequestData
* to fill owner itsVersion .
* @ param pStrVal string representation
* @ return Double value
* @ throws Exception - an exception */
@ Override public final Double fromString ( final Map < String , Object > pAddParam , final String pStrVal ) throws Exception { } }
|
if ( pStrVal == null || "" . equals ( pStrVal ) ) { return null ; } if ( pAddParam != null ) { String dsep = ( String ) pAddParam . get ( "decSepv" ) ; if ( dsep != null ) { String dgsep = ( String ) pAddParam . get ( "decGrSepv" ) ; String strVal = pStrVal . replace ( dgsep , "" ) . replace ( dsep , "." ) ; return Double . valueOf ( strVal ) ; } } return Double . valueOf ( pStrVal ) ;
|
public class SearchHelper { /** * Set up an exists filter for attribute name . Consider the following example .
* < table border = " 1 " > < caption > Example Values < / caption >
* < tr > < td > < b > Value < / b > < / td > < / tr >
* < tr > < td > givenName < / td > < / tr >
* < / table >
* < p > < i > Result < / i > < / p >
* < code > ( givenName = * ) < / code >
* @ param attributeName A valid attribute name */
public void setFilterExists ( final String attributeName ) { } }
|
final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "(" ) ; sb . append ( new FilterSequence ( attributeName , "*" , FilterSequence . MatchingRuleEnum . EQUALS ) ) ; sb . append ( ")" ) ; this . filter = sb . toString ( ) ;
|
public class BoxRequestItemCopy { /** * Returns the name currently set for the item copy .
* @ return name for the item copy , or null if not set */
public String getName ( ) { } }
|
return mBodyMap . containsKey ( BoxItem . FIELD_NAME ) ? ( String ) mBodyMap . get ( BoxItem . FIELD_NAME ) : null ;
|
public class WTabRenderer { /** * Paints the given WTab .
* @ param component the WTab to paint .
* @ param renderContext the RenderContext to paint to . */
@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } }
|
WTab tab = ( WTab ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( "ui:tab" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "open" , tab . isOpen ( ) , "true" ) ; xml . appendOptionalAttribute ( "disabled" , tab . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , tab . isHidden ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , tab . getToolTip ( ) ) ; switch ( tab . getMode ( ) ) { case CLIENT : xml . appendAttribute ( "mode" , "client" ) ; break ; case LAZY : xml . appendAttribute ( "mode" , "lazy" ) ; break ; case EAGER : xml . appendAttribute ( "mode" , "eager" ) ; break ; case DYNAMIC : xml . appendAttribute ( "mode" , "dynamic" ) ; break ; case SERVER : xml . appendAttribute ( "mode" , "server" ) ; break ; default : throw new SystemException ( "Unknown tab mode: " + tab . getMode ( ) ) ; } if ( tab . getAccessKey ( ) != 0 ) { xml . appendAttribute ( "accessKey" , String . valueOf ( Character . toUpperCase ( tab . getAccessKey ( ) ) ) ) ; } xml . appendClose ( ) ; // Paint label
tab . getTabLabel ( ) . paint ( renderContext ) ; // Paint content
WComponent content = tab . getContent ( ) ; xml . appendTagOpen ( "ui:tabcontent" ) ; xml . appendAttribute ( "id" , tab . getId ( ) + "-content" ) ; xml . appendClose ( ) ; // Render content if not EAGER Mode or is EAGER and is the current AJAX trigger
if ( content != null && ( TabMode . EAGER != tab . getMode ( ) || AjaxHelper . isCurrentAjaxTrigger ( tab ) ) ) { // Visibility of content set in prepare paint
content . paint ( renderContext ) ; } xml . appendEndTag ( "ui:tabcontent" ) ; xml . appendEndTag ( "ui:tab" ) ;
|
public class ClientService { /** * Removes a client from the database
* Also clears all additional override information for the clientId
* @ param profileId profile ID of client to remove
* @ param clientUUID client UUID of client to remove
* @ throws Exception exception */
public void remove ( int profileId , String clientUUID ) throws Exception { } }
|
PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { // first try selecting the row we want to deal with
statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_CLIENT_UUID + " = ?" + " AND " + Constants . CLIENT_PROFILE_ID + "= ?" ) ; statement . setString ( 1 , clientUUID ) ; statement . setInt ( 2 , profileId ) ; results = statement . executeQuery ( ) ; if ( ! results . next ( ) ) { throw new Exception ( "Could not find specified clientUUID: " + clientUUID ) ; } } catch ( Exception e ) { throw e ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } // delete from the client table
String queryString = "DELETE FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . CLIENT_CLIENT_UUID + " = ? " + " AND " + Constants . CLIENT_PROFILE_ID + " = ?" ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( queryString ) ; statement . setString ( 1 , clientUUID ) ; statement . setInt ( 2 , profileId ) ; logger . info ( "Query: {}" , statement . toString ( ) ) ; statement . executeUpdate ( ) ; } catch ( Exception e ) { throw e ; } finally { try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } // delete from other tables as appropriate
// need to delete from enabled _ overrides and request _ response
try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_REQUEST_RESPONSE + " WHERE " + Constants . CLIENT_CLIENT_UUID + " = ? " + " AND " + Constants . CLIENT_PROFILE_ID + " = ?" ) ; statement . setString ( 1 , clientUUID ) ; statement . setInt ( 2 , profileId ) ; statement . executeUpdate ( ) ; } catch ( Exception e ) { // ok to swallow this . . just means there wasn ' t any
} try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . CLIENT_CLIENT_UUID + " = ? " + " AND " + Constants . CLIENT_PROFILE_ID + " = ?" ) ; statement . setString ( 1 , clientUUID ) ; statement . setInt ( 2 , profileId ) ; statement . executeUpdate ( ) ; } catch ( Exception e ) { // ok to swallow this . . just means there wasn ' t any
} finally { try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } }
|
public class StringHtmlEncoder { /** * Encodes complete component by calling { @ link UIComponent # encodeAll ( FacesContext ) } .
* @ param component component
* @ param context { @ link FacesContext }
* @ return the rendered string .
* @ throws IOException thrown by writer */
public static String encodeComponent ( final FacesContext context , final UIComponent component ) throws IOException { } }
|
final FacesContextStringResolverWrapper resolver = new FacesContextStringResolverWrapper ( context ) ; component . encodeAll ( resolver ) ; return resolver . getStringWriter ( ) . toString ( ) . replace ( "\n" , "" ) . trim ( ) ;
|
public class Utility { /** * Calculate the magnitudo of the several drainage area .
* It begin from the first state , where the magnitudo is setted to 1 , and
* then it follow the path of the water until the outlet .
* During this process the magnitudo of each through areas is incremented of
* 1 units . This operation is done for every state , so any path of the water
* are analized , from the state where she is intercept until the outlet .
* @ param magnitudo is the array where the magnitudo is stored .
* @ param whereDrain array which contains where a pipe drains .
* @ param pm the progerss monitor .
* @ throw IllegalArgumentException if the water through a number of state
* which is greater than the state in the network . */
public static void pipeMagnitude ( double [ ] magnitude , double [ ] whereDrain , IHMProgressMonitor pm ) { } }
|
int count = 0 ; /* whereDrain Contiene gli indici degli stati riceventi . */
/* magnitude Contiene la magnitude dei vari stati . */
int length = magnitude . length ; /* Per ogni stato */
for ( int i = 0 ; i < length ; i ++ ) { count = 0 ; /* la magnitude viene posta pari a 1 */
magnitude [ i ] ++ ; int k = i ; /* * Si segue il percorso dell ' acqua e si incrementa di 1 la mgnitude
* di tutti gli stati attraversati prima di raggiungere l ' uscita */
while ( whereDrain [ k ] != Constants . OUT_INDEX_PIPE && count < length ) { k = ( int ) whereDrain [ k ] ; magnitude [ k ] ++ ; count ++ ; } if ( count > length ) { pm . errorMessage ( msg . message ( "trentoP.error.pipe" ) ) ; throw new IllegalArgumentException ( msg . message ( "trentoP.error.pipe" ) ) ; } }
|
public class TcasesOpenApi { /** * Returns a { @ link SystemInputDef system input definition } for the API responses defined by the given
* OpenAPI specification . Returns null if the given spec defines no API responses to model . */
public static SystemInputDef getResponseInputModel ( OpenAPI api , ModelOptions options ) { } }
|
ResponseInputModeller inputModeller = new ResponseInputModeller ( options ) ; return inputModeller . getResponseInputModel ( api ) ;
|
public class AsyncActivityImpl { /** * ( non - Javadoc )
* @ see
* AsyncActivity # get ( java . net . URI ,
* Header [ ] ,
* Credentials ) */
public void get ( URI uri , Header [ ] additionalRequestHeaders , Credentials credentials ) { } }
|
ra . getExecutorService ( ) . execute ( new AsyncGetHandler ( ra , handle , uri , additionalRequestHeaders , credentials ) ) ;
|
public class DocletInvoker { /** * Utility method for converting a search path string to an array of directory and JAR file
* URLs .
* Note that this method is called by the DocletInvoker .
* @ param path the search path string
* @ return the resulting array of directory and JAR file URLs */
private static URL [ ] pathToURLs ( String path ) { } }
|
java . util . List < URL > urls = new ArrayList < > ( ) ; for ( String s : path . split ( Pattern . quote ( File . pathSeparator ) ) ) { if ( ! s . isEmpty ( ) ) { URL url = fileToURL ( Paths . get ( s ) ) ; if ( url != null ) { urls . add ( url ) ; } } } return urls . toArray ( new URL [ urls . size ( ) ] ) ;
|
public class Debug { /** * Create the debug log at the specified location if possible . If this call
* fails , { @ link # isOpen } returns false and diagnostic information will be
* printed to System . err . */
static void open ( File dir , String fileName ) { } }
|
if ( dir . mkdirs ( ) || dir . isDirectory ( ) ) { File file = new File ( dir , fileName ) ; try { out = new PrintStream ( TextFileOutputStreamFactory . createOutputStream ( file ) , true , "UTF-8" ) ; openedFile = file ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } }
|
public class AvatarZooKeeperClient { /** * Get the information stored in the node of zookeeper . If retry is set
* to true it will keep retrying until the data in that node is available
* ( failover case ) . If the retry is set to false it will return the first
* value that it gets from the zookeeper .
* @ param node the path of zNode in zookeeper
* @ param stat { @ link Stat } object that will contain stats of the node
* @ param retry if true will retry until the data in znode is not null
* @ return byte [ ] the data in the znode
* @ throws IOException
* @ throws KeeperException
* @ throws InterruptedException */
private synchronized byte [ ] getNodeData ( String node , Stat stat , boolean retry , boolean sync ) throws IOException , KeeperException , InterruptedException { } }
|
int failures = 0 ; byte [ ] data = null ; while ( data == null ) { initZK ( ) ; try { if ( sync ) { SyncUtil su = new SyncUtil ( ) ; su . sync ( zk , node ) ; } data = zk . getData ( node , watch , stat ) ; if ( data == null && retry ) { // Failover is in progress
// reset the failures
failures = 0 ; DistributedAvatarFileSystem . LOG . info ( "Failover is in progress. Waiting" ) ; try { Thread . sleep ( failoverCheckPeriod ) ; } catch ( InterruptedException iex ) { Thread . currentThread ( ) . interrupt ( ) ; } } else { return data ; } } catch ( KeeperException kex ) { if ( KeeperException . Code . CONNECTIONLOSS == kex . code ( ) && failures < ZK_CONNECTION_RETRIES ) { failures ++ ; // This means there was a failure connecting to zookeeper
// we should retry since some nodes might be down .
continue ; } throw kex ; } finally { if ( closeConnOnEachOp ) { stopZK ( ) ; } } } return data ;
|
public class VulnerabilitiesLoader { /** * Returns a { @ code List } of resources files with { @ code fileName } and { @ code fileExtension } contained in the
* { @ code directory } .
* @ return the list of resources files contained in the { @ code directory }
* @ see LocaleUtils # createResourceFilesPattern ( String , String ) */
List < String > getListOfVulnerabilitiesFiles ( ) { } }
|
if ( ! Files . exists ( directory ) ) { logger . debug ( "Skipping read of vulnerabilities, the directory does not exist: " + directory . toAbsolutePath ( ) ) ; return Collections . emptyList ( ) ; } final Pattern filePattern = LocaleUtils . createResourceFilesPattern ( fileName , fileExtension ) ; final List < String > fileNames = new ArrayList < > ( ) ; try { Files . walkFileTree ( directory , Collections . < FileVisitOption > emptySet ( ) , 1 , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { String fileName = file . getFileName ( ) . toString ( ) ; if ( filePattern . matcher ( fileName ) . matches ( ) ) { fileNames . add ( fileName ) ; } return FileVisitResult . CONTINUE ; } } ) ; } catch ( IOException e ) { logger . error ( "An error occurred while walking directory: " + directory , e ) ; } return fileNames ;
|
public class PseudoClassSpecifierChecker { /** * Add { @ code : last - of - type } elements .
* @ see < a href = " http : / / www . w3 . org / TR / css3 - selectors / # last - of - type - pseudo " > < code > : last - of - type < / code > pseudo - class < / a > */
private void addLastOfType ( ) { } }
|
for ( Node node : nodes ) { Node n = DOMHelper . getNextSiblingElement ( node ) ; while ( n != null ) { if ( DOMHelper . getNodeName ( n ) . equals ( DOMHelper . getNodeName ( node ) ) ) { break ; } n = DOMHelper . getNextSiblingElement ( n ) ; } if ( n == null ) { result . add ( node ) ; } }
|
public class JsonUtil { /** * Write all properties of an node accepted by the filter into an JSON array .
* @ param writer the JSON writer object ( with the JSON state )
* @ param filter the property name filter
* @ param values the Sling ValueMap to write
* @ throws javax . jcr . RepositoryException error on accessing JCR
* @ throws java . io . IOException error on write JSON */
public static void writeJsonValueMap ( JsonWriter writer , StringFilter filter , ValueMap values , MappingRules mapping ) throws RepositoryException , IOException { } }
|
if ( values != null ) { TreeMap < String , Object > sortedProperties = new TreeMap < > ( ) ; Iterator < Map . Entry < String , Object > > iterator = values . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry < String , Object > entry = iterator . next ( ) ; String key = entry . getKey ( ) ; if ( filter . accept ( key ) ) { sortedProperties . put ( key , entry . getValue ( ) ) ; } } if ( mapping . propertyFormat . scope == MappingRules . PropertyFormat . Scope . value ) { writer . beginObject ( ) ; } else { writer . beginArray ( ) ; } for ( Map . Entry < String , Object > entry : sortedProperties . entrySet ( ) ) { writeJsonProperty ( writer , entry . getKey ( ) , entry . getValue ( ) , mapping ) ; } if ( mapping . propertyFormat . scope == MappingRules . PropertyFormat . Scope . value ) { writer . endObject ( ) ; } else { writer . endArray ( ) ; } }
|
public class ContentExposingResource { /** * Get the binary content of a datastream
* @ param rangeValue the range value
* @ param resource the fedora resource
* @ return Binary blob
* @ throws IOException if io exception occurred */
private Response getBinaryContent ( final String rangeValue , final FedoraResource resource ) throws IOException { } }
|
final FedoraBinary binary = ( FedoraBinary ) resource ; final CacheControl cc = new CacheControl ( ) ; cc . setMaxAge ( 0 ) ; cc . setMustRevalidate ( true ) ; final Response . ResponseBuilder builder ; if ( rangeValue != null && rangeValue . startsWith ( "bytes" ) ) { final Range range = Range . convert ( rangeValue ) ; final long contentSize = binary . getContentSize ( ) ; final String endAsString ; if ( range . end ( ) == - 1 ) { endAsString = Long . toString ( contentSize - 1 ) ; } else { endAsString = Long . toString ( range . end ( ) ) ; } final String contentRangeValue = String . format ( "bytes %s-%s/%s" , range . start ( ) , endAsString , contentSize ) ; if ( range . end ( ) > contentSize || ( range . end ( ) == - 1 && range . start ( ) > contentSize ) ) { builder = status ( REQUESTED_RANGE_NOT_SATISFIABLE ) . header ( "Content-Range" , contentRangeValue ) ; } else { @ SuppressWarnings ( "resource" ) final RangeRequestInputStream rangeInputStream = new RangeRequestInputStream ( binary . getContent ( ) , range . start ( ) , range . size ( ) ) ; builder = status ( PARTIAL_CONTENT ) . entity ( rangeInputStream ) . header ( "Content-Range" , contentRangeValue ) . header ( CONTENT_LENGTH , range . size ( ) ) ; } } else { @ SuppressWarnings ( "resource" ) final InputStream content = binary . getContent ( ) ; builder = ok ( content ) ; } // we set the content - type explicitly to avoid content - negotiation from getting in the way
// getBinaryResourceMediaType will try to use the mime type on the resource , falling back on
// ' application / octet - stream ' if the mime type is syntactically invalid
return builder . type ( getBinaryResourceMediaType ( resource ) . toString ( ) ) . cacheControl ( cc ) . build ( ) ;
|
public class BitChromosome { /** * Return the indexes of the < i > ones < / i > of this bit - chromosome as stream .
* @ since 3.0
* @ return the indexes of the < i > ones < / i > of this bit - chromosome */
public IntStream ones ( ) { } }
|
return IntStream . range ( 0 , length ( ) ) . filter ( index -> bit . get ( _genes , index ) ) ;
|
public class IcuSyntaxUtils { /** * Gets the opening ( left ) string for a plural statement .
* @ param varName The plural var name .
* @ param offset The offset .
* @ return the ICU syntax string for the plural opening string . */
private static String getPluralOpenString ( String varName , int offset ) { } }
|
StringBuilder openingPartSb = new StringBuilder ( ) ; openingPartSb . append ( '{' ) . append ( varName ) . append ( ",plural," ) ; if ( offset != 0 ) { openingPartSb . append ( "offset:" ) . append ( offset ) . append ( ' ' ) ; } return openingPartSb . toString ( ) ;
|
public class Instance { /** * The elastic inference accelerator associated with the instance .
* @ param elasticInferenceAcceleratorAssociations
* The elastic inference accelerator associated with the instance . */
public void setElasticInferenceAcceleratorAssociations ( java . util . Collection < ElasticInferenceAcceleratorAssociation > elasticInferenceAcceleratorAssociations ) { } }
|
if ( elasticInferenceAcceleratorAssociations == null ) { this . elasticInferenceAcceleratorAssociations = null ; return ; } this . elasticInferenceAcceleratorAssociations = new com . amazonaws . internal . SdkInternalList < ElasticInferenceAcceleratorAssociation > ( elasticInferenceAcceleratorAssociations ) ;
|
public class ProfileServiceClient { /** * Deletes the specified profile . Prerequisite : The profile has no associated applications or
* assignments associated .
* < p > Sample code :
* < pre > < code >
* try ( ProfileServiceClient profileServiceClient = ProfileServiceClient . create ( ) ) {
* ProfileName name = ProfileName . of ( " [ PROJECT ] " , " [ TENANT ] " , " [ PROFILE ] " ) ;
* profileServiceClient . deleteProfile ( name ) ;
* < / code > < / pre >
* @ param name Required .
* < p > Resource name of the profile to be deleted .
* < p > The format is " projects / { project _ id } / tenants / { tenant _ id } / profiles / { profile _ id } " , for
* example , " projects / api - test - project / tenants / foo / profiles / bar " .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final void deleteProfile ( ProfileName name ) { } }
|
DeleteProfileRequest request = DeleteProfileRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; deleteProfile ( request ) ;
|
public class CPDefinitionInventoryPersistenceImpl { /** * Caches the cp definition inventories in the entity cache if it is enabled .
* @ param cpDefinitionInventories the cp definition inventories */
@ Override public void cacheResult ( List < CPDefinitionInventory > cpDefinitionInventories ) { } }
|
for ( CPDefinitionInventory cpDefinitionInventory : cpDefinitionInventories ) { if ( entityCache . getResult ( CPDefinitionInventoryModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionInventoryImpl . class , cpDefinitionInventory . getPrimaryKey ( ) ) == null ) { cacheResult ( cpDefinitionInventory ) ; } else { cpDefinitionInventory . resetOriginalValues ( ) ; } }
|
public class ProductReservationUrl { /** * Get Resource Url for DeleteProductReservation
* @ param productReservationId Unique identifier of the product reservation .
* @ return String Resource Url */
public static MozuUrl deleteProductReservationUrl ( Integer productReservationId ) { } }
|
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/productreservations/{productReservationId}" ) ; formatter . formatUrl ( "productReservationId" , productReservationId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
|
public class CommerceUserSegmentEntryUtil { /** * Removes the commerce user segment entry with the primary key from the database . Also notifies the appropriate model listeners .
* @ param commerceUserSegmentEntryId the primary key of the commerce user segment entry
* @ return the commerce user segment entry that was removed
* @ throws NoSuchUserSegmentEntryException if a commerce user segment entry with the primary key could not be found */
public static CommerceUserSegmentEntry remove ( long commerceUserSegmentEntryId ) throws com . liferay . commerce . user . segment . exception . NoSuchUserSegmentEntryException { } }
|
return getPersistence ( ) . remove ( commerceUserSegmentEntryId ) ;
|
public class Encryption { /** * This is a sugar method that calls decrypt method and catch the exceptions returning
* { @ code null } when it occurs and logging the error
* @ param data the String to be decrypted
* @ return the decrypted String or { @ code null } if you send the data as { @ code null } */
public String decryptOrNull ( String data ) { } }
|
try { return decrypt ( data ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; }
|
public class CpeParser { /** * Parses a CPE String into an object with the option of parsing CPE 2.2 URI
* strings in lenient mode - allowing for CPE values that do not adhere to
* the specification .
* @ param cpeString the CPE string to parse
* @ param lenient when < code > true < / code > the CPE 2.2 parser will put in
* lenient mode attempting to parse invalid CPE URI values .
* @ return the CPE object represented by the given cpeString
* @ throws CpeParsingException thrown if the cpeString is invalid */
public static Cpe parse ( String cpeString , boolean lenient ) throws CpeParsingException { } }
|
if ( cpeString == null ) { throw new CpeParsingException ( "CPE String is null and cannot be parsed" ) ; } else if ( cpeString . regionMatches ( 0 , "cpe:/" , 0 , 5 ) ) { return parse22 ( cpeString , lenient ) ; } else if ( cpeString . regionMatches ( 0 , "cpe:2.3:" , 0 , 8 ) ) { return parse23 ( cpeString , lenient ) ; } throw new CpeParsingException ( "The CPE string specified does not conform to the CPE 2.2 or 2.3 specification" ) ;
|
public class DomUtils { /** * Removes all the given tags from the document .
* @ param dom the document object .
* @ param tagName the tag name , examples : script , style , meta
* @ return the changed dom . */
public static Document removeTags ( Document dom , String tagName ) { } }
|
NodeList list ; try { list = XPathHelper . evaluateXpathExpression ( dom , "//" + tagName . toUpperCase ( ) ) ; while ( list . getLength ( ) > 0 ) { Node sc = list . item ( 0 ) ; if ( sc != null ) { sc . getParentNode ( ) . removeChild ( sc ) ; } list = XPathHelper . evaluateXpathExpression ( dom , "//" + tagName . toUpperCase ( ) ) ; } } catch ( XPathExpressionException e ) { LOGGER . error ( "Error while removing tag " + tagName , e ) ; } return dom ;
|
public class EditText { /** * @ return the color of the shadow layer
* @ see # setShadowLayer ( float , float , float , int )
* @ attr ref android . R . styleable # TextView _ shadowColor */
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public int getShadowColor ( ) { } }
|
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getShadowColor ( ) ; return 0 ;
|
public class OAuth2Credentials { /** * Gets the authorization URL to retrieve the authorization code . */
@ Nullable public String getAuthorizationUrl ( ) throws UnsupportedEncodingException { } }
|
String authorizationCodeRequestUrl = authorizationCodeFlow . newAuthorizationUrl ( ) . setScopes ( scopes ) . build ( ) ; if ( redirectUri != null ) { authorizationCodeRequestUrl += "&redirect_uri=" + URLEncoder . encode ( redirectUri , "UTF-8" ) ; } return authorizationCodeRequestUrl ;
|
public class CoreRemoteMongoCollectionImpl { /** * Finds a document in the collection and replaces it with the given document
* @ param filter the query filter
* @ param replacement the document to replace the matched document with
* @ return the resulting document */
public DocumentT findOneAndReplace ( final Bson filter , final Bson replacement ) { } }
|
return operations . findOneAndModify ( "findOneAndReplace" , filter , replacement , new RemoteFindOneAndModifyOptions ( ) , documentClass ) . execute ( service ) ;
|
public class X3Dobject { /** * Called after parsing < / Shape > */
private void ShapePostParsing ( ) { } }
|
if ( ! gvrRenderingDataUSEd ) { // SHAPE node not being USEd ( shared ) elsewhere
// Shape containts Text
if ( gvrTextViewSceneObject != null ) { gvrTextViewSceneObject . setTextColor ( ( ( ( 0xFF << 8 ) + ( int ) ( shaderSettings . diffuseColor [ 0 ] * 255 ) << 8 ) + ( int ) ( shaderSettings . diffuseColor [ 1 ] * 255 ) << 8 ) + ( int ) ( shaderSettings . diffuseColor [ 2 ] * 255 ) ) ; gvrTextViewSceneObject = null ; } { // UNIVERSAL _ LIGHTS
if ( ! gvrMaterialUSEd ) { // if GVRMaterial is NOT set by a USE statement .
if ( meshAttachedSceneObject == null ) { gvrMaterial = shaderSettings . material ; gvrRenderData . setMaterial ( gvrMaterial ) ; } else { // This GVRSceneObject came with a GVRRenderData and GVRMaterial
// already attached . Examples of this are Text or primitives
// such as the Box , Cone , Cylinder , Sphere
DefinedItem definedGRRenderingData = null ; if ( gvrRenderData != null ) { // < Shape > node created an unused gvrRenderData
// Check if we had a DEF in Shape node so that we can point to
// the new gvrRenderData
for ( DefinedItem definedItem : mDefinedItems ) { if ( definedItem . getGVRRenderData ( ) == gvrRenderData ) { definedGRRenderingData = definedItem ; break ; } } } gvrRenderData = meshAttachedSceneObject . getRenderData ( ) ; // reset the DEF item to now point to the shader
if ( definedGRRenderingData != null ) definedGRRenderingData . setGVRRenderData ( gvrRenderData ) ; gvrMaterial = gvrRenderData . getMaterial ( ) ; } // X3D doesn ' t have an ambient color so need to do color
// calibration tests on how to set this .
gvrMaterial . setVec4 ( "diffuse_color" , shaderSettings . diffuseColor [ 0 ] , shaderSettings . diffuseColor [ 1 ] , shaderSettings . diffuseColor [ 2 ] , ( 1.0f - shaderSettings . getTransparency ( ) ) ) ; gvrMaterial . setVec4 ( "specular_color" , shaderSettings . specularColor [ 0 ] , shaderSettings . specularColor [ 1 ] , shaderSettings . specularColor [ 2 ] , 1.0f ) ; gvrMaterial . setVec4 ( "emissive_color" , shaderSettings . emissiveColor [ 0 ] , shaderSettings . emissiveColor [ 1 ] , shaderSettings . emissiveColor [ 2 ] , 1.0f ) ; gvrMaterial . setFloat ( "specular_exponent" , 128.0f * shaderSettings . shininess ) ; if ( ! shaderSettings . getMaterialName ( ) . isEmpty ( ) ) { DefinedItem definedItem = new DefinedItem ( shaderSettings . getMaterialName ( ) ) ; definedItem . setGVRMaterial ( gvrMaterial ) ; mDefinedItems . add ( definedItem ) ; // Add gvrMaterial to Array list
// of DEFined items Clones
// objects with USE
} if ( shaderSettings . getMultiTexture ( ) ) { if ( ! shaderSettings . getMultiTextureName ( ) . isEmpty ( ) ) { DefinedItem definedItem = new DefinedItem ( shaderSettings . getMultiTextureName ( ) ) ; definedItem . setGVRMaterial ( gvrMaterial ) ; mDefinedItems . add ( definedItem ) ; // Add gvrMaterial to Array list
} gvrMaterial . setTexture ( "diffuseTexture" , shaderSettings . getMultiTextureGVRTexture ( 0 ) ) ; gvrMaterial . setTexture ( "diffuseTexture1" , shaderSettings . getMultiTextureGVRTexture ( 1 ) ) ; // 0 : Mul ; 1 = for ADD ; 2 for SUBTRACT ; 3 for DIVIDE ; 4 = smooth add ; 5 = Signed add
gvrMaterial . setInt ( "diffuseTexture1_blendop" , shaderSettings . getMultiTextureMode ( ) . ordinal ( ) ) ; gvrMaterial . setTexCoord ( "diffuseTexture" , "a_texcoord" , "diffuse_coord" ) ; gvrMaterial . setTexCoord ( "diffuseTexture1" , "a_texcoord" , "diffuse_coord1" ) ; } else if ( shaderSettings . texture != null ) { gvrMaterial . setTexture ( "diffuseTexture" , shaderSettings . texture ) ; // if the TextureMap is a DEFined item , then set the
// GVRMaterial to it as well to help if we set the
// in a SCRIPT node .
for ( DefinedItem definedItem : mDefinedItems ) { if ( definedItem . getGVRTexture ( ) == shaderSettings . texture ) { definedItem . setGVRMaterial ( gvrMaterial ) ; break ; } } } if ( ! shaderSettings . movieTextures . isEmpty ( ) ) { try { GVRVideoSceneObjectPlayer < ? > videoSceneObjectPlayer = null ; try { videoSceneObjectPlayer = utility . makeExoPlayer ( shaderSettings . movieTextures . get ( 0 ) ) ; } catch ( Exception e ) { Log . e ( TAG , "Exception getting videoSceneObjectPlayer: " + e ) ; } videoSceneObjectPlayer . start ( ) ; GVRVideoSceneObject gvrVideoSceneObject = new GVRVideoSceneObject ( gvrContext , gvrRenderData . getMesh ( ) , videoSceneObjectPlayer , GVRVideoSceneObject . GVRVideoType . MONO ) ; currentSceneObject . addChildObject ( gvrVideoSceneObject ) ; // Primitives such as Box , Cone , etc come with their own mesh
// so we need to remove these .
if ( meshAttachedSceneObject != null ) { GVRSceneObject primitiveParent = meshAttachedSceneObject . getParent ( ) ; primitiveParent . removeChildObject ( meshAttachedSceneObject ) ; } meshAttachedSceneObject = gvrVideoSceneObject ; if ( shaderSettings . getMovieTextureName ( ) != null ) { gvrVideoSceneObject . setName ( shaderSettings . getMovieTextureName ( ) ) ; DefinedItem item = new DefinedItem ( shaderSettings . getMovieTextureName ( ) ) ; item . setGVRVideoSceneObject ( gvrVideoSceneObject ) ; mDefinedItems . add ( item ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; Log . e ( TAG , "X3D MovieTexture Exception:\n" + e ) ; } } // end MovieTexture
// Texture Transform
// If DEFined iteam , add to the DeFinedItem list . Maay be interactive
// GearVR may not be doing texture transforms on primitives or text
// crash otherwise .
if ( meshAttachedSceneObject == null ) { if ( ! shaderSettings . getTextureTransformName ( ) . isEmpty ( ) ) { DefinedItem definedItem = new DefinedItem ( shaderSettings . getTextureTransformName ( ) ) ; definedItem . setGVRMaterial ( gvrMaterial ) ; definedItem . setTextureTranslation ( shaderSettings . getTextureTranslation ( ) ) ; definedItem . setTextureCenter ( shaderSettings . getTextureCenter ( ) ) ; definedItem . setTextureScale ( shaderSettings . getTextureScale ( ) ) ; definedItem . setTextureRotation ( shaderSettings . getTextureRotation ( ) . getValue ( ) ) ; definedItem . setName ( shaderSettings . getTextureTransformName ( ) ) ; mDefinedItems . add ( definedItem ) ; // Add gvrMaterial to Array list
} // Texture Transform Matrix equation :
// TC ' = - C * S * R * C * T * TC
// where TC ' is the transformed texture coordinate
// TC is the original Texture Coordinate
// C = center , S = scale , R = rotation , T = translation
Matrix3f textureTransform = animationInteractivityManager . SetTextureTransformMatrix ( shaderSettings . getTextureTranslation ( ) , shaderSettings . getTextureCenter ( ) , shaderSettings . getTextureScale ( ) , shaderSettings . getTextureRotation ( ) ) ; shaderSettings . textureMatrix = textureTransform ; float [ ] texMtx = new float [ 9 ] ; shaderSettings . textureMatrix . get ( texMtx ) ; gvrMaterial . setFloatArray ( "texture_matrix" , texMtx ) ; } // Appearance node thus far contains properties of GVRMaterial
// node
if ( ! shaderSettings . getAppearanceName ( ) . isEmpty ( ) ) { DefinedItem definedItem = new DefinedItem ( shaderSettings . getAppearanceName ( ) ) ; definedItem . setGVRMaterial ( gvrMaterial ) ; mDefinedItems . add ( definedItem ) ; // Add gvrMaterial to Array list
// of DEFined items Clones
// objects with USE
} if ( ( shaderSettings . getTransparency ( ) != 0 ) && ( shaderSettings . getTransparency ( ) != 1 ) ) { gvrRenderData . setRenderingOrder ( GVRRenderingOrder . TRANSPARENT ) ; } } // end ! gvrMaterialUSEd
gvrTexture = null ; } } // end ! gvrRenderingDataUSEd
if ( meshAttachedSceneObject != null ) { // gvrRenderData already attached to a GVRSceneObject such as a
// Cone or Cylinder or a Movie Texture
meshAttachedSceneObject = null ; } else currentSceneObject . attachRenderData ( gvrRenderData ) ; if ( lodManager . shapeLODSceneObject != null ) { // if this Shape node was a direct child of a
// Level - of - Detial ( LOD ) , then restore the parent object
// since we had to add a GVRSceneObject to support
// the Shape node ' s attachement to LOD .
currentSceneObject = currentSceneObject . getParent ( ) ; lodManager . shapeLODSceneObject = null ; } gvrMaterialUSEd = false ; // for DEFine and USE , true if we encounter a
// USE
gvrRenderingDataUSEd = false ; // for DEFine and USE gvrRenderingData for
// x3d SHAPE node
gvrRenderData = null ;
|
public class DebugServer { /** * Shuts down the server . Active connections are not affected . */
public void shutdown ( ) { } }
|
debugConnection = null ; shuttingDown = true ; try { if ( serverSocket != null ) { serverSocket . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; }
|
public class IncidentUtil { /** * Produce a one line description of the throwable , suitable for error message
* and log printing .
* @ param thrown thrown object
* @ return description of the thrown object */
public static String oneLiner ( Throwable thrown ) { } }
|
StackTraceElement [ ] stack = thrown . getStackTrace ( ) ; String topOfStack = null ; if ( stack . length > 0 ) { topOfStack = " at " + stack [ 0 ] ; } return thrown . toString ( ) + topOfStack ;
|
public class KeyManager { /** * PRIVATE HELPER METHODS */
private boolean validateEncryptionKeyData ( KeyData data ) { } }
|
if ( data . getIv ( ) . length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE ) { LOGGER . warning ( "IV does not have the expected size: " + ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes" ) ; return false ; } return true ;
|
public class WBeanComponent { /** * Indicates whether this component ' s data has changed from the default value .
* TODO : This needs to be added to the databound interface after the bulk of the components have been converted .
* @ return true if this component ' s current value differs from the default value for the given context . */
public boolean isChanged ( ) { } }
|
Object currentValue = getData ( ) ; Object sharedValue = ( ( BeanAndProviderBoundComponentModel ) getDefaultModel ( ) ) . getData ( ) ; if ( getBeanProperty ( ) != null ) { sharedValue = getBeanValue ( ) ; } return ! Util . equals ( currentValue , sharedValue ) ;
|
public class QueryPlanner { /** * Fast track the parsing for the pseudo - statement generated by the
* { @ literal @ } SwapTables system stored procedure .
* If this functionality turns out to fall within the behavior of a
* more general SWAP TABLE statement supported in a ( future ) SQL
* parser , the system stored procedure can fall back to using it .
* Extending the HSQL parser NOW to support a " SWAP TABLE " statement
* JUST for this special case , but keeping that support disabled for
* the normal { @ literal @ } AdHoc and compiled stored procedures code paths would
* be overkill at this point .
* So we settle for this early return of a " forged " parser result .
* Note that we don ' t allow this from an { @ literal @ } AdHoc compilation . See
* ENG - 12368. */
public void planSwapTables ( ) { } }
|
// reset any error message
m_recentErrorMsg = null ; // Reset plan node ids to start at 1 for this plan
AbstractPlanNode . resetPlanNodeIds ( ) ; assert ( m_sql . startsWith ( "@SwapTables " ) ) ; String [ ] swapTableArgs = m_sql . split ( " " ) ; m_xmlSQL = forgeVoltXMLForSwapTables ( swapTableArgs [ 1 ] , swapTableArgs [ 2 ] ) ; m_planSelector . outputCompiledStatement ( m_xmlSQL ) ;
|
public class DefaultSpeciesNewStrategy { /** * Creates a new instance of a collection based on the class type of collection and specified initial capacity ,
* not on the type of objects the collections contains .
* e . g . CollectionFactory . < Integer > speciesNew ( hashSetOfString , 20 ) returns a new HashSet < Integer > ( 20 ) ;
* e . g . CollectionFactory . < Date > speciesNew ( linkedListOfWombles , 42 ) returns a new LinkedList < Date > ( 42 ) ; */
public < T > Collection < T > speciesNew ( Collection < ? > collection , int size ) { } }
|
if ( size < 0 ) { throw new IllegalArgumentException ( "size may not be < 0 but was " + size ) ; } if ( collection instanceof Proxy || collection instanceof PriorityQueue || collection instanceof PriorityBlockingQueue || collection instanceof SortedSet ) { return DefaultSpeciesNewStrategy . createNewInstanceForCollectionType ( collection ) ; } Constructor < ? > constructor = ReflectionHelper . getConstructor ( collection . getClass ( ) , SIZE_CONSTRUCTOR_TYPES ) ; if ( constructor != null ) { return ( Collection < T > ) ReflectionHelper . newInstance ( constructor , size ) ; } return this . speciesNew ( collection ) ;
|
public class BitUtil { /** * Generate a string that is the hex representation of a given byte array .
* @ param buffer to convert to a hex representation .
* @ param offset the offset into the buffer .
* @ param length the number of bytes to convert .
* @ return new String holding the hex representation ( in Big Endian ) of the passed array . */
public static String toHex ( final byte [ ] buffer , final int offset , final int length ) { } }
|
return new String ( toHexByteArray ( buffer , offset , length ) , UTF_8 ) ;
|
public class ZipUtilities { /** * Unzips a Zip File in byte array format to a specified directory .
* @ param zipFile The zip file .
* @ param directory The directory to unzip the file to .
* @ return true if the file was successfully unzipped otherwise false . */
public static boolean unzipFileIntoDirectory ( final File zipFile , final String directory ) { } }
|
final Map < ZipEntry , byte [ ] > zipEntries = new HashMap < ZipEntry , byte [ ] > ( ) ; ZipInputStream zis ; try { zis = new ZipInputStream ( new FileInputStream ( zipFile ) ) ; } catch ( FileNotFoundException ex ) { LOG . error ( "Unable to find specified file" , ex ) ; return false ; } ZipEntry entry = null ; byte [ ] buffer = new byte [ 1024 ] ; try { int read ; while ( ( entry = zis . getNextEntry ( ) ) != null ) { final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; while ( ( read = zis . read ( buffer ) ) > 0 ) { bos . write ( buffer , 0 , read ) ; } zipEntries . put ( entry , bos . toByteArray ( ) ) ; } } catch ( IOException ex ) { LOG . error ( "Unable to write ZIP file to directory" , ex ) ; return false ; } return unzipFileIntoDirectory ( zipEntries , directory ) ;
|
public class InternalPureXbaseLexer { /** * $ ANTLR start " T _ _ 39" */
public final void mT__39 ( ) throws RecognitionException { } }
|
try { int _type = T__39 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalPureXbase . g : 37:7 : ( ' / ' )
// InternalPureXbase . g : 37:9 : ' / '
{ match ( '/' ) ; } state . type = _type ; state . channel = _channel ; } finally { }
|
public class StringValueConverterImpl { /** * This method gets the singleton instance of this { @ link StringValueConverterImpl } . < br >
* < b > ATTENTION : < / b > < br >
* Please prefer dependency - injection instead of using this method .
* @ return the singleton instance . */
public static StringValueConverterImpl getInstance ( ) { } }
|
if ( instance == null ) { synchronized ( StringValueConverterImpl . class ) { if ( instance == null ) { StringValueConverterImpl converter = new StringValueConverterImpl ( ) ; converter . initialize ( ) ; instance = converter ; } } } return instance ;
|
public class ReportDistributor { /** * Send report via all senders .
* @ param reportFile Report to send .
* @ return if distributing was successful */
public boolean distribute ( @ NonNull File reportFile ) { } }
|
ACRA . log . i ( LOG_TAG , "Sending report " + reportFile ) ; try { final CrashReportPersister persister = new CrashReportPersister ( ) ; final CrashReportData previousCrashReport = persister . load ( reportFile ) ; sendCrashReport ( previousCrashReport ) ; IOUtils . deleteFile ( reportFile ) ; return true ; } catch ( RuntimeException e ) { ACRA . log . e ( LOG_TAG , "Failed to send crash reports for " + reportFile , e ) ; IOUtils . deleteFile ( reportFile ) ; } catch ( IOException e ) { ACRA . log . e ( LOG_TAG , "Failed to load crash report for " + reportFile , e ) ; IOUtils . deleteFile ( reportFile ) ; } catch ( JSONException e ) { ACRA . log . e ( LOG_TAG , "Failed to load crash report for " + reportFile , e ) ; IOUtils . deleteFile ( reportFile ) ; } catch ( ReportSenderException e ) { ACRA . log . e ( LOG_TAG , "Failed to send crash report for " + reportFile , e ) ; // An issue occurred while sending this report but we can still try to
// send other reports . Report sending is limited by ACRAConstants . MAX _ SEND _ REPORTS
// so there ' s not much to fear about overloading a failing server .
} return false ;
|
public class JMString { /** * Is word boolean .
* @ param wordString the word string
* @ return the boolean */
public static boolean isWord ( String wordString ) { } }
|
return Optional . ofNullable ( wordPattern ) . orElseGet ( ( ) -> wordPattern = Pattern . compile ( WordPattern ) ) . matcher ( wordString ) . matches ( ) ;
|
public class Island { /** * Two islands are competitors if there is a horizontal or
* vertical line which goes through both islands */
public boolean isCompetitor ( Island isl ) { } }
|
for ( Coordinate c : isl ) { for ( Coordinate d : islandCoordinates ) { if ( c . sameColumn ( d ) || c . sameRow ( d ) ) return true ; } } return false ;
|
public class MessageDrivenBeanO { /** * Return enterprise bean associate with this < code > BeanO < / code > . < p >
* MessageDrivenBeans do not implement this method since they
* are created on demand by the container , not by the client . < p > */
@ Override public final EnterpriseBean getEnterpriseBean ( ) throws RemoteException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getEnterpriseBean" ) ; throw new UnsupportedOperationException ( ) ;
|
public class CmsPublishProject { /** * Performs the publish action , will be called by the JSP page . < p >
* @ throws JspException if problems including sub - elements occur */
public void actionPublish ( ) throws JspException { } }
|
try { boolean isFolder = false ; if ( ! isMultiOperation ( ) ) { if ( isDirectPublish ( ) ) { isFolder = getCms ( ) . readResource ( getParamResource ( ) , CmsResourceFilter . ALL ) . isFolder ( ) ; } } if ( performDialogOperation ( ) ) { // if no exception is caused and " true " is returned publish operation was successful
if ( isMultiOperation ( ) || isFolder ) { // set request attribute to reload the explorer tree view
List < String > folderList = new ArrayList < String > ( ) ; folderList . add ( CmsResource . getParentFolder ( getResourceList ( ) . get ( 0 ) ) ) ; Iterator < String > it = getResourceList ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String res = it . next ( ) ; if ( CmsResource . isFolder ( res ) ) { folderList . add ( res ) ; } } getJsp ( ) . getRequest ( ) . setAttribute ( REQUEST_ATTRIBUTE_RELOADTREE , folderList ) ; } actionCloseDialog ( ) ; } else { // " false " returned , display " please wait " screen
getJsp ( ) . include ( FILE_DIALOG_SCREEN_WAIT ) ; } } catch ( Throwable e ) { // prepare common message part
includeErrorpage ( this , e ) ; }
|
public class BloomFilter { /** * Adds an object to the Bloom filter . The output from the object ' s
* toString ( ) method is used as input to the hash functions .
* @ param element is an element to register in the Bloom filter . */
public void add ( E element ) { } }
|
long hash ; String valString = element . toString ( ) ; for ( int x = 0 ; x < k ; x ++ ) { hash = createHash ( valString + Integer . toString ( x ) ) ; hash = hash % ( long ) bitSetSize ; bitset . set ( Math . abs ( ( int ) hash ) , true ) ; } numberOfAddedElements ++ ;
|
public class SiftsXMLParser { /** * < entity type = " protein " entityId = " A " > */
private SiftsEntity getSiftsEntity ( Element empEl ) { } }
|
// for each < employee > element get text or int values of
// name , id , age and name
String type = empEl . getAttribute ( "type" ) ; String entityId = empEl . getAttribute ( "entityId" ) ; // Create a new Employee with the value read from the xml nodes
SiftsEntity entity = new SiftsEntity ( type , entityId ) ; // get nodelist of segments . . .
NodeList nl = empEl . getElementsByTagName ( "segment" ) ; if ( nl != null && nl . getLength ( ) > 0 ) { for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { // get the entity element
Element el = ( Element ) nl . item ( i ) ; SiftsSegment s = getSiftsSegment ( el ) ; logger . debug ( "new segment: " + s ) ; entity . addSegment ( s ) ; } } logger . debug ( "new SIFTS entity: " + entity ) ; return entity ;
|
public class LogPackageImpl { /** * Laods the package and any sub - packages from their serialized form .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void loadPackage ( ) { } }
|
if ( isLoaded ) return ; isLoaded = true ; URL url = getClass ( ) . getResource ( packageFilename ) ; if ( url == null ) { throw new RuntimeException ( "Missing serialized package: " + packageFilename ) ; } URI uri = URI . createURI ( url . toString ( ) ) ; Resource resource = new EcoreResourceFactoryImpl ( ) . createResource ( uri ) ; try { resource . load ( null ) ; } catch ( IOException exception ) { throw new WrappedException ( exception ) ; } initializeFromLoadedEPackage ( this , ( EPackage ) resource . getContents ( ) . get ( 0 ) ) ; createResource ( eNS_URI ) ;
|
public class Descriptors { /** * Creates a { @ link ResultDescriptor } for a { @ link AnalyzerResult } class
* @ param resultClass
* @ return */
public static ResultDescriptor ofResult ( final Class < ? extends AnalyzerResult > resultClass ) { } }
|
ResultDescriptor resultDescriptor = _resultDescriptors . get ( resultClass ) ; if ( resultDescriptor == null ) { resultDescriptor = new ResultDescriptorImpl ( resultClass ) ; _resultDescriptors . put ( resultClass , resultDescriptor ) ; } return resultDescriptor ;
|
public class IntentUtils { /** * Call standard camera application for capturing an image
* @ param file Full path to captured file */
public static Intent photoCapture ( String file ) { } }
|
Uri uri = Uri . fromFile ( new File ( file ) ) ; Intent intent = new Intent ( MediaStore . ACTION_IMAGE_CAPTURE ) ; intent . putExtra ( MediaStore . EXTRA_OUTPUT , uri ) ; return intent ;
|
public class ApacheHttpClient { /** * connectionRequestTimeout 从连接池中取出连接的超时时间 connectTimeout 和服务器建立连接的超时时间
* socketTimeout 从服务器读取数据的超时时间 */
private static RequestConfig getRequestConfig ( Integer readTimeoutInMillis ) { } }
|
return RequestConfig . custom ( ) . setConnectionRequestTimeout ( 600 ) . setConnectTimeout ( XianConfig . getIntValue ( "apache.httpclient.connectTimeout" , 600 ) ) . setSocketTimeout ( readTimeoutInMillis ) . build ( ) ;
|
public class RequestExpirationScheduler { /** * Schedules a request for completion
* @ param requestId , the unique identifier if the request
* @ param request , the request
* @ param time , time expressed in long
* @ param unit , { @ link TimeUnit } */
public void scheduleForCompletion ( String requestId , CompletableFuture < Boolean > request , long time , TimeUnit unit ) { } }
|
if ( request . isDone ( ) ) { if ( trace ) { log . tracef ( "Request[%s] is not scheduled because is already done" , requestId ) ; } return ; } if ( scheduledRequests . containsKey ( requestId ) ) { String message = String . format ( "Request[%s] is not scheduled because it is already scheduled" , requestId ) ; log . error ( message ) ; throw new IllegalStateException ( message ) ; } if ( trace ) { log . tracef ( "Request[%s] being scheduled to be completed in [%d, %s]" , requestId , time , unit ) ; } ScheduledFuture < ? > scheduledFuture = scheduledExecutorService . schedule ( ( ) -> { request . complete ( false ) ; scheduledRequests . remove ( requestId ) ; } , time , unit ) ; scheduledRequests . putIfAbsent ( requestId , new ScheduledRequest ( request , scheduledFuture ) ) ;
|
public class NtlmPasswordAuthenticator { /** * Returns the effective user session key .
* @ param tc
* @ param chlng
* The server challenge .
* @ return A < code > byte [ ] < / code > containing the effective user session key ,
* used in SMB MAC signing and NTLMSSP signing and sealing . */
public byte [ ] getUserSessionKey ( CIFSContext tc , byte [ ] chlng ) { } }
|
byte [ ] key = new byte [ 16 ] ; try { getUserSessionKey ( tc , chlng , key , 0 ) ; } catch ( Exception ex ) { log . error ( "Failed to get session key" , ex ) ; } return key ;
|
public class SubjectUtils { /** * Returns the name of the single type of all given items or { @ link Optional # absent ( ) } if no such
* type exists . */
private static Optional < String > getHomogeneousTypeName ( Iterable < ? > items ) { } }
|
Optional < String > homogeneousTypeName = Optional . absent ( ) ; for ( Object item : items ) { if ( item == null ) { /* * TODO ( cpovirk ) : Why ? We could have multiple nulls , which would be homogeneous . More
* likely , we could have exactly one null , which is still homogeneous . Arguably it ' s weird
* to call a single element " homogeneous " at all , but that ' s not specific to null . */
return Optional . absent ( ) ; } else if ( ! homogeneousTypeName . isPresent ( ) ) { // This is the first item
homogeneousTypeName = Optional . of ( objectToTypeName ( item ) ) ; } else if ( ! objectToTypeName ( item ) . equals ( homogeneousTypeName . get ( ) ) ) { // items is a heterogeneous collection
return Optional . absent ( ) ; } } return homogeneousTypeName ;
|
public class JedisSortedSet { /** * Return the score of the specified element of the sorted set at key .
* @ param member
* @ return The score value or < code > null < / code > if the element does not exist in the set . */
public Double score ( final String member ) { } }
|
return doWithJedis ( new JedisCallable < Double > ( ) { @ Override public Double call ( Jedis jedis ) { return jedis . zscore ( getKey ( ) , member ) ; } } ) ;
|
public class SasUtils { /** * Creates a reader from the given file . Support GZIP compressed files .
* @ param file file to read
* @ return reader */
public static BufferedReader createReader ( File file ) throws IOException { } }
|
InputStream is = new FileInputStream ( file ) ; if ( file . getName ( ) . toLowerCase ( ) . endsWith ( ".gz" ) ) is = new GZIPInputStream ( is ) ; return new BufferedReader ( new InputStreamReader ( is , StandardCharsets . UTF_8 ) ) ;
|
public class NodeHealthCheckerService { /** * Method used to start the Node health monitoring . */
void start ( ) { } }
|
// if health script path is not configured don ' t start the thread .
if ( ! shouldRun ( conf ) ) { LOG . info ( "Not starting node health monitor" ) ; return ; } nodeHealthScriptScheduler = new Timer ( "NodeHealthMonitor-Timer" , true ) ; // Start the timer task immediately and
// then periodically at interval time .
nodeHealthScriptScheduler . scheduleAtFixedRate ( timer , 0 , intervalTime ) ;
|
public class SipServletMessageImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipServletMessage # getContentType ( ) */
public String getContentType ( ) { } }
|
ContentTypeHeader cth = ( ContentTypeHeader ) this . message . getHeader ( getCorrectHeaderName ( ContentTypeHeader . NAME ) ) ; if ( cth != null ) { // Fix For Issue http : / / code . google . com / p / mobicents / issues / detail ? id = 2659
// getContentType doesn ' t return the full header value
// String contentType = cth . getContentType ( ) ;
// String contentSubType = cth . getContentSubType ( ) ;
// if ( contentSubType ! = null )
// return contentType + " / " + contentSubType ;
return ( ( HeaderExt ) cth ) . getValue ( ) ; } return null ;
|
public class Latkes { /** * Loads the latke . props . */
private static void loadLatkeProps ( ) { } }
|
if ( null == latkeProps ) { latkeProps = new Properties ( ) ; } try { InputStream resourceAsStream ; final String latkePropsEnv = System . getenv ( "LATKE_PROPS" ) ; if ( StringUtils . isNotBlank ( latkePropsEnv ) ) { LOGGER . debug ( "Loading latke.properties from env var [$LATKE_PROPS=" + latkePropsEnv + "]" ) ; resourceAsStream = new FileInputStream ( latkePropsEnv ) ; } else { LOGGER . debug ( "Loading latke.properties from classpath [/latke.properties]" ) ; resourceAsStream = Latkes . class . getResourceAsStream ( "/latke.properties" ) ; } if ( null != resourceAsStream ) { latkeProps . load ( resourceAsStream ) ; LOGGER . debug ( "Loaded latke.properties" ) ; } } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Loads latke.properties failed" , e ) ; throw new RuntimeException ( "Loads latke.properties failed" ) ; }
|
public class Util { /** * Configure outbound HTTP pipeline for SSL configuration .
* @ param socketChannel Socket channel of outbound connection
* @ param sslConfig { @ link SSLConfig }
* @ param host host of the connection
* @ param port port of the connection
* @ throws SSLException if any error occurs in the SSL connection */
public static SSLEngine configureHttpPipelineForSSL ( SocketChannel socketChannel , String host , int port , SSLConfig sslConfig ) throws SSLException { } }
|
LOG . debug ( "adding ssl handler" ) ; SSLEngine sslEngine = null ; SslHandler sslHandler ; ChannelPipeline pipeline = socketChannel . pipeline ( ) ; SSLHandlerFactory sslHandlerFactory = new SSLHandlerFactory ( sslConfig ) ; if ( sslConfig . isOcspStaplingEnabled ( ) ) { sslHandlerFactory . createSSLContextFromKeystores ( false ) ; ReferenceCountedOpenSslContext referenceCountedOpenSslContext = sslHandlerFactory . buildClientReferenceCountedOpenSslContext ( ) ; if ( referenceCountedOpenSslContext != null ) { sslHandler = referenceCountedOpenSslContext . newHandler ( socketChannel . alloc ( ) ) ; sslEngine = sslHandler . engine ( ) ; setSslHandshakeTimeOut ( sslConfig , sslHandler ) ; socketChannel . pipeline ( ) . addLast ( sslHandler ) ; socketChannel . pipeline ( ) . addLast ( new OCSPStaplingHandler ( ( ReferenceCountedOpenSslEngine ) sslEngine ) ) ; } } else { if ( sslConfig . getTrustStore ( ) != null ) { sslHandlerFactory . createSSLContextFromKeystores ( false ) ; sslEngine = instantiateAndConfigSSL ( sslConfig , host , port , sslConfig . isHostNameVerificationEnabled ( ) , sslHandlerFactory ) ; } else { sslEngine = getSslEngineForCerts ( socketChannel , host , port , sslConfig , sslHandlerFactory ) ; } sslHandler = new SslHandler ( sslEngine ) ; setSslHandshakeTimeOut ( sslConfig , sslHandler ) ; pipeline . addLast ( Constants . SSL_HANDLER , sslHandler ) ; if ( sslConfig . isValidateCertEnabled ( ) ) { pipeline . addLast ( Constants . HTTP_CERT_VALIDATION_HANDLER , new CertificateValidationHandler ( sslEngine , sslConfig . getCacheValidityPeriod ( ) , sslConfig . getCacheSize ( ) ) ) ; } } return sslEngine ;
|
public class Sets { /** * Returns true if there is at least element that is in both s1 and s2 . Faster
* than calling intersection ( Set , Set ) if you don ' t need the contents of the
* intersection . */
public static < E > boolean intersects ( Set < E > s1 , Set < E > s2 ) { } }
|
// loop over whichever set is smaller
if ( s1 . size ( ) < s2 . size ( ) ) { for ( E element1 : s1 ) { if ( s2 . contains ( element1 ) ) { return true ; } } } else { for ( E element2 : s2 ) { if ( s1 . contains ( element2 ) ) { return true ; } } } return false ;
|
public class DefaultGroovyMethods { /** * Support the subscript operator with an IntRange for a long array
* @ param array a long array
* @ param range an IntRange indicating the indices for the items to retrieve
* @ return list of the retrieved longs
* @ since 1.0 */
@ SuppressWarnings ( "unchecked" ) public static List < Long > getAt ( long [ ] array , IntRange range ) { } }
|
RangeInfo info = subListBorders ( array . length , range ) ; List < Long > answer = primitiveArrayGet ( array , new IntRange ( true , info . from , info . to - 1 ) ) ; return info . reverse ? reverse ( answer ) : answer ;
|
public class ModelsImpl { /** * Adds a list to an existing closed list .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param clEntityId The closed list entity extractor ID .
* @ param wordListCreateObject Words list .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Integer object */
public Observable < ServiceResponse < Integer > > addSubListWithServiceResponseAsync ( UUID appId , String versionId , UUID clEntityId , WordListObject wordListCreateObject ) { } }
|
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( clEntityId == null ) { throw new IllegalArgumentException ( "Parameter clEntityId is required and cannot be null." ) ; } if ( wordListCreateObject == null ) { throw new IllegalArgumentException ( "Parameter wordListCreateObject is required and cannot be null." ) ; } Validator . validate ( wordListCreateObject ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . addSubList ( appId , versionId , clEntityId , wordListCreateObject , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Integer > > > ( ) { @ Override public Observable < ServiceResponse < Integer > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Integer > clientResponse = addSubListDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class AlbumFilterActivity { /** * Select picture , from album . */
private void selectAlbum ( ) { } }
|
Album . album ( this ) . multipleChoice ( ) . filterMimeType ( new Filter < String > ( ) { // MimeType of File .
@ Override public boolean filter ( String attributes ) { // MimeType : image / jpeg , image / png , video / mp4 , video / 3gp . . .
return attributes . contains ( "jpeg" ) ; } } ) // . filterSize ( ) / / File size .
// . filterDuration ( ) / / Video duration .
. afterFilterVisibility ( mAfterFilterVisibility ) . columnCount ( 2 ) . selectCount ( 6 ) . camera ( true ) . checkedList ( mAlbumFiles ) . widget ( Widget . newDarkBuilder ( this ) . title ( mToolbar . getTitle ( ) . toString ( ) ) . build ( ) ) . onResult ( new Action < ArrayList < AlbumFile > > ( ) { @ Override public void onAction ( @ NonNull ArrayList < AlbumFile > result ) { mAlbumFiles = result ; mAdapter . notifyDataSetChanged ( mAlbumFiles ) ; mTvMessage . setVisibility ( result . size ( ) > 0 ? View . VISIBLE : View . GONE ) ; } } ) . onCancel ( new Action < String > ( ) { @ Override public void onAction ( @ NonNull String result ) { Toast . makeText ( AlbumFilterActivity . this , R . string . canceled , Toast . LENGTH_LONG ) . show ( ) ; } } ) . start ( ) ;
|
public class BitVector { /** * comparable methods */
@ Override public int compareNumericallyTo ( BitStore that ) { } }
|
if ( that instanceof BitVector ) { if ( this == that ) return 0 ; // cheap check
BitVector v = ( BitVector ) that ; return this . size ( ) < that . size ( ) ? compareNumeric ( this , v ) : - compareNumeric ( v , this ) ; } return BitStore . super . compareNumericallyTo ( that ) ;
|
public class RepositoryConnectionList { /** * This will return any ESAs that match the supplied < code > identifier < / code > .
* The matching is done on any of the symbolic name , short name or lower case short name
* of the resource .
* @ param attribute The attribute to match against
* @ param identifier The identifier to look for
* @ return The EsaResources that match the identifier
* @ throws RepositoryBackendException */
public Collection < SampleResource > getMatchingSamples ( final FilterableAttribute attribute , final String identifier ) throws RepositoryBackendException { } }
|
Collection < SampleResource > resources = cycleThroughRepositories ( new RepositoryInvoker < SampleResource > ( ) { @ Override public Collection < SampleResource > performActionOnRepository ( RepositoryConnection connection ) throws RepositoryBackendException { return connection . getMatchingSamples ( attribute , identifier ) ; } } ) ; return resources ;
|
public class RGBColor { /** * RGB color as r , g , b triple . */
public static RGBColor rgb ( int r , int g , int b ) { } }
|
return new RGBColor ( makeRgb ( r , g , b ) ) ;
|
public class RecurlyClient { /** * Lookup the first coupon redemption on an account .
* @ param accountCode recurly account id
* @ return the coupon redemption for this account on success , null otherwise */
public Redemption getCouponRedemptionByAccount ( final String accountCode ) { } }
|
return doGET ( Accounts . ACCOUNTS_RESOURCE + "/" + accountCode + Redemption . REDEMPTION_RESOURCE , Redemption . class ) ;
|
public class ShufflingIterable { /** * Returns a new iterator that iterates over a new random ordering of the data . */
@ Override public Iterator < T > iterator ( ) { } }
|
final List < T > shuffledList = Lists . newArrayList ( data ) ; Collections . shuffle ( shuffledList , rng ) ; return Collections . unmodifiableList ( shuffledList ) . iterator ( ) ;
|
public class PrettyTime { /** * / * [ deutsch ]
* < p > Formatiert die gesamte angegebene Dauer . < / p >
* < p > Eine lokalisierte Ausgabe ist nur f & uuml ; r die Zeiteinheiten
* { @ link CalendarUnit # YEARS } , { @ link CalendarUnit # MONTHS } ,
* { @ link CalendarUnit # WEEKS } , { @ link CalendarUnit # DAYS } und
* alle { @ link ClockUnit } - Instanzen vorhanden . Bei Bedarf werden
* andere Einheiten zu diesen normalisiert . < / p >
* < p > Hinweis : Diese Methode verwendet standardm & auml ; & szlig ; volle
* W & ouml ; rter . Falls { @ link # withShortStyle ( ) } aufgerufen wurde , werden
* Abk & uuml ; rzungen verwendet . < / p >
* @ param duration object representing a duration which might contain several units and quantities
* @ return formatted list output
* @ since 3.6/4.4 */
public String print ( Duration < ? > duration ) { } }
|
TextWidth width = ( this . shortStyle ? TextWidth . ABBREVIATED : TextWidth . WIDE ) ; return this . print ( duration , width , false , Integer . MAX_VALUE ) ;
|
public class LengthValidator { /** * Verifziert die Laenge des uebergebenen Wertes . Im Gegensatz zur
* { @ link # validate ( String , int , int ) } - Methode wird herbei eine
* { @ link IllegalArgumentException } geworfen .
* @ param value zu pruefender Wert
* @ param min geforderte Minimal - Laenge
* @ param max Maximal - Laenge
* @ return der gepruefte Wert ( zur evtl . Weiterverarbeitung ) */
public static String verify ( String value , int min , int max ) { } }
|
try { return validate ( value , min , max ) ; } catch ( IllegalArgumentException ex ) { throw new LocalizedIllegalArgumentException ( ex ) ; }
|
public class Person { /** * Adds an interaction between this person and another .
* @ param destination the Person being interacted with
* @ param description a description of the interaction
* @ return the resulting Relatioship */
public Relationship interactsWith ( Person destination , String description ) { } }
|
return interactsWith ( destination , description , null ) ;
|
public class SibRaConsumerSession { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . core . AbstractConsumerSession # unlockSet ( com . ibm . wsspi . sib . core . SIMessageHandle [ ] ) */
public void unlockSet ( SIMessageHandle [ ] msgHandles ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIIncorrectCallException , SIMessageNotLockedException { } }
|
throw new SibRaNotSupportedException ( NLS . getString ( "ASYNCHRONOUS_METHOD_CWSIV0250" ) ) ;
|
public class RScriptExecutor { /** * Execute R script and parse response : - write the response to outputPathname if outputPathname
* is not null - else return the response
* @ param script R script to execute
* @ param outputPathname optional output pathname for output file
* @ return response value or null in outputPathname is not null */
String executeScript ( String script , String outputPathname ) { } }
|
// Workaround : script contains the absolute output pathname in case outputPathname is not null
// Replace the absolute output pathname with a relative filename such that OpenCPU can handle
// the script .
String scriptOutputFilename ; if ( outputPathname != null ) { scriptOutputFilename = generateRandomString ( ) ; script = script . replace ( outputPathname , scriptOutputFilename ) ; } else { scriptOutputFilename = null ; } try { // execute script and use session key to retrieve script response
String openCpuSessionKey = executeScriptExecuteRequest ( script ) ; return executeScriptGetResponseRequest ( openCpuSessionKey , scriptOutputFilename , outputPathname ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; }
|
public class ExternalResource { /** * Creates a statement that will execute { @ code beforeClass ) and { @ code afterClass )
* @ param base
* the base statement to be executed
* @ return
* the statement for invoking beforeClass and afterClass */
private Statement classStatement ( final Statement base ) { } }
|
return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { beforeClass ( ) ; doStateTransition ( State . BEFORE_EXECUTED ) ; try { base . evaluate ( ) ; } finally { afterClass ( ) ; doStateTransition ( State . AFTER_EXECUTED ) ; } } } ;
|
public class LongValueData { /** * { @ inheritDoc } */
protected boolean internalEquals ( ValueData another ) { } }
|
if ( another instanceof LongValueData ) { return ( ( LongValueData ) another ) . value == value ; } return false ;
|
public class FileUtils { /** * Creates an empty file and its intermediate directories if necessary .
* @ param filePath pathname string of the file to create */
public static void createFile ( String filePath ) throws IOException { } }
|
Path storagePath = Paths . get ( filePath ) ; Files . createDirectories ( storagePath . getParent ( ) ) ; Files . createFile ( storagePath ) ;
|
public class FhirTerser { /** * Returns a list containing all child elements ( including the resource itself ) which are < b > non - empty < / b > and are either of the exact type specified , or are a subclass of that type .
* For example , specifying a type of { @ link StringDt } would return all non - empty string instances within the message . Specifying a type of { @ link IResource } would return the resource itself , as
* well as any contained resources .
* Note on scope : This method will descend into any contained resources ( { @ link IResource # getContained ( ) } ) as well , but will not descend into linked resources ( e . g .
* { @ link BaseResourceReferenceDt # getResource ( ) } ) or embedded resources ( e . g . Bundle . entry . resource )
* @ param theResource The resource instance to search . Must not be null .
* @ param theType The type to search for . Must not be null .
* @ return Returns a list of all matching elements */
public < T extends IBase > List < T > getAllPopulatedChildElementsOfType ( IBaseResource theResource , final Class < T > theType ) { } }
|
final ArrayList < T > retVal = new ArrayList < T > ( ) ; BaseRuntimeElementCompositeDefinition < ? > def = myContext . getResourceDefinition ( theResource ) ; visit ( new IdentityHashMap < Object , Object > ( ) , theResource , theResource , null , null , def , new IModelVisitor ( ) { @ SuppressWarnings ( "unchecked" ) @ Override public void acceptElement ( IBaseResource theOuterResource , IBase theElement , List < String > thePathToElement , BaseRuntimeChildDefinition theChildDefinition , BaseRuntimeElementDefinition < ? > theDefinition ) { if ( theElement == null || theElement . isEmpty ( ) ) { return ; } if ( theType . isAssignableFrom ( theElement . getClass ( ) ) ) { retVal . add ( ( T ) theElement ) ; } } } ) ; return retVal ;
|
public class AssertExcludes { /** * Asserts that the element ' s value does not contain the provided expected
* value . If the element isn ' t present or an input , this will constitute a
* failure , same as a mismatch . This information will be logged and
* recorded , with a screenshot for traceability and added debugging support .
* @ param expectedValue the expected value of the element */
@ SuppressWarnings ( "squid:S2259" ) public void value ( String expectedValue ) { } }
|
String value = checkValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not input" ; } assertNotNull ( reason , value ) ; assertFalse ( "Value found: element value of '" + value + CONTAINS + expectedValue + "'" , value . contains ( expectedValue ) ) ;
|
public class Native { /** * The current time in microseconds , as returned by libc . gettimeofday ( ) ; can only be used if
* { @ link # isCurrentTimeMicrosAvailable ( ) } is true . */
public static long currentTimeMicros ( ) { } }
|
if ( ! isCurrentTimeMicrosAvailable ( ) ) { throw new IllegalStateException ( "Native call not available. " + "Check isCurrentTimeMicrosAvailable() before calling this method." ) ; } LibCLoader . Timeval tv = new LibCLoader . Timeval ( LibCLoader . LIB_C_RUNTIME ) ; int res = LibCLoader . LIB_C . gettimeofday ( tv , null ) ; if ( res != 0 ) { throw new IllegalStateException ( "Call to libc.gettimeofday() failed with result " + res ) ; } return tv . tv_sec . get ( ) * 1000000 + tv . tv_usec . get ( ) ;
|
public class CmsSchedulerThreadPool { /** * Dequeue the next pending < code > Runnable < / code > . < p >
* @ return the next pending < code > Runnable < / code >
* @ throws InterruptedException if something goes wrong */
protected Runnable getNextRunnable ( ) throws InterruptedException { } }
|
Runnable toRun = null ; // Wait for new Runnable ( see runInThread ( ) ) and notify runInThread ( )
// in case the next Runnable is already waiting .
synchronized ( m_nextRunnableLock ) { if ( m_nextRunnable == null ) { m_nextRunnableLock . wait ( 1000 ) ; } if ( m_nextRunnable != null ) { toRun = m_nextRunnable ; m_nextRunnable = null ; m_nextRunnableLock . notifyAll ( ) ; } } return toRun ;
|
public class ConversationTable { /** * Returns an iterator which iterates over the tables
* contents . The values returned by this iterator are
* objects of type Conversation .
* @ return Iterator */
public synchronized Iterator iterator ( ) { } }
|
if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "iterator" ) ; Iterator returnValue = idToConvTable . values ( ) . iterator ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "iterator" , returnValue ) ; return returnValue ;
|
public class EnhancedAnnotationImpl { /** * Returns the annotated members with a given annotation type
* If the annotated members are null , they are initialized first .
* @ param annotationType The annotation type to match
* @ return The set of abstracted members with the given annotation type
* present . An empty set is returned if no matches are found
* @ see org . jboss . weld . annotated . enhanced . EnhancedAnnotation # getMembers ( Class ) */
public Set < EnhancedAnnotatedMethod < ? , ? > > getMembers ( Class < ? extends Annotation > annotationType ) { } }
|
return Collections . unmodifiableSet ( annotatedMembers . get ( annotationType ) ) ;
|
public class ReaderGroupStateManager { /** * Add this reader to the reader group so that it is able to acquire segments */
void initializeReader ( long initialAllocationDelay ) { } }
|
boolean alreadyAdded = sync . updateState ( ( state , updates ) -> { if ( state . getSegments ( readerId ) == null ) { log . debug ( "Adding reader {} to reader grop. CurrentState is: {}" , readerId , state ) ; updates . add ( new AddReader ( readerId ) ) ; return false ; } else { return true ; } } ) ; if ( alreadyAdded ) { throw new IllegalStateException ( "The requested reader: " + readerId + " cannot be added to the group because it is already in the group. Perhaps close() was not called?" ) ; } long randomDelay = ( long ) ( Math . random ( ) * Math . min ( initialAllocationDelay , sync . getState ( ) . getConfig ( ) . getGroupRefreshTimeMillis ( ) ) ) ; acquireTimer . reset ( Duration . ofMillis ( initialAllocationDelay + randomDelay ) ) ;
|
public class SessionContext { /** * Adds a list of Session Attribute Listeners
* For shared session context or global sesions , we call
* this method to add each app ' s listeners . */
public void addHttpSessionAttributeListener ( ArrayList al , String j2eeName ) { } }
|
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . entering ( methodClassName , methodNames [ ADD_HTTP_SESSION_ATTRIBUTE_LISTENER ] , "addHttpSessionAttributeListener:" + al ) ; } if ( j2eeName != null ) { addToJ2eeNameList ( j2eeName , al . size ( ) , mHttpSessionAttributeListenersJ2eeNames ) ; } mHttpSessionAttributeListeners . addAll ( al ) ; if ( mHttpSessionAttributeListeners . size ( ) > 0 ) { sessionAttributeListener = true ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . exiting ( methodClassName , methodNames [ ADD_HTTP_SESSION_ATTRIBUTE_LISTENER ] , "addHttpSessionAttributeListener:" + al ) ; }
|
public class ElementParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setControlParameters ( ControlParameters newControlParameters ) { } }
|
if ( newControlParameters != controlParameters ) { NotificationChain msgs = null ; if ( controlParameters != null ) msgs = ( ( InternalEObject ) controlParameters ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . ELEMENT_PARAMETERS__CONTROL_PARAMETERS , null , msgs ) ; if ( newControlParameters != null ) msgs = ( ( InternalEObject ) newControlParameters ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . ELEMENT_PARAMETERS__CONTROL_PARAMETERS , null , msgs ) ; msgs = basicSetControlParameters ( newControlParameters , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . ELEMENT_PARAMETERS__CONTROL_PARAMETERS , newControlParameters , newControlParameters ) ) ;
|
public class WebservicesBndComponentImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . javaee . ddmodel . wsbnd . WebservicesBnd # getWebserviceDescriptions ( ) */
@ Override public List < WebserviceDescription > getWebserviceDescriptions ( ) { } }
|
List < WebserviceDescription > webserviceDescriptionList = delegate == null ? new ArrayList < WebserviceDescription > ( ) : new ArrayList < WebserviceDescription > ( delegate . getWebserviceDescriptions ( ) ) ; webserviceDescriptionList . addAll ( webserviceDescriptionTypeMap . values ( ) ) ; return webserviceDescriptionList ;
|
public class JmxCollector { /** * Convenience function to run standalone . */
public static void main ( String [ ] args ) throws Exception { } }
|
String hostPort = "" ; if ( args . length > 0 ) { hostPort = args [ 0 ] ; } JmxCollector jc = new JmxCollector ( ( "{" + "`hostPort`: `" + hostPort + "`," + "}" ) . replace ( '`' , '"' ) ) ; for ( MetricFamilySamples mfs : jc . collect ( ) ) { System . out . println ( mfs ) ; }
|
public class CmsHistoryClearDialog { /** * Returns a list with the possible versions to choose from . < p >
* @ return a list with the possible versions to choose from */
private List getVersions ( ) { } }
|
ArrayList ret = new ArrayList ( ) ; int defaultHistoryVersions = OpenCms . getSystemInfo ( ) . getHistoryVersions ( ) ; int historyVersions = 0 ; // Add the option for disabled version history
ret . add ( new CmsSelectWidgetOption ( "-1" , true , Messages . get ( ) . getBundle ( ) . key ( Messages . GUI_HISTORY_CLEAR_VERSION_SELECT_0 ) ) ) ; // Iterate from 1 to 50 with a stepping of 1 for the first 10 entries and a stepping of five for the entries from 10 to 50
while ( historyVersions < 50 ) { // increment the history version
historyVersions ++ ; if ( ( ( historyVersions % 5 ) == 0 ) || ( historyVersions <= 10 ) ) { ret . add ( new CmsSelectWidgetOption ( String . valueOf ( historyVersions ) , false , String . valueOf ( historyVersions ) ) ) ; } } // If the default setting for the version history is more than 50
if ( defaultHistoryVersions > historyVersions ) { ret . add ( new CmsSelectWidgetOption ( String . valueOf ( defaultHistoryVersions ) , false , String . valueOf ( defaultHistoryVersions ) ) ) ; } return ret ;
|
public class GosuParser { private boolean areParametersEquivalent_Enhancement ( DynamicFunctionSymbol dfs1 , DynamicFunctionSymbol dfs2 ) { } }
|
return ! dfs1 . isStatic ( ) && dfs2 . isStatic ( ) && dfs1 . getDeclaringTypeInfo ( ) . getOwnersType ( ) instanceof IGosuEnhancement && areParametersEquivalent ( dfs1 , dfs2 , ( ( IGosuEnhancement ) dfs1 . getDeclaringTypeInfo ( ) . getOwnersType ( ) ) . getEnhancedType ( ) ) ;
|
public class NettyNetworkService { /** * Decrement the use count of the workerGroup and request a graceful
* shutdown once it is no longer being used by anyone . */
private static synchronized void decrementUseCount ( ) { } }
|
final String methodName = "decrementUseCount" ; logger . entry ( methodName ) ; -- useCount ; if ( useCount <= 0 ) { if ( bootstrap != null ) { bootstrap . group ( ) . shutdownGracefully ( 0 , 500 , TimeUnit . MILLISECONDS ) ; } bootstrap = null ; useCount = 0 ; } logger . exit ( methodName ) ;
|
public class SharedObject { /** * { @ inheritDoc } */
@ Override public boolean setAttribute ( String name , Object value ) { } }
|
log . debug ( "setAttribute - name: {} value: {}" , name , value ) ; boolean result = true ; if ( ownerMessage . addEvent ( Type . CLIENT_UPDATE_ATTRIBUTE , name , null ) ) { if ( value == null && super . removeAttribute ( name ) ) { // Setting a null value removes the attribute
modified . set ( true ) ; syncEvents . add ( new SharedObjectEvent ( Type . CLIENT_DELETE_DATA , name , null ) ) ; deleteStats . incrementAndGet ( ) ; } else if ( value != null ) { boolean setAttr = super . setAttribute ( name , value ) ; log . debug ( "Set attribute?: {} modified: {}" , setAttr , modified . get ( ) ) ; // only sync if the attribute changed
modified . set ( true ) ; syncEvents . add ( new SharedObjectEvent ( Type . CLIENT_UPDATE_DATA , name , value ) ) ; changeStats . incrementAndGet ( ) ; } else { result = false ; } notifyModified ( ) ; } return result ;
|
public class Either { /** * Applies either the left or the right function as appropriate . */
public final < T > T fold ( Function < ? super L , ? extends T > left , Function < ? super R , ? extends T > right ) { } }
|
if ( isLeft ( ) ) { return left . apply ( getLeft ( ) ) ; } else { return right . apply ( getRight ( ) ) ; }
|
public class CoreDictionary { /** * 获取词频
* @ param term
* @ return */
public static int getTermFrequency ( String term ) { } }
|
Attribute attribute = get ( term ) ; if ( attribute == null ) return 0 ; return attribute . totalFrequency ;
|
public class DiameterEventChargingSipServlet { /** * Method for doing the Charging , either it ' s a debit or a refund .
* @ param sessionId the Session - Id for the Diameter Message
* @ param userId the User - Id of the client in the Diameter Server
* @ param cost the Cost ( or Refund value ) of the service
* @ param refund boolean indicating if it ' s a refund or not
* @ return a long with the Result - Code AVP from the Answer */
private long doDiameterCharging ( String sessionId , String userId , Long cost , boolean refund ) { } }
|
try { logger . info ( "Creating Diameter Charging " + ( refund ? "Refund" : "Debit" ) + " Request UserId[" + userId + "], Cost[" + cost + "]..." ) ; Request req = ( Request ) diameterBaseClient . createAccountingRequest ( sessionId , userId , cost , refund ) ; logger . info ( "Sending Diameter Charging " + ( refund ? "Refund" : "Debit" ) + " Request..." ) ; Message msg = diameterBaseClient . sendMessageSync ( req ) ; long resultCode = - 1 ; if ( msg instanceof Answer ) resultCode = ( ( Answer ) msg ) . getResultCode ( ) . getUnsigned32 ( ) ; return resultCode ; } catch ( Exception e ) { logger . error ( "Failure communicating with Diameter Charging Server." , e ) ; return 5012 ; }
|
public class SimpleTimeZone { /** * Sets the daylight savings starting year .
* @ param year The daylight savings starting year . */
public void setStartYear ( int year ) { } }
|
if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify a frozen SimpleTimeZone instance." ) ; } getSTZInfo ( ) . sy = year ; this . startYear = year ; transitionRulesInitialized = false ;
|
public class StreamMetadataResourceImpl { /** * Implementation of updateStream REST API .
* @ param scopeName The scope name of stream .
* @ param streamName The name of stream .
* @ param updateStreamRequest The object conforming to updateStreamConfig request json .
* @ param securityContext The security for API access .
* @ param asyncResponse AsyncResponse provides means for asynchronous server side response processing . */
@ Override public void updateStream ( final String scopeName , final String streamName , final UpdateStreamRequest updateStreamRequest , final SecurityContext securityContext , final AsyncResponse asyncResponse ) { } }
|
long traceId = LoggerHelpers . traceEnter ( log , "updateStream" ) ; try { restAuthHelper . authenticateAuthorize ( getAuthorizationHeader ( ) , AuthResourceRepresentation . ofStreamInScope ( scopeName , streamName ) , READ_UPDATE ) ; } catch ( AuthException e ) { log . warn ( "Update stream for {} failed due to authentication failure." , scopeName + "/" + streamName ) ; asyncResponse . resume ( Response . status ( Status . fromStatusCode ( e . getResponseCode ( ) ) ) . build ( ) ) ; LoggerHelpers . traceLeave ( log , "Update stream" , traceId ) ; return ; } StreamConfiguration streamConfiguration = ModelHelper . getUpdateStreamConfig ( updateStreamRequest ) ; controllerService . updateStream ( scopeName , streamName , streamConfiguration ) . thenApply ( streamStatus -> { if ( streamStatus . getStatus ( ) == UpdateStreamStatus . Status . SUCCESS ) { log . info ( "Successfully updated stream config for: {}/{}" , scopeName , streamName ) ; return Response . status ( Status . OK ) . entity ( ModelHelper . encodeStreamResponse ( scopeName , streamName , streamConfiguration ) ) . build ( ) ; } else if ( streamStatus . getStatus ( ) == UpdateStreamStatus . Status . STREAM_NOT_FOUND || streamStatus . getStatus ( ) == UpdateStreamStatus . Status . SCOPE_NOT_FOUND ) { log . warn ( "Stream: {}/{} not found" , scopeName , streamName ) ; return Response . status ( Status . NOT_FOUND ) . build ( ) ; } else { log . warn ( "updateStream failed for {}/{}" , scopeName , streamName ) ; return Response . status ( Status . INTERNAL_SERVER_ERROR ) . build ( ) ; } } ) . exceptionally ( exception -> { log . warn ( "updateStream for {}/{} failed with exception: {}" , scopeName , streamName , exception ) ; return Response . status ( Status . INTERNAL_SERVER_ERROR ) . build ( ) ; } ) . thenApply ( asyncResponse :: resume ) . thenAccept ( x -> LoggerHelpers . traceLeave ( log , "updateStream" , traceId ) ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.