code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static String quoteJavaIntArray(int[] array){
if (array == null) {
return "null";
}
StatementBuilder buff=new StatementBuilder("new int[]{");
for ( int a : array) {
buff.appendExceptFirst(", ");
buff.append(a);
}
return buff.append('}').toString();
}
| Convert an int array to the Java source code that represents this array. Null will be converted to 'null'. |
public final void yybegin(int newState){
zzLexicalState=newState;
}
| Enters a new lexical state |
public static void main(String[] args){
int N=Integer.parseInt(args[0]);
Complex[] x=new Complex[N];
for (int i=0; i < N; i++) {
x[i]=new Complex(i,0);
x[i]=new Complex(-2 * Math.random() + 1,0);
}
show(x,"x");
Complex[] y=fft(x);
show(y,"y = fft(x)");
Complex[] z=ifft(y);
show(z,"z = ifft(y)");
Complex[] c=cconvolve(x,x);
show(c,"c = cconvolve(x, x)");
Complex[] d=convolve(x,x);
show(d,"d = convolve(x, x)");
}
| Test client and sample execution % java FFT 4 x ------------------- -0.03480425839330703 0.07910192950176387 0.7233322451735928 0.1659819820667019 y = fft(x) ------------------- 0.9336118983487516 -0.7581365035668999 + 0.08688005256493803i 0.44344407521182005 -0.7581365035668999 - 0.08688005256493803i z = ifft(y) ------------------- -0.03480425839330703 0.07910192950176387 + 2.6599344570851287E-18i 0.7233322451735928 0.1659819820667019 - 2.6599344570851287E-18i c = cconvolve(x, x) ------------------- 0.5506798633981853 0.23461407150576394 - 4.033186818023279E-18i -0.016542951108772352 0.10288019294318276 + 4.033186818023279E-18i d = convolve(x, x) ------------------- 0.001211336402308083 - 3.122502256758253E-17i -0.005506167987577068 - 5.058885073636224E-17i -0.044092969479563274 + 2.1934338938072244E-18i 0.10288019294318276 - 3.6147323062478115E-17i 0.5494685269958772 + 3.122502256758253E-17i 0.240120239493341 + 4.655566391833896E-17i 0.02755001837079092 - 2.1934338938072244E-18i 4.01805098805014E-17i |
public static double cdf(double x,double n){
return cdf(x,n / 2.0,2.0);
}
| cumulative density function of the chi-square distribution |
public CSVParser(char separator,char quotechar,char escape,boolean strictQuotes,boolean ignoreLeadingWhiteSpace,boolean ignoreQuotations){
if (anyCharactersAreTheSame(separator,quotechar,escape)) {
throw new UnsupportedOperationException("The separator, quote, and escape characters must be different!");
}
if (separator == NULL_CHARACTER) {
throw new UnsupportedOperationException("The separator character must be defined!");
}
this.separator=separator;
this.quotechar=quotechar;
this.escape=escape;
this.strictQuotes=strictQuotes;
this.ignoreLeadingWhiteSpace=ignoreLeadingWhiteSpace;
this.ignoreQuotations=ignoreQuotations;
}
| Constructs CSVParser with supplied separator and quote char. Allows setting the "strict quotes" and "ignore leading whitespace" flags |
public Object clone() throws CloneNotSupportedException {
return new IntVector(this);
}
| Returns clone of current IntVector |
public static void generateCallerPathDiagrams(){
MySafeDelegator.generateCallerPathDiagrams();
}
| Generates caller path diagram into default (<tt>mysafe-caller-path</tt>) file. |
public static Pattern compile(String regex,String flags) throws PatternSyntaxException {
return new Pattern(regex,flags);
}
| Compiles the given String into a Pattern that can be used to match text. The syntax is normal for Java, including backslashes as part of regex syntax, like the digit shorthand "\d", escaped twice to "\\d" (so the double-quoted String itself doesn't try to interpret the backslash). <br> This variant allows flags to be passed as an String. The flag string should consist of letters 'i','m','s','x','u','X'(the case is significant) and a hyphen or plus. The meaning of letters: <ul> <li><b>i</b> - case insensitivity, corresponds to REFlags.IGNORE_CASE;</li> <li><b>m</b> - multiline treatment(BOLs and EOLs affect the '^' and '$'), corresponds to REFlags.MULTILINE flag;</li> <li><b>s</b> - single line treatment('.' matches \r's and \n's),corresponds to REFlags.DOTALL;</li> <li><b>x</b> - extended whitespace comments (spaces and eols in the expression are ignored), corresponds to REFlags.IGNORE_SPACES.</li> <li><b>u</b> - predefined classes are regarded as belonging to Unicode, corresponds to REFlags.UNICODE; this may yield some performance penalty.</li> <li><b>X</b> - compatibility with XML Schema, corresponds to REFlags.XML_SCHEMA.</li> <li><b>-</b> - turn off the specified flags; normally has no effect unless something adds the flags.</li> <li><b>+</b> - turn on the specified flags; normally is no different from just using the letters.</li> </ul> |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public static boolean isMatchingEtag(final List<String> headerList,final String etag){
for ( String header : headerList) {
final String[] headerEtags=header.split(",");
for ( String s : headerEtags) {
s=s.trim();
if (s.equals(etag) || "*".equals(s)) {
return true;
}
}
}
return false;
}
| Checks if one of the tags in the list equals the given etag. |
public final boolean containsKey(String name){
return mMap.containsKey(name);
}
| Returns true iff a key of the given name exists in the format. |
public String next(int n) throws JSONException {
if (n == 0) {
return "";
}
char[] chars=new char[n];
int pos=0;
while (pos < n) {
chars[pos]=this.next();
if (this.end()) {
throw this.syntaxError("Substring bounds error");
}
pos+=1;
}
return new String(chars);
}
| Get the next n characters. |
@Override protected void onNfcStateDisabled(){
toast(getString(R.string.nfcAvailableDisabled));
}
| NFC feature was found but is currently disabled |
private void tryToGetAudioFocus(){
if (mAudioFocus != AudioFocus.FOCUS && mAudioManager != null && (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN))) {
mAudioFocus=AudioFocus.FOCUS;
}
}
| Requests the audio focus to the Audio Manager |
private static byte[] encode3to4(byte[] b4,byte[] threeBytes,int numSigBytes,int options){
encode3to4(threeBytes,0,numSigBytes,b4,0,options);
return b4;
}
| Encodes up to the first three bytes of array <var>threeBytes</var> and returns a four-byte array in Base64 notation. The actual number of significant bytes in your array is given by <var>numSigBytes</var>. The array <var>threeBytes</var> needs only be as big as <var>numSigBytes</var>. Code can reuse a byte array by passing a four-byte array as <var>b4</var>. |
public MarketingPermissionNotFoundException(String message){
super(message);
}
| Constructs a new exception with the specified detail message. The cause is not initialized. |
public int binarySearchFromTo(char key,int from,int to){
return cern.colt.Sorting.binarySearchFromTo(this.elements,key,from,to);
}
| Searches the receiver for the specified value using the binary search algorithm. The receiver must <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple elements equal to the specified object, there is no guarantee which instance will be found. |
protected boolean parseAndBuildBindings(PossibleMatch possibleMatch,boolean mustResolve) throws CoreException {
if (this.progressMonitor != null && this.progressMonitor.isCanceled()) throw new OperationCanceledException();
try {
if (BasicSearchEngine.VERBOSE) System.out.println("Parsing " + possibleMatch.openable.toStringWithAncestors());
this.parser.nodeSet=possibleMatch.nodeSet;
CompilationResult unitResult=new CompilationResult(possibleMatch,1,1,this.options.maxProblemsPerUnit);
CompilationUnitDeclaration parsedUnit=this.parser.dietParse(possibleMatch,unitResult);
if (parsedUnit != null) {
if (!parsedUnit.isEmpty()) {
if (mustResolve) {
this.lookupEnvironment.buildTypeBindings(parsedUnit,null);
}
if (hasAlreadyDefinedType(parsedUnit)) return false;
getMethodBodies(parsedUnit,possibleMatch.nodeSet);
if (this.patternLocator.mayBeGeneric && !mustResolve && possibleMatch.nodeSet.mustResolve) {
this.lookupEnvironment.buildTypeBindings(parsedUnit,null);
}
}
possibleMatch.parsedUnit=parsedUnit;
int size=this.matchesToProcess.length;
if (this.numberOfMatches == size) System.arraycopy(this.matchesToProcess,0,this.matchesToProcess=new PossibleMatch[size == 0 ? 1 : size * 2],0,this.numberOfMatches);
this.matchesToProcess[this.numberOfMatches++]=possibleMatch;
}
}
finally {
this.parser.nodeSet=null;
}
return true;
}
| Add the possibleMatch to the loop -> build compilation unit declarations, their bindings and record their results. |
@NonNull public static String convertDiffToPrettyMinutesLeft(@NonNull Context context,@NonNull DateTime diffTime){
int minutes=diffTime.getMinuteOfHour();
if (minutes == 0) {
return context.getString(R.string.time_left_less_than_minute);
}
else {
return context.getResources().getQuantityString(R.plurals.time_left_minutes,minutes,minutes);
}
}
| Converts the time difference to the human readable minutes. |
public Activity alwaysRunAfter(String beforeKey,String afterKey){
Activity before=get(beforeKey);
Activity after=get(afterKey);
if (before != null && after != null) ActivityManager.alwaysScheduleAfter(before,after);
return after;
}
| Schedules the Activity corresponding to the afterKey to always be run immediately after the completion of the Activity corresponding to the beforeKey. This method has no scheduling effect on the Activity corresponding to the before key. |
public static double sumToDouble(float[] array){
double sum=0;
for ( float x : array) {
sum+=x;
}
return sum;
}
| Sum all numbers from array. |
public static RecordEventForInstanceE parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
RecordEventForInstanceE object=new RecordEventForInstanceE();
int event;
java.lang.String nillableValue=null;
java.lang.String prefix="";
java.lang.String namespaceuri="";
try {
while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
java.util.Vector handledAttributes=new java.util.Vector();
while (!reader.isEndElement()) {
if (reader.isStartElement()) {
if (reader.isStartElement() && new javax.xml.namespace.QName("http://oscm.org","recordEventForInstance").equals(reader.getName())) {
object.setRecordEventForInstance(RecordEventForInstance.Factory.parse(reader));
}
else {
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
}
else {
reader.next();
}
}
}
catch ( javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
| static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element |
@DSSink({DSSinkKind.FILE}) @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.195 -0400",hash_original_method="3154661078E59224754D0E69E10DDFB6",hash_generated_method="37574DF2C28BFC93DF4FFF3E9C9847C8") public static void writeLines(File file,Collection<?> lines,String lineEnding) throws IOException {
writeLines(file,null,lines,lineEnding,false);
}
| Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the specified line ending will be used. |
public void execute(){
Mmhc search;
int depth=getParams().getInt("depth",-1);
search=new Mmhc(getIndependenceTest(),getIndependenceTest().getDataSets().get(0));
search.setDepth(depth);
search.setKnowledge((IKnowledge)getParams().get("knowledge",new Knowledge2()));
Graph graph=search.search();
setResultGraph(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph,getSourceGraph());
}
else {
GraphUtils.circleLayout(graph,200,200,150);
}
}
| Executes the algorithm, producing (at least) a result workbench. Must be implemented in the extending class. |
public FileParsingTextSource(File data,TextSource fallback){
delegate=new StringParsingTextSource(StringIterable.fromFile(data),fallback);
}
| Reads text from tab-separated file. Assumes platform default encoding. |
@Override public void readSettings(){
SharedPreferences sharedPreferences=this.getSharedPreferences(getString(R.string.sp_widget_clock_day_center_setting),Context.MODE_PRIVATE);
setLocation(new Location(sharedPreferences.getString(getString(R.string.key_location),getString(R.string.local)),null));
Location location=DatabaseHelper.getInstance(this).searchLocation(getLocation());
if (location != null) {
setLocation(location);
}
}
| <br> life cycle. |
@Override @Transient public boolean isFullTextSearchable(){
return true;
}
| Override the gisFeature value.<br> Default to true;<br> If this field is set to false, then the object won't be synchronized with the fullText search engine |
@SuppressWarnings("unchecked") private BufferOutput writeByClass(Class<?> type,Object object,BufferOutput output,TypeSerializer serializer){
if (whitelistRequired.get()) throw new SerializationException("cannot serialize unregistered type: " + type);
serializer.write(object,output.writeByte(Identifier.CLASS.code()).writeUTF8(type.getName()),this);
return output;
}
| Writes an object to the buffer with its class name. |
public static boolean completed(Collection<ShardSnapshotStatus> shards){
for ( ShardSnapshotStatus status : shards) {
if (status.state().completed() == false) {
return false;
}
}
return true;
}
| Checks if all shards in the list have completed |
private List<LatticeNode> levelUpLattice(List<LatticeNode> latticeNodes,List<ContextualDatum> data){
Stopwatch sw=Stopwatch.createUnstarted();
log.debug("\tSorting lattice nodes in level {} by their dimensions ",latticeNodes.get(0).dimensions.size());
sw.start();
List<LatticeNode> latticeNodeByDimensions=new ArrayList<>(latticeNodes);
Collections.sort(latticeNodeByDimensions,new LatticeNode.DimensionComparator());
sw.stop();
long sortingTime=sw.elapsed(TimeUnit.MILLISECONDS);
sw.reset();
log.debug("\tDone Sorting lattice nodes in level {} by their dimensions (duration: {}ms)",latticeNodes.get(0).dimensions.size(),sortingTime);
List<LatticeNode> result=new ArrayList<LatticeNode>();
log.debug("\tJoining lattice nodes in level {} by their dimensions ",latticeNodes.get(0).dimensions.size());
sw.start();
int numLatticeNodeJoins=0;
int numDenseContexts=0;
for (int i=0; i < latticeNodeByDimensions.size(); i++) {
for (int j=i + 1; j < latticeNodeByDimensions.size(); j++) {
LatticeNode s1=latticeNodeByDimensions.get(i);
LatticeNode s2=latticeNodeByDimensions.get(j);
LatticeNode joined=s1.join(s2,data,denseContextTau);
if (joined != null) {
numLatticeNodeJoins++;
if (joined.getDenseContexts().size() != 0) {
result.add(joined);
numDenseContexts+=joined.getDenseContexts().size();
}
}
}
}
sw.stop();
long joiningTime=sw.elapsed(TimeUnit.MILLISECONDS);
sw.reset();
log.debug("\tDone Joining lattice nodes in level {} by their dimensions (duration: {}ms)",latticeNodes.get(0).dimensions.size(),joiningTime);
log.debug("\tDone Joining lattice nodes in level {} by their dimensions," + " there are {} joins and {} dense contexts (average duration per lattice node pair join: {}ms)",latticeNodes.get(0).dimensions.size(),numLatticeNodeJoins,numDenseContexts,(numLatticeNodeJoins == 0) ? 0 : joiningTime / numLatticeNodeJoins);
return result;
}
| Walking up the lattice, construct the lattice node, when include those lattice nodes that contain at least one dense context |
public String toString(){
return name;
}
| Returns the name of this WatchMode ("on", "off", "add", "remove"). |
@Override public boolean onTouchEvent(MotionEvent event){
boolean retValue=mGestureDetector.onTouchEvent(event);
int action=event.getAction();
if (action == MotionEvent.ACTION_UP) {
onUp();
}
else if (action == MotionEvent.ACTION_CANCEL) {
onCancel();
}
return retValue;
}
| Implemented to handle touch screen motion events. |
@Override public void editingStopped(ChangeEvent e){
getModel().setValueAt(getCellEditor().getCellEditorValue(),getEditingRow(),getEditingColumn());
}
| This is needed in order to allow auto completition: Otherwise the editor will be immediately removed after setting the first selected value and loosing its focus. This way it is ensured that the editor won't be removed. |
void relocate(String relocatingNodeId,long expectedShardSize){
ensureNotFrozen();
version++;
assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this;
state=ShardRoutingState.RELOCATING;
this.relocatingNodeId=relocatingNodeId;
this.allocationId=AllocationId.newRelocation(allocationId);
this.expectedShardSize=1;
}
| Relocate the shard to another node. |
public static void main(String[] args){
String runNumber1="749";
String runNumber2="869";
String netfile=DgPaths.RUNBASE + "run" + runNumber1.toString()+ "/"+ runNumber1.toString()+ "."+ "output_network.xml.gz";
String plans1file=DgPaths.RUNBASE + "run" + runNumber1.toString()+ "/"+ runNumber1.toString()+ "."+ "output_plans.xml.gz";
String plans2file=DgPaths.RUNBASE + "run" + runNumber2.toString()+ "/"+ runNumber2.toString()+ "."+ "output_plans.xml.gz";
args=new String[4];
args[0]=netfile;
args[1]=plans1file;
args[2]=plans2file;
args[3]=DgPaths.RUNBASE + "run" + runNumber2.toString()+ "/"+ runNumber1.toString()+ "vs"+ runNumber2.toString()+ "plansCompare.txt";
DgAnalysisPopulation pop=new DgAnalysisPopulation();
DgAnalysisPopulationReader reader=new DgAnalysisPopulationReader();
reader.readAnalysisPopulation(pop,runNumber1,netfile,args[1]);
reader.readAnalysisPopulation(pop,runNumber2,netfile,args[2]);
if (args.length == 3) {
System.out.println(new PlanComparisonStringWriter(pop,runNumber1,runNumber2).getResult());
}
else if (args.length == 4) {
new PlanComparisonFileWriter(pop).write(args[3],runNumber1,runNumber2);
}
else printHelp();
}
| Should be called with 3 arguments, each of them a path to a file: 1. the config file containing the world and the network 2. the first plan file 3. the second plan file |
public void moveChild(ActionEvent actionEvent){
UIComponent destinationContainer=actionEvent.getComponent().getParent();
UIComponent viewRoot=FacesContext.getCurrentInstance().getViewRoot();
UIComponent moveableChild=destinationContainer.findComponent("outputText2");
if (moveableChild == null) {
moveableChild=viewRoot.findComponent("form1:outputText2");
}
if (moveableChild == null) {
moveableChild=viewRoot.findComponent("form1:subview1:outputText2");
}
if (moveableChild == null) {
moveableChild=viewRoot.findComponent("form1:subview2:outputText2");
}
if (moveableChild == null) {
moveableChild=viewRoot.findComponent("form1:subview2:subview2b:outputText2");
}
if (moveableChild != null) {
moveableChild.getParent().getChildren().remove(moveableChild);
destinationContainer.getChildren().add(0,moveableChild);
}
}
| Move the child. |
public boolean isIndexed(){
return isIndexed;
}
| Returns true for indexed properties, returns false for all other property styles. <p> An indexed property is a property returning an array value or a getter-method taking a single integer parameter. |
@Override public void populateFrame(Audio a){
if (!(a instanceof AudioSource)) {
throw new IllegalArgumentException(a.getSystemName() + " is not an AudioSource object");
}
super.populateFrame(a);
AudioSource s=(AudioSource)a;
AudioManager am=InstanceManager.getDefault(jmri.AudioManager.class);
String ab=s.getAssignedBufferName();
Audio b=am.getAudio(ab);
if (b != null) {
assignedBuffer.setSelectedItem(b.getUserName() == null ? ab : b.getUserName());
}
loopInfinite.setSelected((s.getMinLoops() == AudioSource.LOOP_CONTINUOUS));
loopMin.setValue(loopInfinite.isSelected() ? 0 : s.getMinLoops());
loopMax.setValue(loopInfinite.isSelected() ? 0 : s.getMaxLoops());
position.setValue(s.getPosition());
positionRelative.setSelected(s.isPositionRelative());
velocity.setValue(s.getVelocity());
gain.setValue(s.getGain());
pitch.setValue(s.getPitch());
refDistance.setValue(s.getReferenceDistance());
maxDistance.setValue(s.getMaximumDistance());
rollOffFactor.setValue(s.getRollOffFactor());
fadeInTime.setValue(s.getFadeIn());
fadeOutTime.setValue(s.getFadeOut());
this.newSource=false;
}
| Method to populate the Edit Source frame with current values |
public JSONObject(Map<String,Object> map){
this.map=new HashMap<String,Object>();
if (map != null) {
Iterator<Entry<String,Object>> i=map.entrySet().iterator();
while (i.hasNext()) {
Entry<String,Object> entry=i.next();
Object value=entry.getValue();
if (value != null) {
this.map.put(entry.getKey(),wrap(value));
}
}
}
}
| Construct a JSONObject from a Map. |
public String graph(FPTreeRoot tree){
StringBuffer text=new StringBuffer();
text.append("digraph FPTree {\n");
text.append("N0 [label=\"ROOT\"]\n");
tree.graphFPTree(text);
text.append("}\n");
return text.toString();
}
| Assemble a dot graph representation of the FP-tree. |
@Override public void run(){
amIActive=true;
String inputFilesString=null;
String[] pointFiles;
String outputHeader=null;
int row, col;
int nrows, ncols;
double x, y;
double z=0;
int a, i;
int progress=0;
int numPoints=0;
double maxValue;
double minX=Double.POSITIVE_INFINITY;
double maxX=Double.NEGATIVE_INFINITY;
double minY=Double.POSITIVE_INFINITY;
double maxY=Double.NEGATIVE_INFINITY;
double north, south, east, west;
double resolution=1;
String str1=null;
FileWriter fw=null;
BufferedWriter bw=null;
PrintWriter out=null;
List<KdTree.Entry<Double>> results;
double noData=-32768;
double northing, easting;
String whatToInterpolate="";
String returnNumberToInterpolate="all points";
String suffix="";
boolean excludeNeverClassified=false;
boolean excludeUnclassified=false;
boolean excludeBareGround=false;
boolean excludeLowVegetation=false;
boolean excludeMediumVegetation=false;
boolean excludeHighVegetation=false;
boolean excludeBuilding=false;
boolean excludeLowPoint=false;
boolean excludeModelKeyPoint=false;
boolean excludeWater=false;
if (args.length <= 0) {
showFeedback("Plugin parameters have not been set.");
return;
}
inputFilesString=args[0];
suffix=args[1].trim();
whatToInterpolate=args[2].toLowerCase();
returnNumberToInterpolate=args[3].toLowerCase();
resolution=Double.parseDouble(args[4]);
double circleCircumscrbingGridCell=Math.sqrt(2) * resolution / 2.0;
excludeNeverClassified=Boolean.parseBoolean(args[5]);
excludeUnclassified=Boolean.parseBoolean(args[6]);
excludeBareGround=Boolean.parseBoolean(args[7]);
excludeLowVegetation=Boolean.parseBoolean(args[8]);
excludeMediumVegetation=Boolean.parseBoolean(args[9]);
excludeHighVegetation=Boolean.parseBoolean(args[10]);
excludeBuilding=Boolean.parseBoolean(args[11]);
excludeLowPoint=Boolean.parseBoolean(args[12]);
excludeModelKeyPoint=Boolean.parseBoolean(args[13]);
excludeWater=Boolean.parseBoolean(args[14]);
if ((inputFilesString.length() <= 0)) {
showFeedback("One or more of the input parameters have not been set properly.");
return;
}
try {
boolean[] classValuesToExclude=new boolean[32];
if (excludeNeverClassified) {
classValuesToExclude[0]=true;
}
if (excludeUnclassified) {
classValuesToExclude[1]=true;
}
if (excludeBareGround) {
classValuesToExclude[2]=true;
}
if (excludeLowVegetation) {
classValuesToExclude[3]=true;
}
if (excludeMediumVegetation) {
classValuesToExclude[4]=true;
}
if (excludeHighVegetation) {
classValuesToExclude[5]=true;
}
if (excludeBuilding) {
classValuesToExclude[6]=true;
}
if (excludeLowPoint) {
classValuesToExclude[7]=true;
}
if (excludeModelKeyPoint) {
classValuesToExclude[8]=true;
}
if (excludeWater) {
classValuesToExclude[9]=true;
}
pointFiles=inputFilesString.split(";");
int numPointFiles=pointFiles.length;
long numPointsInFile=0;
PointRecord point;
PointRecColours pointColours;
double[] entry;
for (int j=0; j < numPointFiles; j++) {
LASReader las=new LASReader(pointFiles[j]);
progress=(int)((j + 1) * 100d / numPointFiles);
updateProgress("Loop " + (j + 1) + " of "+ numPointFiles+ " Reading point data:",progress);
numPointsInFile=las.getNumPointRecords();
numPoints=0;
for (a=0; a < numPointsInFile; a++) {
point=las.getPointRecord(a);
if (returnNumberToInterpolate.equals("all points")) {
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()])) {
numPoints++;
}
}
else if (returnNumberToInterpolate.equals("first return")) {
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()]) && point.getReturnNumber() == 1) {
numPoints++;
}
}
else {
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()]) && point.getReturnNumber() == point.getNumberOfReturns()) {
numPoints++;
}
}
}
minX=Double.POSITIVE_INFINITY;
maxX=Double.NEGATIVE_INFINITY;
minY=Double.POSITIVE_INFINITY;
maxY=Double.NEGATIVE_INFINITY;
KdTree<Double> pointsTree=new KdTree.SqrEuclid<Double>(2,new Integer(numPoints));
if (returnNumberToInterpolate.equals("all points")) {
for (a=0; a < numPointsInFile; a++) {
point=las.getPointRecord(a);
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()])) {
x=point.getX();
y=point.getY();
if (whatToInterpolate.equals("z (elevation)")) {
z=point.getZ();
}
else if (whatToInterpolate.equals("intensity")) {
z=point.getIntensity();
}
else if (whatToInterpolate.equals("classification")) {
z=point.getClassification();
}
else if (whatToInterpolate.equals("scan angle")) {
z=point.getScanAngle();
}
else if (whatToInterpolate.equals("rgb data")) {
pointColours=las.getPointRecordColours(a);
z=(double)((255 << 24) | (pointColours.getBlue() << 16) | (pointColours.getGreen() << 8)| pointColours.getRed());
}
entry=new double[]{y,x};
pointsTree.addPoint(entry,z);
if (x < minX) {
minX=x;
}
if (x > maxX) {
maxX=x;
}
if (y < minY) {
minY=y;
}
if (y > maxY) {
maxY=y;
}
}
progress=(int)(100d * (a + 1) / numPointsInFile);
if ((progress % 2) == 0) {
updateProgress("Reading point data:",progress);
}
}
}
else if (returnNumberToInterpolate.equals("first return")) {
for (a=0; a < numPointsInFile; a++) {
point=las.getPointRecord(a);
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()]) && point.getReturnNumber() == 1) {
x=point.getX();
y=point.getY();
if (whatToInterpolate.equals("z (elevation)")) {
z=point.getZ();
}
else if (whatToInterpolate.equals("intensity")) {
z=point.getIntensity();
}
else if (whatToInterpolate.equals("classification")) {
z=point.getClassification();
}
else if (whatToInterpolate.equals("scan angle")) {
z=point.getScanAngle();
}
else if (whatToInterpolate.equals("rgb data")) {
pointColours=las.getPointRecordColours(a);
z=(double)((255 << 24) | (pointColours.getBlue() << 16) | (pointColours.getGreen() << 8)| pointColours.getRed());
}
entry=new double[]{y,x};
pointsTree.addPoint(entry,z);
if (x < minX) {
minX=x;
}
if (x > maxX) {
maxX=x;
}
if (y < minY) {
minY=y;
}
if (y > maxY) {
maxY=y;
}
}
progress=(int)(100d * (a + 1) / numPointsInFile);
if ((progress % 2) == 0) {
updateProgress("Reading point data:",progress);
}
}
}
else {
for (a=0; a < numPointsInFile; a++) {
point=las.getPointRecord(a);
if (!point.isPointWithheld() && !(classValuesToExclude[point.getClassification()]) && point.getReturnNumber() == point.getNumberOfReturns()) {
x=point.getX();
y=point.getY();
if (whatToInterpolate.equals("z (elevation)")) {
z=point.getZ();
}
else if (whatToInterpolate.equals("intensity")) {
z=point.getIntensity();
}
else if (whatToInterpolate.equals("classification")) {
z=point.getClassification();
}
else if (whatToInterpolate.equals("scan angle")) {
z=point.getScanAngle();
}
else if (whatToInterpolate.equals("rgb data")) {
pointColours=las.getPointRecordColours(a);
z=(double)((255 << 24) | (pointColours.getBlue() << 16) | (pointColours.getGreen() << 8)| pointColours.getRed());
}
entry=new double[]{y,x};
pointsTree.addPoint(entry,z);
if (x < minX) {
minX=x;
}
if (x > maxX) {
maxX=x;
}
if (y < minY) {
minY=y;
}
if (y > maxY) {
maxY=y;
}
}
progress=(int)(100d * (a + 1) / numPointsInFile);
if ((progress % 2) == 0) {
updateProgress("Reading point data:",progress);
}
}
}
outputHeader=pointFiles[j].replace(".las",suffix + ".dep");
if ((new File(outputHeader)).exists()) {
(new File(outputHeader)).delete();
(new File(outputHeader.replace(".dep",".tas"))).delete();
}
west=minX - 0.5 * resolution;
north=maxY + 0.5 * resolution;
nrows=(int)(Math.ceil((north - minY) / resolution));
ncols=(int)(Math.ceil((maxX - west) / resolution));
south=north - nrows * resolution;
east=west + ncols * resolution;
fw=new FileWriter(outputHeader,false);
bw=new BufferedWriter(fw);
out=new PrintWriter(bw,true);
str1="Min:\t" + Double.toString(Integer.MAX_VALUE);
out.println(str1);
str1="Max:\t" + Double.toString(Integer.MIN_VALUE);
out.println(str1);
str1="North:\t" + Double.toString(north);
out.println(str1);
str1="South:\t" + Double.toString(south);
out.println(str1);
str1="East:\t" + Double.toString(east);
out.println(str1);
str1="West:\t" + Double.toString(west);
out.println(str1);
str1="Cols:\t" + Integer.toString(ncols);
out.println(str1);
str1="Rows:\t" + Integer.toString(nrows);
out.println(str1);
str1="Data Type:\t" + "float";
out.println(str1);
str1="Z Units:\t" + "not specified";
out.println(str1);
str1="XY Units:\t" + "not specified";
out.println(str1);
str1="Projection:\t" + "not specified";
out.println(str1);
if (!whatToInterpolate.equals("rgb data")) {
str1="Data Scale:\tcontinuous";
}
else {
str1="Data Scale:\trgb";
}
out.println(str1);
if (whatToInterpolate.equals("rgb data")) {
str1="Preferred Palette:\t" + "rgb.pal";
}
else if (whatToInterpolate.equals("intensity")) {
str1="Preferred Palette:\t" + "grey.pal";
}
else {
str1="Preferred Palette:\t" + "spectrum.pal";
}
out.println(str1);
str1="NoData:\t" + noData;
out.println(str1);
if (java.nio.ByteOrder.nativeOrder() == java.nio.ByteOrder.LITTLE_ENDIAN) {
str1="Byte Order:\t" + "LITTLE_ENDIAN";
}
else {
str1="Byte Order:\t" + "BIG_ENDIAN";
}
out.println(str1);
out.close();
WhiteboxRaster image=new WhiteboxRaster(outputHeader,"rw");
double halfResolution=resolution / 2;
for (row=0; row < nrows; row++) {
for (col=0; col < ncols; col++) {
easting=(col * resolution) + (west + halfResolution);
northing=(north - halfResolution) - (row * resolution);
entry=new double[]{northing,easting};
results=pointsTree.neighborsWithinRange(entry,circleCircumscrbingGridCell);
if (!results.isEmpty()) {
maxValue=Float.NEGATIVE_INFINITY;
for (i=0; i < results.size(); i++) {
z=results.get(i).value;
if (z > maxValue) {
maxValue=z;
}
;
}
image.setValue(row,col,maxValue);
}
else {
image.setValue(row,col,noData);
}
}
if (cancelOp) {
cancelOperation();
return;
}
progress=(int)(100f * row / (nrows - 1));
updateProgress("Interpolating point data:",progress);
}
image.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
image.addMetadataEntry("Created on " + new Date());
image.close();
}
returnData(pointFiles[0].replace(".las",suffix + ".dep"));
}
catch ( OutOfMemoryError oe) {
myHost.showFeedback("An out-of-memory error has occurred during operation.");
}
catch ( Exception e) {
myHost.showFeedback("An error has occurred during operation. See log file for details.");
myHost.logException("Error in " + getDescriptiveName(),e);
}
finally {
updateProgress("Progress: ",0);
amIActive=false;
myHost.pluginComplete();
}
}
| Used to execute this plugin tool. |
private boolean maybeDisableSync(){
if (mSyncEverything.isChecked() || !getSelectedModelTypes().isEmpty() || !canDisableSync()) {
return false;
}
SyncController.get(getActivity()).stop();
mSyncSwitchPreference.setChecked(false);
updateSyncStateFromSwitch();
return true;
}
| Disables Sync if all data types have been disabled. |
public boolean isAfterLast(){
return pos >= lcText.length;
}
| Gibt zurueck ob der Zeiger nach dem letzten Zeichen steht. |
public StreamingTemplateEngine(){
this(StreamingTemplate.class.getClassLoader());
}
| Create a streaming template engine instance using the default class loader |
public void writeTo(DataOutput out) throws IOException {
out.writeInt(typeId);
U.writeString(out,typeName);
if (fields == null) out.writeInt(-1);
else {
out.writeInt(fields.size());
for ( Map.Entry<String,Integer> fieldEntry : fields.entrySet()) {
U.writeString(out,fieldEntry.getKey());
out.writeInt(fieldEntry.getValue());
}
}
U.writeString(out,affKeyFieldName);
if (schemas == null) out.writeInt(-1);
else {
out.writeInt(schemas.size());
for ( BinarySchema schema : schemas) schema.writeTo(out);
}
out.writeBoolean(isEnum);
}
| The object implements the writeTo method to save its contents by calling the methods of DataOutput for its primitive values and strings or calling the writeTo method for other objects. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:13.399 -0500",hash_original_method="76A5C02B3DC683D5BF99D1052171A66C",hash_generated_method="09185FFE4AB317576453852013B0DBCE") private void parseStale(String value){
if (value != null) {
if (value.equalsIgnoreCase("true")) {
mStale=true;
}
}
}
| Parses and initializes the 'stale' paramer value. Any value different from case-insensitive "true" is considered "false". |
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
Map<String,List<String>> metaData=MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
}
| PacketExtensionProvider implementation |
public boolean evaluate(InternalContextAdapter context) throws MethodInvocationException {
Object value=execute(null,context);
if (value == null) {
return false;
}
else if (value instanceof Boolean) {
if (((Boolean)value).booleanValue()) return true;
else return false;
}
else return true;
}
| Computes boolean value of this reference Returns the actual value of reference return type boolean, and 'true' if value is not null |
public void playSequentially(Animator... items){
if (items != null) {
mNeedsSort=true;
if (items.length == 1) {
play(items[0]);
}
else {
for (int i=0; i < items.length - 1; ++i) {
play(items[i]).before(items[i + 1]);
}
}
}
}
| Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends. |
public InlineQueryResultVideo.InlineQueryResultVideoBuilder thumbUrl(URL thumbUrl){
this.thumb_url=thumbUrl;
return this;
}
| *Required Sets the URL of the thumbnail that should show next to the result in the inline result selection pane |
protected void createMinimalGeometry(DrawContext dc,ShapeData shapeData){
this.computeReferencePoint(dc.getTerrain(),shapeData);
if (shapeData.getReferencePoint() == null) return;
this.computeBoundaryVertices(dc.getTerrain(),shapeData.getOuterBoundaryInfo(),shapeData.getReferencePoint());
if (this.getExtent() == null || this.getAltitudeMode() != WorldWind.ABSOLUTE) shapeData.setExtent(this.computeExtent(shapeData.getOuterBoundaryInfo(),shapeData.getReferencePoint()));
shapeData.setEyeDistance(this.computeEyeDistance(dc,shapeData));
shapeData.setGlobeStateKey(dc.getGlobe().getGlobeStateKey(dc));
shapeData.setVerticalExaggeration(dc.getVerticalExaggeration());
}
| Computes the information necessary to determine this extruded polygon's extent. |
private void initH2Console(ServletContext servletContext){
log.debug("Initialize H2 console");
ServletRegistration.Dynamic h2ConsoleServlet=servletContext.addServlet("H2Console",new org.h2.server.web.WebServlet());
h2ConsoleServlet.addMapping("/h2-console/*");
h2ConsoleServlet.setInitParameter("-properties","src/main/resources/");
h2ConsoleServlet.setLoadOnStartup(1);
}
| Initializes H2 console |
public static <A extends CommonAllocator<A>,ValueT>ValueT fromMemBufferHolder(MemBufferHolder<A> mbh) throws IOException, ClassNotFoundException {
return toObject(mbh.get());
}
| de-serialize an object from a MemBufferHolder object. |
public void testSkipAndLimitPlan() throws Exception {
OracleCollection col=dbAdmin.createCollection("testSkipAndLimitPlan");
OracleDocument d;
for (int i=0; i < 50; i++) {
d=db.createDocumentFromString("{\"num\" : " + i + "}");
col.insert(d);
}
OracleOperationBuilderImpl obuilder=(OracleOperationBuilderImpl)col.find().skip(10).limit(10);
String plan=obuilder.explainPlan("basic");
checkPaginationPlan(plan);
}
| Make sure basic pagination plan (i.e. whole table pagination only, no where clause, and no filer spec orderby). has the following form. This should be produced by the pagination workaround (see OracleOperationBuilderImpl. paginationWorkaround() method for more info). SELECT STATEMENT NESTED LOOPS VIEW WINDOW NOSORT STOPKEY INDEX FULL SCAN TABLE ACCESS BY USER ROWID The index full scan/window no sort stopkey/view is used to get the rowids of the rows we are interested in. This become the inner (left) side of the join. The outer (right) side of the join is the table. Thus table access is only for the rows with rowids we're interested in. |
private void updatePreviewAndConflicts(){
if (myButton == -1 || myModifiers == -1) {
return;
}
myTarConflicts.setText(null);
myLblPreview.setText(KeymapUtil.getMouseShortcutText(myButton,myModifiers,getClickCount()) + " ");
final MouseShortcut mouseShortcut=new MouseShortcut(myButton,myModifiers,getClickCount());
if (myButton > 3 && getClickCount() == 2) {
myTarConflicts.setForeground(JBColor.RED);
myTarConflicts.setText(KeyMapBundle.message("mouse.shortcut.dialog.side.buttons.with.double.click",myButton));
return;
}
StringBuilder buffer=new StringBuilder();
String[] actionIds=myKeymap.getActionIds(mouseShortcut);
for ( String actionId : actionIds) {
if (actionId.equals(myActionId)) {
continue;
}
String actionPath=myMainGroup.getActionQualifiedPath(actionId);
if (actionPath == null) {
continue;
}
Shortcut[] shortcuts=myKeymap.getShortcuts(actionId);
for ( Shortcut shortcut1 : shortcuts) {
if (!(shortcut1 instanceof MouseShortcut)) {
continue;
}
MouseShortcut shortcut=(MouseShortcut)shortcut1;
if (shortcut.getButton() != mouseShortcut.getButton() || shortcut.getModifiers() != mouseShortcut.getModifiers()) {
continue;
}
if (buffer.length() > 1) {
buffer.append('\n');
}
buffer.append('[');
buffer.append(actionPath);
buffer.append(']');
break;
}
}
if (buffer.length() == 0) {
myTarConflicts.setForeground(UIUtil.getTextAreaForeground());
myTarConflicts.setText(KeyMapBundle.message("mouse.shortcut.dialog.no.conflicts.area"));
}
else {
myTarConflicts.setForeground(JBColor.RED);
myTarConflicts.setText(KeyMapBundle.message("mouse.shortcut.dialog.assigned.to.area",buffer.toString()));
}
}
| Updates all UI controls |
@Override protected void installListeners(){
super.installListeners();
splitPane.addPropertyChangeListener(this);
}
| Installs the event listeners for the UI. |
public void writeByte(byte b,boolean append){
writeByteArray(new byte[]{b},append);
}
| Write a text in a binary File |
private void put122(final int b,final int s1,final int s2){
pool.put12(b,s1).putShort(s2);
}
| Puts one byte and two shorts into the constant pool. |
@Reference(title="Algorithm AS 91: The percentage points of the $\\chi^2$ distribution",authors="D.J. Best, D. E. Roberts",booktitle="Journal of the Royal Statistical Society. Series C (Applied Statistics)") public static double quantile(double p,double k,double theta){
final double EPS2=5e-7;
final int MAXIT=1000;
if (Double.isNaN(p) || Double.isNaN(k) || Double.isNaN(theta)) {
return Double.NaN;
}
if (p <= 0) {
return 0;
}
if (p >= 1) {
return Double.POSITIVE_INFINITY;
}
if (k < 0 || theta <= 0) {
return Double.NaN;
}
if (k == 0) {
return 0.;
}
int max_newton_iterations=1;
if (k < 1e-10) {
max_newton_iterations=7;
}
final double g=logGamma(k);
double ch=chisquaredProbitApproximation(p,2 * k,g);
chisq: {
if (Double.isInfinite(ch)) {
max_newton_iterations=0;
break chisq;
}
if (ch < EPS2) {
max_newton_iterations=20;
break chisq;
}
if (p > 1 - 1e-14 || p < 1e-100) {
max_newton_iterations=20;
break chisq;
}
final double c=k - 1;
final double ch0=ch;
for (int i=1; i <= MAXIT; i++) {
final double q=ch;
final double p1=0.5 * ch;
final double p2=p - regularizedGammaP(k,p1);
if (Double.isInfinite(p2) || ch <= 0) {
ch=ch0;
max_newton_iterations=27;
break chisq;
}
{
final double t=p2 * Math.exp(k * MathUtil.LOG2 + g + p1 - c * Math.log(ch));
final double b=t / ch;
final double a=0.5 * t - b * c;
final double s1=(210. + a * (140. + a * (105. + a * (84. + a * (70. + 60. * a))))) / 420.;
final double s2=(420. + a * (735. + a * (966. + a * (1141. + 1278 * a)))) / 2520.;
final double s3=(210. + a * (462. + a * (707. + 932. * a))) / 2520.;
final double s4=(252. + a * (672. + 1182. * a) + c * (294. + a * (889. + 1740. * a))) / 5040.;
final double s5=(84. + 2264. * a + c * (1175. + 606. * a)) / 2520.;
final double s6=(120. + c * (346. + 127. * c)) / 5040.;
ch+=t * (1 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3 - b * (s4 - b * (s5 - b * s6))))));
}
if (Math.abs(q - ch) < EPS2 * ch) {
break chisq;
}
if (Math.abs(q - ch) > 0.1 * Math.abs(ch)) {
ch=((ch < q) ? 0.9 : 1.1) * q;
}
}
LoggingUtil.warning("No convergence in AS 91 Gamma probit.");
}
double x=0.5 * ch / theta;
if (max_newton_iterations > 0) {
x=gammaQuantileNewtonRefinement(Math.log(p),k,theta,max_newton_iterations,x);
}
return x;
}
| Compute probit (inverse cdf) for Gamma distributions. Based on algorithm AS 91: Reference: <p> Algorithm AS 91: The percentage points of the $\chi^2$ distribution<br /> D.J. Best, D. E. Roberts<br /> Journal of the Royal Statistical Society. Series C (Applied Statistics) </p> |
public double[] computeLocalActiveOfPreviousObservations() throws Exception {
return computeLocalActiveUsingPreviousObservations(null,true);
}
| Computes the local active info storage for the previous supplied observations. <p>Where more than one time series has been added, the array contains the local values for each tuple in the order in which they were added.</p> <p>If there was only a single time series added, the array contains k zero values before the local values. (This means the length of the return array is the same as the length of the input time series). </p> <p>Precondition: The user must have computed the local TEs first for these vectors.</p> |
boolean isTargetItemEnabled(){
if (target == null) {
return false;
}
return AWTAccessor.getMenuItemAccessor().isItemEnabled(target);
}
| Returns true if item and all its parents are enabled This function is used to fix 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false) |
public void runTest() throws Throwable {
Document doc;
Node rootNode;
boolean state;
doc=(Document)load("staff",false);
rootNode=doc.getDocumentElement();
state=rootNode.isSupported("xml","2.0");
assertTrue("throw_True",state);
}
| Runs the test case. |
public String sqlTypeToString(int sqlType){
return sqlTypes.get(sqlType);
}
| Transforms integer, representing java.sql.Types value, into to human readable string. |
private long hash(final char[] a,final int l,final int k){
final int[] w=weight[k];
long h=init[k];
int i=l;
while (i-- != 0) h^=(h << 5) + a[i] * w[i % NUMBER_OF_WEIGHTS] + (h >>> 2);
return (h & 0x7FFFFFFFFFFFFFFFL) % m;
}
| Hashes the given character array with the given hash function. |
private Span createSpan(HttpServletRequest request,boolean skip,Span spanFromRequest,String name){
if (spanFromRequest != null) {
if (log.isDebugEnabled()) {
log.debug("Span has already been created - continuing with the previous one");
}
return spanFromRequest;
}
Span parent=this.spanExtractor.joinTrace(request);
if (parent != null) {
if (log.isDebugEnabled()) {
log.debug("Found a parent span " + parent + " in the request");
}
addRequestTagsForParentSpan(request,parent);
spanFromRequest=parent;
this.tracer.continueSpan(spanFromRequest);
if (parent.isRemote()) {
parent.logEvent(Span.SERVER_RECV);
}
request.setAttribute(TRACE_REQUEST_ATTR,spanFromRequest);
if (log.isDebugEnabled()) {
log.debug("Parent span is " + parent + "");
}
}
else {
if (skip) {
spanFromRequest=this.tracer.createSpan(name,NeverSampler.INSTANCE);
}
else {
spanFromRequest=this.tracer.createSpan(name);
}
spanFromRequest.logEvent(Span.SERVER_RECV);
request.setAttribute(TRACE_REQUEST_ATTR,spanFromRequest);
if (log.isDebugEnabled()) {
log.debug("No parent span present - creating a new span");
}
}
return spanFromRequest;
}
| Creates a span and appends it as the current request's attribute |
private static void appendFloatType(StringBuilder sb){
sb.append("FLOAT");
}
| Output the SQL type for a Java float. |
Tokenizer(String data){
super(data);
}
| Creates a new tokenizer that will process the given string. |
private void delete(IgniteUuid trashId){
IgfsEntryInfo info=null;
try {
info=meta.info(trashId);
}
catch ( ClusterTopologyServerNotFoundException ignore) {
}
catch ( IgniteCheckedException e) {
U.warn(log,"Cannot obtain trash directory info (is node stopping?)");
if (log.isDebugEnabled()) U.error(log,"Cannot obtain trash directory info.",e);
}
if (info != null) {
for ( Map.Entry<String,IgfsListingEntry> entry : info.listing().entrySet()) {
IgniteUuid fileId=entry.getValue().fileId();
if (log.isDebugEnabled()) log.debug("Deleting IGFS trash entry [name=" + entry.getKey() + ", fileId="+ fileId+ ']');
try {
if (!cancelled) {
if (delete(trashId,entry.getKey(),fileId)) {
if (log.isDebugEnabled()) log.debug("Sending delete confirmation message [name=" + entry.getKey() + ", fileId="+ fileId+ ']');
}
}
else break;
}
catch ( IgniteInterruptedCheckedException ignored) {
}
catch ( IgniteCheckedException e) {
U.error(log,"Failed to delete entry from the trash directory: " + entry.getKey(),e);
}
}
}
}
| Perform cleanup of concrete trash directory. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:29.002 -0500",hash_original_method="328DA368C3B0C5FF79EC2B4ACE66A1A9",hash_generated_method="C9E59CBA897C530A6A55F5DD7BEEA99A") protected void fireRetransmissionTimer(){
try {
if (this.getState() == null || !this.isMapped) return;
boolean inv=isInviteTransaction();
TransactionState s=this.getState();
if ((inv && TransactionState.CALLING == s) || (!inv && (TransactionState.TRYING == s || TransactionState.PROCEEDING == s))) {
if (lastRequest != null) {
if (sipStack.generateTimeStampHeader && lastRequest.getHeader(TimeStampHeader.NAME) != null) {
long milisec=System.currentTimeMillis();
TimeStamp timeStamp=new TimeStamp();
try {
timeStamp.setTimeStamp(milisec);
}
catch ( InvalidArgumentException ex) {
InternalErrorHandler.handleException(ex);
}
lastRequest.setHeader(timeStamp);
}
super.sendMessage(lastRequest);
if (this.notifyOnRetransmit) {
TimeoutEvent txTimeout=new TimeoutEvent(this.getSipProvider(),this,Timeout.RETRANSMIT);
this.getSipProvider().handleEvent(txTimeout,this);
}
if (this.timeoutIfStillInCallingState && this.getState() == TransactionState.CALLING) {
this.callingStateTimeoutCount--;
if (callingStateTimeoutCount == 0) {
TimeoutEvent timeoutEvent=new TimeoutEvent(this.getSipProvider(),this,Timeout.RETRANSMIT);
this.getSipProvider().handleEvent(timeoutEvent,this);
this.timeoutIfStillInCallingState=false;
}
}
}
}
}
catch ( IOException e) {
this.raiseIOExceptionEvent();
raiseErrorEvent(SIPTransactionErrorEvent.TRANSPORT_ERROR);
}
}
| Called by the transaction stack when a retransmission timer fires. |
public static PatternNotExpr not(PatternExpr subexpression){
return new PatternNotExpr(subexpression);
}
| Not-keyword pattern expression flips the truth-value of the pattern sub-expression. |
private void handleMethodExitNode(CCFGNode node,CCFGMethodEntryNode investigatedMethod,Set<Map<String,VariableDefinition>> activeDefs,Set<BytecodeInstruction> freeUses){
CCFGMethodExitNode exitNode=(CCFGMethodExitNode)node;
if (exitNode.isExitOfMethodEntry(investigatedMethod)) {
rememberActiveDefs(exitNode.getMethod(),activeDefs);
rememberFreeUses(exitNode.getMethod(),freeUses);
}
}
| If this is the methodExit of our investigated public method we remember our current activeDefs for intra-class pairs |
protected Node export(Node n,AbstractDocument d){
GenericProcessingInstruction p;
p=(GenericProcessingInstruction)super.export(n,d);
p.setTarget(getTarget());
return p;
}
| Exports this node to the given document. |
public static TransitSchedule mergeEqualRouteProfiles(TransitSchedule schedule,String outputDirectory){
return new TransitScheduleSimplifier().mergeEqualTransitRoutes(schedule,outputDirectory);
}
| Simplifies a transit schedule by merging transit routes within a transit line with equal route profiles. The simplified schedule is also written into a new file. |
protected void sendIntensity(double intensity){
if (log.isDebugEnabled()) {
log.debug("sendIntensity(" + intensity + ")"+ " lastOutputStep: "+ lastOutputStep+ " maxDimStep: "+ maxDimStep);
}
int newStep=(int)Math.round(intensity * maxDimStep);
if ((newStep < 0) || (newStep > maxDimStep)) {
log.error("newStep wrong: " + newStep + " intensity: "+ intensity);
}
if (newStep == lastOutputStep) {
if (log.isDebugEnabled()) {
log.debug("intensity " + intensity + " within current step, return");
}
return;
}
if (log.isDebugEnabled()) {
log.debug("function set Intensity " + intensity);
}
InsteonSequence out=new InsteonSequence();
out.addFunction(idhighbyte,idmiddlebyte,idlowbyte,Constants.FUNCTION_REQ_STD,(Constants.FLAG_STD | (maxHops << Constants.FLAG_SHIFT_HOPSLEFT) | maxHops),Constants.CMD_LIGHT_CHG,newStep);
tc.sendInsteonSequence(out,null);
if (log.isDebugEnabled()) {
log.debug("sendIntensity(" + intensity + ") addr "+ idhighbyte+ idmiddlebyte+ idlowbyte+ " newStep "+ newStep);
}
lastOutputStep=newStep;
}
| Send a Dim/Bright command to the Insteon hardware to reach a specific intensity. Acts immediately, and changes no general state. <p> This sends "Dim" commands. |
public static void organizeDistribution(final Object[] objs,final RandomChoiceChooserD chooser){
organizeDistribution(objs,chooser,false);
}
| Same as organizeDistribution(objs, chooser, <b>false</b>); |
@Override public void afterLoad(TermsEnum termsEnum,long actualUsed){
assert termsEnum instanceof RamAccountingTermsEnum;
long estimatedBytes=((RamAccountingTermsEnum)termsEnum).getTotalBytes();
breaker.addWithoutBreaking(-(estimatedBytes - actualUsed));
}
| Adjusts the breaker based on the difference between the actual usage and the aggregated estimations. |
@Override public String toString(){
return this.area + "/" + this.aisle+ "/"+ this.x+ "/"+ this.y+ "/"+ this.z;
}
| Return a String like AREA/AISLE/X/Y/Z. |
public void addToStackIgnoreList(String line){
addToList(stackIgnoreList,line);
}
| Adds the specified line to the list of classes that we should filter out of reporting results if the deserialization event occurred with the specified class in the current call stack. For example, to help ignore if serialization is happening through memcache. |
String isResizingRequired(PropertyHandler paramHandler) throws Exception {
String countCPU=paramHandler.getCountCPU();
try {
Integer.valueOf(countCPU);
}
catch ( NumberFormatException e) {
return null;
}
String masterTemplateId=paramHandler.getMasterTemplateId();
String slaveTemplateId=paramHandler.getSlaveTemplateId();
VSystemConfiguration configuration=getVSystemConfiguration(paramHandler);
for ( VServerConfiguration server : configuration.getVServers()) {
String existingCPU=server.getNumOfCPU();
String diskImageId=server.getDiskImageId();
if (existingCPU != null && !existingCPU.equals(countCPU)) {
if (diskImageId != null && (diskImageId.equals(masterTemplateId) || diskImageId.equals(slaveTemplateId))) {
logger.debug("Server " + server.getServerId() + " to be resized to CPU# "+ countCPU);
SubPropertyHandler subPropertyHandler=paramHandler.getTemporaryVserver(server);
subPropertyHandler.setCountCPU(countCPU);
subPropertyHandler.setState(FlowState.VSERVER_MODIFICATION_REQUESTED);
subPropertyHandler.setOperation(Operation.VSERVER_MODIFICATION);
paramHandler.setState(FlowState.VSYSTEM_RESIZE_VSERVERS);
return server.getServerId();
}
}
}
return null;
}
| Compare current and required sizing information of affected VMs. Returns the server ID of the first server that is to be changed or <code>null</code> if no server is to be changed. |
@Override protected void onFinishInflate(){
final int childCount=getChildCount();
if (childCount > 2) {
throw new IllegalStateException("PtrFrameLayout only can host 2 elements");
}
else if (childCount == 2) {
if (mHeaderId != 0 && mHeaderView == null) {
mHeaderView=findViewById(mHeaderId);
}
if (mContainerId != 0 && mContent == null) {
mContent=findViewById(mContainerId);
}
if (mContent == null || mHeaderView == null) {
View child1=getChildAt(0);
View child2=getChildAt(1);
if (child1 instanceof PtrUIHandler) {
mHeaderView=child1;
mContent=child2;
}
else if (child2 instanceof PtrUIHandler) {
mHeaderView=child2;
mContent=child1;
}
else {
if (mContent == null && mHeaderView == null) {
mHeaderView=child1;
mContent=child2;
}
else {
if (mHeaderView == null) {
mHeaderView=mContent == child1 ? child2 : child1;
}
else {
mContent=mHeaderView == child1 ? child2 : child1;
}
}
}
}
}
else if (childCount == 1) {
mContent=getChildAt(0);
}
else {
TextView errorView=new TextView(getContext());
errorView.setClickable(true);
errorView.setTextColor(0xffff6600);
errorView.setGravity(Gravity.CENTER);
errorView.setTextSize(20);
errorView.setText("The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?");
mContent=errorView;
addView(mContent);
}
if (mHeaderView != null) {
mHeaderView.bringToFront();
}
super.onFinishInflate();
}
| Find it's child layout as header and content. Exception would throw if there are more than two child layouts. If there are two child layouts, it would find out header and content by resource id or class type. If there only one child layouts, it would be regard as content. If there is no child layout, a error hint would show. |
public void undoUpdate() throws SQLException {
throw new UnsupportedOperationException();
}
| Immediately reverses the last update operation if the row has been modified. This method can be called to reverse updates on a all columns until all updates in a row have been rolled back to their originating state since the last synchronization (<code>acceptChanges</code>) or population. This method may also be called while performing updates to the insert row. <P> <code>undoUpdate</code may be called at any time during the life-time of a rowset, however after a synchronization has occurs this method has no affect until further modification to the RowSet data occurs. |
public double calculateLogLikelihood(){
double logLikelihood;
if (!cacheBranches) logLikelihood=traitLogLikelihood(null,treeModel.getRoot());
else logLikelihood=traitCachedLogLikelihood(null,treeModel.getRoot());
if (logLikelihood > maxLogLikelihood) {
maxLogLikelihood=logLikelihood;
}
return logLikelihood;
}
| Calculate the log likelihood of the current state. |
public void dumpUrl(Path webGraphDb,String url) throws IOException {
fs=FileSystem.get(getConf());
nodeReaders=MapFileOutputFormat.getReaders(fs,new Path(webGraphDb,WebGraph.NODE_DIR),getConf());
Text key=new Text(url);
Node node=new Node();
MapFileOutputFormat.getEntry(nodeReaders,new HashPartitioner<Text,Node>(),key,node);
System.out.println(url + ":");
System.out.println(" inlink score: " + node.getInlinkScore());
System.out.println(" outlink score: " + node.getOutlinkScore());
System.out.println(" num inlinks: " + node.getNumInlinks());
System.out.println(" num outlinks: " + node.getNumOutlinks());
FSUtils.closeReaders(nodeReaders);
}
| Prints the content of the Node represented by the url to system out. |
public Enumeration<Option> listOptions(){
Vector<Option> result=new Vector<Option>();
result.addElement(new Option("\tThe complexity constant C.\n" + "\t(default 1)","C",1,"-C <double>"));
result.addElement(new Option("\tWhether to 0=normalize/1=standardize/2=neither.\n" + "\t(default 0=normalize)","N",1,"-N"));
result.addElement(new Option("\tOptimizer class used for solving quadratic optimization problem\n" + "\t(default " + RegSMOImproved.class.getName() + ")","I",1,"-I <classname and parameters>"));
result.addElement(new Option("\tThe Kernel to use.\n" + "\t(default: weka.classifiers.functions.supportVector.PolyKernel)","K",1,"-K <classname and parameters>"));
result.addAll(Collections.list(super.listOptions()));
result.addElement(new Option("","",0,"\nOptions specific to optimizer ('-I') " + getRegOptimizer().getClass().getName() + ":"));
result.addAll(Collections.list(((OptionHandler)getRegOptimizer()).listOptions()));
result.addElement(new Option("","",0,"\nOptions specific to kernel ('-K') " + getKernel().getClass().getName() + ":"));
result.addAll(Collections.list(((OptionHandler)getKernel()).listOptions()));
return result.elements();
}
| Returns an enumeration describing the available options. |
protected void addOneCandidateCluster(LinkedList<Set<V>> candidates,Map<V,double[]> voltage_ranks){
try {
List<Map<V,double[]>> clusters;
clusters=new ArrayList<Map<V,double[]>>(kmc.cluster(voltage_ranks,2));
if (clusters.get(0).size() < clusters.get(1).size()) candidates.add(clusters.get(0).keySet());
else candidates.add(clusters.get(1).keySet());
}
catch ( NotEnoughClustersException e) {
}
}
| alternative to addTwoCandidateClusters(): cluster vertices by voltages into 2 clusters. We only consider the smaller of the two clusters returned by k-means to be a 'true' cluster candidate; the other is a garbage cluster. |
public ObjectFactory(){
}
| Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.rsa.names._2009._12.std_ext.ws_trust1_4.advice |
public static Boolean checkIsReadOnly(){
String state=Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
return true;
}
else {
return false;
}
}
| Checks the SD card is readonly. |
public boolean removeNeighbours(List<Triangle> triangles){
return getNeighbours().removeAll(triangles);
}
| Remove neighbour triangles of the triangle. |
public DefaultPrivateData(String elementName,String namespace){
this.elementName=elementName;
this.namespace=namespace;
}
| Creates a new generic private data object. |
public JsonArray add(JsonValue value){
if (value == null) {
throw new NullPointerException("value is null");
}
values.add(value);
return this;
}
| Appends the specified JSON value to the end of this array. |
@Override public void visitJumpInsn(final int opcode,final Label lbl){
super.visitJumpInsn(opcode,lbl);
LabelNode ln=((JumpInsnNode)instructions.getLast()).label;
if (opcode == JSR && !subroutineHeads.containsKey(ln)) {
subroutineHeads.put(ln,new BitSet());
}
}
| Detects a JSR instruction and sets a flag to indicate we will need to do inlining. |
public Coordinate transform(Coordinate src,Coordinate dest){
double xp=m00 * src.x + m01 * src.y + m02;
double yp=m10 * src.x + m11 * src.y + m12;
dest.x=xp;
dest.y=yp;
return dest;
}
| Applies this transformation to the <tt>src</tt> coordinate and places the results in the <tt>dest</tt> coordinate (which may be the same as the source). |
public ByteFifoBuffer(int len){
array=new byte[len];
}
| Creates buffer of specified size |
public void not(){
mv.visitInsn(Opcodes.ICONST_1);
mv.visitInsn(Opcodes.IXOR);
}
| Generates the instructions to compute the bitwise negation of the top stack value. |
private void zzDoEOF(){
if (!zzEOFDone) {
zzEOFDone=true;
}
}
| Contains user EOF-code, which will be executed exactly once, when the end of file is reached |
public FunctionBlockPropertySource createFunctionBlockPropertySource(){
FunctionBlockPropertySourceImpl functionBlockPropertySource=new FunctionBlockPropertySourceImpl();
return functionBlockPropertySource;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public BezierScaleHandle(BezierFigure owner){
super(owner);
}
| Creates a new instance. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:30.761 -0500",hash_original_method="224D5C409E7F86CE5414891CFB70A981",hash_generated_method="178E85B2327E05C49F9EEB00F2AE391D") private int regCodeToServiceState(int code){
switch (code) {
case 0:
case 2:
case 3:
case 4:
case 10:
case 12:
case 13:
case 14:
return ServiceState.STATE_OUT_OF_SERVICE;
case 1:
return ServiceState.STATE_IN_SERVICE;
case 5:
return ServiceState.STATE_IN_SERVICE;
default :
loge("regCodeToServiceState: unexpected service state " + code);
return ServiceState.STATE_OUT_OF_SERVICE;
}
}
| code is registration state 0-5 from TS 27.007 7.2 |
public GuildCreateHandler(ImplDiscordAPI api){
super(api,true,"GUILD_CREATE");
}
| Creates a new instance of this class. |
public String seedTipText(){
return "The seed to use for randomization.";
}
| Describes this property. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.