bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected FreeMarkerView prepareView(String templateName) { FreeMarkerView fv = new FreeMarkerView(); fv.setUrl(templateName); fv.setApplicationContext(wac); fv.setExposeSpringMacroHelpers(true); return fv; }
|
protected FreeMarkerView prepareView(String templateName) throws Exception { FreeMarkerView fv = new FreeMarkerView(); fv.setUrl(templateName); fv.setApplicationContext(wac); fv.setExposeSpringMacroHelpers(true); return fv; }
| 1,115,590
|
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
|
public void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
| 1,115,594
|
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
|
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( totalElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
| 1,115,595
|
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
|
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( filteredElem ) .append( ")" ); setText( textBuf.toString() ); }
| 1,115,596
|
public static SearchResultsDataModel lookupResultDataModel( Search search ) { return (SearchResultsDataModel) searchToDataModelMap.get( search ); }
|
public static SearchResultsDataModel lookupResultDataModel( Search search ) { return searchToDataModelMap.get( search ); }
| 1,115,597
|
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView); myContents = aView; myRecipe = aRecipe; }
|
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView, aRecipe); myContents = aView; myRecipe = aRecipe; }
| 1,115,598
|
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView); myContents = aView; myRecipe = aRecipe; }
|
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView); myContents = aView; }
| 1,115,599
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <MALT>"+getName()+"</MALT>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <POINTS>"+pppg+"</POINTS>\n" ); sb.append( " <LOV>"+lov+"</LOV>\n" ); sb.append( " <MASHED>"+mashed+"</MASHED>\n" ); sb.append( " <STEEPED>"+steeped+"</STEEPED>\n" ); sb.append( " <COSTLB>"+getCostPerU()+"</COSTLB>\n" ); sb.append( " <DESCRIPTION>"+getDescription()+"</DESCRIPTION>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <MALT>"+getName()+"</MALT>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <POINTS>"+pppg+"</POINTS>\n" ); sb.append( " <LOV>"+lov+"</LOV>\n" ); sb.append( " <MASHED>"+mashed+"</MASHED>\n" ); sb.append( " <STEEPED>"+steeped+"</STEEPED>\n" ); sb.append( " <COSTLB>"+getCostPerU()+"</COSTLB>\n" ); sb.append( " <DESCRIPTION>"+SBStringUtils.subEntities(getDescription())+"</DESCRIPTION>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
| 1,115,600
|
public BasicTimeConfig(DataSetSeismogram[] seismos){ add(seismos); }
|
public BasicTimeConfig(DataSetSeismogram[] seismos){ add(seismos); }
| 1,115,601
|
public ConfigEvent(DataSetSeismogram[] seismos, TimeEvent time, AmpEvent amp){ this.seismos = seismos; this.time = time; this.amp = amp; }
|
public ConfigEvent(DataSetSeismogram[] seismos, TimeEvent time, AmpEvent amp){ this.seismos = seismos; this.time = time; this.amp = amp; }
| 1,115,602
|
get_for_day(edu.iris.Fissures.IfNetwork.ChannelId channel_id, int year, int jday, edu.iris.Fissures.Dimension pixel_size) throws PlottableNotAvailable, UnsupportedDimension { SoftReference ref; Plottable[] plottableArray; String key = ChannelIdUtil.toString(channel_id)+"."+Integer.toString(year)+"."+Integer.toString(jday); ref = (SoftReference)dayCache.get(key); if(ref != null) { plottableArray = (Plottable[])ref.get(); if(plottableArray != null) { return plottableArray; } else { dayCache.remove(ChannelIdUtil.toString(channel_id)); } } plottableArray = plottableDC.get_for_day(channel_id, year, jday, pixel_size); dayCache.put(key, new SoftReference(plottableArray)); return plottableArray; }
|
get_for_day(edu.iris.Fissures.IfNetwork.ChannelId channel_id, int year, int jday, edu.iris.Fissures.Dimension pixel_size) throws PlottableNotAvailable, UnsupportedDimension { SoftReference ref; Plottable[] plottableArray; String key = ChannelIdUtil.toString(channel_id)+"."+Integer.toString(year)+"."+Integer.toString(jday); ref = (SoftReference)dayCache.get(key); if(ref != null) { plottableArray = (Plottable[])ref.get(); if(plottableArray != null) { return plottableArray; } else { dayCache.remove(key); } } plottableArray = plottableDC.get_for_day(channel_id, year, jday, pixel_size); dayCache.put(key, new SoftReference(plottableArray)); return plottableArray; }
| 1,115,603
|
public void setPasswordDirty(boolean passwordDirty) { this.verifyPassword = ""; this.passwordDirty = passwordDirty; }
|
public void setPasswordDirty(boolean passwordDirty) { this.passwordDirty = passwordDirty; }
| 1,115,604
|
public String createFileName(DataSet dataset) { String filename = dataset.getName()+".dsml"; filename = filename.replaceAll(" ","_"); filename = filename.replaceAll(",","_"); filename = filename.replaceAll("/","_"); filename = filename.replaceAll(":","_"); // filename = filename.replaceAll("\\","_"); return filename; }
|
public static String createFileName(DataSet dataset) { String filename = dataset.getName()+".dsml"; filename = filename.replaceAll(" ","_"); filename = filename.replaceAll(",","_"); filename = filename.replaceAll("/","_"); filename = filename.replaceAll(":","_"); // filename = filename.replaceAll("\\","_"); return filename; }
| 1,115,606
|
public void insertInto(Element element, DataSet dataset, File directory) throws IOException, ParserConfigurationException, MalformedURLException { Document doc = element.getOwnerDocument(); element.setAttribute("datasetid", dataset.getId()); element.appendChild(XMLUtil.createTextElement(doc, "name", dataset.getName())); element.appendChild(XMLUtil.createTextElement(doc, "owner", dataset.getOwner())); String[] childDataSets = dataset.getDataSetNames(); for (int i = 0; i < childDataSets.length; i++) { String childDirName = childDataSets[i].replace(' ','_'); File childDirectory = new File(directory, childDirName); if ( ! childDirectory.exists()) { childDirectory.mkdirs(); } if (useDataSetRef) { insertRef(element, dataset.getDataSet(childDataSets[i]), childDirectory); } else { insert(element, dataset.getDataSet(childDataSets[i]), childDirectory); } } String[] childDSS = dataset.getDataSetSeismogramNames(); File dataDir = new File(directory, "data"); dataDir.mkdirs(); for (int i = 0; i < childDSS.length; i++) { DataSetSeismogram dss = dataset.getDataSetSeismogram(childDSS[i]); URLDataSetSeismogram urlDSS; if (saveLocally || ! (dss instanceof URLDataSetSeismogram)) { urlDSS = URLDataSetSeismogram.localize(dss, dataDir); } else { urlDSS = (URLDataSetSeismogram)dss; } insert(element, urlDSS, directory.toURI().toURL()); } String[] paramNames = dataset.getParameterNames(); for (int i = 0; i < paramNames.length; i++) { insert(element, paramNames[i], dataset.getParameter(paramNames[i])); } }
|
public void insertInto(Element element, DataSet dataset, File directory) throws IOException, ParserConfigurationException, MalformedURLException { Document doc = element.getOwnerDocument(); element.setAttribute("datasetid", dataset.getId()); element.appendChild(XMLUtil.createTextElement(doc, "name", dataset.getName())); element.appendChild(XMLUtil.createTextElement(doc, "owner", dataset.getOwner())); String[] childDataSets = dataset.getDataSetNames(); for (int i = 0; i < childDataSets.length; i++) { String childDirName = createFileName(dataset.getDataSet(childDataSets[i])); File childDirectory = new File(directory, childDirName); if ( ! childDirectory.exists()) { childDirectory.mkdirs(); } if (useDataSetRef) { insertRef(element, dataset.getDataSet(childDataSets[i]), childDirectory); } else { insert(element, dataset.getDataSet(childDataSets[i]), childDirectory); } } String[] childDSS = dataset.getDataSetSeismogramNames(); File dataDir = new File(directory, "data"); dataDir.mkdirs(); for (int i = 0; i < childDSS.length; i++) { DataSetSeismogram dss = dataset.getDataSetSeismogram(childDSS[i]); URLDataSetSeismogram urlDSS; if (saveLocally || ! (dss instanceof URLDataSetSeismogram)) { urlDSS = URLDataSetSeismogram.localize(dss, dataDir); } else { urlDSS = (URLDataSetSeismogram)dss; } insert(element, urlDSS, directory.toURI().toURL()); } String[] paramNames = dataset.getParameterNames(); for (int i = 0; i < paramNames.length; i++) { insert(element, paramNames[i], dataset.getParameter(paramNames[i])); } }
| 1,115,607
|
public Element insertRef(Element element, DataSet dataset, File directory) throws IOException, ParserConfigurationException, MalformedURLException { File dsFile = save(dataset, directory); return insertRef(element, dsFile.toURI().toURL().toString(), dataset.getName()); }
|
public Element insertRef(Element element, DataSet dataset, File directory) throws IOException, ParserConfigurationException, MalformedURLException { File dsFile = save(dataset, directory); return insertRef(element, directory.getName()+"/"+dsFile.getName(), dataset.getName()); }
| 1,115,608
|
public static String getText(Element config) { if(config == null) return null; NodeList children = config.getChildNodes(); Node node; for (int i=0; i<children.getLength(); i++) { node = children.item(i); if (node instanceof Text) { return node.getNodeValue(); } } //nothing found, return null return null; }
|
public static String getText(Element config) { if(config == null) return new String(""); NodeList children = config.getChildNodes(); Node node; for (int i=0; i<children.getLength(); i++) { node = children.item(i); if (node instanceof Text) { return node.getNodeValue(); } } //nothing found, return null return null; }
| 1,115,609
|
public static String getText(Element config) { if(config == null) return null; NodeList children = config.getChildNodes(); Node node; for (int i=0; i<children.getLength(); i++) { node = children.item(i); if (node instanceof Text) { return node.getNodeValue(); } } //nothing found, return null return null; }
|
public static String getText(Element config) { if(config == null) return new String(""); NodeList children = config.getChildNodes(); Node node; for (int i=0; i<children.getLength(); i++) { node = children.item(i); if (node instanceof Text) { return node.getNodeValue(); } } //nothing found, return null return new String(""); }
| 1,115,610
|
public void addDataSetSeismogram(DataSetSeismogram dss, AuditInfo[] audit) { if (datasetSeismogramNames.contains(dss.getName())) { int n = 1; String tmpName = dss.getName(); while(datasetSeismogramNames.contains(dss.getName())) { n++; tmpName = dss.getName()+"."+n; } // found a num that isn't used dss.setName(tmpName); } dss.setDataSet(this); datasetSeismograms.put(dss.getName(), dss); datasetSeismogramNames.add(dss.getName()); }
|
public void addDataSetSeismogram(DataSetSeismogram dss, AuditInfo[] audit) { if (datasetSeismogramNames.contains(dss.getName())) { int n = 1; String tmpName = dss.getName(); while(datasetSeismogramNames.contains(tmpName)) { n++; tmpName = dss.getName()+"."+n; } // found a num that isn't used dss.setName(tmpName); } dss.setDataSet(this); datasetSeismograms.put(dss.getName(), dss); datasetSeismogramNames.add(dss.getName()); }
| 1,115,611
|
public void run() { try { // no gwebcache actions if we have no auto connect and are // not connected to any host NetworkHostsContainer networkHostsCont = HostManager.getInstance().getNetworkHostsContainer(); if ( NetworkManager.getInstance().isConnected() || networkHostsCont.getTotalConnectionCount() > 0 ) { invokeQueryMoreGWebCachesRequest( false ); invokeQueryMoreHostsRequest( true ); } } catch ( Throwable th) { NLogger.error( NLoggerNames.GWEBCACHE, th, th ); } }
|
public void run() { try { // no gwebcache actions if we have no auto connect and are // not connected to any host NetworkHostsContainer networkHostsCont = HostManager.getInstance().getNetworkHostsContainer(); if ( NetworkManager.getInstance().isConnected() || networkHostsCont.getTotalConnectionCount() > 0 ) { invokeQueryMoreHostsRequest( true ); } } catch ( Throwable th) { NLogger.error( NLoggerNames.GWEBCACHE, th, th ); } }
| 1,115,612
|
public boolean updateRemoteGWebCache( DestAddress myHostAddress, boolean preferPhex ) { String fullHostName = null; if ( myHostAddress != null ) { fullHostName = myHostAddress.getFullHostName(); } int retrys = 0; boolean succ = false; do { retrys ++; GWebCacheConnection connection = getRandomGWebCacheConnection( preferPhex ); // continue if no connection... if ( connection == null ) { continue; } GWebCache gWebCache = getGWebCacheForUpdate( connection.getGWebCache() ); assert !gWebCache.isPhexCache() && gWebCache.equals( connection.getGWebCache() ) : "isPhexCache: " + gWebCache.isPhexCache() + ",equals " + gWebCache.getUrl() + " - " + connection.getGWebCache().getUrl(); String urlString = null; if ( gWebCache != null ) { urlString = gWebCache.getUrl().toExternalForm(); } if ( fullHostName == null && urlString == null ) { // no data to update... try again to determine random GWebCache in loop continue; } succ = connection.updateRequest( fullHostName, urlString ); // continue if cache is bad or not successful... if ( !verifyGWebCache( connection ) || !succ ) { continue; } } // do this max 5 times or until we where successful while ( !succ && retrys < 5 ); return succ; }
|
public boolean updateRemoteGWebCache( DestAddress myHostAddress, boolean preferPhex ) { String fullHostName = null; if ( myHostAddress != null ) { fullHostName = myHostAddress.getFullHostName(); } int retrys = 0; boolean succ = false; do { retrys ++; GWebCacheConnection connection = getRandomGWebCacheConnection( preferPhex ); // continue if no connection... if ( connection == null ) { continue; } GWebCache gWebCache = getGWebCacheForUpdate( connection.getGWebCache() ); assert !gWebCache.isPhexCache() && !gWebCache.equals( connection.getGWebCache() ) : "isPhexCache: " + gWebCache.isPhexCache() + ",equals " + gWebCache.getUrl() + " - " + connection.getGWebCache().getUrl(); String urlString = null; if ( gWebCache != null ) { urlString = gWebCache.getUrl().toExternalForm(); } if ( fullHostName == null && urlString == null ) { // no data to update... try again to determine random GWebCache in loop continue; } succ = connection.updateRequest( fullHostName, urlString ); // continue if cache is bad or not successful... if ( !verifyGWebCache( connection ) || !succ ) { continue; } } // do this max 5 times or until we where successful while ( !succ && retrys < 5 ); return succ; }
| 1,115,614
|
private void annotateOperators(OperatorSet o) { OP_GT = new XOperator(o.getGT(),XOperator.BINARY+XOperator.LEFT+XOperator.TRANSITIVE); OP_LT = new XOperator(o.getLT(),XOperator.BINARY+XOperator.LEFT+XOperator.TRANSITIVE); OP_EQ = new XOperator(o.getEQ(),XOperator.BINARY+XOperator.LEFT+XOperator.EQUIVILENCE); OP_LE = new XOperator(o.getLE(),XOperator.BINARY+XOperator.LEFT+XOperator.REFLEXIVE+XOperator.TRANSITIVE); OP_GE = new XOperator(o.getGE(),XOperator.BINARY+XOperator.LEFT+XOperator.REFLEXIVE+XOperator.TRANSITIVE); OP_NE = new XOperator(o.getNE(),XOperator.BINARY+XOperator.LEFT+XOperator.SYMMETRIC); OP_AND = new XOperator(o.getAnd(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE+XOperator.USE_BINDING_FOR_PRINT); OP_OR = new XOperator(o.getOr(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_NOT = new XOperator(o.getNot(),XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_ADD = new XOperator(o.getAdd(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_SUBTRACT = new XOperator(o.getSubtract(),XOperator.BINARY+XOperator.LEFT+XOperator.COMPOSITE+XOperator.USE_BINDING_FOR_PRINT); OP_UMINUS = new XOperator(o.getUMinus(),XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_MULTIPLY = new XOperator(o.getMultiply(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_DIVIDE = new XOperator(o.getDivide(),XOperator.BINARY+XOperator.LEFT+XOperator.COMPOSITE); OP_MOD = new XOperator(o.getMod(),XOperator.BINARY+XOperator.LEFT); /** unary division i.e. 1/x or x^(-1) **/ OP_UDIVIDE = new XOperator("UDivide","^-1",null,XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_POWER = new XOperator(o.getPower(),XOperator.BINARY+XOperator.LEFT); OP_ASSIGN = new XOperator("=",new XAssign(),XOperator.BINARY+XOperator.RIGHT); // OP_DOT = new XOperator(o.getDot(),XOperator.BINARY+XOperator.RIGHT); // OP_CROSS = new XOperator(o.getCross(),XOperator.BINARY+XOperator.RIGHT); // OP_LIST = new XOperator(o.getList(),XOperator.NARY+XOperator.RIGHT); // setPrecedenceTable(new Operator[][] { {OP_UMINUS}, {OP_NOT}, {OP_POWER}, {OP_MULTIPLY,OP_DIVIDE,OP_MOD,OP_DOT,OP_CROSS}, {OP_ADD,OP_SUBTRACT}, {OP_LT,OP_LE}, {OP_GT,OP_GE}, {OP_EQ}, {OP_NE}, {OP_AND}, {OP_OR}, {OP_ASSIGN}, }); //printOperators(); // ((XOperator) OP_ADD).setInverseOp(OP_UMINUS); ((XOperator) OP_ADD).setBinaryInverseOp(OP_SUBTRACT); ((XOperator) OP_SUBTRACT).setRootOp(OP_ADD); ((XOperator) OP_SUBTRACT).setInverseOp(OP_UMINUS); ((XOperator) OP_UMINUS).setRootOp(OP_ADD); ((XOperator) OP_UMINUS).setBinaryInverseOp(OP_SUBTRACT); ((XOperator) OP_MULTIPLY).setInverseOp(OP_UDIVIDE); ((XOperator) OP_MULTIPLY).setBinaryInverseOp(OP_DIVIDE); ((XOperator) OP_DIVIDE).setRootOp(OP_MULTIPLY); ((XOperator) OP_DIVIDE).setInverseOp(OP_UDIVIDE); ((XOperator) OP_UDIVIDE).setRootOp(OP_MULTIPLY); ((XOperator) OP_UDIVIDE).setBinaryInverseOp(OP_DIVIDE); // Set distribuative over ((XOperator) OP_UMINUS).setDistributiveOver(OP_ADD); // -(a+b) -> (-a) + (-b) ((XOperator) OP_UMINUS).setDistributiveOver(OP_SUBTRACT); // -(a-b) -> (-a) - (-b) ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_ADD); // a*(b+c) -> a*b + a*c ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_SUBTRACT); // a*(b-c) -> a*b - a*c ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_UMINUS); // a*(-b) -> -(a*b) }
|
private void annotateOperators(OperatorSet o) { OP_GT = new XOperator(o.getGT(),XOperator.BINARY+XOperator.LEFT+XOperator.TRANSITIVE); OP_LT = new XOperator(o.getLT(),XOperator.BINARY+XOperator.LEFT+XOperator.TRANSITIVE); OP_EQ = new XOperator(o.getEQ(),XOperator.BINARY+XOperator.LEFT+XOperator.EQUIVILENCE); OP_LE = new XOperator(o.getLE(),XOperator.BINARY+XOperator.LEFT+XOperator.REFLEXIVE+XOperator.TRANSITIVE); OP_GE = new XOperator(o.getGE(),XOperator.BINARY+XOperator.LEFT+XOperator.REFLEXIVE+XOperator.TRANSITIVE); OP_NE = new XOperator(o.getNE(),XOperator.BINARY+XOperator.LEFT+XOperator.SYMMETRIC); OP_AND = new XOperator(o.getAnd(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE+XOperator.USE_BINDING_FOR_PRINT); OP_OR = new XOperator(o.getOr(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_NOT = new XOperator(o.getNot(),XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_ADD = new XOperator(o.getAdd(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_SUBTRACT = new XOperator(o.getSubtract(),XOperator.BINARY+XOperator.LEFT+XOperator.COMPOSITE+XOperator.USE_BINDING_FOR_PRINT); OP_UMINUS = new XOperator(o.getUMinus(),XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_MULTIPLY = new XOperator(o.getMultiply(),XOperator.BINARY+XOperator.LEFT+XOperator.COMMUTATIVE+XOperator.ASSOCIATIVE); OP_DIVIDE = new XOperator(o.getDivide(),XOperator.BINARY+XOperator.LEFT+XOperator.COMPOSITE); OP_MOD = new XOperator(o.getMod(),XOperator.BINARY+XOperator.LEFT); /** unary division i.e. 1/x or x^(-1) **/ OP_UDIVIDE = new XOperator("UDivide","^-1",null,XOperator.UNARY+XOperator.RIGHT+XOperator.PREFIX+XOperator.SELF_INVERSE); OP_POWER = new XOperator(o.getPower(),XOperator.BINARY+XOperator.LEFT); OP_ASSIGN = new XOperator("=",new XAssign(),XOperator.BINARY+XOperator.RIGHT); // OP_DOT = new XOperator(o.getDot(),XOperator.BINARY+XOperator.RIGHT); // OP_CROSS = new XOperator(o.getCross(),XOperator.BINARY+XOperator.RIGHT); // OP_LIST = new XOperator(o.getList(),XOperator.NARY+XOperator.RIGHT); // setPrecedenceTable(new Operator[][] { {OP_UMINUS}, {OP_NOT}, {OP_POWER}, {OP_MULTIPLY,OP_DIVIDE,OP_MOD,OP_DOT,OP_CROSS}, {OP_ADD,OP_SUBTRACT}, {OP_LT,OP_LE}, {OP_GT,OP_GE}, {OP_EQ}, {OP_NE}, {OP_AND}, {OP_OR}, {OP_ASSIGN}, }); //printOperators(); // ((XOperator) OP_ADD).setInverseOp(OP_UMINUS); ((XOperator) OP_ADD).setBinaryInverseOp(OP_SUBTRACT); ((XOperator) OP_SUBTRACT).setRootOp(OP_ADD); ((XOperator) OP_SUBTRACT).setInverseOp(OP_UMINUS); ((XOperator) OP_UMINUS).setRootOp(OP_ADD); ((XOperator) OP_UMINUS).setBinaryInverseOp(OP_SUBTRACT); ((XOperator) OP_MULTIPLY).setInverseOp(OP_UDIVIDE); ((XOperator) OP_MULTIPLY).setBinaryInverseOp(OP_DIVIDE); ((XOperator) OP_DIVIDE).setRootOp(OP_MULTIPLY); ((XOperator) OP_DIVIDE).setInverseOp(OP_UDIVIDE); ((XOperator) OP_UDIVIDE).setRootOp(OP_MULTIPLY); ((XOperator) OP_UDIVIDE).setBinaryInverseOp(OP_DIVIDE); // Set distribuative over ((XOperator) OP_UMINUS).setDistributiveOver(OP_ADD); // -(a+b) -> (-a) + (-b) ((XOperator) OP_UMINUS).setDistributiveOver(OP_SUBTRACT); // -(a-b) -> (-a) - (-b) ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_ADD); // a*(b+c) -> a*b + a*c ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_SUBTRACT); // a*(b-c) -> a*b - a*c ((XOperator) OP_MULTIPLY).setDistributiveOver(OP_UMINUS); // a*(-b) -> -(a*b) }
| 1,115,615
|
public void addDataSetSeismogram(DataSetSeismogram dss) { String name; name = dss.getName(); if ( name == null || name.length == 0) { name = ChannelIdUtil.toStringNoDates(dss.getRequestFilter().channel_id); } // end of if () name = getUniqueName(getDataSetSeismogramNames(), name); if ( ! name.equals(dss.getName()) ) { dss.setName(name); } // end of if () dssNames.add(name); dataSetSeismograms.put(name, dss); }
|
public void addDataSetSeismogram(DataSetSeismogram dss) { String name; name = dss.getName(); if ( name == null || name.length == 0) { name = ChannelIdUtil.toStringNoDates(dss.getRequestFilter().channel_id); } // end of if () name = getUniqueName(getDataSetSeismogramNames(), name); if ( ! name.equals(dss.getName()) ) { dss.setName(name); } // end of if () dssNames.add(name); dataSetSeismograms.put(name, dss); }
| 1,115,616
|
public abstract ChangeLogSet parse(Build build, File changelogFile) throws IOException, SAXException;
|
public abstract ChangeLogSet<? extends Entry> parse(Build build, File changelogFile) throws IOException, SAXException;
| 1,115,617
|
public void freeze(SuiteResult parent) { this.parent = parent; if(!isPassed()) { CaseResult prev = getPreviousResult(); if(prev!=null && !prev.isPassed()) this.failedSince = prev.failedSince; else this.failedSince = getOwner().getNumber(); } }
|
public void freeze(SuiteResult parent) { this.parent = parent; if(!isPassed() && failedSince==0) { CaseResult prev = getPreviousResult(); if(prev!=null && !prev.isPassed()) this.failedSince = prev.failedSince; else this.failedSince = getOwner().getNumber(); } }
| 1,115,618
|
/*package*/ void setNode(Node node) { assert node!=null; this.node = node; setNumExecutors(node.getNumExecutors()); }
|
/*package*/ void setNode(Node node) { assert node!=null; if(node instanceof Slave) this.nodeName = node.getNodeName(); else this.nodeName = null; setNumExecutors(node.getNumExecutors()); }
| 1,115,621
|
public static DataSetSeismogram[][] getComponents(DataSetSeismogram[] dss, String suffix){ List names = new ArrayList(); List north = new ArrayList(); List east = new ArrayList(); List z = new ArrayList(); for(int i = 0; i < dss.length; i++){ if(!names.contains(dss[i].getSeismogram().getName())){ LocalSeismogramImpl seis = dss[i].getSeismogram(); XMLDataSet dataSet = (XMLDataSet)dss[i].getDataSet(); ChannelId[] channelGroup = DataSetChannelGrouper.retrieveGrouping(dataSet, seis.getChannelID()); for(int counter = 0; counter < channelGroup.length; counter++) { LocalSeismogram[] newSeismograms = DisplayUtils.getSeismogram(channelGroup[counter], dataSet, new TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime())); for(int j = 0; j < newSeismograms.length; j++){ DataSetSeismogram current = new DataSetSeismogram((LocalSeismogramImpl)newSeismograms[j], dataSet, ((LocalSeismogramImpl)newSeismograms[i]).getName()+ suffix); if(DisplayUtils.getOrientationName(channelGroup[counter].channel_code).equals("North")){ north.add(current); }else if(DisplayUtils.getOrientationName(channelGroup[counter].channel_code).equals("East")){ east.add(current); }else{ z.add(current); } names.add(current.getSeismogram().getName()); } } } } DataSetSeismogram[][] sortedSeismos = new DataSetSeismogram[3][]; sortedSeismos[0] = ((DataSetSeismogram[])north.toArray(new DataSetSeismogram[north.size()])); sortedSeismos[1] = ((DataSetSeismogram[])east.toArray(new DataSetSeismogram[east.size()])); sortedSeismos[2] = ((DataSetSeismogram[])z.toArray(new DataSetSeismogram[z.size()])); return sortedSeismos; }
|
public static DataSetSeismogram[][] getComponents(DataSetSeismogram[] dss, String suffix){ List names = new ArrayList(); List north = new ArrayList(); List east = new ArrayList(); List z = new ArrayList(); for(int i = 0; i < dss.length; i++){ if(!names.contains(dss[i].getSeismogram().getName())){ LocalSeismogramImpl seis = dss[i].getSeismogram(); XMLDataSet dataSet = (XMLDataSet)dss[i].getDataSet(); ChannelId[] channelGroup = DataSetChannelGrouper.retrieveGrouping(dataSet, seis.getChannelID()); for(int counter = 0; counter < channelGroup.length; counter++) { LocalSeismogram[] newSeismograms = DisplayUtils.getSeismogram(channelGroup[counter], dataSet, new TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime())); for(int j = 0; j < newSeismograms.length; j++){ DataSetSeismogram current = new DataSetSeismogram((LocalSeismogramImpl)newSeismograms[j], dataSet, ((LocalSeismogramImpl)newSeismograms[i]).getName()+ suffix); if(DisplayUtils.getOrientationName(channelGroup[counter].channel_code).equals("North")){ north.add(current); }else if(DisplayUtils.getOrientationName(channelGroup[counter].channel_code).equals("East")){ east.add(current); }else{ z.add(current); } names.add(current.getSeismogram().getName()); } } } } DataSetSeismogram[][] sortedSeismos = new DataSetSeismogram[3][]; sortedSeismos[0] = ((DataSetSeismogram[])north.toArray(new DataSetSeismogram[north.size()])); sortedSeismos[1] = ((DataSetSeismogram[])east.toArray(new DataSetSeismogram[east.size()])); sortedSeismos[2] = ((DataSetSeismogram[])z.toArray(new DataSetSeismogram[z.size()])); return sortedSeismos; }
| 1,115,622
|
public void findFittingPartForRange( Range requestedRange ) { Range availableRange; Iterator iterator = availableRangeSet.getIterator(); long fileSize = getFileSize(); while ( iterator.hasNext() ) { availableRange = (Range)iterator.next(); if ( availableRange.isRangeSatisfiable( requestedRange, fileSize ) ) { partialFile = swDownloadFile.getIncompleteFile(); long startOffset = requestedRange.getStartOffset( fileSize ); long endOffset = Math.min( requestedRange.getEndOffset( fileSize ), availableRange.getEndOffset( fileSize ) ); requestedRange.update( startOffset, endOffset ); fileStartOffset = startOffset; return; } } }
|
public void findFittingPartForRange( Range requestedRange ) { Range availableRange; Iterator iterator = availableRangeSet.getIterator(); long fileSize = getFileSize(); while ( iterator.hasNext() ) { availableRange = (Range)iterator.next(); if ( availableRange.isRangeSatisfiable( requestedRange, fileSize ) ) { partialFile = swDownloadFile.getIncompleteFile(); long startOffset = requestedRange.getStartOffset( fileSize ); long endOffset = Math.min( requestedRange.getEndOffset( fileSize ), availableRange.getEndOffset( fileSize ) ); requestedRange.update( startOffset, endOffset ); fileStartOffset = startOffset; return; } } }
| 1,115,623
|
public Diff() { super(); numberOfParameters = 2; }
|
public Diff() { super(); super.numberOfParameters = 2; }
| 1,115,624
|
public NetworkAttr get_attributes() { int count = 0; RuntimeException lastException = null; while (count < retry) { try { return net.get_attributes(); } catch (RuntimeException t) { lastException = t; logger.warn("Caught exception, retrying "+count+" of "+retry, t); } count++; } throw lastException; }
|
public NetworkAttr get_attributes() { int count = 0; RuntimeException lastException = null; while (count < retry) { try { return net.get_attributes(); } catch (RuntimeException t) { lastException = t; logger.warn("Caught exception, retrying "+ ++count +" of "+retry, t); } count++; } throw lastException; }
| 1,115,625
|
public NetworkAttr get_attributes() { int count = 0; RuntimeException lastException = null; while (count < retry) { try { return net.get_attributes(); } catch (RuntimeException t) { lastException = t; logger.warn("Caught exception, retrying "+count+" of "+retry, t); } count++; } throw lastException; }
|
public NetworkAttr get_attributes() { int count = 0; RuntimeException lastException = null; while (count < retry) { try { return net.get_attributes(); } catch (RuntimeException t) { lastException = t; logger.warn("Caught exception, retrying "+count+" of "+retry, t); } } throw lastException; }
| 1,115,626
|
public void mul(PNodeI term,PNodeI power) throws ParseException { for(int i=0;i<length;++i) { if(terms[i].equals(term)) { powers[i] = powers[i].add(power); return; } } // insert in correct posn PNodeI newTerms[] = new PNodeI[length+1]; PNodeI newPowers[] = new PNodeI[length+1]; int pos=0; boolean done = false; for(int i=0;i<length;++i) { if(!done && terms[i].compareTo(term) > 0) { newTerms[pos] = term; newPowers[pos] = power; ++pos; done = true; } newTerms[pos] = terms[i]; newPowers[pos] = powers[i]; ++pos; } if(!done) { newTerms[pos] = term; newPowers[pos] = power; ++pos; } length = length+1; terms = newTerms; powers = newPowers; }
|
public void mul(PConstant c) throws ParseException { for(int i=0;i<length;++i) { if(terms[i].equals(term)) { powers[i] = powers[i].add(power); return; } } // insert in correct posn PNodeI newTerms[] = new PNodeI[length+1]; PNodeI newPowers[] = new PNodeI[length+1]; int pos=0; boolean done = false; for(int i=0;i<length;++i) { if(!done && terms[i].compareTo(term) > 0) { newTerms[pos] = term; newPowers[pos] = power; ++pos; done = true; } newTerms[pos] = terms[i]; newPowers[pos] = powers[i]; ++pos; } if(!done) { newTerms[pos] = term; newPowers[pos] = power; ++pos; } length = length+1; terms = newTerms; powers = newPowers; }
| 1,115,627
|
public void mul(PNodeI term,PNodeI power) throws ParseException { for(int i=0;i<length;++i) { if(terms[i].equals(term)) { powers[i] = powers[i].add(power); return; } } // insert in correct posn PNodeI newTerms[] = new PNodeI[length+1]; PNodeI newPowers[] = new PNodeI[length+1]; int pos=0; boolean done = false; for(int i=0;i<length;++i) { if(!done && terms[i].compareTo(term) > 0) { newTerms[pos] = term; newPowers[pos] = power; ++pos; done = true; } newTerms[pos] = terms[i]; newPowers[pos] = powers[i]; ++pos; } if(!done) { newTerms[pos] = term; newPowers[pos] = power; ++pos; } length = length+1; terms = newTerms; powers = newPowers; }
|
public void mul(PNodeI term,PNodeI power) throws ParseException { for(int i=0;i<length;++i) { if(terms[i].equals(term)) { powers[i] = powers[i].add(power); return; } } // insert in correct posn PNodeI newTerms[] = new PNodeI[length+1]; PNodeI newPowers[] = new PNodeI[length+1]; int pos=0; boolean done = false; for(int i=0;i<length;++i) { if(!done && terms[i].compareTo(term) > 0) { newTerms[pos] = term; newPowers[pos] = power; ++pos; done = true; } newTerms[pos] = terms[i]; newPowers[pos] = powers[i]; ++pos; } if(!done) { newTerms[pos] = term; newPowers[pos] = power; ++pos; } length = length+1; terms = newTerms; powers = newPowers; }
| 1,115,628
|
void power(PConstant c) throws ParseException { coeff = (PConstant) c.pow(c); for(int i=0;i<length;++i) powers[i] = powers[i].mul(c); }
|
void power(PConstant c) throws ParseException { coeff = (PConstant) coeff.pow(c); for(int i=0;i<length;++i) powers[i] = powers[i].mul(c); }
| 1,115,629
|
public Process(Entity entity, String docCode) { super(entity, docCode); }
|
public Process(Entity entity, String docCode) { super(entity, docCode); }
| 1,115,630
|
public RemoteFile[] getSelectedRemoteFiles( boolean singleForAll ) { ISearchDataModel searchDataModel = searchTreeTableModel.getDisplayedResultsData(); if (searchDataModel == null) { return EMPTY_REMOTE_FILE_ARRAY; } TreePath[] selectionPaths = searchTreeTable.getTreeSelectionModel().getSelectionPaths(); if ( selectionPaths.length == 0 ) { return EMPTY_REMOTE_FILE_ARRAY; } HashSet remoteFileSet = new HashSet(); for ( int i = 0; i < selectionPaths.length; i++ ) { if ( selectionPaths[i].getPathCount() == 3 ) { if ( singleForAll ) { SearchResultElement element = (SearchResultElement)selectionPaths[i].getPathComponent( 1 ); RemoteFile[] files = element.getRemoteFiles(); remoteFileSet.addAll( Arrays.asList( files ) ); } else { RemoteFile remoteFile = (RemoteFile)selectionPaths[i].getPathComponent( 2 ); remoteFileSet.add( remoteFile ); } } else { SearchResultElement element = (SearchResultElement)selectionPaths[i].getPathComponent( 1 ); RemoteFile[] files = element.getRemoteFiles(); remoteFileSet.addAll( Arrays.asList( files ) ); } } RemoteFile[] result = new RemoteFile[ remoteFileSet.size() ]; remoteFileSet.toArray( result ); return result; }
|
public RemoteFile[] getSelectedRemoteFiles( boolean singleForAll ) { ISearchDataModel searchDataModel = searchTreeTableModel.getDisplayedResultsData(); if (searchDataModel == null) { return EMPTY_REMOTE_FILE_ARRAY; } TreePath[] selectionPaths = searchTreeTable.getTreeSelectionModel().getSelectionPaths(); if ( selectionPaths == null || selectionPaths.length == 0 ) { return EMPTY_REMOTE_FILE_ARRAY; } HashSet remoteFileSet = new HashSet(); for ( int i = 0; i < selectionPaths.length; i++ ) { if ( selectionPaths[i].getPathCount() == 3 ) { if ( singleForAll ) { SearchResultElement element = (SearchResultElement)selectionPaths[i].getPathComponent( 1 ); RemoteFile[] files = element.getRemoteFiles(); remoteFileSet.addAll( Arrays.asList( files ) ); } else { RemoteFile remoteFile = (RemoteFile)selectionPaths[i].getPathComponent( 2 ); remoteFileSet.add( remoteFile ); } } else { SearchResultElement element = (SearchResultElement)selectionPaths[i].getPathComponent( 1 ); RemoteFile[] files = element.getRemoteFiles(); remoteFileSet.addAll( Arrays.asList( files ) ); } } RemoteFile[] result = new RemoteFile[ remoteFileSet.size() ]; remoteFileSet.toArray( result ); return result; }
| 1,115,631
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
|
public SWDownloadFile getDownloadFile( int index ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
| 1,115,632
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
| 1,115,633
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return null; } return null; } }
| 1,115,634
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return null; } }
|
public SWDownloadFile getDownloadFile( long fileSize, URN matchURN ) { synchronized( downloadList ) { SWDownloadFile file = getDownloadFileByURN( matchURN ); if ( file != null && file.getTotalDataSize() == fileSize ) { return file; } return downloadList.get( index ); } }
| 1,115,635
|
private void prepareComponent() { CloseEventHandler closeEventHandler = new CloseEventHandler(); addWindowListener( closeEventHandler ); Container contentPane = getContentPane(); contentPane.setLayout( new BorderLayout() ); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns "4dlu, fill:p:grow, 12dlu, fill:p:grow, 8dlu," + // rows "p, 2dlu, p 4dlu" ); //btn rows PanelBuilder contentPB = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); ruleEditPanel = new JPanel(); ruleEditPanel.setLayout(new BorderLayout()); contentPB.add( ruleEditPanel, cc.xywh( 2, 2, 1, 1 ) ); ruleDescPanel = new RuleDescriptionPanel( this ); contentPB.add( ruleDescPanel, cc.xywh( 2, 4, 1, 1 ) ); // button bar contentPB.add( new JSeparator(), cc.xywh( 1, rowCount - 3, columnCount, 1 ) ); JButton backBtn = new JButton( Localizer.getString( "WizardDialog_Back" ) ); backBtn.addActionListener( new BackBtnListener()); nextBtn = new JButton( Localizer.getString( "WizardDialog_Next" ) ); nextBtn.setDefaultCapable( true ); nextBtn.setRequestFocusEnabled( true ); nextBtn.addActionListener( new NextBtnListener()); finishBtn = new JButton( Localizer.getString( "WizardDialog_Finish" ) ); finishBtn.addActionListener( new FinishBtnListener()); JButton cancelBtn = new JButton( Localizer.getString( "WizardDialog_Cancel" ) ); cancelBtn.addActionListener( closeEventHandler ); JPanel btnPanel = ButtonBarFactory.buildWizardBar(backBtn, nextBtn, finishBtn, cancelBtn); contentPB.add( btnPanel, cc.xywh( 2, rowCount - 1, columnCount - 2, 1 ) ); setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE ); getRootPane().setDefaultButton( nextBtn ); // set first panel to show... updatePage(); pack(); int height = getHeight(); setSize( height*5/4, height ); setLocationRelativeTo( getParent() ); }
|
private void prepareComponent() { CloseEventHandler closeEventHandler = new CloseEventHandler(); addWindowListener( closeEventHandler ); Container contentPane = getContentPane(); contentPane.setLayout( new BorderLayout() ); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns "4dlu, fill:p:grow, 12dlu, fill:p:grow, 8dlu," + // rows "p, 2dlu, p 4dlu" ); //btn rows PanelBuilder contentPB = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); ruleEditPanel = new JPanel(); ruleEditPanel.setLayout(new BorderLayout()); contentPB.add( ruleEditPanel, cc.xywh( 2, 2, 1, 1 ) ); ruleDescPanel = new RuleDescriptionPanel( this ); contentPB.add( ruleDescPanel, cc.xywh( 2, 4, 1, 1 ) ); // button bar contentPB.add( new JSeparator(), cc.xywh( 1, rowCount - 3, columnCount, 1 ) ); backBtn = new JButton( Localizer.getString( "WizardDialog_Back" ) ); backBtn.addActionListener( new BackBtnListener()); nextBtn = new JButton( Localizer.getString( "WizardDialog_Next" ) ); nextBtn.setDefaultCapable( true ); nextBtn.setRequestFocusEnabled( true ); nextBtn.addActionListener( new NextBtnListener()); finishBtn = new JButton( Localizer.getString( "WizardDialog_Finish" ) ); finishBtn.addActionListener( new FinishBtnListener()); JButton cancelBtn = new JButton( Localizer.getString( "WizardDialog_Cancel" ) ); cancelBtn.addActionListener( closeEventHandler ); JPanel btnPanel = ButtonBarFactory.buildWizardBar(backBtn, nextBtn, finishBtn, cancelBtn); contentPB.add( btnPanel, cc.xywh( 2, rowCount - 1, columnCount - 2, 1 ) ); setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE ); getRootPane().setDefaultButton( nextBtn ); // set first panel to show... updatePage(); pack(); int height = getHeight(); setSize( height*5/4, height ); setLocationRelativeTo( getParent() ); }
| 1,115,636
|
public UserRole findUserRoleByNaturalId(User user, Service service, String serviceExtension);
|
public UserRole findUserRoleByNaturalId(UserGroup userGroup, Service service, String serviceExtension);
| 1,115,638
|
public String getClockDifferenceString() { try { long diff = getClockDifference(); if(-1000<diff && diff <1000) return "In sync"; // clock is in sync long abs = Math.abs(diff); String s = Util.getTimeSpanString(abs); if(diff<0) s += " ahead"; else s += " behind"; if(diff>100*60) // more than a minute difference s = "<span class='error'>"+s+"</span>"; return s; } catch (IOException e) { return "<span class='error'>Unable to check</span>"; } }
|
public String getClockDifferenceString() { try { long diff = getClockDifference(); if(-1000<diff && diff <1000) return "In sync"; // clock is in sync long abs = Math.abs(diff); String s = Util.getTimeSpanString(abs); if(diff<0) s += " ahead"; else s += " behind"; if(abs>100*60) // more than a minute difference s = "<span class='error'>"+s+"</span>"; return s; } catch (IOException e) { return "<span class='error'>Unable to check</span>"; } }
| 1,115,639
|
public Entity findDefaultEntity() { return entityDao.findDefaultEntity().getDefaultEntity().getEntity(); }
|
public Entity findDefaultEntity() { return entityDao.findDefaultEntity(); }
| 1,115,640
|
public PSNEventInfo(DataInputStream data) throws IOException{ dis = data; time = new PSNDateTime(dis); //System.out.println(time.toString()); lat = SacTimeSeries.swapBytes(dis.readDouble()); lon = SacTimeSeries.swapBytes(dis.readDouble()); depthKM = SacTimeSeries.swapBytes(dis.readDouble()); magnitudes = new double[6]; for (int i = 0; i < magnitudes.length; i++) { magnitudes[i] = (double)SacTimeSeries.swapBytes(dis.readShort())/100.0; } dis.readFully(fourBytes); otherMagType = new String(fourBytes); eventType = dis.readByte(); locationQuality = dis.readByte(); flags = SacTimeSeries.swapBytes((short)dis.readUnsignedShort()); dis.readFully(sixBytes); reportingAgency = new String(sixBytes); }
|
public PSNEventInfo(DataInputStream data) throws IOException{ dis = data; time = new PSNDateTime(dis); //System.out.println(time.toString()); lat = SacTimeSeries.swapBytes(dis.readDouble()); lon = SacTimeSeries.swapBytes(dis.readDouble()); depthKM = SacTimeSeries.swapBytes(dis.readDouble()); magnitudes = new double[6]; for (int i = 0; i < magnitudes.length; i++) { magnitudes[i] = (double)SacTimeSeries.swapBytes(dis.readShort())/100.0; } dis.readFully(fourBytes); otherMagType = new String(PSNDataFile.chopToLength(fourBytes)); eventType = dis.readByte(); locationQuality = dis.readByte(); flags = SacTimeSeries.swapBytes((short)dis.readUnsignedShort()); dis.readFully(sixBytes); reportingAgency = new String(sixBytes); }
| 1,115,641
|
public PSNEventInfo(DataInputStream data) throws IOException{ dis = data; time = new PSNDateTime(dis); //System.out.println(time.toString()); lat = SacTimeSeries.swapBytes(dis.readDouble()); lon = SacTimeSeries.swapBytes(dis.readDouble()); depthKM = SacTimeSeries.swapBytes(dis.readDouble()); magnitudes = new double[6]; for (int i = 0; i < magnitudes.length; i++) { magnitudes[i] = (double)SacTimeSeries.swapBytes(dis.readShort())/100.0; } dis.readFully(fourBytes); otherMagType = new String(fourBytes); eventType = dis.readByte(); locationQuality = dis.readByte(); flags = SacTimeSeries.swapBytes((short)dis.readUnsignedShort()); dis.readFully(sixBytes); reportingAgency = new String(sixBytes); }
|
public PSNEventInfo(DataInputStream data) throws IOException{ dis = data; time = new PSNDateTime(dis); //System.out.println(time.toString()); lat = SacTimeSeries.swapBytes(dis.readDouble()); lon = SacTimeSeries.swapBytes(dis.readDouble()); depthKM = SacTimeSeries.swapBytes(dis.readDouble()); magnitudes = new double[6]; for (int i = 0; i < magnitudes.length; i++) { magnitudes[i] = (double)SacTimeSeries.swapBytes(dis.readShort())/100.0; } dis.readFully(fourBytes); otherMagType = new String(fourBytes); eventType = dis.readByte(); locationQuality = dis.readByte(); flags = SacTimeSeries.swapBytes((short)dis.readUnsignedShort()); dis.readFully(sixBytes); reportingAgency = new String(PSNDataFile.chopToLength(sixBytes)); }
| 1,115,642
|
public void run(){ LocalSeismogramImpl[] containedSeis = container.getSeismograms(); List alreadyFiltered = new ArrayList(); Iterator it = data.iterator(); boolean found = false; while(it.hasNext()){ SoftReference currentRef = (SoftReference)it.next(); LocalSeismogramImpl current = (LocalSeismogramImpl)currentRef.get(); if(current == null){ it.remove(); break; } for (int i = 0; i < containedSeis.length && !found; i++){ if(current.getEndTime().equals(containedSeis[i].getEndTime()) && current.getBeginTime().equals(containedSeis[i].getBeginTime())){ found = true; alreadyFiltered.add(containedSeis[i]); } } if(!found){ it.remove(); } } for (int i = 0; i < containedSeis.length; i++){ it = alreadyFiltered.iterator(); found = false; while(it.hasNext()){ for (int j = 0; j < containedSeis.length && !found; j++) { if(containedSeis == it.next()){ found = true; } } } if(!found){ data.add(new SoftReference(filterData(containedSeis[i], filter))); } } if((containedSeis.length - alreadyFiltered.size()) > 0){ pushData(getFilteredSeismograms(), null); } }
|
public void run(){ LocalSeismogramImpl[] containedSeis = container.getSeismograms(); List alreadyFiltered = new ArrayList(); Iterator it = data.iterator(); boolean found = false; while(it.hasNext()){ SoftReference currentRef = (SoftReference)it.next(); LocalSeismogramImpl current = (LocalSeismogramImpl)currentRef.get(); if(current == null){ it.remove(); break; } for (int i = 0; i < containedSeis.length && !found; i++){ if(current.getEndTime().equals(containedSeis[i].getEndTime()) && current.getBeginTime().equals(containedSeis[i].getBeginTime())){ found = true; alreadyFiltered.add(containedSeis[i]); } } if(!found){ it.remove(); } } for (int i = 0; i < containedSeis.length; i++){ it = alreadyFiltered.iterator(); found = false; while(it.hasNext()){ for (int j = 0; j < containedSeis.length && !found; j++) { if(containedSeis == it.next()){ found = true; } } } if(!found){ data.add(new SoftReference(filterData(containedSeis[i], filter))); } } if((containedSeis.length - alreadyFiltered.size()) > 0){ pushData(getFilteredSeismograms(), null); } }
| 1,115,643
|
public FilteredDataSetSeismogram(DataSetSeismogram dss, ColoredFilter filter){ super(dss.getDataSet(), filter.getName()); this.filter = filter; wrappedDSS = dss; container = new SeismogramContainer(this, wrappedDSS); }
|
public FilteredDataSetSeismogram(DataSetSeismogram dss, ColoredFilter filter){ super(dss.getDataSet(), filter.getName()); this.filter = filter; wrappedDSS = dss; container = new SeismogramContainer(this, wrappedDSS); }
| 1,115,644
|
public edu.iris.Fissures.Time getBeginTime() { return wrappedDSS.getBeginTime(); }
|
public Time getBeginTime() { return wrappedDSS.getBeginTime(); }
| 1,115,646
|
public edu.iris.Fissures.Time getEndTime() { return wrappedDSS.getEndTime(); }
|
public Time getEndTime() { return wrappedDSS.getEndTime(); }
| 1,115,647
|
public void setBeginTime(edu.iris.Fissures.Time time) { throw new UnsupportedOperationException("Cannot set begin time on filtered seismogram. It is entirely reliant on the wrapped dss time"); }
|
public void setBeginTime(Time time) { throw new UnsupportedOperationException("Cannot set begin time on filtered seismogram. It is entirely reliant on the wrapped dss time"); }
| 1,115,648
|
public void setEndTime(edu.iris.Fissures.Time time) { throw new UnsupportedOperationException("Cannot set end time on filtered seismogram. It is entirely reliant on the wrapped dss time"); }
|
public void setEndTime(Time time) { throw new UnsupportedOperationException("Cannot set end time on filtered seismogram. It is entirely reliant on the wrapped dss time"); }
| 1,115,649
|
public void simplifyTestString(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); if(!expected.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+expected+"\""); assertEquals("<"+expr+">",expected,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTestString(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.preprocess(node); Node simp = j.simplify(processed); String res = j.pv.toString(simp); if(!expected.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+expected+"\""); assertEquals("<"+expr+">",expected,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,650
|
public void simplifyTestString(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); if(!expected.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+expected+"\""); assertEquals("<"+expr+">",expected,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTestString(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.toString(simp); if(!expected.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+expected+"\""); assertEquals("<"+expr+">",expected,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,651
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.preprocess(node); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,652
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,653
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.preprocess(node2); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,654
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
|
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); Node processed = j.commandv.process(node,j); Node simp = j.simplify(processed); String res = j.pv.toString(simp); Node node2 = j.parse(expected); Node processed2 = j.commandv.process(node2,j); Node simp2 = j.simplify(processed2); String res2 = j.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
| 1,115,655
|
public StatRecord(String description, String unit, int value) { this.description = description; this.unit = unit; intValue = value; this.value = "" + value; }
|
public StatRecord(String description, String unit, int value) { this.description = description; this.unit = unit; intValue = value; this.value = "" + value; }
| 1,115,656
|
public static void deleteContentsRecursive(File file) throws IOException { for (File child : file.listFiles()) { if (child.isDirectory()) deleteContentsRecursive(child); if (!child.delete()) throw new IOException("Unable to delete " + child.getPath()); } }
|
public static void deleteContentsRecursive(File file) throws IOException { File[] files = file.listFiles(); if(files==null) return; for (File child : files) { if (child.isDirectory()) deleteContentsRecursive(child); if (!child.delete()) throw new IOException("Unable to delete " + child.getPath()); } }
| 1,115,657
|
static public int binom(int n,int i) { expand(n); return coeffs[n][i]; }
|
static public int binom(int n,int i) throws ArrayIndexOutOfBoundsException { expand(n); return coeffs[n][i]; }
| 1,115,658
|
public void testAuthenticateWithProxy() throws Exception { this.context = new CasSecurityContext(new TicketValidator() { public Assertion validate(String ticketId, Service service) throws ValidationException { return new AssertionImpl(new SimplePrincipal("test"), new HashMap()); } }, new SimpleService("test")); this.context.getOpaqueCredentialsInstance().setCredentials("ticket"); this.context.authenticate(); assertEquals("test", this.context.getProxyTicket(new SimpleService("test"))); }
|
public void testAuthenticateWithProxy() throws Exception { this.context = new CasSecurityContext(new TicketValidator() { public Assertion validate(String ticketId, Service service) throws ValidationException { return new AssertionImpl(new SimplePrincipal("test"), new HashMap(), new ProxyRetriever() { public String getProxyTicketIdFor(String proxyGrantingTicketId, Service targetService) { return "test"; } }, "proxyTicketId"); } }, new SimpleService("test")); this.context.getOpaqueCredentialsInstance().setCredentials("ticket"); this.context.authenticate(); assertEquals("test", this.context.getProxyTicket(new SimpleService("test"))); }
| 1,115,659
|
public Assertion validate(String ticketId, Service service) throws ValidationException { return new AssertionImpl(new SimplePrincipal("test"), new HashMap()); }
|
public Assertion validate(String ticketId, Service service) throws ValidationException { return new AssertionImpl(new SimplePrincipal("test"), new HashMap(), new ProxyRetriever() { public String getProxyTicketIdFor(String proxyGrantingTicketId, Service targetService) { return "test"; } }, "proxyTicketId"); }
| 1,115,660
|
public AbstractPNode(PolynomialCreator pc) { this.pc = pc; }
|
public AbstractPNode(PolynomialCreator pc) { this.pc = pc; }
| 1,115,663
|
public PNodeI add(PNodeI node) throws ParseException { if(node.isZero()) return this; if(this.isZero()) return node; if(this.equals(node)) return new Monomial(pc,pc.twoConstant,this); if(node instanceof Polynomial) return node.add(this); if(this.compareTo(node) < 0) return new Polynomial(pc,new PNodeI[]{this,node}); // x+y else return new Polynomial(pc,new PNodeI[]{node,this}); // x+y }
|
public PNodeI add(PNodeI node) throws ParseException { if(node.isZero()) return this; if(this.isZero()) return node; if(this.equals(node)) return new Monomial(pc,pc.twoConstant,this); if(node instanceof Polynomial) return node.add(this); if(this.compareTo(node) < 0) return new Polynomial(pc,new PNodeI[]{this,node}); // x+y else return new Polynomial(pc,new PNodeI[]{node,this}); // x+y }
| 1,115,664
|
public PNodeI mul(PNodeI node) throws ParseException { if(node.isZero()) return pc.zeroConstant; if(node.isOne()) return this; if(this.equals(node)) return new Monomial(pc,pc.oneConstant,this,pc.twoConstant); if(node instanceof Constant) return new Monomial(pc,(Constant) node,this); if(node instanceof Monomial) return ((Monomial) node).mul(this); if(this instanceof Constant) {// if(node instanceof Polynomial)// return ((Polynomial) node).mul((Constant) this); return new Monomial(pc,(Constant) this,node); } if(this.compareTo(node) < 0) return new Monomial(pc, pc.oneConstant, new PNodeI[]{this,node}, new PNodeI[]{pc.oneConstant,pc.oneConstant}); else return new Monomial(pc, pc.oneConstant, new PNodeI[]{node,this}, new PNodeI[]{pc.oneConstant,pc.oneConstant}); }
|
public PNodeI mul(PNodeI node) throws ParseException { if(node.isZero()) return pc.zeroConstant; if(node.isOne()) return this; if(this.equals(node)) return new Monomial(pc,pc.oneConstant,this,pc.twoConstant); if(node instanceof Constant) return new Monomial(pc,(Constant) node,this); if(node instanceof Monomial) return ((Monomial) node).mul(this); if(this instanceof Constant) {// if(node instanceof Polynomial)// return ((Polynomial) node).mul((Constant) this); return new Monomial(pc,(Constant) this,node); } if(this.compareTo(node) < 0) return new Monomial(pc, pc.oneConstant, new PNodeI[]{this,node}, new PNodeI[]{pc.oneConstant,pc.oneConstant}); else return new Monomial(pc, pc.oneConstant, new PNodeI[]{node,this}, new PNodeI[]{pc.oneConstant,pc.oneConstant}); }
| 1,115,665
|
public boolean isNegative() { try { return ((Double) value).compareTo(pc.zero) < 0; } catch(Exception e) { return false; } }
|
public boolean isNegative() { try { return ((Double) value).compareTo((Double) pc.zero) < 0; } catch(Exception e) { return false; } }
| 1,115,666
|
public FilteredSeismogramShape(ColoredFilter filter, DataSetSeismogram seismogram, JComponent parent){ super(parent, seismogram); this.seismogram = seismogram; this.filter = filter; }
|
public FilteredSeismogramShape(ColoredFilter filter, DataSetSeismogram seismogram, JComponent parent){ super(parent, seismogram); this.seismogram = seismogram; this.filter = filter; }
| 1,115,667
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException, SeedFormatException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
| 1,115,669
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
| 1,115,670
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = bytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
| 1,115,671
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette return null; } catch (InstantiationException e) { // must not be installed, skip this blockette return null; } catch (IllegalAccessException e) { // must not be installed, skip this blockette return null; } catch (InvocationTargetException e) { // must not be installed, skip this blockette return null; } }
|
public static Blockette parseBlockette(int type, byte[] bytes) throws IOException { try { //System.out.println(" Class.forName Blockette"+type); Class blocketteClass = Class.forName("edu.sc.seis.fissuresUtil.mseed.Blockette"+type); //System.out.println(" Class.forName suceeded"); Class[] argTypes = new Class[1]; // argTypes[0] = Class.forName("byte[]"); argTypes[0] = byte[].class; Constructor read = blocketteClass.getConstructor(argTypes); // blockette needs 4 bytes for type and next offset values, even // though their values are not used directly byte[] fullBytes = new byte[4+bytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(bytes, 0, fullBytes, 4, bytes.length); Object[] arguments = new Object[1]; arguments[0] = fullBytes; //System.out.println("Constructor suceeded"); Blockette blockette = (Blockette)read.newInstance(arguments); //System.out.println("read suceeded"); return blockette; } catch (ClassNotFoundException e) { // must not be installed, read an unknownblockette System.out.println(" Class.forName failed: "+type); Blockette blockette = new BlocketteUnknown(bytes, type); return blockette; } catch ( NoSuchMethodException e) { // must not be installed, skip this blockette throw new SeedFormatException("Can't load blockette for type="+type, e); } catch (InstantiationException e) { // must not be installed, skip this blockette throw new SeedFormatException("Can't load blockette for type="+type, e); } catch (IllegalAccessException e) { // must not be installed, skip this blockette throw new SeedFormatException("Can't load blockette for type="+type, e); } catch (InvocationTargetException e) { // must not be installed, skip this blockette throw new SeedFormatException("Can't load blockette for type="+type, e); } }
| 1,115,672
|
private boolean checkContents(File file, String contents) { try { String s = new BufferedReader(new FileReader(file)).readLine(); if(s==null) return false; return s.trim().equals(contents.trim()); } catch (IOException e) { return false; } }
|
private boolean checkContents(File file, String contents) { try { String s = new BufferedReader(new FileReader(file)).readLine(); if(s==null) return false; return s.trim().equals(contents.trim()); } catch (IOException e) { return false; } }
| 1,115,673
|
public SeedRecord getNextRecord() throws SeedFormatException, IOException { ControlHeader header = ControlHeader.read(inStream); if (header instanceof DataHeader) { return readDataRecord((DataHeader)header); } else {throw new SeedFormatException("Found a control record in miniseed");// return readControlRecord(header); } }
|
public SeedRecord getNextRecord() throws SeedFormatException, IOException { ControlHeader header = ControlHeader.read(inStream); if (header instanceof DataHeader) { return readDataRecord((DataHeader)header); } else {throw new SeedFormatException("Found a control record in miniseed");// return readControlRecord(header); } }
| 1,115,674
|
public SeedRecord getNextRecord() throws SeedFormatException, IOException { ControlHeader header = ControlHeader.read(inStream); if (header instanceof DataHeader) { return readDataRecord((DataHeader)header); } else {throw new SeedFormatException("Found a control record in miniseed");// return readControlRecord(header); } }
|
public SeedRecord getNextRecord() throws SeedFormatException, IOException { ControlHeader header = ControlHeader.read(inStream); if (header instanceof DataHeader) { return readDataRecord((DataHeader)header); else {throw new SeedFormatException("Found a control record in miniseed");// return readControlRecord(header);
| 1,115,675
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } byte[] fullBytes = new byte[4+blocketteBytes.length]; System.arraycopy(Utility.intToByteArray(type), 2, fullBytes, 0, 2); System.arraycopy(blocketteBytes, 0, fullBytes, 4, blocketteBytes.length); Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
| 1,115,676
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
| 1,115,677
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
|
protected DataRecord readDataRecord(DataHeader header) throws IOException, SeedFormatException { Assert.isTrue(header.getDataBlocketteOffset()>= header.getSize(), "Offset to first blockette must be larger than the header size"); byte[] garbage = new byte[header.getDataBlocketteOffset()- header.getSize()]; DataRecord dataRec = new DataRecord(header); if (garbage.length != 0) { inStream.readFully(garbage); } byte[] blocketteBytes; int currOffset = header.getDataBlocketteOffset(); int type, nextOffset; for (int i=0; i< header.getNumBlockettes() ; i++) { //get blockette type (first 2 bytes) byte hibyte = inStream.readByte(); byte lowbyte = inStream.readByte(); type = Utility.uBytesToInt(hibyte, lowbyte, false); // System.out.println("Blockette type "+type); hibyte = inStream.readByte(); lowbyte = inStream.readByte(); nextOffset = Utility.uBytesToInt(hibyte, lowbyte, false); // account for the 4 bytes above currOffset += 4; if (nextOffset != 0) { blocketteBytes = new byte[nextOffset - currOffset]; } else if (header.getDataOffset() > currOffset) { blocketteBytes = new byte[header.getDataOffset()- currOffset]; } else { blocketteBytes = new byte[0]; } inStream.readFully(blocketteBytes); if (nextOffset != 0) { currOffset = nextOffset; } else { currOffset += blocketteBytes.length; } Blockette b = Blockette.parseBlockette(type, blocketteBytes); dataRec.addBlockette(b); if (nextOffset == 0) { break; } } Blockette[] allBs = dataRec.getBlockettes(1000); if (allBs.length == 0) { // no data throw new SeedFormatException("no blockette 1000"); } else if (allBs.length > 1) { throw new SeedFormatException( "Multiple blockette 1000s in the volume. "+ allBs.length); } // System.out.println("allBs.length="+allBs.length); Blockette1000 b1000 = (Blockette1000)allBs[0]; // System.out.println(b1000); byte[] timeseries; if (header.getDataOffset() == 0) { // data record with no data, so gobble up the rest of the record timeseries = new byte[b1000.getDataRecordLength() - currOffset]; } else { timeseries = new byte[ b1000.getDataRecordLength() - header.getDataOffset() ]; } // System.out.println("getDataRecordLength() = "+ b1000.getDataRecordLength()); inStream.readFully(timeseries); dataRec.setData(timeseries); return dataRec; }
| 1,115,678
|
public SeedFormatException(String s) { super(s); }
|
public SeedFormatException(String s) { super(s); }
| 1,115,679
|
public void addUrn2FileMapping( ShareFile shareFile ) { assert( shareFile.getURN() != null ); urnToFileMap.put( shareFile.getURN(), shareFile ); // only add time once we have a valid URN... // it makes no sense to return whats new files without urn. addTimeToFile( shareFile ); }
|
public void addUrn2FileMapping( ShareFile shareFile ) { assert( shareFile.getURN() != null ); urnToFileMap.put( shareFile.getURN(), shareFile ); // only add time once we have a valid URN... // it makes no sense to return whats new files without urn. addTimeToFile( shareFile ); }
| 1,115,681
|
private double calcColour(double lov) { double colour = 0; if (colourMethod.equals("EBC")){ // From Greg Noonan's article at http://brewingtechniques.com/bmg/noonan.html colour = (lov * 2.65) - 1.2; } else { // calculates SRM based on MCU (degrees LOV) if (lov > 0) colour = 1.4922 * Math.pow(lov, 0.6859); else colour = 0; } return colour; }
|
private double calcColour(double lov) { double colour = 0; if (colourMethod.equals("EBC")){ // From Greg Noonan's article at http://brewingtechniques.com/bmg/noonan.html colour = 1.4922 * Math.pow(lov, 0.6859); colour = (colour * 2.65) - 1.2; } else { // calculates SRM based on MCU (degrees LOV) if (lov > 0) colour = 1.4922 * Math.pow(lov, 0.6859); else colour = 0; } return colour; }
| 1,115,682
|
public void calcMaltTotals() { double og = 0; double fg = 0; double lov = 0; double maltPoints = 0; double mcu = 0; totalMaltLbs = 0; totalMaltCost = 0; totalMashLbs = 0; // first figure out the total we're dealing with for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); totalMaltLbs += (m.getAmountAs("lb")); if (m.getMashed()){ // apply efficiency and add to mash weight maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * efficiency / postBoilVol.getValueAs("gal"); totalMashLbs += (m.getAmountAs("lb")); } else maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * 100 / postBoilVol.getValueAs("gal"); mcu += m.getLov() * m.getAmountAs("lb") / postBoilVol.getValueAs("gal"); totalMaltCost += m.getCostPerU() * m.getAmountAs("lb"); } // now set the malt % by weight: for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); m.setPercent((m.getAmountAs("lb")/totalMaltLbs * 100)); } // set the fields in the object estOg = (maltPoints / 100) + 1; estFg = 1 + ((estOg - 1) * ((100 - attenuation) / 100)); srm = calcColour(mcu); mash.setMaltWeight(totalMashLbs); calcAlcohol("Volume"); }
|
public void calcMaltTotals() { double og = 0; double fg = 0; double lov = 0; double maltPoints = 0; double mcu = 0; totalMaltLbs = 0; totalMaltCost = 0; totalMashLbs = 0; // first figure out the total we're dealing with for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); totalMaltLbs += (m.getAmountAs("lb")); if (m.getMashed()){ // apply efficiency and add to mash weight maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * efficiency / postBoilVol.getValueAs("gal"); totalMashLbs += (m.getAmountAs("lb")); } else maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * 100 / postBoilVol.getValueAs("gal"); mcu += m.getLov() * m.getAmountAs("lb") / postBoilVol.getValueAs("gal"); totalMaltCost += m.getCostPerU() * m.getAmountAs("lb"); } // now set the malt % by weight: for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); m.setPercent((m.getAmountAs("lb")/totalMaltLbs * 100)); } // set the fields in the object estOg = (maltPoints / 100) + 1; estFg = 1 + ((estOg - 1) * ((100 - attenuation) / 100)); srm = calcColour(mcu); mash.setMaltWeight(totalMashLbs); calcAlcohol("Volume"); }
| 1,115,683
|
public String toText(){ DecimalFormat df1 = new DecimalFormat("0.0"); DecimalFormat df2 = new DecimalFormat("0.00"); MessageFormat mf; StringBuffer sb = new StringBuffer(); sb.append("StrangeBrew J1.0 recipe text output\n\n"); sb.append("Details:\n"); sb.append("Name: " + name + "\n"); sb.append("Brewer: " + brewer + "\n"); sb.append("Size: " + df1.format(postBoilVol.getValue()) + " " + postBoilVol.getUnits()+"\n"); sb.append("Style: " + style.getName() + "\n"); mf = new MessageFormat("OG: {0,number,0.000},\tFG:{1,number,0.000}, \tALC:{2,number,0.0}\n"); Object[] objs = {new Double(estOg), new Double(estFg), new Double(alcohol) }; sb.append(mf.format( objs )); sb.append("Fermentables:\n"); sb.append(padLeft("Name ", 30, ' ') + " amount units pppg lov %\n"); mf = new MessageFormat("{0} {1} {2} {3,number,0.000} {4} {5,number, 0.0}%\n"); for (int i=0; i<fermentables.size(); i++){ Fermentable f = (Fermentable)fermentables.get(i); Object[] objf = {padLeft(f.getName(), 30, ' '), padRight(" "+df2.format(f.getAmountAs(f.getUnits())), 6, ' '), f.getUnits(), new Double(f.getPppg()), padRight(" "+df1.format(f.getLov()), 6, ' '), new Double(f.getPercent())}; sb.append(mf.format(objf)); } sb.append("Hops:\n"); sb.append(padLeft("Name ", 20, ' ') + " amount units Alpha Min IBU\n"); mf = new MessageFormat("{0} {1} {2} {3} {4} {5}\n"); for (int i=0; i<hops.size(); i++){ Hop h = (Hop)hops.get(i); Object[] objh = {padLeft(h.getName(), 20, ' '), padRight(" "+df2.format(h.getAmountAs(h.getUnits())), 6, ' '), h.getUnits(), padRight(" "+h.getAlpha(), 5, ' '), padRight(" "+df1.format(h.getMinutes()), 6, ' '), padRight(" "+df1.format(h.getIBU()), 5, ' ')}; sb.append(mf.format(objh)); } sb.append("Mash:\n"); sb.append(padLeft("Step ", 10, ' ') + " Temp End Ramp Min\n"); mf = new MessageFormat("{0} {1} {2} {3} {4}\n"); for (int i=0; i<mash.getStepSize(); i++){ Object[] objm = {padLeft(mash.getStepType(i), 10, ' '), padRight(" " + mash.getStepStartTemp(i), 6, ' '), padRight(" " + mash.getStepEndTemp(i), 6, ' '), padRight(" "+mash.getStepRampMin(i), 4, ' '), padRight(" "+mash.getStepMin(i), 6, ' ')}; sb.append(mf.format(objm)); } return sb.toString(); }
|
public String toText(){ DecimalFormat df1 = new DecimalFormat("0.0"); DecimalFormat df2 = new DecimalFormat("0.00"); MessageFormat mf; StringBuffer sb = new StringBuffer(); sb.append("StrangeBrew J1.0 recipe text output\n\n"); sb.append("Details:\n"); sb.append("Name: " + name + "\n"); sb.append("Brewer: " + brewer + "\n"); sb.append("Size: " + df1.format(postBoilVol.getValue()) + " " + postBoilVol.getUnits()+"\n"); sb.append("Style: " + style.getName() + "\n"); mf = new MessageFormat("OG: {0,number,0.000},\tFG:{1,number,0.000}, \tALC:{2,number,0.0}\n"); Object[] objs = {new Double(estOg), new Double(estFg), new Double(alcohol) }; sb.append(mf.format( objs )); sb.append("Fermentables:\n"); sb.append(padLeft("Name ", 30, ' ') + " amount units pppg lov %\n"); mf = new MessageFormat("{0} {1} {2} {3,number,0.000} {4} {5,number, 0.0}%\n"); for (int i=0; i<fermentables.size(); i++){ Fermentable f = (Fermentable)fermentables.get(i); Object[] objf = {padLeft(f.getName(), 30, ' '), padRight(" "+df2.format(f.getAmountAs(f.getUnits())), 6, ' '), f.getUnits(), new Double(f.getPppg()), padRight(" "+df1.format(f.getLov()), 6, ' '), new Double(f.getPercent())}; sb.append(mf.format(objf)); } sb.append("Hops:\n"); sb.append(padLeft("Name ", 20, ' ') + " amount units Alpha Min IBU\n"); mf = new MessageFormat("{0} {1} {2} {3} {4} {5}\n"); for (int i=0; i<hops.size(); i++){ Hop h = (Hop)hops.get(i); Object[] objh = {padLeft(h.getName(), 20, ' '), padRight(" "+df2.format(h.getAmountAs(h.getUnits())), 6, ' '), h.getUnits(), padRight(" "+h.getAlpha(), 5, ' '), padRight(" "+df1.format(h.getMinutes()), 6, ' '), padRight(" "+df1.format(h.getIBU()), 5, ' ')}; sb.append(mf.format(objh)); } sb.append("Mash:\n"); sb.append(padLeft("Step ", 10, ' ') + " Temp End Ramp Min\n"); mf = new MessageFormat("{0} {1} {2} {3} {4}\n"); for (int i=0; i<mash.getStepSize(); i++){ Object[] objm = {padLeft(mash.getStepType(i), 10, ' '), padRight(" " + mash.getStepStartTemp(i), 6, ' '), padRight(" " + mash.getStepEndTemp(i), 6, ' '), padRight(" "+mash.getStepRampMin(i), 4, ' '), padRight(" "+mash.getStepMin(i), 6, ' ')}; sb.append(mf.format(objm)); } return sb.toString(); }
| 1,115,684
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,685
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,686
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void addTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get( time ); if ( shareFileSet == null ) { shareFileSet = new HashSet(); timeToFileMap.put(time, shareFileSet); } shareFileSet.add( shareFile ); } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,687
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,688
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,689
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,690
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
|
private void removeTimeToFile( ShareFile shareFile ) { rwLock.writeLock(); try { Long time = shareFile.getNetworkCreateTime(); Set shareFileSet = (Set) timeToFileMap.get(time); if ( shareFileSet == null ) { return; } shareFileSet.remove(shareFile); if ( shareFileSet.size() == 0 ) { timeToFileMap.remove(time); } } finally { try{ rwLock.writeUnlock(); } catch (IllegalAccessException exp ) { NLogger.error( NLoggerNames.Sharing, exp, exp ); } } }
| 1,115,691
|
public void valueTest(String expr,String expected) throws Exception { Object res = calcValue(expr); myAssertEquals(expr,expected,res.toString()); }
|
public void valueTest(String expr,Object expected) throws Exception { Object res = calcValue(expr); myAssertEquals(expr,expected,res.toString()); }
| 1,115,693
|
public void valueTest(String expr,String expected) throws Exception { Object res = calcValue(expr); myAssertEquals(expr,expected,res.toString()); }
|
public void valueTest(String expr,String expected) throws Exception { Object res = calcValue(expr); myAssertEquals(expr,expected,res); }
| 1,115,694
|
public BaseFormat(int base,String prefix) { super(); this.base = base; tb = new ToBase(base,prefix); fb = new FromBase(base,prefix); }
|
private BaseFormat() { super(); this.base = base; tb = new ToBase(base,prefix); fb = new FromBase(base,prefix); }
| 1,115,695
|
public BaseFormat(int base,String prefix) { super(); this.base = base; tb = new ToBase(base,prefix); fb = new FromBase(base,prefix); }
|
public BaseFormat(int base,String prefix) { super(); this.base = base; tb = new ToBase(base,prefix); fb = new FromBase(base,prefix); }
| 1,115,696
|
public Comparator getColumnComparator( int column ) { switch( column ) { case HOST_MODEL_INDEX: return new DestAddressComparator(); case PROGRESS_MODEL_INDEX: return ComparableComparator.getInstance(); case ETA_MODEL_INDEX: return new ETAComparator(); // for all other columns use default comparator default: return null; } }
|
public Comparator<?> getColumnComparator( int column ) { switch( column ) { case HOST_MODEL_INDEX: return new DestAddressComparator(); case PROGRESS_MODEL_INDEX: return ComparableComparator.getInstance(); case ETA_MODEL_INDEX: return new ETAComparator(); // for all other columns use default comparator default: return null; } }
| 1,115,697
|
public Object getComparableValueAt( int row, int column ) { SWDownloadCandidate candidate = downloadFile.getTransferCandidate( row ); if ( candidate == null ) { return ""; } SWDownloadSegment segment; switch( column ) { case FROM_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getStart() ); case TO_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getEnd() ); case SIZE_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTotalDataSize() ); case PROGRESS_MODEL_INDEX: { DownloadScopeList availableScopeList = candidate.getAvailableScopeList(); if ( availableScopeList == null ) { return null; } return new Long( availableScopeList.getAggregatedLength() ); } case STATUS_MODEL_INDEX: CandidateStatus status = candidate.getStatus(); if ( status == CandidateStatus.REMOTLY_QUEUED ) { int queuePosition = candidate.getXQueueParameters().getPosition().intValue(); Double doubObj = new Double( status.ordinal() + 1.0 - Math.min( (double)queuePosition, (double)10000 ) / 10000.0 ); return doubObj; } else { long timeLeft = candidate.getStatusTimeLeft(); return new Double( status.ordinal() + (double)timeLeft / 1000000.0 ); } case RATE_MODEL_INDEX: { segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTransferSpeed() ); } case ETA_MODEL_INDEX: { segment = candidate.getDownloadSegment(); return segment; } } return getValueAt( row, column ); }
|
public Object getComparableValueAt( int row, int column ) { SWDownloadCandidate candidate = downloadFile.getTransferCandidate( row ); if ( candidate == null ) { return null; } SWDownloadSegment segment; switch( column ) { case FROM_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getStart() ); case TO_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getEnd() ); case SIZE_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTotalDataSize() ); case PROGRESS_MODEL_INDEX: { DownloadScopeList availableScopeList = candidate.getAvailableScopeList(); if ( availableScopeList == null ) { return null; } return new Long( availableScopeList.getAggregatedLength() ); } case STATUS_MODEL_INDEX: CandidateStatus status = candidate.getStatus(); if ( status == CandidateStatus.REMOTLY_QUEUED ) { int queuePosition = candidate.getXQueueParameters().getPosition().intValue(); Double doubObj = new Double( status.ordinal() + 1.0 - Math.min( (double)queuePosition, (double)10000 ) / 10000.0 ); return doubObj; } else { long timeLeft = candidate.getStatusTimeLeft(); return new Double( status.ordinal() + (double)timeLeft / 1000000.0 ); } case RATE_MODEL_INDEX: { segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTransferSpeed() ); } case ETA_MODEL_INDEX: { segment = candidate.getDownloadSegment(); return segment; } } return getValueAt( row, column ); }
| 1,115,698
|
public Object getComparableValueAt( int row, int column ) { SWDownloadCandidate candidate = downloadFile.getTransferCandidate( row ); if ( candidate == null ) { return ""; } SWDownloadSegment segment; switch( column ) { case FROM_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getStart() ); case TO_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getEnd() ); case SIZE_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTotalDataSize() ); case PROGRESS_MODEL_INDEX: { DownloadScopeList availableScopeList = candidate.getAvailableScopeList(); if ( availableScopeList == null ) { return null; } return new Long( availableScopeList.getAggregatedLength() ); } case STATUS_MODEL_INDEX: CandidateStatus status = candidate.getStatus(); if ( status == CandidateStatus.REMOTLY_QUEUED ) { int queuePosition = candidate.getXQueueParameters().getPosition().intValue(); Double doubObj = new Double( status.ordinal() + 1.0 - Math.min( (double)queuePosition, (double)10000 ) / 10000.0 ); return doubObj; } else { long timeLeft = candidate.getStatusTimeLeft(); return new Double( status.ordinal() + (double)timeLeft / 1000000.0 ); } case RATE_MODEL_INDEX: { segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTransferSpeed() ); } case ETA_MODEL_INDEX: { segment = candidate.getDownloadSegment(); return segment; } } return getValueAt( row, column ); }
|
public Object getComparableValueAt( int row, int column ) { SWDownloadCandidate candidate = downloadFile.getTransferCandidate( row ); if ( candidate == null ) { return ""; } SWDownloadSegment segment; switch( column ) { case FROM_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getStart() ); case TO_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getEnd() ); case SIZE_MODEL_INDEX: segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTotalDataSize() ); case PROGRESS_MODEL_INDEX: { DownloadScopeList availableScopeList = candidate.getAvailableScopeList(); if ( availableScopeList == null ) { return null; } return new Long( availableScopeList.getAggregatedLength() ); } case STATUS_MODEL_INDEX: CandidateStatus status = candidate.getStatus(); if ( status == CandidateStatus.REMOTLY_QUEUED ) { int queuePosition = candidate.getXQueueParameters().getPosition().intValue(); Double doubObj = new Double( status.ordinal() + 1.0 - Math.min( (double)queuePosition, (double)10000 ) / 10000.0 ); return doubObj; } else { long timeLeft = candidate.getStatusTimeLeft(); return new Double( status.ordinal() + timeLeft / 1000000.0 ); } case RATE_MODEL_INDEX: { segment = candidate.getDownloadSegment(); if ( segment == null ) { return null; } return new Long( segment.getTransferSpeed() ); } case ETA_MODEL_INDEX: { segment = candidate.getDownloadSegment(); return segment; } } return getValueAt( row, column ); }
| 1,115,699
|
public DrawableSeismogram(JComponent parent, DataSetSeismogram seis, Color color){ this(parent, seis, color, seis.toString()); }
|
public DrawableSeismogram(JComponent parent, DataSetSeismogram seis, Color color){ this(parent, seis, color, seis.toString()); }
| 1,115,700
|
public Job doCreateJob(StaplerRequest req, StaplerResponse rsp) throws IOException { Job job = owner.doCreateJob(req, rsp); jobNames.add(job.getName()); owner.save(); return job; }
|
public Job doCreateJob(StaplerRequest req, StaplerResponse rsp) throws IOException { Job job = owner.doCreateJob(req, rsp); jobNames.add(job.getName()); owner.save(); return job; }
| 1,115,701
|
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(path); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
|
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(URLEncoder.encode(path,"UTF-8")); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
| 1,115,702
|
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(path); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
|
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(path); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect2(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
| 1,115,703
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.