_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q175700 | DirectoryBuilder.findIndex | test | public boolean findIndex() throws IOException {
Path indexPath = Paths.get(dir.toString(), partitionName + suffix);
if (Files.exists(indexPath)) {
this.index = indexPath;
BasicFileAttributes attr = Files.readAttributes(indexPath, BasicFileAttributes.class);
this.indexLastModified = attr.lastMo... | java | {
"resource": ""
} |
q175701 | DirectoryBuilder.isLeaf | test | private boolean isLeaf(IndexReader indexReader) throws IOException {
if (partitionStatus == PartitionStatus.unknown) {
int countDir=0, countFile=0, count =0;
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(dir)) {
Iterator<Path> iterator = dirStream.iterator();
w... | java | {
"resource": ""
} |
q175702 | DirectoryBuilder.constructChildren | test | public List<DirectoryBuilder> constructChildren(IndexReader indexReader, CollectionUpdateType forceCollection) throws IOException {
if (childrenConstructed) return children;
if (index != null && forceCollection == CollectionUpdateType.nocheck) { // use index if it exists
constructChildrenFromIndex(indexR... | java | {
"resource": ""
} |
q175703 | DirectoryBuilder.scanForChildren | test | private void scanForChildren() {
if (debug) System.out.printf("DirectoryBuilder.scanForChildren on %s ", dir);
int count = 0;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) {
for (Path p : ds) {
BasicFileAttributes attr = Files.readAttributes(p, BasicFileAttributes.class);
... | java | {
"resource": ""
} |
q175704 | DirectoryBuilder.readFilesFromIndex | test | public List<MFile> readFilesFromIndex(IndexReader indexReader) throws IOException {
List<MFile> result = new ArrayList<>(100);
if (index == null) return result;
indexReader.readMFiles(index, result);
return result;
} | java | {
"resource": ""
} |
q175705 | GridDataset.getGridsets | test | public List<ucar.nc2.dt.GridDataset.Gridset> getGridsets() {
return new ArrayList<ucar.nc2.dt.GridDataset.Gridset>(gridsetHash.values());
} | java | {
"resource": ""
} |
q175706 | FileCache.acquire | test | public FileCacheable acquire(FileFactory factory, DatasetUrl durl, ucar.nc2.util.CancelTask cancelTask) throws IOException {
return acquire(factory, durl.trueurl, durl, -1, cancelTask, null);
} | java | {
"resource": ""
} |
q175707 | FileCache.remove | test | private void remove(CacheElement.CacheFile want) {
want.remove();
files.remove(want.ncfile);
try {
want.ncfile.setFileCache(null); // unhook the caching
want.ncfile.close();
} catch (IOException e) {
log.error("close failed on "+want.ncfile.getLocation(), e);
}
... | java | {
"resource": ""
} |
q175708 | FileCache.eject | test | @Override
public void eject(Object hashKey) {
if (disabled.get()) return;
// see if its in the cache
CacheElement wantCacheElem = cache.get(hashKey);
if (wantCacheElem == null) return;
synchronized (wantCacheElem) { // synch in order to traverse the list
for (CacheElement.Ca... | java | {
"resource": ""
} |
q175709 | FileCache.release | test | @Override
public boolean release(FileCacheable ncfile) throws IOException {
if (ncfile == null) return false;
if (disabled.get()) {
ncfile.setFileCache(null); // prevent infinite loops
ncfile.close();
return false;
}
// find it in the file cache
CacheElement.CacheFil... | java | {
"resource": ""
} |
q175710 | BufrNumbers.int4 | test | private static int int4(int a, int b, int c, int d) {
// all bits set to ones
if (a == 0xff && b == 0xff && c == 0xff && d == 0xff)
return UNDEFINED;
return (1 - ((a & 128) >> 6)) * ((a & 127) << 24 | b << 16 | c << 8 | d);
} | java | {
"resource": ""
} |
q175711 | FileCacheARC.updateInCache | test | private CacheElement updateInCache(CacheElement elem) {
if (shadowCache.firstKey() == elem) return elem;
elem.updateAccessed();
CacheElement prev = shadowCache.put(elem, elem); // faster if we could just insert at the top of the list. maybe we need to use LinkedList ?
if (prev != null && (elem != prev)... | java | {
"resource": ""
} |
q175712 | FileCacheARC.clearCache | test | public synchronized void clearCache(boolean force) {
List<CacheElement.CacheFile> deleteList = new ArrayList<>(2 * cache.size());
if (force) {
cache.clear(); // deletes everything from the cache
deleteList.addAll(files.values()); // add everything to the delete list
files.clear();
// c... | java | {
"resource": ""
} |
q175713 | GridCoordSys.makeVerticalTransform | test | void makeVerticalTransform(GridDataset gds, Formatter parseInfo) {
if (vt != null) return; // already done
if (vCT == null) return; // no vt
vt = vCT.makeVerticalTransform(gds.getNetcdfDataset(), timeDim);
if (vt == null) {
if (parseInfo != null)
parseInfo.format(" - ERR can't ... | java | {
"resource": ""
} |
q175714 | GridCoordSys.isGlobalLon | test | @Override
public boolean isGlobalLon() {
if (!isLatLon) return false;
if (!(horizXaxis instanceof CoordinateAxis1D)) return false;
CoordinateAxis1D lon = (CoordinateAxis1D) horizXaxis;
double first = lon.getCoordEdge(0);
double last = lon.getCoordEdge((int) lon.getSize());
double min = ... | java | {
"resource": ""
} |
q175715 | GridCoordSys.isZPositive | test | @Override
public boolean isZPositive() {
if (vertZaxis == null) return false;
if (vertZaxis.getPositive() != null) {
return vertZaxis.getPositive().equalsIgnoreCase(ucar.nc2.constants.CF.POSITIVE_UP);
}
if (vertZaxis.getAxisType() == AxisType.Height) return true;
return vertZaxis.getA... | java | {
"resource": ""
} |
q175716 | GridCoordSys.findXYindexFromCoord | test | @Override
public int[] findXYindexFromCoord(double x_coord, double y_coord, int[] result) {
if (result == null)
result = new int[2];
if ((horizXaxis instanceof CoordinateAxis1D) && (horizYaxis instanceof CoordinateAxis1D)) {
result[0] = ((CoordinateAxis1D) horizXaxis).findCoordElement(x_coo... | java | {
"resource": ""
} |
q175717 | GridCoordSys.findXYindexFromCoordBounded | test | @Override
public int[] findXYindexFromCoordBounded(double x_coord, double y_coord, int[] result) {
if (result == null)
result = new int[2];
if ((horizXaxis instanceof CoordinateAxis1D) && (horizYaxis instanceof CoordinateAxis1D)) {
result[0] = ((CoordinateAxis1D) horizXaxis).findCoordElemen... | java | {
"resource": ""
} |
q175718 | GridCoordSys.findXYindexFromLatLon | test | @Override
public int[] findXYindexFromLatLon(double lat, double lon, int[] result) {
Projection dataProjection = getProjection();
ProjectionPoint pp = dataProjection.latLonToProj(new LatLonPointImpl(lat, lon), new ProjectionPointImpl());
return findXYindexFromCoord(pp.getX(), pp.getY(), result);
... | java | {
"resource": ""
} |
q175719 | GridCoordSys.findXYindexFromLatLonBounded | test | @Override
public int[] findXYindexFromLatLonBounded(double lat, double lon, int[] result) {
Projection dataProjection = getProjection();
ProjectionPoint pp = dataProjection.latLonToProj(new LatLonPointImpl(lat, lon), new ProjectionPointImpl());
return findXYindexFromCoordBounded(pp.getX(), pp.getY()... | java | {
"resource": ""
} |
q175720 | MyTextField.getItemPos | test | protected int getItemPos() {
if (nitems < 1)
return -arrow_size; // dont show indicator
else if (nitems == 1)
return b.width/2; // indicator in center
int item = table.getSelectedRowIndex(); // selected item
int eff_width = b.width - 2*arrow_size; // effective widt... | java | {
"resource": ""
} |
q175721 | MyTextField.getItem | test | protected int getItem( int pixel) {
if (nitems < 2)
return 0;
int eff_width = b.width - 2*arrow_size; // effective width
double fitem = ((double) (pixel-arrow_size)*(nitems-1)) / eff_width;
int item = (int)(fitem+.5);
item = Math.max( Math.min(item, nitems-1), 0);
... | java | {
"resource": ""
} |
q175722 | DirectoryCollection.iterateOverMFileCollection | test | public void iterateOverMFileCollection(Visitor visit) throws IOException {
if (debug) System.out.printf(" iterateOverMFileCollection %s ", collectionDir);
int count = 0;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(collectionDir, new MyStreamFilter())) {
for (Path p : ds) {
try {
... | java | {
"resource": ""
} |
q175723 | TdsDownloader.getRemoteFiles | test | public void getRemoteFiles(final CancelTask _cancel) {
this.cancel = _cancel;
String urls = config.getServerPrefix() + "/thredds/admin/log/"+type+"/";
ta.append(String.format("Download URL = %s%n", urls));
String contents = null;
try (HTTPMethod method = HTTPFactory.Get(session, urls)) {
... | java | {
"resource": ""
} |
q175724 | FslHrrrLocalTables.getSubCenterName | test | @Override
public String getSubCenterName(int center, int subcenter) {
switch (subcenter) {
case 0:
return null;
case 1:
return "FSL/FRD Regional Analysis and Prediction Branch";
case 2:
return "FSL/FRD Local Analysis and Prediction Branch";
}
return su... | java | {
"resource": ""
} |
q175725 | CalendarPeriod.fromUnitString | test | public static CalendarPeriod.Field fromUnitString(String udunit) {
udunit = udunit.trim();
udunit = udunit.toLowerCase();
if (udunit.equals("s")) return Field.Second;
if (udunit.equals("ms")) return Field.Millisec;
// eliminate plurals
if (udunit.endsWith("s")) udunit = udunit.substr... | java | {
"resource": ""
} |
q175726 | CalendarPeriod.of | test | public static CalendarPeriod of(int value, Field field) {
CalendarPeriod want = new CalendarPeriod(value, field);
if (cache == null) return want;
CalendarPeriod got = cache.getIfPresent(want);
if (got != null) return got;
cache.put(want, want);
return want;
} | java | {
"resource": ""
} |
q175727 | CalendarPeriod.of | test | public static CalendarPeriod of(String udunit) {
int value;
String units;
String[] split = StringUtil2.splitString(udunit);
if (split.length == 1) {
value = 1;
units = split[0];
} else if (split.length == 2) {
try {
value = Integer.parseInt(split[0]);
}... | java | {
"resource": ""
} |
q175728 | CalendarPeriod.subtract | test | public int subtract(CalendarDate start, CalendarDate end) {
long diff = end.getDifferenceInMsecs(start);
int thislen = millisecs();
if ((diff % thislen != 0))
log.warn("roundoff error");
return (int) (diff / thislen);
} | java | {
"resource": ""
} |
q175729 | CalendarPeriod.getConvertFactor | test | public double getConvertFactor(CalendarPeriod from) {
if (field == CalendarPeriod.Field.Month || field == CalendarPeriod.Field.Year) {
log.warn(" CalendarDate.convert on Month or Year");
}
return (double) from.millisecs() / millisecs();
} | java | {
"resource": ""
} |
q175730 | CalendarPeriod.getValueInMillisecs | test | public double getValueInMillisecs() {
if (field == CalendarPeriod.Field.Month)
return 30.0 * 24.0 * 60.0 * 60.0 * 1000.0 * value;
else if (field == CalendarPeriod.Field.Year)
return 365.0 * 24.0 * 60.0 * 60.0 * 1000.0 * value;
else return millisecs();
} | java | {
"resource": ""
} |
q175731 | CalendarPeriod.getOffset | test | public int getOffset(CalendarDate start, CalendarDate end) {
if (start.equals(end)) return 0;
long start_millis = start.getDateTime().getMillis();
long end_millis = end.getDateTime().getMillis();
// 5 second slop
Period p;
if (start_millis < end_millis)
p = new Period(start_millis... | java | {
"resource": ""
} |
q175732 | GempakGridServiceProvider.sync | test | public boolean sync() throws IOException {
if ((gemreader.getInitFileSize() < raf.length()) && extendIndex) {
gemreader.init(true);
GridIndex index = gemreader.getGridIndex();
// reconstruct the ncfile objects
ncfile.empty();
open(index, null);
return true;
}
return false... | java | {
"resource": ""
} |
q175733 | GempakGridServiceProvider.initTables | test | private void initTables() {
try {
GempakGridParameterTable.addParameters(
"resources/nj22/tables/gempak/wmogrib3.tbl");
GempakGridParameterTable.addParameters(
"resources/nj22/tables/gempak/ncepgrib2.tbl");
} catch (Exception e) {
System.out.println("unable to init ... | java | {
"resource": ""
} |
q175734 | DataRootPathMatcher.put | test | private boolean put(DataRootExt dateRootExt) {
map.put(dateRootExt.getPath(), dateRootExt);
return treeSet.add(dateRootExt.getPath());
} | java | {
"resource": ""
} |
q175735 | DataRootPathMatcher.findLongestPathMatch | test | public String findLongestPathMatch( String reqPath) {
SortedSet<String> tail = treeSet.tailSet(reqPath);
if (tail.isEmpty()) return null;
String after = tail.first();
if (reqPath.startsWith( after)) // common case
return tail.first();
// have to check more, until no common starting chars
... | java | {
"resource": ""
} |
q175736 | DataRootPathMatcher.findDataRoot | test | public DataRoot findDataRoot( String reqPath) {
String path = findLongestPathMatch(reqPath);
if (path == null) return null;
DataRootExt dataRootExt = map.get(path);
if (dataRootExt == null) {
logger.error("DataRootPathMatcher found path {} but not in map", path);
return null;
}
retu... | java | {
"resource": ""
} |
q175737 | DataRootPathMatcher.convert2DataRoot | test | public @Nonnull DataRoot convert2DataRoot(DataRootExt dataRootExt) {
DataRoot dataRoot = dataRootExt.getDataRoot();
if (dataRoot != null) return dataRoot;
// otherwise must read the catalog that its in
dataRoot = readDataRootFromCatalog(dataRootExt);
dataRootExt.setDataRoot(dataRoot);
return da... | java | {
"resource": ""
} |
q175738 | NcssParamsBean.getCalendarDateRange | test | public CalendarDateRange getCalendarDateRange(Calendar cal) {
if (dateRange == null) return null;
if (cal.equals(Calendar.getDefault())) return dateRange;
// otherwise must reparse
return makeCalendarDateRange(cal);
} | java | {
"resource": ""
} |
q175739 | CoordinateSharerBest.reindex | test | public List<Integer> reindex(List<Coordinate> coords) {
List<Integer> result = new ArrayList<>();
for (Coordinate coord : coords) {
Coordinate sub = swap.get(coord);
Coordinate use = (sub == null) ? coord : sub;
Integer idx = indexMap.get(use); // index into unionCoords
if (idx == ... | java | {
"resource": ""
} |
q175740 | NetcdfFileWriter.createNew | test | static public NetcdfFileWriter createNew(Version version, String location, Nc4Chunking chunker) throws IOException {
return new NetcdfFileWriter(version, location, false, chunker);
} | java | {
"resource": ""
} |
q175741 | NetcdfFileWriter.addGroup | test | public Group addGroup(Group parent, String name) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (parent == null) return ncfile.getRootGroup();
Group result = new Group(ncfile, parent, name);
parent.addGroup(result);
return result;
} | java | {
"resource": ""
} |
q175742 | NetcdfFileWriter.addTypedef | test | public EnumTypedef addTypedef(Group g, EnumTypedef td) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (!version.isExtendedModel())
throw new IllegalArgumentException("Enum type only supported in extended model, this version is="+version);
g.addEnumeration(td);... | java | {
"resource": ""
} |
q175743 | NetcdfFileWriter.deleteGroupAttribute | test | public Attribute deleteGroupAttribute(Group g, String attName) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (g == null) g = ncfile.getRootGroup();
Attribute att = g.findAttribute(attName);
if (null == att) return null;
g.remove(att);
return att;
} | java | {
"resource": ""
} |
q175744 | NetcdfFileWriter.renameGroupAttribute | test | public Attribute renameGroupAttribute(Group g, String oldName, String newName) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (!isValidObjectName(newName)) {
String newnewName = createValidObjectName(newName);
log.warn("illegal attribute name= " + newName ... | java | {
"resource": ""
} |
q175745 | NetcdfFileWriter.addRecordStructure | test | public Structure addRecordStructure() {
if (version != Version.netcdf3) return null;
boolean ok = (Boolean) ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);
if (!ok)
throw new IllegalStateException("can't add record variable");
return (Structure) ncfile.findVariable("reco... | java | {
"resource": ""
} |
q175746 | NetcdfFileWriter.abort | test | public void abort() throws java.io.IOException {
if (spiw != null) {
spiw.close();
spiw = null;
}
} | java | {
"resource": ""
} |
q175747 | Bean.writeProperties | test | public void writeProperties(PrintWriter out) throws IOException {
if (p == null) p = BeanParser.getParser( o.getClass());
p.writeProperties(o, out);
} | java | {
"resource": ""
} |
q175748 | ThreddsMetadataExtractor.extract | test | public ThreddsMetadata extract(Dataset threddsDataset) throws IOException {
ThreddsMetadata metadata = new ThreddsMetadata();
Map<String, Object> flds = metadata.getFlds();
try ( DataFactory.Result result = new DataFactory().openFeatureDataset(threddsDataset, null)) {
if (result.fatalError) {
... | java | {
"resource": ""
} |
q175749 | OffsetUnit.myDivideInto | test | @Override
protected Unit myDivideInto(final Unit that) throws OperationException {
return that instanceof OffsetUnit
? getUnit().divideInto(((OffsetUnit) that).getUnit())
: getUnit().divideInto(that);
} | java | {
"resource": ""
} |
q175750 | OffsetUnit.toDerivedUnit | test | public double toDerivedUnit(final double amount) throws ConversionException {
if (!(_unit instanceof DerivableUnit)) {
throw new ConversionException(this, getDerivedUnit());
}
return ((DerivableUnit) getUnit()).toDerivedUnit(amount + getOffset());
} | java | {
"resource": ""
} |
q175751 | OffsetUnit.fromDerivedUnit | test | public double fromDerivedUnit(final double amount)
throws ConversionException {
if (!(_unit instanceof DerivableUnit)) {
throw new ConversionException(getDerivedUnit(), this);
}
return ((DerivableUnit) getUnit()).fromDerivedUnit(amount)
- getOffset();
... | java | {
"resource": ""
} |
q175752 | ConvertD2N.convertNestedVariable | test | public Array convertNestedVariable(ucar.nc2.Variable v, List<Range> section, DodsV dataV, boolean flatten) throws IOException, DAP2Exception {
Array data = convertTopVariable(v, section, dataV);
if (flatten) {
ArrayStructure as = (ArrayStructure) data;
// make list of names
List<String>... | java | {
"resource": ""
} |
q175753 | ConvertD2N.convertTopVariable | test | public Array convertTopVariable(ucar.nc2.Variable v, List<Range> section, DodsV dataV) throws IOException, DAP2Exception {
Array data = convert(dataV);
// arrays
if ((dataV.darray != null) && (dataV.bt instanceof DString)) {
if (v.getDataType() == DataType.STRING)
return convertString... | java | {
"resource": ""
} |
q175754 | ConvertD2N.convert | test | public Array convert(DodsV dataV) throws IOException, DAP2Exception {
// scalars
if (dataV.darray == null) {
if (dataV.bt instanceof DStructure) {
ArrayStructure structArray = makeArrayStructure( dataV);
iconvertDataStructure( (DStructure) dataV.bt, structArray.getStructureMembers... | java | {
"resource": ""
} |
q175755 | MetadataManager.closeAll | test | static synchronized public void closeAll() {
List<MetadataManager> closeDatabases = new ArrayList<>(openDatabases);
for (MetadataManager mm : closeDatabases) {
if (debug) System.out.println(" close database " + mm.collectionName);
mm.close();
}
openDatabases = new ArrayList<>(); // empty
... | java | {
"resource": ""
} |
q175756 | MetadataManager.openDatabase | test | private synchronized void openDatabase() {
if (database != null) return;
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setReadOnly(readOnly);
dbConfig.setAllowCreate(!readOnly);
if (!readOnly)
dbConfig.setDeferredWrite(true);
database = myEnv.openDatabase(null, collectionName, d... | java | {
"resource": ""
} |
q175757 | CalendarDuration.convertToPeriod | test | static org.joda.time.Period convertToPeriod(int value, String udunit) {
if (udunit.endsWith("s")) udunit = udunit.substring(0, udunit.length()-1);
switch (udunit) {
case "msec":
return Period.millis(value);
case "sec":
return Period.seconds(value);
case "minute":
... | java | {
"resource": ""
} |
q175758 | ErddapStringArray.ensureCapacity | test | public void ensureCapacity(long minCapacity) {
if (array.length < minCapacity) {
//ensure minCapacity is < Integer.MAX_VALUE
ErddapMath2.ensureArraySizeOkay(minCapacity, "StringArray");
//caller may know exact number needed, so don't double above 2x current size
... | java | {
"resource": ""
} |
q175759 | ErddapStringArray.get | test | public String get(int index) {
if (index >= size)
throw new IllegalArgumentException(ErddapString2.ERROR + " in StringArray.get: index (" +
index + ") >= size (" + size + ").");
return array[index];
} | java | {
"resource": ""
} |
q175760 | InvDatasetScan.makeCatalogForDirectory | test | public InvCatalogImpl makeCatalogForDirectory( String orgPath, URI catURI ) {
if ( log.isDebugEnabled())
{
log.debug( "baseURI=" + catURI );
log.debug( "orgPath=" + orgPath );
log.debug( "rootPath=" + rootPath );
log.debug( "scanLocation=" + scanLocation );
}
// Get the dataset... | java | {
"resource": ""
} |
q175761 | InvDatasetScan.makeProxyDsResolverCatalog | test | public InvCatalogImpl makeProxyDsResolverCatalog( String path, URI baseURI )
{
if ( path == null ) return null;
if ( path.endsWith( "/")) return null;
// Get the dataset path.
String dsDirPath = translatePathToLocation( path );
if ( dsDirPath == null )
{
log.error( "makeProxyDsResolverC... | java | {
"resource": ""
} |
q175762 | AggregationNew.getCoordinateType | test | private DataType getCoordinateType() {
List<Dataset> nestedDatasets = getDatasets();
DatasetOuterDimension first = (DatasetOuterDimension) nestedDatasets.get(0);
return first.isStringValued ? DataType.STRING : DataType.DOUBLE;
} | java | {
"resource": ""
} |
q175763 | Grib2Pds.factory | test | @Nullable
public static Grib2Pds factory(int template, byte[] input) {
switch (template) {
case 0:
return new Grib2Pds0(input);
case 1:
return new Grib2Pds1(input);
case 2:
return new Grib2Pds2(input);
case 5:
return new Grib2Pds5(input);
ca... | java | {
"resource": ""
} |
q175764 | Grib2Pds.calcTime | test | protected CalendarDate calcTime(int startIndex) {
int year = GribNumbers.int2(getOctet(startIndex++), getOctet(startIndex++));
int month = getOctet(startIndex++);
int day = getOctet(startIndex++);
int hour = getOctet(startIndex++);
int minute = getOctet(startIndex++);
int second = getOct... | java | {
"resource": ""
} |
q175765 | Grib2Pds.applyScaleFactor | test | double applyScaleFactor(int scale, int value) {
return ((scale == 0) || (scale == 255) || (value == 0)) ? value : value * Math.pow(10, -scale);
} | java | {
"resource": ""
} |
q175766 | EcmwfLocalConcepts.parseLocalConcept | test | private void parseLocalConcept(String filename, String conceptName) throws IOException {
try (InputStream is = new FileInputStream(filename)) {
addLocalConcept(is, conceptName);
}
} | java | {
"resource": ""
} |
q175767 | EcmwfLocalConcepts.addLocalConcept | test | private void addLocalConcept(InputStream is, String conceptName) throws IOException {
/*
example entry from name.def:
#Total precipitation of at least 5 mm
'Total precipitation of at least 5 mm' = {
table2Version = 131 ;
indicatorOfParameter = 61 ;
... | java | {
"resource": ""
} |
q175768 | EcmwfLocalConcepts.cleanLine | test | private String cleanLine(String lineIn) {
String lineOut;
lineOut = lineIn.replaceAll("'", "");
lineOut = lineOut.replaceAll("\t", "");
lineOut = lineOut.replaceAll(";", "");
return lineOut.trim();
} | java | {
"resource": ""
} |
q175769 | EcmwfLocalConcepts.storeConcept | test | private void storeConcept(String tableVersion, String parameterNumber, String key, String value) {
HashMap<String, HashMap<String, String>> tmpTable;
if (localConcepts.containsKey(tableVersion)) {
tmpTable = localConcepts.get(tableVersion);
if (tmpTable.containsKey(parameterNumb... | java | {
"resource": ""
} |
q175770 | EcmwfLocalConcepts.writeGrib1Tables | test | private void writeGrib1Tables() throws IOException {
SimpleDateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
Calendar cal = Calendar.getInstance();
String writeDate = dateFormat.format(cal.getTime());
String grib1Info;
List<String> tableNums ... | java | {
"resource": ""
} |
q175771 | EcmwfLocalConcepts.writeLookupTableFile | test | private void writeLookupTableFile(List<String> tableNums, Path dir, String writeDate) throws IOException {
System.out.println("Writing: lookupTables.txt");
Collections.sort(tableNums);
Path lookupTableReg = dir.resolve("lookupTables.txt");
Files.deleteIfExists(lookupTableReg);
F... | java | {
"resource": ""
} |
q175772 | EcmwfLocalConcepts.showLocalConcepts | test | private void showLocalConcepts() {
for (String tableNum : localConcepts.keySet()) {
for (String paramNum : localConcepts.get(tableNum).keySet()) {
for (String key :localConcepts.get(tableNum).get(paramNum).keySet()) {
System.out.println(key + ":" + localConcepts.ge... | java | {
"resource": ""
} |
q175773 | EcmwfLocalConcepts.main | test | public static void main(String[] args) {
EcmwfLocalConcepts ec = new EcmwfLocalConcepts();
try {
ec.writeGrib1Tables();
System.out.println("Finished!");
} catch (IOException e) {
e.printStackTrace();
}
} | java | {
"resource": ""
} |
q175774 | DatasetSourceType.getType | test | public static DatasetSourceType getType( String name)
{
if ( name == null) return null;
return ( (DatasetSourceType) hash.get( name));
} | java | {
"resource": ""
} |
q175775 | DatasetSource.expand | test | public InvDataset expand() throws IOException
{
// Get the new catalog being generated and its top-level dataset.
this.resultingCatalog = this.createSkeletonCatalog( prefixUrlPath );
this.accessPointDataset = (InvDataset) this.resultingCatalog.getDatasets().get( 0);
// IOException thrown by createSke... | java | {
"resource": ""
} |
q175776 | DatasetSource.fullExpand | test | public InvCatalog fullExpand() throws IOException
{
logger.debug( "fullExpand(): expanding DatasetSource named \"{}\"", this.getName());
InvDataset topDs = this.expand();
InvCatalog generatedCat = topDs.getParentCatalog();
// Add metadata to all datasets.
for ( Iterator it = this.getDatasetEnhan... | java | {
"resource": ""
} |
q175777 | DatasetSource.nameDatasets | test | private void nameDatasets( InvDatasetImpl datasetContainer)
{
if ( this.getDatasetNamerList().isEmpty()) return;
if ( this.isFlatten())
{
logger.debug( "nameDatasets(): structure is FLAT calling nameDatasetList()");
this.nameDatasetList( datasetContainer);
}
else
{
logger.deb... | java | {
"resource": ""
} |
q175778 | DatasetSource.nameDatasetList | test | private void nameDatasetList( InvDatasetImpl dataset)
{
// Create temporary dataset in which to hold named datasets.
InvDatasetImpl namedDs = new InvDatasetImpl( dataset,
"nameDatastList() temp dataset", null, null, null);
// InvDatasetImpl(parentDs, name, dataType, serviceName, urlPath)
dat... | java | {
"resource": ""
} |
q175779 | DatasetSource.nameDatasetTree | test | private void nameDatasetTree( InvDatasetImpl dataset)
{
// If dataset does not have a name, try naming it with dsNamers.
// @todo Rethink naming of directories (look at how DatasetFilter deals with collection vs atomic datasets).
if ( dataset.getName().equals("") || ! dataset.hasAccess())
{
logg... | java | {
"resource": ""
} |
q175780 | ScalablePicture.loadPictureImd | test | public void loadPictureImd(URL imageUrl, double rotation) {
Tools.log("loadPictureImd invoked with URL: " + imageUrl.toString());
if (sourcePicture != null) sourcePicture.removeListener(this);
sourcePicture = new SourcePicture();
sourcePicture.addListener(this);
setStatus(LOADING, "Loading: " +... | java | {
"resource": ""
} |
q175781 | ScalablePicture.stopLoadingExcept | test | public void stopLoadingExcept(URL url) {
if (sourcePicture != null) {
boolean isCurrentlyLoading = sourcePicture.stopLoadingExcept(url);
if (!isCurrentlyLoading) {
// sourcePicture.removeListener( this );
}
PictureCache.stopBackgroundLoadingExcept(url);
}
} | java | {
"resource": ""
} |
q175782 | ScalablePicture.sourceStatusChange | test | public void sourceStatusChange(int statusCode, String statusMessage, SourcePicture sp) {
//Tools.log("ScalablePicture.sourceStatusChange: status received from SourceImage: " + statusMessage);
switch (statusCode) {
case SourcePicture.UNINITIALISED:
Tools.log("ScalablePicture.sourceStatusChang... | java | {
"resource": ""
} |
q175783 | ScalablePicture.sourceLoadProgressNotification | test | public void sourceLoadProgressNotification(int statusCode, int percentage) {
Enumeration e = scalablePictureStatusListeners.elements();
while (e.hasMoreElements()) {
((ScalablePictureListener) e.nextElement())
.sourceLoadProgressNotification(statusCode, percentage);
}
} | java | {
"resource": ""
} |
q175784 | ScalablePicture.createScaledPictureInThread | test | public void createScaledPictureInThread(int priority) {
setStatus(SCALING, "Scaling picture.");
ScaleThread t = new ScaleThread(this);
t.setPriority(priority);
t.start();
} | java | {
"resource": ""
} |
q175785 | ScalablePicture.getScaledSize | test | public Dimension getScaledSize() {
if (scaledPicture != null)
return new Dimension(scaledPicture.getWidth(), scaledPicture.getHeight());
else
return new Dimension(0, 0);
} | java | {
"resource": ""
} |
q175786 | ScalablePicture.getScaledSizeString | test | public String getScaledSizeString() {
if (scaledPicture != null)
return Integer.toString(scaledPicture.getWidth())
+ " x "
+ Integer.toString(scaledPicture.getHeight());
else
return "0 x 0";
} | java | {
"resource": ""
} |
q175787 | GempakSoundingFileReader.getMergedParts | test | public List<String> getMergedParts() {
List<String> list = new ArrayList<>(1);
list.add(SNDT);
return list;
} | java | {
"resource": ""
} |
q175788 | GempakSoundingFileReader.makeHeader | test | private String makeHeader(GempakStation stn, String date) {
StringBuilder builder = new StringBuilder();
builder.append("STID = ");
builder.append(StringUtil2.padRight((stn.getSTID().trim()
+ stn.getSTD2().trim()), 8));
builder.append("\t");
builder.append("STNM = ");
builder.... | java | {
"resource": ""
} |
q175789 | GempakSoundingFileReader.SN_CKUA | test | private List<String> SN_CKUA() {
List<String> types = new ArrayList<>();
boolean above = false;
boolean done = false;
String partToCheck;
while (!done) {
// check for mandatory groups
for (int group = 0; group < belowGroups.length; group++) {
if (above) {
partT... | java | {
"resource": ""
} |
q175790 | GempakSoundingFileReader.checkForValidGroup | test | private boolean checkForValidGroup(String partToCheck, String[] params) {
DMPart part = getPart(partToCheck);
if (part == null) {
return false;
}
int i = 0;
for (DMParam parm : part.params) {
if (!(parm.kprmnm.equals(params[i++]))) {
return false;
}
}
ret... | java | {
"resource": ""
} |
q175791 | DiskCache.setRootDirectory | test | static public void setRootDirectory(String cacheDir) {
if (!cacheDir.endsWith("/"))
cacheDir = cacheDir + "/";
root = StringUtil2.replace(cacheDir, '\\', "/"); // no nasty backslash
makeRootDirectory();
} | java | {
"resource": ""
} |
q175792 | DiskCache.makeRootDirectory | test | static public void makeRootDirectory() {
File dir = new File(root);
if (!dir.exists())
if (!dir.mkdirs())
throw new IllegalStateException("DiskCache.setRootDirectory(): could not create root directory <" + root + ">.");
checkExist = true;
} | java | {
"resource": ""
} |
q175793 | DiskCache.getCacheFile | test | static public File getCacheFile(String fileLocation) {
File f = new File(makeCachePath(fileLocation));
if (f.exists()) {
if (!f.setLastModified(System.currentTimeMillis()))
logger.warn("Failed to setLastModified on " + f.getPath());
}
if (!checkExist) {
File dir = f.getParen... | java | {
"resource": ""
} |
q175794 | DiskCache.cleanCache | test | static public void cleanCache(Date cutoff, StringBuilder sbuff) {
if (sbuff != null) sbuff.append("CleanCache files before ").append(cutoff).append("\n");
File dir = new File(root);
File[] children = dir.listFiles();
if (children == null) return;
for (File file : children) {
Date lastMod... | java | {
"resource": ""
} |
q175795 | DiskCache.cleanCache | test | static public void cleanCache(long maxBytes, Comparator<File> fileComparator, StringBuilder sbuff) {
if (sbuff != null) sbuff.append("DiskCache clean maxBytes= ")
.append(maxBytes).append("on dir ").append(root).append("\n");
File dir = new File(root);
long total = 0, total_delete = 0;
... | java | {
"resource": ""
} |
q175796 | Descriptor.isBufrTable | test | static public boolean isBufrTable(short fxy) {
int f = (fxy & 0xC000) >> 14;
int x = (fxy & 0x3F00) >> 8;
int y = (fxy & 0xFF);
return (f == 0) && (x == 0) && (y < 13);
} | java | {
"resource": ""
} |
q175797 | CoordinateAxis.factory | test | static public CoordinateAxis factory(NetcdfDataset ncd, VariableDS vds) {
if ((vds.getRank() == 0) || (vds.getRank() == 1) || (vds.getRank() == 2 && vds.getDataType() == DataType.CHAR)) {
return new CoordinateAxis1D(ncd, vds);
} else if (vds.getRank() == 2)
return new CoordinateAxis2D(ncd, vds);
... | java | {
"resource": ""
} |
q175798 | CoordinateAxis.copyNoCache | test | public CoordinateAxis copyNoCache() {
CoordinateAxis axis = new CoordinateAxis(ncd, getParentGroup(), getShortName(), getDataType(), getDimensionsString(),
getUnitsString(), getDescription());
// other state
axis.axisType = this.axisType;
axis.boundaryRef = this.boundaryRef;
axis.isCont... | java | {
"resource": ""
} |
q175799 | CoordinateAxis.isNumeric | test | public boolean isNumeric() {
return (getDataType() != DataType.CHAR) &&
(getDataType() != DataType.STRING) &&
(getDataType() != DataType.STRUCTURE);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.