_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q174500
ErrorResponse.buildException
test
public DapException buildException() { String XML = buildXML(); DapException dapex = new DapException(XML).setCode(code); return dapex; }
java
{ "resource": "" }
q174501
AWIPSConvention.breakupLevels
test
private List<Dimension> breakupLevels(NetcdfDataset ds, Variable levelVar) throws IOException { if (debugBreakup) parseInfo.format("breakupLevels = %s%n", levelVar.getShortName()); List<Dimension> dimList = new ArrayList<>(); ArrayChar levelVarData; try { levelVarData = (ArrayChar) levelVar...
java
{ "resource": "" }
q174502
AWIPSConvention.makeZCoordAxis
test
private Dimension makeZCoordAxis(NetcdfDataset ds, List<String> values, String units) throws IOException { int len = values.size(); String name = makeZCoordName(units); if (len > 1) name = name + Integer.toString(len); else name = name + values.get(0); StringUtil2.replace(name, ' ...
java
{ "resource": "" }
q174503
AWIPSConvention.createNewVariables
test
private void createNewVariables(NetcdfDataset ds, Variable ncVar, List<Dimension> newDims, Dimension levelDim) throws InvalidRangeException { List<Dimension> dims = ncVar.getDimensions(); int newDimIndex = dims.indexOf(levelDim); //String shapeS = ncVar.getShapeS(); ...
java
{ "resource": "" }
q174504
AWIPSConvention.makeTimeCoordAxisFromReference
test
private CoordinateAxis makeTimeCoordAxisFromReference(NetcdfDataset ds, Variable timeVar, Array vals) { Variable refVar = ds.findVariable("reftime"); if (refVar == null) return null; double refValue; try { Array refArray = refVar.read(); refValue = refArray.getDouble(refArray.getIndex(...
java
{ "resource": "" }
q174505
GribToNetcdfWriter.bitShave
test
public static float bitShave(float value, int bitMask) { if (Float.isNaN(value)) return value; // ?? int bits = Float.floatToRawIntBits(value); int shave = bits & bitMask; return Float.intBitsToFloat(shave); }
java
{ "resource": "" }
q174506
GribToNetcdfWriter.main
test
public static void main(String[] args) { String fileIn = (args.length > 0) ? args[0] : "Q:/cdmUnitTest/formats/grib2/LMPEF_CLM_050518_1200.grb"; String fileOut = (args.length > 1) ? args[1] : "C:/tmp/ds.mint.bi"; try (GribToNetcdfWriter writer = new GribToNetcdfWriter(fileIn, fileOut)) { writer.write...
java
{ "resource": "" }
q174507
NetcdfDataset.wrap
test
static public NetcdfDataset wrap(NetcdfFile ncfile, Set<Enhance> mode) throws IOException { if (ncfile instanceof NetcdfDataset) { NetcdfDataset ncd = (NetcdfDataset) ncfile; if (!ncd.enhanceNeeded(mode)) return (NetcdfDataset) ncfile; } // enhancement requires wrappping, to not modify ...
java
{ "resource": "" }
q174508
NetcdfDataset.openFile
test
public static NetcdfFile openFile(String location, ucar.nc2.util.CancelTask cancelTask) throws IOException { DatasetUrl durl = DatasetUrl.findDatasetUrl(location); return openOrAcquireFile(null, null, null, durl, -1, cancelTask, null); }
java
{ "resource": "" }
q174509
NetcdfDataset.clearCoordinateSystems
test
public void clearCoordinateSystems() { coordSys = new ArrayList<>(); coordAxes = new ArrayList<>(); coordTransforms = new ArrayList<>(); for (Variable v : getVariables()) { VariableEnhanced ve = (VariableEnhanced) v; ve.clearCoordinateSystems(); // ?? } enhanceMode.remove(Enhance.C...
java
{ "resource": "" }
q174510
NetcdfDataset.findCoordinateAxis
test
public CoordinateAxis findCoordinateAxis(AxisType type) { if (type == null) return null; for (CoordinateAxis v : coordAxes) { if (type == v.getAxisType()) return v; } return null; }
java
{ "resource": "" }
q174511
NetcdfDataset.findCoordinateAxis
test
public CoordinateAxis findCoordinateAxis(String fullName) { if (fullName == null) return null; for (CoordinateAxis v : coordAxes) { if (fullName.equals(v.getFullName())) return v; } return null; }
java
{ "resource": "" }
q174512
NetcdfDataset.findCoordinateSystem
test
public CoordinateSystem findCoordinateSystem(String name) { if (name == null) return null; for (CoordinateSystem v : coordSys) { if (name.equals(v.getName())) return v; } return null; }
java
{ "resource": "" }
q174513
NetcdfDataset.findCoordinateTransform
test
public CoordinateTransform findCoordinateTransform(String name) { if (name == null) return null; for (CoordinateTransform v : coordTransforms) { if (name.equals(v.getName())) return v; } return null; }
java
{ "resource": "" }
q174514
NetcdfDataset.enhanceNeeded
test
public boolean enhanceNeeded(Set<Enhance> want) throws IOException { if (want == null) return false; for (Enhance mode : want) { if (!this.enhanceMode.contains(mode)) return true; } return false; }
java
{ "resource": "" }
q174515
NetcdfDataset.setValues
test
public void setValues(Variable v, int npts, double start, double incr) { if (npts != v.getSize()) throw new IllegalArgumentException("bad npts = " + npts + " should be " + v.getSize()); Array data = Array.makeArray(v.getDataType(), npts, start, incr); if (v.getRank() != 1) data = data.reshape(v....
java
{ "resource": "" }
q174516
NetcdfDataset.setValues
test
public void setValues(Variable v, List<String> values) throws IllegalArgumentException { Array data = Array.makeArray(v.getDataType(), values); if (data.getSize() != v.getSize()) throw new IllegalArgumentException("Incorrect number of values specified for the Variable " + v.getFullName() + ...
java
{ "resource": "" }
q174517
NetcdfDataset.makeArray
test
static public Array makeArray(DataType dtype, List<String> stringValues) throws NumberFormatException { return Array.makeArray(dtype, stringValues); }
java
{ "resource": "" }
q174518
Index.index
test
public long index() { long offset = 0; for(int i = 0; i < this.indices.length; i++) { offset *= this.dimsizes[i]; offset += this.indices[i]; } return offset; }
java
{ "resource": "" }
q174519
MFileOS7.getExistingFile
test
static public MFileOS7 getExistingFile(String filename) throws IOException { if (filename == null) return null; Path path = Paths.get(filename); if (Files.exists(path)) return new MFileOS7(path); return null; }
java
{ "resource": "" }
q174520
EsriShapefile.getFeatures
test
public List<EsriFeature> getFeatures(Rectangle2D bBox) { if (bBox == null) return features; List<EsriFeature> list = new ArrayList<>(); for (EsriFeature gf : features) { if (gf.getBounds2D().intersects(bBox)) list.add(gf); } return list; }
java
{ "resource": "" }
q174521
EsriShapefile.discretize
test
private void discretize(double[] d, int n) { if (coarseness == 0.0) return; for (int i = 0; i < n; i++) { d[i] = (Math.rint(resolution * d[i]) / resolution); } }
java
{ "resource": "" }
q174522
ThreddsMetadata.add
test
public void add(ThreddsMetadata tmd, boolean includeInherited) { creators.addAll(tmd.getCreators()); contributors.addAll(tmd.getContributors()); dates.addAll(tmd.getDates()); docs.addAll(tmd.getDocumentation()); keywords.addAll(tmd.getKeywords()); projects.addAll(tmd.getProjects()); properti...
java
{ "resource": "" }
q174523
ThreddsMetadata.addDocumentation
test
public void addDocumentation(String type, String content) { if (content == null) { removeDocumentation(type); return; } content = content.trim(); for (InvDocumentation doc : getDocumentation()) { String dtype = doc.getType(); if ((dtype != null) && dtype.equalsIgnoreCase(type)) ...
java
{ "resource": "" }
q174524
ThreddsMetadata.removeDocumentation
test
public void removeDocumentation(String type) { Iterator iter = docs.iterator(); while (iter.hasNext()) { InvDocumentation doc = (InvDocumentation) iter.next(); String dtype = doc.getType(); if ((dtype != null) && dtype.equalsIgnoreCase(type)) iter.remove(); } }
java
{ "resource": "" }
q174525
LayoutSegmented.getMaxBytes
test
private int getMaxBytes(long start) { int segno = 0; while (start >= segMax[segno]) segno++; return (int) (segMax[segno] - start); }
java
{ "resource": "" }
q174526
NsslRadarMosaicConvention.isMine
test
public static boolean isMine(NetcdfFile ncfile) { String cs = ncfile.findAttValueIgnoreCase(null, CDM.CONVENTIONS, null); if (cs != null) return false; String s = ncfile.findAttValueIgnoreCase(null, "DataType", null); if ((s == null) || !(s.equalsIgnoreCase("LatLonGrid") || s.equalsIgnoreCase("Lat...
java
{ "resource": "" }
q174527
CollectionManagerCatalog.getDataset
test
@Override public void getDataset(Dataset ds, Object context) { if (ds.hasAccess()) { DataFactory tdataFactory = new DataFactory(); Access access = tdataFactory.chooseDatasetAccess(ds.getAccess()); if (access == null) throw new IllegalStateException(); MFileRemote mfile = new MFileRemote(ac...
java
{ "resource": "" }
q174528
CoordSysBuilder.breakupConventionNames
test
static public List<String> breakupConventionNames(String convAttValue) { List<String> names = new ArrayList<>(); if ((convAttValue.indexOf(',') > 0) || (convAttValue.indexOf(';') > 0)) { StringTokenizer stoke = new StringTokenizer(convAttValue, ",;"); while (stoke.hasMoreTokens()) { S...
java
{ "resource": "" }
q174529
CoordSysBuilder.buildConventionAttribute
test
static public String buildConventionAttribute(String mainConv, String... convAtts) { List<String> result = new ArrayList<>(); result.add(mainConv); for (String convs : convAtts) { if (convs == null) continue; List<String> ss = breakupConventionNames(convs); // may be a list for (Stri...
java
{ "resource": "" }
q174530
CoordSysBuilder.buildCoordinateSystems
test
@Override public void buildCoordinateSystems(NetcdfDataset ncDataset) { // put status info into parseInfo that can be shown to someone trying to debug this process parseInfo.format("Parsing with Convention = %s%n", conventionName); // Bookkeeping info for each variable is kept in the VarProcess inne...
java
{ "resource": "" }
q174531
CoordSysBuilder.findCoordinateAxes
test
protected void findCoordinateAxes(NetcdfDataset ncDataset) { for (VarProcess vp : varList) { if (vp.coordAxes != null) findCoordinateAxes(vp, vp.coordAxes); if (vp.coordinates != null) findCoordinateAxes(vp, vp.coordinates); } }
java
{ "resource": "" }
q174532
CoordSysBuilder.findCoordinateSystems
test
protected void findCoordinateSystems(NetcdfDataset ncDataset) { for (VarProcess vp : varList) { if (vp.coordSys != null) { StringTokenizer stoker = new StringTokenizer(vp.coordSys); while (stoker.hasMoreTokens()) { String vname = stoker.nextToken(); VarProcess ap = fi...
java
{ "resource": "" }
q174533
CoordSysBuilder.makeCoordinateSystems
test
protected void makeCoordinateSystems(NetcdfDataset ncDataset) { for (VarProcess vp : varList) { if (vp.isCoordinateSystem) { vp.makeCoordinateSystem(); } } }
java
{ "resource": "" }
q174534
CoordSysBuilder.makeCoordinateSystemsMaximal
test
protected void makeCoordinateSystemsMaximal(NetcdfDataset ncDataset) { boolean requireCompleteCoordSys = !ncDataset.getEnhanceMode().contains(NetcdfDataset.Enhance.IncompleteCoordSystems); for (VarProcess vp : varList) { VariableEnhanced ve = (VariableEnhanced) vp.v; if (vp.hasCoordinateSy...
java
{ "resource": "" }
q174535
CoordSysBuilder.isCoordinateAxisForVariable
test
protected boolean isCoordinateAxisForVariable(Variable axis, VariableEnhanced v) { List<Dimension> varDims = v.getDimensionsAll(); List<Dimension> axisDims = axis.getDimensionsAll(); // a CHAR variable must really be a STRING, so leave out the last (string length) dimension int checkDims = axisDim...
java
{ "resource": "" }
q174536
CoordSysBuilder.addCoordinateVariable
test
protected void addCoordinateVariable(Dimension dim, VarProcess vp) { List<VarProcess> list = coordVarMap.get(dim); if (list == null) { list = new ArrayList<>(); coordVarMap.put(dim, list); } if (!list.contains(vp)) list.add(vp); }
java
{ "resource": "" }
q174537
InvCatalogImpl.subset
test
public void subset(InvDataset ds) { InvDatasetImpl dataset = (InvDatasetImpl) ds; // Make all inherited metadata local. dataset.transferMetadata(dataset, true); topDataset = dataset; datasets.clear(); // throw away the rest datasets.add(topDataset); // parent lookups need to be local ...
java
{ "resource": "" }
q174538
InvCatalogImpl.filter
test
public void filter(DatasetFilter filter) { mark(filter, topDataset); delete(topDataset); this.filter = filter; }
java
{ "resource": "" }
q174539
InvCatalogImpl.mark
test
private boolean mark(DatasetFilter filter, InvDatasetImpl ds) { if (ds instanceof InvCatalogRef) { InvCatalogRef catRef = (InvCatalogRef) ds; if (!catRef.isRead()) return false; } // recurse into nested datasets first boolean allMarked = true; for (InvDataset nested : ds.getDatasets()) ...
java
{ "resource": "" }
q174540
InvCatalogImpl.delete
test
private void delete(InvDatasetImpl ds) { if (ds instanceof InvCatalogRef) { InvCatalogRef catRef = (InvCatalogRef) ds; if (!catRef.isRead()) return; } Iterator iter = ds.getDatasets().iterator(); while (iter.hasNext()) { InvDatasetImpl nested = (InvDatasetImpl) iter.next(); if (...
java
{ "resource": "" }
q174541
LoadCommon.initOnce
test
public void initOnce(HttpServletRequest req) throws SendError { if(once) return; once = true; log.info(getClass().getName() + " GET initialization"); if(this.tdsContext == null) throw new SendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Can...
java
{ "resource": "" }
q174542
Counters.count
test
public boolean count(String name, Comparable value) { Counter counter = map.get(name); if (counter == null) { counter = add(name); } return counter.count(value); }
java
{ "resource": "" }
q174543
StandardPrefixDB.add
test
private void add(final String name, final String symbol, final double definition) throws PrefixExistsException { addName(name, definition); addSymbol(symbol, definition); }
java
{ "resource": "" }
q174544
TableRowAbstract.compare
test
public int compare( TableRow other, int col) { String s1 = getValueAt(col).toString(); String s2 = other.getValueAt(col).toString(); int ret = s1.compareToIgnoreCase( s2); // break ties if (ret == 0) return compareTie( other, col); return ret; }
java
{ "resource": "" }
q174545
TableRowAbstract.compareBoolean
test
protected int compareBoolean(TableRow other, int col, boolean b1, boolean b2) { // break ties if (b1 == b2) return compareTie( other, col); return b1 ? 1 : -1; }
java
{ "resource": "" }
q174546
Dap4ParserImpl.getGroupScope
test
DapGroup getGroupScope() throws DapException { DapGroup gscope = (DapGroup) searchScope(DapSort.GROUP, DapSort.DATASET); if(gscope == null) throw new DapException("Undefined Group Scope"); return gscope; }
java
{ "resource": "" }
q174547
Dap4ParserImpl.passReserved
test
void passReserved(XMLAttributeMap map, DapNode node) throws ParseException { try { DapAttribute attr = null; for(Map.Entry<String, SaxEvent> entry : map.entrySet()) { SaxEvent event = entry.getValue(); String key = entry.getKey(); String value = event.value...
java
{ "resource": "" }
q174548
TimeParamsValidator.hasValidDateRange
test
private boolean hasValidDateRange(String time_start, String time_end, String time_duration) { // no range if ((null == time_start) && (null == time_end) && (null == time_duration)) return false; if ((null != time_start) && (null != time_end)) return true; if ((null != time_start) && (null ...
java
{ "resource": "" }
q174549
SliceIterator.hasNext
test
@Override public boolean hasNext() { switch (state) { case INITIAL: return (slice.getFirst() < slice.getStop()); case STARTED: return (this.index < slice.getLast()); case DONE: } return false; }
java
{ "resource": "" }
q174550
DSPRegistry.register
test
synchronized public void register(String className, boolean last) throws DapException { try { Class<? extends DSP> klass = (Class<? extends DSP>) loader.loadClass(className); register(klass, last); } catch (ClassNotFoundException e) { throw new DapExce...
java
{ "resource": "" }
q174551
DSPRegistry.register
test
synchronized public void register(Class<? extends DSP> klass, boolean last) { // is this already defined? if(registered(klass)) return; if(last) registry.add(new Registration(klass)); else registry.add(0, new Registration(klass)); }
java
{ "resource": "" }
q174552
DSPRegistry.registered
test
synchronized public boolean registered(Class<? extends DSP> klass) { for(Registration r : registry) { if(r.dspclass == klass) return true; } return false; }
java
{ "resource": "" }
q174553
DSPRegistry.unregister
test
synchronized public void unregister(Class<? extends DSP> klass) { for(int i = 0; i < registry.size(); i++) { if(registry.get(i).dspclass == klass) { registry.remove(i); break; } } }
java
{ "resource": "" }
q174554
Grib2Tables.factory
test
public static Grib2Tables factory(int center, int subCenter, int masterVersion, int localVersion, int genProcessId) { Grib2TablesId id = new Grib2TablesId(center, subCenter, masterVersion, localVersion, genProcessId); Grib2Tables cust = tables.get(id); if (cust != null) return cust; // note that w...
java
{ "resource": "" }
q174555
Grib2Tables.getForecastTimeIntervalSizeInHours
test
public double getForecastTimeIntervalSizeInHours(Grib2Pds pds) { Grib2Pds.PdsInterval pdsIntv = (Grib2Pds.PdsInterval) pds; int timeUnitOrg = pds.getTimeUnit(); // calculate total "range" in units of timeUnit int range = 0; for (Grib2Pds.TimeInterval ti : pdsIntv.getTimeIntervals()) { ...
java
{ "resource": "" }
q174556
Grib2Tables.getForecastTimeIntervalOffset
test
@Nullable public int[] getForecastTimeIntervalOffset(Grib2Record gr) { TimeCoordIntvDateValue tinvd = getForecastTimeInterval(gr); if (tinvd == null) return null; Grib2Pds pds = gr.getPDS(); int unit = convertTimeUnit(pds.getTimeUnit()); TimeCoordIntvValue tinv = tinvd.convertReferenceDate...
java
{ "resource": "" }
q174557
Grib2Tables.getVertUnit
test
@Override public VertCoordType getVertUnit(int code) { // VertCoordType(int code, String desc, String abbrev, String units, String datum, boolean isPositiveUp, boolean isLayer) switch (code) { case 11: case 12: return new VertCoordType(code, "m", null, true); case 20: ...
java
{ "resource": "" }
q174558
DapDataset.finish
test
public void finish() { if(this.finished) return; if(this.ce == null) this.visiblenodes = nodelist; else { this.visiblenodes = new ArrayList<DapNode>(nodelist.size()); for(int i = 0; i < nodelist.size(); i++) { DapNode node = nod...
java
{ "resource": "" }
q174559
DapDataset.sort
test
public void sort() { List<DapNode> sorted = new ArrayList<DapNode>(); sortR(this, sorted); // Assign indices for(int i = 0; i < sorted.size(); i++) { sorted.get(i).setIndex(i); } this.nodelist = sorted; }
java
{ "resource": "" }
q174560
PartitionCollectionImmutable.getRaf
test
RandomAccessFile getRaf(int partno, int fileno) throws IOException { Partition part = getPartition(partno); try (GribCollectionImmutable gc = part.getGribCollection()) { return gc.getDataRaf(fileno); } }
java
{ "resource": "" }
q174561
Evaluator.findVariableWithAttribute
test
static public VarAtt findVariableWithAttribute(NetcdfDataset ds, String attName) { for (Variable v : ds.getVariables()) { Attribute att = v.findAttributeIgnoreCase(attName); if (att != null) return new VarAtt(v, att); } // descend into structures for (Variable v : ds.getVariables()) ...
java
{ "resource": "" }
q174562
Evaluator.findVariableWithAttributeValue
test
static public Variable findVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { for (Variable v : ds.getVariables()) { String haveValue = ds.findAttValueIgnoreCase(v, attName, null); if ((haveValue != null) && haveValue.equals(attValue)) return v; } // ...
java
{ "resource": "" }
q174563
Evaluator.findNameOfVariableWithAttributeValue
test
static public String findNameOfVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { Variable v = findVariableWithAttributeValue(ds, attName, attValue); return (v == null) ? null : v.getShortName(); }
java
{ "resource": "" }
q174564
Evaluator.findVariableWithAttributeValue
test
static public Variable findVariableWithAttributeValue(Structure struct, String attName, String attValue) { for (Variable v : struct.getVariables()) { Attribute att = v.findAttributeIgnoreCase(attName); if ((att != null) && att.getStringValue().equals(attValue)) return v; } return n...
java
{ "resource": "" }
q174565
Evaluator.findNestedStructure
test
static public Structure findNestedStructure(Structure s) { for (Variable v : s.getVariables()) { if ((v instanceof Structure)) return (Structure) v; } return null; }
java
{ "resource": "" }
q174566
Evaluator.hasNetcdf3RecordStructure
test
static public boolean hasNetcdf3RecordStructure(NetcdfDataset ds) { Variable v = ds.findVariable("record"); return (v != null) && (v.getDataType() == DataType.STRUCTURE); }
java
{ "resource": "" }
q174567
Evaluator.getLiteral
test
static public String getLiteral(NetcdfDataset ds, String key, Formatter errlog) { if (key.startsWith(":")) { String val = ds.findAttValueIgnoreCase(null, key.substring(1), null); if ((val == null) && (errlog != null)) errlog.format(" Cant find global attribute %s%n", key); return val;...
java
{ "resource": "" }
q174568
Evaluator.getFeatureType
test
static public FeatureType getFeatureType(NetcdfDataset ds, String key, Formatter errlog) { FeatureType ft = null; String fts = getLiteral(ds, key, errlog); if (fts != null) { ft = FeatureType.valueOf(fts.toUpperCase()); if ((ft == null) && (errlog != null)) errlog.format(" Cant fin...
java
{ "resource": "" }
q174569
Evaluator.getVariableName
test
static public String getVariableName(NetcdfDataset ds, String key, Formatter errlog) { Variable v = null; String vs = getLiteral(ds, key, errlog); if (vs != null) { v = ds.findVariable(vs); if ((v == null) && (errlog != null)) errlog.format(" Cant find Variable %s from %s%n", vs, k...
java
{ "resource": "" }
q174570
CoordinateAxis2D.getCoordValue
test
public double getCoordValue(int j, int i) { if (coords == null) doRead(); return coords.get(j, i); }
java
{ "resource": "" }
q174571
CoordinateAxis2D.connectLon
test
static private double connectLon(double connect, double val) { if (Double.isNaN(connect)) return val; if (Double.isNaN(val)) return val; double diff = val - connect; if (Math.abs(diff) < MAX_JUMP) return val; // common case fast // we have to add or subtract 360 double result = diff > 0 ...
java
{ "resource": "" }
q174572
CoordinateAxis2D.getCoordValues
test
public double[] getCoordValues() { if (coords == null) doRead(); if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis2D.getCoordValues() on non-numeric"); return (double[]) coords.get1DJavaArray(DataType.DOUBLE); }
java
{ "resource": "" }
q174573
CoordinateAxis2D.section
test
public CoordinateAxis2D section(Range r1, Range r2) throws InvalidRangeException { List<Range> section = new ArrayList<>(); section.add(r1); section.add(r2); return (CoordinateAxis2D) section(section); }
java
{ "resource": "" }
q174574
CoordinateAxis2D.findClosest
test
private int findClosest(ArrayDouble.D2 boundsForRun , double target) { double minDiff = Double.MAX_VALUE; int idxFound = -1; int n = boundsForRun.getShape()[0]; for (int i = 0; i < n; i++) { double midpoint = (boundsForRun.get(i,0) + boundsForRun.get(i,1))/2.0; double diff = Math.abs...
java
{ "resource": "" }
q174575
CDMNode.getName
test
@Deprecated public String getName() { switch (sort) { case ATTRIBUTE: case DIMENSION: case ENUMERATION: // for these cases, getName is getShortName return getShortName(); case VARIABLE: // Atomic case SEQUENCE: case STRUCTURE: ...
java
{ "resource": "" }
q174576
PopupMenu.addAction
test
public void addAction( String menuName, Action act) { act.putValue( Action.NAME, menuName); super.add(act); }
java
{ "resource": "" }
q174577
PathMatcher.match
test
public Match match( String path) { SortedMap<String, Match> tail = treeMap.tailMap( path); if (tail.isEmpty()) return null; String after = tail.firstKey(); //System.out.println(" "+path+"; after="+afterPath); if (path.startsWith( after)) // common case return treeMap.get( after); ...
java
{ "resource": "" }
q174578
ProjectionManager.main
test
public static void main(String[] args) { ProjectionManager d = new ProjectionManager(null, null); d.setVisible(); }
java
{ "resource": "" }
q174579
KMPMatch.indexOf
test
public int indexOf(byte[] data, int start, int max) { int j = 0; if (data.length == 0) return -1; if (start + max > data.length) System.out.println("HEY KMPMatch"); for (int i = start; i < start + max; i++) { while (j > 0 && match[j] != data[i]) j = failure[j - 1]; ...
java
{ "resource": "" }
q174580
PictureCache.add
test
public static synchronized void add( URL url, SourcePicture sp ) { Tools.log("PictureCache.add: " + url.toString() ); if ( sp.getSourceBufferedImage() == null ) { Tools.log ("PictureCache.add: invoked with a null picture! Not cached!"); return; } if ( ( maxCache < 1 ) ) { Tools.log("PictureCache.add...
java
{ "resource": "" }
q174581
PictureCache.reportCache
test
public static synchronized void reportCache() { Tools.log(" PictureCache.reportCache: cache contains: " + Integer.toString( pictureCache.size() ) + " max: " + Integer.toString( maxCache ) ); //Tools.freeMem(); Enumeration e = pictureCache.keys(); while ( e.hasMoreElements() ) { Tools.log(" Cac...
java
{ "resource": "" }
q174582
PictureCache.stopBackgroundLoading
test
public static void stopBackgroundLoading() { Enumeration e = cacheLoadsInProgress.elements(); while ( e.hasMoreElements() ) { ((SourcePicture) e.nextElement()).stopLoading(); } }
java
{ "resource": "" }
q174583
PictureCache.stopBackgroundLoadingExcept
test
public static boolean stopBackgroundLoadingExcept( URL exemptionURL ) { SourcePicture sp; String exemptionURLString = exemptionURL.toString(); Enumeration e = cacheLoadsInProgress.elements(); boolean inProgress = false; while ( e.hasMoreElements() ) { sp = ((SourcePicture) e.nextElement()); if ( ! sp.ge...
java
{ "resource": "" }
q174584
HTTPFactory.Get
test
static public HTTPMethod Get(HTTPSession session, String legalurl) throws HTTPException { return makemethod(HTTPSession.Methods.Get, session, legalurl); }
java
{ "resource": "" }
q174585
HTTPFactory.makemethod
test
static protected HTTPMethod makemethod(HTTPSession.Methods m, HTTPSession session, String url) throws HTTPException { HTTPMethod meth = null; if(MOCKMETHODCLASS == null) { // do the normal case meth = new HTTPMethod(m, session, url); } else {//(MOCKMETHODCLASS != null...
java
{ "resource": "" }
q174586
RandomValue.nextFloat
test
public Object nextFloat(DapType basetype) throws DapException { TypeSort atomtype = basetype.getTypeSort(); switch (atomtype) { case Float32: return new float[]{random.nextFloat()}; case Float64: return new double[]{random.nextDouble()}; ...
java
{ "resource": "" }
q174587
RandomValue.nextCount
test
public int nextCount(int max) throws DapException { int min = 1; if(max < min || min < 1) throw new DapException("bad range"); int range = (max + 1) - min; // min..max+1 -> 0..(max+1)-min int n = random.nextInt(range); // 0..(max+1)-min n = n +...
java
{ "resource": "" }
q174588
DapNetcdfFile.readData
test
@Override protected Array readData(Variable cdmvar, Section section) throws IOException, InvalidRangeException { // The section is applied wrt to the DataDMR, so it // takes into account any constraint used in forming the dataDMR. // We use the Section to produce a view o...
java
{ "resource": "" }
q174589
RadarServerConfig.getProvider
test
private static FileSystemProvider getProvider(URI uri) throws IOException { if(fsproviders.containsKey(uri.getScheme())) { return fsproviders.get(uri.getScheme()); } else { FileSystem fs; try { fs = FileSystems.newFileSystem(uri, ...
java
{ "resource": "" }
q174590
NexradStationDB.readStationTable
test
private static void readStationTable() throws IOException { stationTableHash = new HashMap<String,Station>(); ClassLoader cl = Level2VolumeScan.class.getClassLoader(); InputStream is = cl.getResourceAsStream("resources/nj22/tables/nexrad.tbl"); List<TableParser.Record> recs = TableParser.readTable(is,...
java
{ "resource": "" }
q174591
CoordinateBuilderImpl.getIndex
test
@Override public int getIndex(T gr) { Integer result = valMap.get( extract(gr)); return (result == null) ? 0 : result; }
java
{ "resource": "" }
q174592
TypedDatasetImpl.removeDataVariable
test
protected void removeDataVariable( String varName) { Iterator iter = dataVariables.iterator(); while (iter.hasNext()) { VariableSimpleIF v = (VariableSimpleIF) iter.next(); if (v.getShortName().equals( varName) ) iter.remove(); } }
java
{ "resource": "" }
q174593
MetarParseReport.cloud_hgt2_meters
test
private String cloud_hgt2_meters(String height) { if (height.equals("999")) { return "30000"; } else { // $meters = 30 * $height ; return Integer.toString(30 * Integer.parseInt(height)); } }
java
{ "resource": "" }
q174594
ProxyReader2D.reallyRead
test
@Override public Array reallyRead(Variable mainv, Section section, CancelTask cancelTask) throws IOException, InvalidRangeException { FmrcInvLite.Gridset.Grid gridLite = (FmrcInvLite.Gridset.Grid) mainv.getSPobject(); // read the original type - if its been promoted to a new type, the conversion ha...
java
{ "resource": "" }
q174595
ColorScale.setNumColors
test
public void setNumColors(int n) { if (n != ncolors) { colors = new Color[n]; int prevn = Math.min(ncolors, n); System.arraycopy(useColors, 0, colors, 0, prevn); for (int i = ncolors; i < n; i++) colors[i] = Color.white; useColors = colors; ncolors = n; ed...
java
{ "resource": "" }
q174596
ScaledPanel.calcTransform
test
private AffineTransform calcTransform(Rectangle2D screen, Bounds world) { // scale to limiting dimension double xs = screen.getWidth() / (world.getRight() - world.getLeft()); double ys = screen.getHeight() / (world.getLower() - world.getUpper()); AffineTransform cat = new AffineTransform(); cat.set...
java
{ "resource": "" }
q174597
HTTPAuthUtil.uriToAuthScope
test
static AuthScope uriToAuthScope(URI uri) { assert (uri != null); return new AuthScope(uri.getHost(), uri.getPort(), AuthScope.ANY_REALM, uri.getScheme()); }
java
{ "resource": "" }
q174598
GridIndex.finish
test
public void finish() { if (gcs.size() == 1) return; if (gcs.size() == 2) { List hcs = getHorizCoordSys(); GridDefRecord.compare((GridDefRecord) hcs.get(0), (GridDefRecord) hcs.get(1)); } }
java
{ "resource": "" }
q174599
Factor.isReciprocalOf
test
public boolean isReciprocalOf(final Factor that) { return getBase().equals(that.getBase()) && getExponent() == -that.getExponent(); }
java
{ "resource": "" }