code
stringlengths
10
174k
nl
stringlengths
3
129k
public static void readFully(InputStream in,byte[] dst) throws IOException { readFully(in,dst,0,dst.length); }
Fills 'dst' with bytes from 'in', throwing EOFException if insufficient bytes are available.
protected Object writePreProcess(Object o) throws Exception { return o; }
enables derived classes to due some pre-processing on the objects, that's about to be serialized. Right now it only returns the object.
@Override public Clob createClob() throws SQLException { try { int id=getNextId(TraceObject.CLOB); debugCodeAssign("Clob",TraceObject.CLOB,id,"createClob()"); checkClosed(); try { Value v=ValueLobDb.createTempClob(new InputStreamReader(new ByteArrayInputStream(Utils.EMPTY_BYTES)),0); session.addTemporaryLob(v); return new JdbcClob(this,v,id); } finally { afterWriting(); } } catch ( Exception e) { throw logAndConvert(e); } }
Create a new empty Clob object.
public char[] toCharArray(final int startIndex,int endIndex){ endIndex=validateRange(startIndex,endIndex); final int len=endIndex - startIndex; if (len == 0) { return ArrayUtils.EMPTY_CHAR_ARRAY; } final char chars[]=new char[len]; System.arraycopy(buffer,startIndex,chars,0,len); return chars; }
Copies part of the builder's character array into a new character array.
public void cancelFade(){ this.fadeOut=false; }
Cancels the fade out
private static List<AttributesRule> parseRules(File file){ if (file.exists() && file.isFile()) { try (InputStream stream=new FileInputStream(file)){ AttributesNode parsed=new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch ( IOException e) { System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace(); } } return Collections.emptyList(); }
Parses a list of rules from the given file, returning an empty list if the file doesn't exist.
@Override public void eSet(int featureID,Object newValue){ switch (featureID) { case SGenPackage.DEPRECATABLE_ELEMENT__DEPRECATED: setDeprecated((Boolean)newValue); return; case SGenPackage.DEPRECATABLE_ELEMENT__COMMENT: setComment((String)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public PopupCopyMenu(){ super(); initialize(); }
This method initializes
public boolean isOpenByDefault(){ Object oo=get_Value(COLUMNNAME_IsOpenByDefault); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Open By Default.
public static TransitSchedule mergeTouchingRoutes(Scenario scenario,String outputDirectory){ return new TransitScheduleSimplifier().mergeTouchingTransitRoutes(scenario,outputDirectory); }
Simplifies a transit schedule by merging transit routes within a transit line with touching route profiles. The initial transit routes are split into sections on which they overlap. A new section is created if the number of overlapping transit routes changes.
public ValueNode lockAt(int i){ assert i >= 0 && i < locksSize(); return values.get(localsSize + stackSize + i); }
Get the monitor owner at the specified index.
public void test_equals(){ String name1="CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US"; String name2="cn=duke,ou=javasoft,o=sun microsystems,c=us"; String name3="CN=Alex Astapchuk, OU=SSG, O=Intel ZAO, C=RU"; X500Principal xpr1=new X500Principal(name1); X500Principal xpr2=new X500Principal(name2); X500Principal xpr3=new X500Principal(name3); try { assertTrue("False returned",xpr1.equals(xpr2)); assertFalse("True returned",xpr1.equals(xpr3)); } catch ( Exception e) { fail("Unexpected exception: " + e); } }
javax.security.auth.x500.X500Principal#equals(Object o)
private Clustering<OPTICSModel> extractClusters(ClusterOrder clusterOrderResult,Relation<?> relation,double ixi,int minpts){ ArrayDBIDs clusterOrder=clusterOrderResult.ids; DoubleDataStore reach=clusterOrderResult.reachability; DBIDArrayIter tmp=clusterOrder.iter(); DBIDVar tmp2=DBIDUtil.newVar(); double mib=0.0; List<SteepArea> salist=keepsteep ? new ArrayList<SteepArea>() : null; List<SteepDownArea> sdaset=new ArrayList<>(); final Clustering<OPTICSModel> clustering=new Clustering<>("OPTICS Xi-Clusters","optics"); HashSet<Cluster<OPTICSModel>> curclusters=new HashSet<>(); HashSetModifiableDBIDs unclaimedids=DBIDUtil.newHashSet(relation.getDBIDs()); FiniteProgress scanprog=LOG.isVerbose() ? new FiniteProgress("OPTICS Xi cluster extraction",clusterOrder.size(),LOG) : null; for (SteepScanPosition scan=new SteepScanPosition(clusterOrderResult); scan.hasNext(); ) { if (scanprog != null) { scanprog.setProcessed(scan.index,LOG); } mib=MathUtil.max(mib,scan.getReachability()); if (!scan.next.valid()) { break; } if (scan.steepDown(ixi)) { updateFilterSDASet(mib,sdaset,ixi); final double startval=scan.getReachability(); mib=0.; int startsteep=scan.index, endsteep=scan.index; for (scan.next(); scan.hasNext(); scan.next()) { if (scan.steepDown(ixi)) { endsteep=scan.index; continue; } if (!scan.steepDown(1.0) || scan.index - endsteep > minpts) { break; } } final SteepDownArea sda=new SteepDownArea(startsteep,endsteep,startval,0); if (LOG.isDebuggingFinest()) { LOG.debugFinest("New steep down area: " + sda.toString()); } sdaset.add(sda); if (salist != null) { salist.add(sda); } continue; } if (scan.steepUp(ixi)) { updateFilterSDASet(mib,sdaset,ixi); final SteepUpArea sua; { int startsteep=scan.index, endsteep=scan.index; mib=scan.getReachability(); double esuccr=scan.getNextReachability(); while (!Double.isInfinite(esuccr) && scan.hasNext()) { scan.next(); if (scan.steepUp(ixi)) { endsteep=scan.index; mib=scan.getReachability(); esuccr=scan.getNextReachability(); continue; } if (!scan.steepUp(1.0) || scan.index - endsteep > minpts) { break; } } if (Double.isInfinite(esuccr)) { scan.next(); } sua=new SteepUpArea(startsteep,endsteep,esuccr); if (LOG.isDebuggingFinest()) { LOG.debugFinest("New steep up area: " + sua.toString()); } if (salist != null) { salist.add(sua); } } ListIterator<SteepDownArea> sdaiter=sdaset.listIterator(sdaset.size()); while (sdaiter.hasPrevious()) { SteepDownArea sda=sdaiter.previous(); if (LOG.isDebuggingFinest()) { LOG.debugFinest("Comparing: eU=" + mib + " SDA: "+ sda.toString()); } if (mib * ixi < sda.getMib()) { if (LOG.isDebuggingFinest()) { LOG.debugFinest("mib * ixi = " + mib * ixi + " >= sda.getMib() = " + sda.getMib()); } continue; } int cstart=sda.getStartIndex(), cend=MathUtil.min(sua.getEndIndex(),clusterOrder.size() - 1); { if (sda.getMaximum() * ixi >= sua.getMaximum()) { while (cstart < cend && reach.doubleValue(tmp.seek(cstart + 1)) > sua.getMaximum()) { cstart++; } } else if (sua.getMaximum() * ixi >= sda.getMaximum()) { while (cend > cstart && reach.doubleValue(tmp.seek(cend - 1)) > sda.getMaximum()) { cend--; } } } if (!nocorrect) { simplify: while (cend > cstart) { clusterOrderResult.predecessor.assignVar(tmp.seek(cend),tmp2); for (int i=cstart; i < cend; i++) { if (DBIDUtil.equal(tmp2,tmp.seek(i))) { break simplify; } } --cend; } } if (cend - cstart + 1 < minpts) { if (LOG.isDebuggingFinest()) { LOG.debugFinest("MinPts not satisfied."); } continue; } ModifiableDBIDs dbids=DBIDUtil.newArray(); for (int idx=cstart; idx <= cend; idx++) { tmp.seek(idx); if (unclaimedids.remove(tmp)) { dbids.add(tmp); } } if (LOG.isDebuggingFine()) { LOG.debugFine("Found cluster with " + dbids.size() + " new objects, length "+ (cend - cstart + 1)); } OPTICSModel model=new OPTICSModel(cstart,cend); Cluster<OPTICSModel> cluster=new Cluster<>("Cluster_" + cstart + "_"+ cend,dbids,model); { Iterator<Cluster<OPTICSModel>> iter=curclusters.iterator(); while (iter.hasNext()) { Cluster<OPTICSModel> clus=iter.next(); OPTICSModel omodel=clus.getModel(); if (model.getStartIndex() <= omodel.getStartIndex() && omodel.getEndIndex() <= model.getEndIndex()) { clustering.addChildCluster(cluster,clus); iter.remove(); } } } curclusters.add(cluster); } continue; } scan.next(); } if (scanprog != null) { scanprog.setProcessed(clusterOrder.size(),LOG); } if (!unclaimedids.isEmpty()) { boolean noise=reach.doubleValue(tmp.seek(clusterOrder.size() - 1)) >= Double.POSITIVE_INFINITY; Cluster<OPTICSModel> allcluster=new Cluster<>(noise ? "Noise" : "Cluster",unclaimedids,noise,new OPTICSModel(0,clusterOrder.size() - 1)); for ( Cluster<OPTICSModel> cluster : curclusters) { clustering.addChildCluster(allcluster,cluster); } clustering.addToplevelCluster(allcluster); } else { for ( Cluster<OPTICSModel> cluster : curclusters) { clustering.addToplevelCluster(cluster); } } clustering.addChildResult(clusterOrderResult); if (salist != null) { clusterOrderResult.addChildResult(new SteepAreaResult(salist)); } return clustering; }
Extract clusters from a cluster order result.
@Override public int read() throws IOException { return iis.read(); }
Reads the next byte of data from this input stream. The value byte is returned as an <code>int</code> in the range <code>0</code> to <code>255</code>. If no byte is available because the end of the stream has been reached, the value <code>-1</code> is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown. <p> This method simply performs <code>in.read()</code> and returns the result.
private String wrappedMapping(boolean makeDest,NullPointerControl npc,MappingType mtd,MappingType mts){ String sClass=source.getName(); String dClass=destination.getName(); String str=(makeDest ? " " + sClass + " "+ stringOfGetSource+ " = ("+ sClass+ ") $1;" : " " + dClass + " "+ stringOfGetDestination+ " = ("+ dClass+ ") $1;"+ newLine+ " "+ sClass+ " "+ stringOfGetSource+ " = ("+ sClass+ ") $2;") + newLine; switch (npc) { case SOURCE: str+="if(" + stringOfGetSource + "!=null){"+ newLine; break; case DESTINATION: str+="if(" + stringOfGetDestination + "!=null){"+ newLine; break; case ALL: str+="if(" + stringOfGetSource + "!=null && "+ stringOfGetDestination+ "!=null){"+ newLine; break; default : break; } str+=mapping(makeDest,mtd,mts) + newLine + " return "+ stringOfSetDestination+ ";"+ newLine; return (npc != NOT_ANY) ? str+="}" + newLine + " return null;"+ newLine : str; }
This method adds the Null Pointer Control to mapping created by the mapping method. wrapMapping is used to wrap the mapping returned by mapping method.
public UpdateOperation(EntryEventImpl event,long lastModifiedTime){ super(event,lastModifiedTime); }
Creates a new instance of UpdateOperation
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
private void ensureSorted(){ if (needsSorting) { Collections.sort(children,FigureLayerComparator.INSTANCE); needsSorting=false; } }
Ensures that the children are sorted in z-order sequence from back to front.
public LocalDateTime roundFloorCopy(){ return iInstant.withLocalMillis(iField.roundFloor(iInstant.getLocalMillis())); }
Rounds to the lowest whole unit of this field on a copy of this LocalDateTime. <p> For example, rounding floor on the hourOfDay field of a LocalDateTime where the time is 10:30 would result in new LocalDateTime with the time of 10:00.
public void addProgressListener(ProgressListener listener){ listeners.addListener(listener); }
Adds the given listener to receive progress reports.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public static SparseIntArray adjustPosition(SparseIntArray positions,int startPosition,int endPosition,int adjustBy){ SparseIntArray newPositions=new SparseIntArray(); for (int i=0, size=positions.size(); i < size; i++) { int position=positions.keyAt(i); if (position < startPosition || position > endPosition) { newPositions.put(position,positions.valueAt(i)); } else if (adjustBy > 0) { newPositions.put(position + adjustBy,positions.valueAt(i)); } else if (adjustBy < 0) { if (position > startPosition + adjustBy && position <= startPosition) { ; } else { newPositions.put(position + adjustBy,positions.valueAt(i)); } } } return newPositions; }
internal method to handle the selections if items are added / removed
protected void processUnknownStartOption(final String key,final String value,final Map<String,Object> options,final List<String> vmArgs,final Properties props){ throw new IllegalArgumentException(LocalizedStrings.CacheServerLauncher_UNKNOWN_ARGUMENT_0.toLocalizedString(key)); }
Process a command-line option of the form "-key=value" unknown to the base class.
private void updateColumnWidth(final DynamicColumnData dynamicColumnData,final Double width){ final TableColumn tableColumn=dynamicColumnData.getTableColumn(); final TreeColumn treeColumn=dynamicColumnData.getTreeColumn(); if (tableColumn != null) { tableColumn.setWidth(width.intValue()); } else if (treeColumn != null) { treeColumn.setWidth(width.intValue()); } else { throw new IllegalStateException("No valid to set the column width!"); } }
Update column width
public MySqlLoopStatement parseLoop(String label){ MySqlLoopStatement loopStmt=new MySqlLoopStatement(); loopStmt.setLabelName(label); accept(Token.LOOP); parseProcedureStatementList(loopStmt.getStatements()); accept(Token.END); accept(Token.LOOP); acceptIdentifier(label); accept(Token.SEMI); return loopStmt; }
parse loop statement with label
public IgniteLogger logger(Class<?> cls){ return kernalCtx.log(cls); }
Gets grid logger for given class.
static int[] divide(int quot[],int quotLength,int a[],int aLength,int b[],int bLength){ int normA[]=new int[aLength + 1]; int normB[]=new int[bLength + 1]; int normBLength=bLength; int divisorShift=TBigDecimal.numberOfLeadingZeros(b[bLength - 1]); if (divisorShift != 0) { TBitLevel.shiftLeft(normB,b,0,divisorShift); TBitLevel.shiftLeft(normA,a,0,divisorShift); } else { System.arraycopy(a,0,normA,0,aLength); System.arraycopy(b,0,normB,0,bLength); } int firstDivisorDigit=normB[normBLength - 1]; int i=quotLength - 1; int j=aLength; while (i >= 0) { int guessDigit=0; if (normA[j] == firstDivisorDigit) { guessDigit=-1; } else { long product=(((normA[j] & 0xffffffffL) << 32) + (normA[j - 1] & 0xffffffffL)); long res=TDivision.divideLongByInt(product,firstDivisorDigit); guessDigit=(int)res; int rem=(int)(res >> 32); if (guessDigit != 0) { long leftHand=0; long rightHand=0; boolean rOverflowed=false; guessDigit++; do { guessDigit--; if (rOverflowed) { break; } leftHand=(guessDigit & 0xffffffffL) * (normB[normBLength - 2] & 0xffffffffL); rightHand=((long)rem << 32) + (normA[j - 2] & 0xffffffffL); long longR=(rem & 0xffffffffL) + (firstDivisorDigit & 0xffffffffL); if (TBigDecimal.numberOfLeadingZeros((int)(longR >>> 32)) < 32) { rOverflowed=true; } else { rem=(int)longR; } } while (((leftHand ^ 0x8000000000000000L) > (rightHand ^ 0x8000000000000000L))); } } if (guessDigit != 0) { int borrow=TDivision.multiplyAndSubtract(normA,j - normBLength,normB,normBLength,guessDigit); if (borrow != 0) { guessDigit--; long carry=0; for (int k=0; k < normBLength; k++) { carry+=(normA[j - normBLength + k] & 0xffffffffL) + (normB[k] & 0xffffffffL); normA[j - normBLength + k]=(int)carry; carry>>>=32; } } } if (quot != null) { quot[i]=guessDigit; } j--; i--; } if (divisorShift != 0) { TBitLevel.shiftRight(normB,normBLength,normA,0,divisorShift); return normB; } System.arraycopy(normA,0,normB,0,bLength); return normA; }
Divides the array 'a' by the array 'b' and gets the quotient and the remainder. Implements the Knuth's division algorithm. See D. Knuth, The Art of Computer Programming, vol. 2. Steps D1-D8 correspond the steps in the algorithm description.
public void waitForVolumesToBeVisible(CGRequestParams request){ scan(request.getCopies(),request.getRsets()); }
scans all sites until all volumes involved in the Recoverpoint protection are visible
public Address __lshift__(final Object rhs){ return new Address(m_value.shiftLeft(getBigInteger(rhs).intValue())); }
Used to support << operations on addresses in Python scripts.
public static Partition createPartition(Configuration conf,HiveMetastoreClient ms,HiveObjectSpec partitionSpec) throws IOException, HiveMetastoreException { HiveObjectSpec tableSpec=partitionSpec.getTableSpec(); if (!ms.existsTable(tableSpec.getDbName(),tableSpec.getTableName())) { throw new HiveMetastoreException("Missing table " + tableSpec); } Table table=ms.getTable(tableSpec.getDbName(),tableSpec.getTableName()); Partition partition=new Partition(); partition.setDbName(partitionSpec.getDbName()); partition.setTableName(partitionSpec.getTableName()); Map<String,String> partitionKeyValues=ms.partitionNameToMap(partitionSpec.getPartitionName()); partition.setValues(Lists.newArrayList(partitionKeyValues.values())); StorageDescriptor psd=new StorageDescriptor(table.getSd()); TableType tableType=TableType.valueOf(table.getTableType()); if (tableType.equals(TableType.MANAGED_TABLE) || tableType.equals(TableType.EXTERNAL_TABLE)) { String partitionLocation=table.getSd().getLocation() + "/" + partitionSpec.getPartitionName(); psd.setLocation(partitionLocation); createSomeTextFiles(conf,new Path(partitionLocation)); } psd.setSerdeInfo(new SerDeInfo("LazySimpleSerde","org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe",new HashMap<>())); partition.setSd(psd); Map<String,String> parameters=new HashMap<>(); parameters.put(HiveParameterKeys.TLDT,Long.toString(System.currentTimeMillis())); partition.setParameters(parameters); ms.addPartition(partition); return partition; }
Creates a partition in a table with some dummy files.
public void clearChoices(){ }
Clear any choices previously set
private void endDocument(final boolean multiObjectMode) throws SAXException { if (depth == 0 || depth == 1 && multiObjectMode) { contentHandler.endDocument(); depth=0; } }
Fires the SAX endDocument event towards the configured ContentHandler.
public OverlayPanel(SettingsManager settingsManager,ChannelModel channelModel){ mSettingsManager=settingsManager; if (mSettingsManager != null) { mSettingsManager.addListener(this); } mChannelModel=channelModel; if (mChannelModel != null) { mChannelModel.addListener(this); } addComponentListener(mLabelSizeMonitor); setOpaque(false); setColors(); }
Translucent overlay panel for displaying channel configurations, processing channels, selected channels, frequency labels and lines, and a cursor with a frequency readout.
static public long unpackLong(DataInput is) throws IOException { long result=0; for (int offset=0; offset < 64; offset+=7) { long b=is.readUnsignedByte(); result|=(b & 0x7F) << offset; if ((b & 0x80) == 0) { return result; } } throw new Error("Malformed long."); }
Unpack positive long value from the input stream.
private JsonWriter open(int empty,String openBracket) throws IOException { beforeValue(); push(empty); out.write(openBracket); return this; }
Enters a new scope by appending any necessary whitespace and the given bracket.
public Object nextValue() throws JSONException { char c=this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); case '[': this.back(); return new JSONArray(this); } StringBuilder sb=new StringBuilder(); while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) { sb.append(c); c=this.next(); } this.back(); string=sb.toString().trim(); if ("".equals(string)) { throw this.syntaxError("Missing value"); } return JSONObject.stringToValue(string); }
Get the next value. The value can be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
@DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:49.827 -0500",hash_original_method="0B6772DEF84C5953639B673A22CD2D87",hash_generated_method="ED8B68B0FCFC2C7A0FAC4B07EE3A164E") public SAXException(String message){ super(message); this.exception=null; }
Create a new SAXException.
public void doExportInternal(final JobContext context) throws IOException { doDataExport(context); }
Perform bulk export.
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
protected void describeResultFormats(){ g.add(aService,SD.resultFormat,SD.RDFXML); g.add(aService,SD.resultFormat,SD.NTRIPLES); g.add(aService,SD.resultFormat,SD.TURTLE); g.add(aService,SD.resultFormat,SD.N3); g.add(aService,SD.resultFormat,SD.TRIG); g.add(aService,SD.resultFormat,SD.SPARQL_RESULTS_XML); g.add(aService,SD.resultFormat,SD.SPARQL_RESULTS_JSON); g.add(aService,SD.resultFormat,SD.SPARQL_RESULTS_CSV); g.add(aService,SD.resultFormat,SD.SPARQL_RESULTS_TSV); }
Describe the supported result formats.
public static long longForQuery(SQLiteStatement prog,String[] selectionArgs){ prog.bindAllArgsAsStrings(selectionArgs); return prog.simpleQueryForLong(); }
Utility method to run the pre-compiled query and return the value in the first column of the first row.
private boolean checkMatchFilter(DomainSelection selection,Axis filter,AnalysisSmartCacheRequest request,AnalysisSmartCacheSignature candidate,AnalysisSmartCacheMatch match){ Collection<DimensionMember> original=selection.getMembers(filter); Collection<DimensionMember> candidates=candidate.getAnalysis().getSelection().getMembers(filter); if (original.size() == candidates.size()) { HashSet<DimensionMember> check=new HashSet<>(original); if (check.containsAll(candidates)) { return true; } else if (filter.getDefinitionSafe().getImageDomain().isInstanceOf(IDomain.DATE) && original.size() == 1 && candidates.size() == 1) { GroupByAxis groupBy=findGroupingJoin(filter,candidate.getAnalysis()); if (groupBy != null) { Object originalValue=original.iterator().next().getID(); Object candidateValue=candidates.iterator().next().getID(); if (originalValue instanceof Intervalle && candidateValue instanceof Intervalle) { Intervalle originalDate=(Intervalle)originalValue; Intervalle candidateDate=(Intervalle)candidateValue; Date originalLowerBound=(Date)originalDate.getLowerBound(); Date originalUpperBound=(Date)originalDate.getUpperBound(); Date candidateLowerBound=(Date)candidateDate.getLowerBound(); Date candidateUpperBound=(Date)candidateDate.getUpperBound(); if ((candidateLowerBound.before(originalLowerBound) || candidateLowerBound.equals(originalLowerBound)) && (originalUpperBound.before(candidateUpperBound) || originalUpperBound.equals(candidateUpperBound))) { try { DashboardSelection softFilters=new DashboardSelection(); softFilters.add(filter,original); match.addPostProcessing(new DataMatrixTransformSoftFilter(softFilters)); return true; } catch ( ScopeException e) { return false; } } } } } else { return false; } } else if (candidate.getAxes().contains(filter) && candidates.containsAll(original)) { try { DashboardSelection softFilters=new DashboardSelection(); softFilters.add(filter,original); match.addPostProcessing(new DataMatrixTransformSoftFilter(softFilters)); return true; } catch ( ScopeException e) { return false; } } else { return false; } return false; }
Check if the analysis with signature can match the candidate on a given filter/axis. Matching may imply performing some postProcessing to restrict the output.
public boolean forwardIfCurrent(short before,String val,short after){ int start=pos; if (before == AT_LEAST_ONE_SPACE) { if (!removeSpace()) return false; } else removeSpace(); if (!forwardIfCurrent(val)) { setPos(start); return false; } if (after == AT_LEAST_ONE_SPACE) { if (!removeSpace()) { setPos(start); return false; } } else removeSpace(); return true; }
Gibt zurueck ob ein Wert folgt und vor und hinterher Leerzeichen folgen.
public static String generateReleaseKey(Namespace namespace){ String hexIdString=ByteUtil.toHexString(toByteArray(Objects.hash(namespace.getAppId(),namespace.getClusterName(),namespace.getNamespaceName()),MachineUtil.getMachineIdentifier(),releaseCounter.incrementAndGet())); return KEY_JOINER.join(TIMESTAMP_FORMAT.format(new Date()),hexIdString); }
Generate the release key in the format: timestamp+appId+cluster+namespace+hash(ipAsInt+counter)
public static CommandLineResult executeCommandLine(@Nullable final Map<String,String> env,final String cmd,@Nullable final String[] args,final long timeout,@Nullable final File workingDirectory) throws IOException { return executeCommandLine(env,cmd,args,null,timeout,workingDirectory); }
Executes a command line executable based on the arguments specified.
public boolean isServiceRegistered(){ return ServerApiUtils.isImsConnected(); }
Returns true if the service is registered to the platform, else returns false
public AndroidAuthenticator(Context context,Account account,String authTokenType,boolean notifyAuthFailure){ mContext=context; mAccount=account; mAuthTokenType=authTokenType; mNotifyAuthFailure=notifyAuthFailure; }
Creates a new authenticator.
@Override public boolean add(E o){ return offer(o); }
Adds the specified object to the priority queue.
public ExprCfg parseInterpolate(){ StringBuilder text=new StringBuilder(); StringBuilder exprString=new StringBuilder(); ExprCfg expr=null; int ch; int exprToken=-1; while ((ch=read()) >= 0) { if (_checkEscape && ch == '\\') { ch=read(); if (ch == '$' || ch == '#' || ch == '\\') text.append((char)ch); else { text.append('\\'); unread(); } } else if (ch == '$' || ch == '#') { int origChar=ch; ch=read(); if (ch == '{') { if (exprToken != -1 && exprToken != origChar) throw error(L.l("Mixed '#' and '$'. Expected '{0}' at '{1}'",Character.toString((char)exprToken),Character.toString((char)origChar))); exprToken=origChar; if (text.length() > 0) { ExprCfgString right=new ExprCfgString(text.toString()); if (expr == null) { expr=right; } else { expr=new ExprCfgConcat(expr,right); } text.setLength(0); } exprString.setLength(0); int depth=0; for (ch=read(); ch > 0 && !(ch == '}' && depth == 0); ch=read()) { exprString.append((char)ch); switch (ch) { case '{': depth++; break; case '}': depth--; break; case '\'': case '"': { int end=ch; for (ch=read(); ch > 0 && ch != end; ch=read()) { exprString.append((char)ch); if (ch == '\\') { ch=read(); if (ch > 0) exprString.append((char)ch); } } if (ch > 0) exprString.append((char)ch); } break; } } if (ch != '}') throw error(L.l("expected '}' at end of EL expression",exprString)); ExprCfg right=create(exprString.toString()).parseExpr(); if (expr == null) { expr=right; } else { expr=new ExprCfgConcat(expr,right); } } else { text.append((char)origChar); unread(); } } else { text.append((char)ch); } } if (text.length() > 0) { ExprCfgString right=new ExprCfgString(text.toString()); if (expr == null) { expr=right; } else { expr=new ExprCfgConcat(expr,right); } } if (expr == null) { expr=new ExprCfgString(""); } return expr; }
Parses interpolated code.
public synchronized StatusHistoryEntry addUsed(String title,String game){ StatusHistoryEntry entry=new StatusHistoryEntry(title,game,System.currentTimeMillis(),1,false); StatusHistoryEntry present=entries.get(entry); if (present != null) { entry=present.increaseUsed(); } put(entry); return entry; }
Adds a new entry for the given title and game or modifies the already existing one, if present.
public static SplitPane splitPane(Node node1,Node node2,double pos){ SplitPane sp=new SplitPane(); sp.setOrientation(Orientation.VERTICAL); sp.getItems().addAll(node1,node2); sp.setDividerPosition(0,pos); return sp; }
Create split pane for provided nodes.
private void computeLabelling(){ for (Iterator nodeit=graph.getNodes().iterator(); nodeit.hasNext(); ) { Node node=(Node)nodeit.next(); node.getEdges().computeLabelling(arg); } mergeSymLabels(); updateNodeLabelling(); }
Compute initial labelling for all DirectedEdges at each node. In this step, DirectedEdges will acquire a complete labelling (i.e. one with labels for both Geometries) only if they are incident on a node which has edges for both Geometries
public boolean isTerminated(){ return STATE_Terminated.equals(m_state); }
State is Terminated (Execution issue)
public static <S extends HasMaximizeClickHandlers & HasHandlers>void fire(S source,JavaScriptObject jsObj){ if (TYPE != null) { MaximizeClickEvent event=new MaximizeClickEvent(jsObj); source.fireEvent(event); } }
Fires a open event on all registered handlers in the handler manager.If no such handlers exist, this method will do nothing.
private int handleCC(String value,DoubleMetaphoneResult result,int index){ if (contains(value,index + 2,1,"I","E","H") && !contains(value,index + 2,2,"HU")) { if ((index == 1 && charAt(value,index - 1) == 'A') || contains(value,index - 1,5,"UCCEE","UCCES")) { result.append("KS"); } else { result.append('X'); } index+=3; } else { result.append('K'); index+=2; } return index; }
Handles 'CC' cases
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){ switch (featureID) { case UmplePackage.METHOD_DECLARATOR___METHOD_NAME_1: return getMethodName_1(); case UmplePackage.METHOD_DECLARATOR___PARAMETER_LIST_1: return getParameterList_1(); } return super.eGet(featureID,resolve,coreType); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void or(Criteria criteria){ oredCriteria.add(criteria); }
This method was generated by MyBatis Generator. This method corresponds to the database table profile
public RPRecommendation buildJournalRecommendation(RPProtectionRecommendation rpProtectionRecommendation,String internalSiteName,String journalPolicy,VirtualArray journalVarray,VirtualPool journalVpool,ProtectionSystem ps,VirtualPoolCapabilityValuesWrapper capabilities,int requestedResourceCount,Volume vpoolChangeVolume,boolean isMPStandby){ VirtualPoolCapabilityValuesWrapper newCapabilities=getJournalCapabilities(journalPolicy,capabilities,requestedResourceCount); boolean foundJournal=false; List<Recommendation> journalRec=getRecommendedPools(rpProtectionRecommendation,journalVarray,journalVpool,null,null,newCapabilities,RPHelper.JOURNAL,internalSiteName); StoragePool journalStoragePool=null; URI storageSystemURI=null; if (vpoolChangeVolume != null && vpoolChangeVolume.checkForRp() && !isMPStandby) { List<Volume> existingJournalVolumes=RPHelper.findExistingJournalsForCopy(dbClient,vpoolChangeVolume.getConsistencyGroup(),vpoolChangeVolume.getRpCopyName()); Volume existingJournalVolume=existingJournalVolumes.get(0); if (existingJournalVolume == null) { _log.error(String.format("No existing journal found in CG [%s] for copy [%s], returning false",vpoolChangeVolume.getConsistencyGroup(),vpoolChangeVolume.getRpCopyName())); throw APIException.badRequests.unableToFindSuitableJournalRecommendation(); } if (RPHelper.isVPlexVolume(existingJournalVolume,dbClient)) { if (null == existingJournalVolume.getAssociatedVolumes() || existingJournalVolume.getAssociatedVolumes().isEmpty()) { _log.error("VPLEX volume {} has no backend volumes.",existingJournalVolume.forDisplay()); throw InternalServerErrorException.internalServerErrors.noAssociatedVolumesForVPLEXVolume(existingJournalVolume.forDisplay()); } URI backingVolumeURI=URI.create(existingJournalVolume.getAssociatedVolumes().iterator().next()); Volume backingVolume=dbClient.queryObject(Volume.class,backingVolumeURI); journalStoragePool=dbClient.queryObject(StoragePool.class,backingVolume.getPool()); } else { journalStoragePool=dbClient.queryObject(StoragePool.class,existingJournalVolume.getPool()); } storageSystemURI=existingJournalVolume.getStorageController(); foundJournal=true; } else { for ( Recommendation journalStoragePoolRec : journalRec) { journalStoragePool=dbClient.queryObject(StoragePool.class,journalStoragePoolRec.getSourceStoragePool()); _log.info(String.format("RP Journal Placement : Checking pool : [%s]",journalStoragePool.getLabel())); List<String> associatedStorageSystems=getCandidateTargetVisibleStorageSystems(ps.getId(),journalVarray,internalSiteName,journalStoragePool,VirtualPool.vPoolSpecifiesHighAvailability(journalVpool)); if (associatedStorageSystems == null || associatedStorageSystems.isEmpty()) { _log.info(String.format("RP Journal Placement Solution cannot be found using target pool " + journalStoragePool.getLabel() + " there is no connectivity to rp cluster sites.")); continue; } _log.info(String.format("RP Journal Placement : Associated storage systems for pool [%s] : [%s]",journalStoragePool.getLabel(),Joiner.on("-").join(associatedStorageSystems))); for ( String associateStorageSystem : associatedStorageSystems) { storageSystemURI=ConnectivityUtil.findStorageSystemBySerialNumber(ProtectionSystem.getAssociatedStorageSystemSerialNumber(associateStorageSystem),dbClient,StorageSystemType.BLOCK); StorageSystem storageSystem=dbClient.queryObject(StorageSystem.class,storageSystemURI); if (!isRpSiteConnectedToVarray(storageSystemURI,ps.getId(),internalSiteName,journalVarray)) { _log.info(String.format("RP Journal Placement : StorageSystem [%s] does NOT have connectivity to RP site [%s], ignoring..",storageSystem.getLabel(),internalSiteName)); continue; } foundJournal=true; break; } if (foundJournal) { break; } } } if (foundJournal) { StorageSystem storageSystem=dbClient.queryObject(StorageSystem.class,storageSystemURI); RPRecommendation journalRecommendation=buildRpRecommendation(storageSystem.getLabel(),journalVarray,journalVpool,journalStoragePool,newCapabilities,newCapabilities.getResourceCount(),internalSiteName,storageSystemURI,storageSystem.getSystemType(),ps); _log.info(String.format("RP Journal Placement : Journal Recommendation %s %n",journalRecommendation.toString(dbClient,ps))); return journalRecommendation; } _log.info(String.format("RP Journal Placement : Unable to determine placement for RP journal on site %s",internalSiteName)); return null; }
Builds the journal placement recommendation
public static String saltString(byte[] salt){ return Base64.encodeToString(salt,BASE64_FLAGS); }
Converts the given salt into a base64 encoded string suitable for storage.
public final void popNamespaceContext(){ m_prefixResolvers.pop(); }
Pop the current namespace context for the xpath.
public static boolean isUrl(String url){ Pattern pattern=Pattern.compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+$"); return pattern.matcher(url).matches(); }
is url
public static int openURL(String url) throws IOException { if (url == null) { return -1; } if (OSUtils.isWindows()) { return openURLWindows(url); } else if (OSUtils.isMacOSX()) { openURLMac(url); } else { launchFileOther(url); } return -1; }
Opens the specified url in a browser. <p>A browser will only be opened if the underlying operating system recognizes the url as one that should be opened in a browser, namely a url that ends in .htm or .html.
public static String implode(final Collection<String> strings,final String delim){ return implode(strings,delim,false); }
Implodes a collection of strings into a String.
private void childVis(Node r){ Edge e; r.setVisible(true); if (r.getCVisible()) { for (int noa=0; (e=r.getChild(noa)) != null; noa++) { childVis(e.getTarget()); } } }
Recursively goes through the tree and sets all the children and the parent to visible.
public void attrModified(Attr node,String oldv,String newv){ if (!changing && baseVal != null) { baseVal.invalidate(); } fireBaseAttributeListeners(); if (!hasAnimVal) { fireAnimatedAttributeListeners(); } }
Called when an Attr node has been modified.
protected void initialize(){ if (!System.getProperty("java.version").startsWith("1.3")) { setOpaque(false); setBackground(new java.awt.Color(0,0,0,0)); } setBorderPainted(false); setMargin(new Insets(2,2,2,2)); addMouseListener(new MouseListener()); }
Initializes the button.
protected void put(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { }
Called for a PUT method, logging and metrics have already been captured.
public boolean generate(Projection proj){ Debug.message("eomgdetail","EditableOMPoint.generate()"); if (point != null) point.generate(proj); for (int i=0; i < gPoints.length; i++) { GrabPoint gp=gPoints[i]; if (gp != null) { gp.generate(proj); } } return true; }
Use the current projection to place the graphics on the screen. Has to be called to at least assure the graphics that they are ready for rendering. Called when the graphic position changes.
protected Source processSource(StylesheetHandler handler,Source source){ return source; }
This method does nothing, but a class that extends this class could over-ride it and do some processing of the source.
public boolean needsHighlight(int xIndex,int dataSetIndex){ if (!valuesToHighlight() || dataSetIndex < 0) return false; for (int i=0; i < mIndicesToHightlight.length; i++) if (mIndicesToHightlight[i].getXIndex() == xIndex && mIndicesToHightlight[i].getDataSetIndex() == dataSetIndex) return true; return false; }
checks if the given index in the given DataSet is set for highlighting or not
public ResourceFilter caseSensitive(){ caseSensitive=true; return this; }
The match will be caseSensitive.
public long resolveProductId(final String product){ final long productId=NumberUtils.toLong(product,0L); if (productId > 0L) { bookmarkService.saveBookmarkForProduct(product); return productId; } final String productIdStr=bookmarkService.getProductForURI(product); return NumberUtils.toLong(productIdStr,0L); }
Resolve product PK from string.
static int applyMaskPenaltyRule3(ByteMatrix matrix){ int penalty=0; byte[][] array=matrix.getArray(); int width=matrix.getWidth(); int height=matrix.getHeight(); for (int y=0; y < height; y++) { for (int x=0; x < width; x++) { if (x + 6 < width && array[y][x] == 1 && array[y][x + 1] == 0 && array[y][x + 2] == 1 && array[y][x + 3] == 1 && array[y][x + 4] == 1 && array[y][x + 5] == 0 && array[y][x + 6] == 1 && ((x + 10 < width && array[y][x + 7] == 0 && array[y][x + 8] == 0 && array[y][x + 9] == 0 && array[y][x + 10] == 0) || (x - 4 >= 0 && array[y][x - 1] == 0 && array[y][x - 2] == 0 && array[y][x - 3] == 0 && array[y][x - 4] == 0))) { penalty+=N3; } if (y + 6 < height && array[y][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && ((y + 10 < height && array[y + 7][x] == 0 && array[y + 8][x] == 0 && array[y + 9][x] == 0 && array[y + 10][x] == 0) || (y - 4 >= 0 && array[y - 1][x] == 0 && array[y - 2][x] == 0 && array[y - 3][x] == 0 && array[y - 4][x] == 0))) { penalty+=N3; } } } return penalty; }
Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2).
public static IModelMetaData readDefault(SQL table,String analysisGroup) throws AdeException { final ConnectionWrapper cw=new ConnectionWrapper(AdeInternal.getDefaultConnection()); final ArrayList<Integer> ids=new ArrayList<Integer>(); try { final int groupId=GroupRead.getAnalysisGroupId(analysisGroup); final PreparedStatementWrapper psw=cw.preparedStatement("select MODEL_INTERNAL_ID from " + table + " where is_default=1 and ANALYSIS_GROUP=?"); psw.getPreparedStatement().setInt(1,groupId); final ResultSet rs=psw.executeQuery(); while (rs.next()) { ids.add(rs.getInt(1)); } cw.close(); } catch ( SQLException e) { cw.failed(e); } finally { cw.quietCleanup(); } if (ids.isEmpty()) { return null; } if (ids.size() > 1) { throw new AdeInternalException("Analysis group " + analysisGroup + " has multiple trained models"); } return readMetaData(table,ids.get(0)); }
readDefault returns the model meta data for a default model for a select ANALYSIS_GROUP. <br><br> Null is returned if there are no default models for the given analysis group. <br><br> A ade internal exception is thrown if there is more than 1 default model for a given analysis group. <br><br> A ade internal exception is thrown if the sql fails.
private StringBuilder readLine() throws NetworkException { try { StringBuilder line=new StringBuilder(); int previous=-1; int current=-1; while ((current=mStream.read()) != -1) { line.append((char)current); if ((previous == MsrpConstants.CHAR_LF) && (current == MsrpConstants.CHAR_CR)) { return line.delete(line.length() - 2,line.length()); } previous=current; } return line; } catch ( IOException e) { throw new NetworkException("Failed to read line!",e); } }
Read line
public int localsLength(){ return locals.length; }
Returns the number of local variable table entries, specified at construction.
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:56:01.778 -0500",hash_original_method="23D3B11AE402493DA8F476B948072A30",hash_generated_method="8CD4FC8E1AC9ABF55C88FFAC857144E0") public ParseException(String detailMessage,int location){ super(detailMessage + (" (at offset " + location + ")")); errorOffset=location; }
Constructs a new instance of this class with its stack trace, detail message and the location of the error filled in.
@Override protected EClass eStaticClass(){ return MappingPackage.Literals.FUNCTION_BLOCK_MAPPING_MODEL; }
<!-- begin-user-doc --> <!-- end-user-doc -->
private boolean handleContextItem(int itemId,long[] trackIds){ switch (itemId) { case R.id.list_context_menu_play: playTracks(trackIds); return true; case R.id.list_context_menu_share: shareTrack(trackIds[0]); return true; case R.id.list_context_menu_edit: Intent intent=IntentUtils.newIntent(this,TrackEditActivity.class).putExtra(TrackEditActivity.EXTRA_TRACK_ID,trackIds[0]); startActivity(intent); return true; case R.id.list_context_menu_delete: if (trackIds.length > 1 && trackIds.length == listView.getCount()) { trackIds=new long[]{-1L}; } deleteTracks(trackIds); return true; case R.id.list_context_menu_select_all: int size=listView.getCount(); for (int i=0; i < size; i++) { listView.setItemChecked(i,true); } return false; default : return false; } }
Handles a context item selection.
Item newNameTypeItem(final String name,final String desc){ key2.set(NAME_TYPE,name,desc,null); Item result=get(key2); if (result == null) { put122(NAME_TYPE,newUTF8(name),newUTF8(desc)); result=new Item(index++,key2); put(result); } return result; }
Adds a name and type to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item.
protected boolean accept(XSLTVisitor visitor){ return visitor.visitExtensionElement(this); }
Accept a visitor and call the appropriate method for this class.
public static void showPosition(File file,int line,int column){ try { String ln=getLine(file,line); if (ln != null) { err(ln); if (column < 0) return; String t="^"; for (int i=0; i < column; i++) t=" " + t; err(t); } } catch ( IOException e) { } }
prints a line of a file with marked position.
public double ymax(){ return ymax; }
Returns the maximum <em>y</em>-coordinate of any point in this rectangle.
public NamedWindowDeltaData(NamedWindowDeltaData deltaOne,NamedWindowDeltaData deltaTwo){ this.newData=aggregate(deltaOne.getNewData(),deltaTwo.getNewData()); this.oldData=aggregate(deltaOne.getOldData(),deltaTwo.getOldData()); }
Ctor aggregates two deltas into a single delta.
public boolean addTranslation(final String relFileName,final String sourceLngTxt,final String targetLngTxt){ assert mainTransLists != null; return addTranslation(mainTransLists,relFileName,sourceLngTxt,targetLngTxt); }
Add a translation text to the current map map
public DCCppLight(DCCppTrafficController tc,DCCppLightManager lm,String systemName){ super(systemName); this.tc=tc; this.lm=lm; initializeLight(systemName); }
Create a Light object, with only system name. <P> 'systemName' was previously validated in DCCppLightManager
protected void monitorCredentials(String userId,UserCredentials credentials){ credentials.addChangeListener(new UserCredentialsListener(userId)); }
Adds a listen to rewrite the credentials when the tokens are refreshed.
public void testLogDirectoryCreation() throws Exception { File logDir=new File("testLogDirectoryCreation"); if (logDir.exists()) { for ( File f : logDir.listFiles()) { f.delete(); } logDir.delete(); } if (logDir.exists()) throw new Exception("Unable to delete log directory prior to test: " + logDir.getAbsolutePath()); DiskLog log=new DiskLog(); log.setDoChecksum(true); log.setEventSerializerClass(ProtobufSerializer.class.getName()); log.setLogDir(logDir.getAbsolutePath()); log.setLogFileSize(1000000); log.setReadOnly(false); log.prepare(); log.validate(); log.release(); assertTrue("Log directory must now exist",logDir.exists()); File logDir2=new File("testLogDirectoryCreation2"); FileWriter fw=new FileWriter(logDir2); fw.write("test data"); fw.close(); log=new DiskLog(); log.setDoChecksum(true); log.setEventSerializerClass(ProtobufSerializer.class.getName()); log.setLogDir(logDir2.getAbsolutePath()); log.setLogFileSize(1000000); try { log.prepare(); throw new Exception("Able to open log on invalid directory: " + logDir2.getAbsolutePath()); } catch ( ReplicatorException e) { } }
Confirm that we create the log directory automatically if it is possible to do so and fail horribly if we cannot.
<M extends Map<String,String>>M putIn(final M map){ for ( final Entry<String,Integer> entry : mapping.entrySet()) { map.put(entry.getKey(),values[entry.getValue().intValue()]); } return map; }
Puts all values of this record into the given Map.
protected NegativeConstraint_Impl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void nodeStructureChanged(TreeNode node){ if (node != null) { fireTreeStructureChanged(this,getPathToRoot(node),null,null); } }
Invoke this method if you've totally changed the children of node and its children's children... This will post a treeStructureChanged event.
protected void runTests() throws Exception { BreakpointEvent bpe=startToMain("MultiBreakpointsTarg"); targetClass=bpe.location().declaringType(); mainThread=bpe.thread(); erm=vm().eventRequestManager(); for (int ii=0; ii < nthreads; ii++) { bkpts[ii]=setBreakpoint("MultiBreakpointsTarg","bkpt" + ii,"()V"); } listenUntilVMDisconnect(); for (int ii=0; ii < nthreads; ii++) { if (hits[ii] != nhits) { failure("FAILED: Expected " + nhits + " breakpoints for thread "+ ii+ " but only got "+ hits[ii]); } } if (!testFailed) { println("MultiBreakpointsTest: passed"); } else { throw new Exception("MultiBreakpointsTest: failed"); } }
test core
protected void addNamePropertyDescriptor(Object object){ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),getResourceLocator(),getString("_UI_NamedElement_name_feature"),getString("_UI_PropertyDescriptor_description","_UI_NamedElement_name_feature","_UI_NamedElement_type"),BasePackage.Literals.NAMED_ELEMENT__NAME,true,false,false,ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,null,null)); }
This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- end-user-doc -->
private int textLength(Node node){ int length=node.getTextContent().length(); node=node.getNextSibling(); while (node != null && (node.getNodeType() == TEXT_NODE || node.getNodeType() == CDATA_SECTION_NODE)) { length+=node.getTextContent().length(); if (node.getNodeType() == CDATA_SECTION_NODE) { length+=12; } node=node.getNextSibling(); } return length; }
Returns length of cdata and text nodes chain.
@Override public void run(){ amIActive=true; ShapeType shapeType; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } String outputFile=args[0]; String shapeTypeStr=args[1].toLowerCase(); if (outputFile.isEmpty() || shapeTypeStr.isEmpty()) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { switch (shapeTypeStr) { case "point": shapeType=ShapeType.POINT; break; case "pointz": shapeType=ShapeType.POINTZ; break; case "pointm": shapeType=ShapeType.POINTM; break; case "multipoint": shapeType=ShapeType.MULTIPOINT; break; case "multipointz": shapeType=ShapeType.MULTIPOINTZ; break; case "multipointm": shapeType=ShapeType.MULTIPOINTM; break; case "polyline": shapeType=ShapeType.POLYLINE; break; case "polylinez": shapeType=ShapeType.POLYLINEZ; break; case "polylinem": shapeType=ShapeType.POLYLINEM; break; case "polygon": shapeType=ShapeType.POLYGON; break; case "polygonz": shapeType=ShapeType.POLYGONZ; break; case "polygonm": shapeType=ShapeType.POLYGONM; break; default : showFeedback("The specified ShapeType is not supported or recognized"); return; } DBFField[] fields=new DBFField[1]; fields[0]=new DBFField(); fields[0].setName("FID"); fields[0].setDataType(DBFField.DBFDataType.NUMERIC); fields[0].setFieldLength(10); fields[0].setDecimalCount(0); ShapeFile output=new ShapeFile(outputFile,shapeType,fields); output.write(); returnData(outputFile); myHost.editVector(); showFeedback("Operation complete."); } catch (OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch (Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(),e); } finally { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
private void historyAddChanged(){ if (historyTextEdited) { historyAdd(getText()); historyTextEdited=false; historyPosition=history.size(); } }
Adds the current text to the history, if it was changed.
public boolean logToFile(LogEvent event,StringBuffer lineOut){ return true; }
Called when we are about to log an event to file.
public TableHeaderElement THE(String text,String url){ return new TableHeaderElement(buildHREF(url,text)); }
Returns a TableHeaderElement that contains a URL
@Override public void update(BasicCamera camera){ for (int i=0; i < pointSet.getNumberOfChildren(); ++i) { ((Waypoint)pointSet.getChild(i)).update(camera); } }
Update the map element icons according to the camera position.
public static boolean isWithinTimeComparisonEpsilon(long timeMicros){ long now=Utils.getSystemNowMicrosUtc(); return Math.abs(timeMicros - now) < timeComparisonEpsilon; }
Compares a time value with current time. Both time values are in micros since epoch. Since we can not assume the time came from the same node, we use the concept of a time epsilon: any two time values within epsilon are considered too close to globally order in respect to each other and this method will return true.