code
stringlengths
10
174k
nl
stringlengths
3
129k
public void addBackward(EdgeInfo ei){ backward.append(ei); }
Add the given edge into the list of backward edges.
@SuppressWarnings("rawtypes") @Test public void testCustomStorageFormat() throws Exception { String resourceId="/schema/test/foo"; String storedResourceId="_schema_test_foo.bin"; MockAnalysisComponent observer=new MockAnalysisComponent(); List<ManagedResourceObserver> observers=Arrays.asList((ManagedResourceObserver)observer); Map<String,Object> storedData=new HashMap<>(); Map<String,Object> initArgs=new HashMap<>(); initArgs.put("someArg","someVal"); initArgs.put("arg2",Boolean.TRUE); List<String> arg3list=Arrays.asList("one","two","three"); initArgs.put("arg3",arg3list); initArgs.put("arg4",18L); initArgs.put("arg5",0.9); Map<String,Long> arg6map=new HashMap<>(); arg6map.put("uno",1L); arg6map.put("dos",2L); initArgs.put("arg6",arg6map); storedData.put("initArgs",initArgs); List<String> managedList=new ArrayList<>(); managedList.add("1"); managedList.add("2"); managedList.add("3"); storedData.put(ManagedResource.MANAGED_JSON_LIST_FIELD,managedList); ManagedResourceStorage.InMemoryStorageIO storageIO=new ManagedResourceStorage.InMemoryStorageIO(); storageIO.storage.put(storedResourceId,ser2bytes((Serializable)storedData)); CustomStorageFormatResource res=new CustomStorageFormatResource(resourceId,new SolrResourceLoader(Paths.get("./")),storageIO); res.loadManagedDataAndNotify(observers); assertTrue("Observer was not notified by ManagedResource!",observer.wasNotified); List<String> updatedData=new ArrayList<>(); updatedData.add("1"); updatedData.add("2"); updatedData.add("3"); updatedData.add("4"); res.storeManagedData(updatedData); Object stored=res.storage.load(resourceId); assertNotNull(stored); assertTrue(stored instanceof Map); Map storedMap=(Map)stored; assertNotNull(storedMap.get("initArgs")); List storedList=(List)storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); assertTrue(storedList.contains("4")); }
The ManagedResource storage framework allows the end developer to use a different storage format other than JSON, as demonstrated by this test.
public AccountHeaderBuilder withHeaderBackground(Drawable headerBackground){ this.mHeaderBackground=new ImageHolder(headerBackground); return this; }
set the background for the slider as color
public E removeFirst(){ final Node<E> f=first; if (f == null) throw new NoSuchElementException(); return unlinkFirst(f); }
Removes and returns the first element from this list.
public void testPropertyFileLoading() throws Exception { File propFile=File.createTempFile("propertyLoadTest",".properties"); PrintWriter pw=new PrintWriter(propFile); pw.println("a="); pw.println("a1= "); pw.println("b=foo"); pw.println("b1= foo "); pw.close(); FileInputStream fis=new FileInputStream(propFile); TungstenProperties props=new TungstenProperties(); props.load(fis); fis.close(); Assert.assertEquals("Empty string set","",props.get("a")); Assert.assertEquals("Blank string set","",props.get("a1")); Assert.assertEquals("Value set","foo",props.get("b")); Assert.assertEquals("Padded value set","foo ",props.get("b1")); Assert.assertNull("No value set, is null",props.get("c")); }
Ensure that Java property files are correctly loaded from a property file. This includes Java conventions that leading whitespace before the property value is consumed, but trailing whitespace is not.
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.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:41.303 -0500",hash_original_method="61CB88820073366C14C36F5A2569814F",hash_generated_method="7D268822285759A7379C078F51F43CDF") public static final String readMagic(DataInputStream in){ try { byte[] bytes=new byte[512]; for (int i=0; i < bytes.length; i++) { byte b=in.readByte(); if (b == '\0') { String string=new String(bytes,0,i,"UTF-8"); if (string.startsWith(MAGIC)) { return string; } return null; } bytes[i]=b; } return null; } catch ( IOException e) { return null; } }
Returns the file's magic value as a String if found, otherwise null.
public void testRegister1(){ Phaser phaser=new Phaser(); assertState(phaser,0,0,0); assertEquals(0,phaser.register()); assertState(phaser,0,1,1); }
register() will increment the number of unarrived parties by one and not affect its arrived parties
public Matrix4f rotateZ(float ang){ return rotateZ(ang,this); }
Apply rotation about the Z axis to this matrix by rotating the given amount of radians. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations">http://en.wikipedia.org</a>
public void test_ConstructorIILjava_util_Random(){ BigInteger bi1=new BigInteger(10,5,rand); BigInteger bi2=new BigInteger(10,5,rand); assertTrue(bi1 + " is negative",bi1.compareTo(BigInteger.ZERO) >= 0); assertTrue(bi1 + " is too big",bi1.compareTo(new BigInteger("1024",10)) < 0); assertTrue(bi2 + " is negative",bi2.compareTo(BigInteger.ZERO) >= 0); assertTrue(bi2 + " is too big",bi2.compareTo(new BigInteger("1024",10)) < 0); Random rand=new Random(); BigInteger bi; int certainty[]={0,1,2,3,4,5,6,7,8,9,10,Integer.MIN_VALUE,Integer.MIN_VALUE + 1,-2,-1}; for (int i=2; i <= 20; i++) { for (int c=0; c < certainty.length; c++) { bi=new BigInteger(i,c,rand); assertEquals(i,bi.bitLength()); } } try { new BigInteger(1,80,(Random)null); fail("ArithmeticException expected"); } catch ( ArithmeticException expected) { } try { new BigInteger(-1,(Random)null); fail("IllegalArgumentException expected"); } catch ( IllegalArgumentException expected) { } }
java.math.BigInteger#BigInteger(int, int, java.util.Random)
public static String toHex(byte[] bytes){ char[] hexChars=new char[bytes.length * 2]; int v; for (int j=0; j < bytes.length; j++) { v=bytes[j] & 0xFF; hexChars[j * 2]=hexArray[v >>> 4]; hexChars[j * 2 + 1]=hexArray[v & 0x0F]; } return new String(hexChars); }
Bytes to hex
public void testMoveRenameFileDestinationRootSourceMissing() throws Exception { IgfsPath file=new IgfsPath("/" + FILE.name()); create(igfsSecondary,paths(DIR,SUBDIR),paths(FILE)); create(igfs,null,null); igfs.rename(FILE,file); checkExist(igfs,DIR,SUBDIR); checkExist(igfs,igfsSecondary,file); checkNotExist(igfs,igfsSecondary,FILE); }
Test file move and rename when destination is the root and source is missing.
public void stop(){ CGlobalProgressManager.instance().remove(this); }
Stops the load operation.
@Override public UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException { UpdateResponse ur=null; if (this.solr0 != null) ur=this.solr0.deleteById(ids); if (this.solr1 != null) ur=this.solr1.deleteById(ids); return ur; }
Deletes a list of documents by unique ID
public static SortedDocValues wrap(SortedSetDocValues sortedSet,Type selector){ if (sortedSet.getValueCount() >= Integer.MAX_VALUE) { throw new UnsupportedOperationException("fields containing more than " + (Integer.MAX_VALUE - 1) + " unique terms are unsupported"); } SortedDocValues singleton=DocValues.unwrapSingleton(sortedSet); if (singleton != null) { return singleton; } else { switch (selector) { case MIN: return new MinValue(sortedSet); case MAX: return new MaxValue(sortedSet); case MIDDLE_MIN: return new MiddleMinValue(sortedSet); case MIDDLE_MAX: return new MiddleMaxValue(sortedSet); default : throw new AssertionError(); } } }
Wraps a multi-valued SortedSetDocValues as a single-valued view, using the specified selector
public String country(){ return country; }
Returns the country name or abbreviation (example: 'DE' for Germany).
@Override public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException { try { MBeanServer server=QueryEval.getMBeanServer(); String v=server.getObjectInstance(name).getClassName(); if (v.equals(className)) { return super.apply(name); } throw new InvalidApplicationException("Class name is " + v + ", should be "+ className); } catch ( Exception e) { throw new InvalidApplicationException("Qualified attribute: " + e); } }
Applies the QualifiedAttributeValueExp to an MBean.
public void add(R record){ records.add(record); lastRecord=record; currentSizeBytes+=record.lengthWithOverhead(); if (timestamp < 0) { timestamp=System.currentTimeMillis(); } }
Adds a record to the buffer.
public JPAProperty(JPAProperty property){ this(property.getNamespace(),property.getLocalName(),property.getValue(),property.getOrder()); }
Create a copy of the give JPAProperty
public static void assertSearcherHasChanged(SolrIndexSearcher previous){ SolrQueryRequest req=req("*:*"); try { SolrIndexSearcher newSearcher=getMainSearcher(req); assertNotSame(previous,newSearcher); } finally { req.close(); } }
Given an existing searcher, creates a new SolrRequest, and verifies that the searcher in that request is <b>not</b> the same as the previous searcher -- cleaningly closing the new SolrRequest either way.
public void inputSentence(String text,String subject,String userName,String targetUserName,Message message,Network network) throws MessagingException { Vertex input=createInputParagraph(text.trim(),network); Vertex user=network.createSpeaker(userName); input.addRelationship(Primitive.INSTANTIATION,Primitive.EMAIL); input.getRelationship(Primitive.INPUT).addRelationship(Primitive.INSTANTIATION,Primitive.EMAIL); long date=0; if (message.getReceivedDate() == null) { date=message.getSentDate().getTime(); } else { date=message.getReceivedDate().getTime(); } input.addRelationship(Primitive.CREATEDAT,network.createVertex(date)); input.addRelationship(Primitive.ID,network.createVertex(message.getMessageNumber())); input.addRelationship(Primitive.SPEAKER,user); input.addRelationship(Primitive.TOPIC,network.createSentence(subject)); Vertex conversation=network.createInstance(Primitive.CONVERSATION); Language.addToConversation(input,conversation); conversation.addRelationship(Primitive.SPEAKER,user); conversation.addRelationship(Primitive.TYPE,Primitive.EMAIL); if (targetUserName != null) { Vertex targetUser=null; if (targetUserName.equals(getEmailAddress())) { targetUser=network.createVertex(Primitive.SELF); } else { targetUser=network.createSpeaker(targetUserName); } input.addRelationship(Primitive.TARGET,targetUser); conversation.addRelationship(Primitive.SPEAKER,targetUser); } user.addRelationship(Primitive.INPUT,input); user.addRelationship(Primitive.EMAIL,input); network.save(); getBot().memory().addActiveMemory(input); }
Process the text sentence.
public int addPadding(byte[] in,int inOff){ int count=in.length - inOff; byte code; if (inOff > 0) { code=(byte)((in[inOff - 1] & 0x01) == 0 ? 0xff : 0x00); } else { code=(byte)((in[in.length - 1] & 0x01) == 0 ? 0xff : 0x00); } while (inOff < in.length) { in[inOff]=code; inOff++; } return count; }
add the pad bytes to the passed in block, returning the number of bytes added. <p> Note: this assumes that the last block of plain text is always passed to it inside in. i.e. if inOff is zero, indicating the entire block is to be overwritten with padding the value of in should be the same as the last block of plain text. </p>
public boolean isReverseAxes(){ return m_iterator.isReverse(); }
Tells if this is a reverse axes. Overrides AxesWalker#isReverseAxes.
public boolean shouldShowRequestPermissionRationale(Fragment fragment,String... permissions){ for ( String permission : permissions) { if (FragmentCompat.shouldShowRequestPermissionRationale(fragment,permission)) { return true; } } return false; }
Checks given permissions are needed to show rationale.
public boolean canLoadArchive(AcsAccessObject acs,int archId,String entidad) throws Exception { boolean can=false; DbConnection dbConn=new DbConnection(); try { dbConn.open(DBSessionManager.getSession()); can=ArchiveManager.canLoadArchive(dbConn,acs.getAccessToken(),archId); return can; } catch ( Exception e) { return can; } finally { dbConn.close(); } }
Devuelve <tt>true</tt> si el usuario tiene permisos de acceso sobre el archivador
protected void startWorkFlow(int AD_Workflow_ID){ centerPane.setSelectedIndex(m_tabWorkflow); wfPanel.load(AD_Workflow_ID,false); }
Start Workflow Activity
public TollAnalyzer(final String eventsFile,final double simulationEndTime,final int noOfTimeBins,final String ug){ this(eventsFile,simulationEndTime,noOfTimeBins,null,null,ug); }
User group filtering will be used, result will include all links but persons from given user group only.
public final boolean peekOrTrue(){ return (m_index > -1) ? m_values[m_index] : true; }
Looks at the object at the top of this stack without removing it from the stack. If the stack is empty, it returns true.
public void validate(final Cookie cookie,final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { if (cookie instanceof ClientCookie && !((ClientCookie)cookie).containsAttribute(ClientCookie.VERSION_ATTR)) { throw new MalformedCookieException("Violates RFC 2965. Version attribute is required."); } } }
validate cookie version attribute. Version attribute is REQUIRED.
public InstanceEvent(Object source,Instances structure){ super(source); m_structure=structure; m_status=FORMAT_AVAILABLE; }
Creates a new <code>InstanceEvent</code> instance which encapsulates header information only.
public void testFilteredClassifier(){ try { Instances data=getFilteredClassifierData(); for (int i=0; i < data.numAttributes(); i++) { if (data.classIndex() == i) continue; if (data.attribute(i).isNominal()) { ((SwapValues)m_FilteredClassifier.getFilter()).setAttributeIndex("" + (i + 1)); break; } } } catch ( Exception e) { fail("Problem setting up test for FilteredClassifier: " + e.toString()); } super.testFilteredClassifier(); }
tests the filter in conjunction with the FilteredClassifier
private long factorial(long num){ assert num > 0; if (num == 1) return num; return num * factorial(num - 1); }
Calculates factorial.
public static TypesTreeModel createEmptyTypeModel(){ return new TypesTreeModel(); }
Creates a new instance of the types tree model that doesn't contain any nodes.
public static String dumpAsString(Object obj,boolean verbose){ StringBuffer buf=new StringBuffer(); if (obj instanceof ASN1Primitive) { _dumpAsString("",verbose,(ASN1Primitive)obj,buf); } else if (obj instanceof ASN1Encodable) { _dumpAsString("",verbose,((ASN1Encodable)obj).toASN1Primitive(),buf); } else { return "unknown object type " + obj.toString(); } return buf.toString(); }
Dump out the object as a string.
public boolean removeArg(final BOp arg){ if (arg == null) throw new IllegalArgumentException(); if (arg == this) throw new IllegalArgumentException(); if (args.remove(arg)) { mutation(); return true; } return false; }
Remove the 1st occurrence of the argument (core mutation method).
public Asn1Exception(String message,Throwable causeThrowable){ super(message,causeThrowable); }
Creates a new Asn1Exception with the specified message and cause throwable.
public void initComponents() throws Exception { super.initComponents(); addHelpMenu("package.jmri.jmrix.sprog.update.SprogIIUpdateFrame",true); _memo.getSprogVersionQuery().requestVersion(this); }
Set the help item
public int read() throws IOException { if (ostart >= ofinish) { int i=0; while (i == 0) i=getMoreData(); if (i == -1) return -1; } return ((int)obuffer[ostart++] & 0xff); }
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>
public boolean isLastExpanded(){ return lastExpanded; }
Gets last expanded.
@Override public void characters(char[] text,int start,int len) throws SAXException { if (curHandler != null) { if (unrecognizedElements == 0) { if (curHandler.buffer == null) { curHandler.buffer=new StringBuffer(); } curHandler.buffer.append(text,start,len); } if (curHandler.innerXml != null && (curHandler.mixedContent || unrecognizedElements > 0)) { if (curHandler.fullTextIndex) { curHandler.fullTextIndexWriter.write(text,start,len); curHandler.fullTextIndexWriter.write("\n"); } try { curHandler.innerXml.characters(new String(text,start,len)); } catch ( IOException e) { throw new SAXException(e); } } } }
SAX callback.
public double optDouble(int index,double defaultValue){ try { return getDouble(index); } catch ( Exception e) { return defaultValue; } }
Get the optional double value associated with an index. The defaultValue is returned if there is unknown value for the index, or if the value is not a number and cannot be converted to a number.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-01-27 09:54:12.413 -0500",hash_original_method="43C05B8A0FF5CBFFF8E027DF94B104CB",hash_generated_method="BEA9506A49791E09E851664F93E1DBF1") public void clear(){ int n=mSize; Object[] values=mValues; for (int i=0; i < n; i++) { values[i]=null; } mSize=0; mGarbage=false; }
Removes all key-value mappings from this SparseArray.
public static String toHexString(byte[] buf,String sep,int lineLen){ return toHexString(buf,0,buf.length,sep,lineLen); }
Get a text representation of a byte[] as hexadecimal String, where each pair of hexadecimal digits corresponds to consecutive bytes in the array.
private void skip(){ index++; }
Skips the current symbol.
private double calculateMultipleTraitsLikelihood(ContrastedTraitNode contrastNode,int traitCount){ SimpleTree contrastTree=new SimpleTree(contrastNode); double[][] w=new double[traitCount][traitCount]; for (int j=0; j < traitCount; j++) { for (int k=j; k < traitCount; k++) { double wjk=0.0; for (int i=0; i < contrastTree.getInternalNodeCount(); i++) { ContrastedTraitNode ctNode=(ContrastedTraitNode)contrastTree.getInternalNode(i); wjk+=(ctNode.contrast[j] * ctNode.contrast[k]) / ctNode.contrastVariance; } wjk/=(double)contrastTree.getInternalNodeCount(); w[j][k]=wjk; w[k][j]=wjk; } } MutableMatrix answer=Matrix.Util.createMutableMatrix(new double[1][1]); MutableMatrix temp=Matrix.Util.createMutableMatrix(w); double detW=0.0; try { detW=Matrix.Util.det(temp); } catch ( Matrix.NotSquareException nse) { nse.printStackTrace(System.out); } MutableMatrix invW=Matrix.Util.createMutableMatrix(w); try { Matrix.Util.invert(invW); } catch ( Matrix.NotSquareException nse) { nse.printStackTrace(System.out); } double logL=0.0; int n=contrastTree.getInternalNodeCount() + 1; for (int i=0; i < contrastTree.getInternalNodeCount(); i++) { ContrastedTraitNode ctNode=(ContrastedTraitNode)contrastTree.getInternalNode(i); double[] contrasts=ctNode.getTraitContrasts(); Matrix uT=Matrix.Util.createRowVector(contrasts); Matrix u=Matrix.Util.createColumnVector(contrasts); try { Matrix.Util.product(invW,u,temp); Matrix.Util.product(uT,temp,answer); } catch ( Matrix.WrongDimensionException wde) { wde.printStackTrace(System.out); } logL+=answer.getElement(0,0) / ctNode.getContrastVariance(); logL+=traitCount * Math.log(ctNode.getContrastVariance()); } logL+=traitCount * Math.log(contrastNode.getNodeVariance()); logL+=n * Math.log(detW); logL+=n * traitCount * Math.log(2 * Math.PI); logL=-logL / 2.0; return logL; }
Calculates the likelihood of the contrasted node
public void generate(ActionEvent actionEvent){ final FileChooser fileChooser=new FileChooser(); fileChooser.setTitle("Export to"); fileChooser.getExtensionFilters().add(new ExtensionFilter(Language.JAVA.name,"*.java")); fileChooser.getExtensionFilters().add(new ExtensionFilter(Language.CPP.name,"*.cpp")); fileChooser.getExtensionFilters().add(new ExtensionFilter(Language.PYTHON.name,"*.py")); fileChooser.setInitialFileName("Pipeline.java"); final File file=fileChooser.showSaveDialog(root.getScene().getWindow()); if (file == null) { return; } Language lang=Language.get(fileChooser.getSelectedExtensionFilter().getDescription()); Exporter exporter=new Exporter(pipeline.getSteps(),lang,file); final Set<String> nonExportableSteps=exporter.getNonExportableSteps(); if (!nonExportableSteps.isEmpty()) { StringBuilder b=new StringBuilder("The following steps cannot be exported:\n"); nonExportableSteps.forEach(null); Alert alert=new Alert(Alert.AlertType.WARNING); alert.setContentText(b.toString()); alert.showAndWait(); return; } Thread exportRunner=new Thread(exporter); exportRunner.setDaemon(true); exportRunner.start(); }
Controls the export button in the main menu. Opens a filechooser with language selection. The user can select the language to export to, save location and file name.
public void sendRequests(){ Connection conn=plugin.getDb().getSQLConnection(); try (Statement st=conn.createStatement()){ for ( Entry<String,Integer> entry : plugin.getPoolsManager().getDeathHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "deaths VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (deaths)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "deaths VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getDeathHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getArrowHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "arrows VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (arrows)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "arrows VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getArrowHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getSnowballHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "snowballs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (snowballs)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "snowballs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getSnowballHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getEggHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "eggs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (eggs)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "eggs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getEggHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getFishHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "fish VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (fish)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "fish VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getFishHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getItemBreakHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "itembreaks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (itembreaks)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "itembreaks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getItemBreakHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getEatenItemsHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "eatenitems VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (eatenitems)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "eatenitems VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getEatenItemsHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getShearHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "shears VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (shears)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "shears VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getShearHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getMilkHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "milks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (milks)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "milks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getMilkHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getTradeHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "trades VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (trades)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "trades VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getTradeHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getAnvilHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "anvils VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (anvils)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "anvils VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getAnvilHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getEnchantmentHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "enchantments VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (enchantments)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "enchantments VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getEnchantmentHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getBedHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "beds VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (beds)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "beds VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getBedHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getXpHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "levels VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (levels)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "levels VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getXpHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getConsumedPotionsHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "consumedpotions VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (consumedpotions)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "consumedpotions VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getConsumedPotionsHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getDropHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "drops VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (drops)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "drops VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getDropHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getHoePlowingHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "hoeplowing VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (hoeplowing)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "hoeplowing VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getHoePlowingHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getFertiliseHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "fertilising VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (fertilising)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "fertilising VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getFertiliseHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getTameHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "tames VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (tames)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "tames VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getTameHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getBrewingHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "brewing VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (brewing)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "brewing VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getBrewingHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getFireworkHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "fireworks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (fireworks)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "fireworks VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getFireworkHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getMusicDiscHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "musicdiscs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (musicdiscs)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "musicdiscs VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getMusicDiscHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getEnderPearlHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "enderpearls VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername) DO UPDATE SET (enderpearls)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "enderpearls VALUES ('"+ entry.getKey()+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getEnderPearlHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getBlockPlaceHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "places VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername,blockid) DO UPDATE SET (places)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "places VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getBlockPlaceHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getBlockBreakHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "breaks VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername,blockid) DO UPDATE SET (breaks)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "breaks VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getBlockBreakHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getKillHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "kills VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername,mobname) DO UPDATE SET (kills)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "kills VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getKillHashMap()).remove(entry.getKey(),entry.getValue()); } for ( Entry<String,Integer> entry : plugin.getPoolsManager().getCraftHashMap().entrySet()) { if (plugin.getDb().isPostgres()) st.execute("INSERT INTO " + plugin.getDb().getTablePrefix() + "crafts VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"+ " ON CONFLICT (playername,item) DO UPDATE SET (crafts)=("+ entry.getValue()+ ")"); else st.execute("REPLACE INTO " + plugin.getDb().getTablePrefix() + "crafts VALUES ('"+ entry.getKey().substring(0,36)+ "', '"+ entry.getKey().substring(36)+ "', "+ entry.getValue()+ ")"); ((ConcurrentHashMap<String,Integer>)plugin.getPoolsManager().getCraftHashMap()).remove(entry.getKey(),entry.getValue()); } } catch ( SQLException e) { plugin.getLogger().log(Level.SEVERE,"Error while sending async pooled requests to database: ",e); } }
* Sends requests to the database to deal with regular events and prevent plugin from hitting server performance. Non event related categories (distances and play times) are not handled by pools. Queries must not be batched because of race conditions; a database entry must first be updated, and if cached value in HashMap has not changed (by a listener running on main thread), it can be removed from the HashMap. Any thread doing a subsequent read in the database will retrieve the correct value. Enumerations return elements reflecting the state of the hash table at some point at or since the creation of the enumeration, and therefore the (atomic) remove method can be used within them. The cast operations are necessary to ensure compatibility with Java versions prior to Java 8 (Map interface did not support remove(key, value) before then). PostgreSQL has no REPLACE operator. We have to use the INSERT ... ON CONFLICT construct, which is available for PostgreSQL 9.5+.
public boolean fillEmpties(){ return filledEmpties == null ? false : filledEmpties; }
If true, empty lines should still be appropriately indented. If false, empty lines should be completely blank.
public TypeTuple apply(Substitution<ReferenceType> substitution){ List<Type> typeList=new ArrayList<>(); for ( Type type : this.list) { Type newType=type.apply(substitution); if (newType != null) { typeList.add(newType); } else { typeList.add(type); } } return new TypeTuple(typeList); }
Applies a substitution to a type tuple, replacing any occurrences of type variables. Resulting tuple may only be partially instantiated.
@Override protected void uninstallViewListeners(View p){ super.uninstallViewListeners(p); Action redoActionInView=p.getActionMap().get(ID); if (redoActionInView != null && redoActionInView != this) { redoActionInView.removePropertyChangeListener(redoActionPropertyListener); } }
Installs listeners on the view object.
public Configurator emptyButton(int textRes,int backgroundRes){ if (textRes > 0) { viewEmptyTryAgainButtonText=textRes; } if (backgroundRes > 0) { viewEmptyTryAgainButtonBackgroundResource=backgroundRes; } return this; }
Customize the empty view button.
public static void recordRamUsage(String measurementPoint){ List<MemoryPoolMXBean> pools=ManagementFactory.getMemoryPoolMXBeans(); if (ramPoolName.length != pools.size()) { logger.error("Unexpected change in number of RAM areas (was " + ramPoolName.length + ", now "+ pools.size()); } else { for (int i=0; i < pools.size(); i++) { MemoryPoolMXBean pool=pools.get(i); if (ramPoolName[i] == null) ramPoolName[i]=pool.getName(); if (ramPoolType[i] == null) ramPoolType[i]=pool.getType().toString(); if (!ramPoolName[i].equals(pool.getName())) { logger.error("Mismatch on RAM Pool " + i + " name (expected "+ ramPoolName[i]+ ", got "+ pool.getName()+ "0"); } else { MemoryUsage usage=pool.getUsage(); if (usage.getCommitted() > ramPoolCommitted[i]) ramPoolCommitted[i]=usage.getCommitted(); if (usage.getInit() > ramPoolInit[i]) ramPoolInit[i]=usage.getInit(); if (usage.getMax() > ramPoolMax[i]) ramPoolMax[i]=usage.getMax(); if (usage.getUsed() > ramPoolUsed[i]) ramPoolUsed[i]=usage.getUsed(); if (logger.isDebugEnabled()) { if (i == 0) { logger.info(""); logger.info("Java VM RAM Usage " + measurementPoint); logger.info(String.format(" %-20s %-15s%10s%10s%10s%10s","NAME","TYPE","COMMITTED","INIT","MAX","USED")); } logger.info(String.format(" %-20s %-15s%10d MB%7d MB%7d MB%7d MB",pool.getName(),pool.getType().toString(),usage.getCommitted() / (2 << 20),usage.getInit() / (2 << 20),usage.getMax() / (2 << 20),usage.getUsed() / (2 << 20))); logger.info(""); } } } } }
Record the RAM usage at the specified measuring point. If in a debug mode we also output to log file, otherwise just accumlate results.
private static byte char64(char x){ if ((int)x < 0 || (int)x > index_64.length) return -1; return index_64[(int)x]; }
Look up the 3 bits base64-encoded by the specified character, range-checking againt conversion table
@Override public CompilerPhase newExecution(IR ir){ return this; }
Return this instance of this phase. This phase contains no per-compilation instance fields.
public File resourceDwcaFile(@NotNull String resourceName){ return dataFile(RESOURCES_DIR + "/" + resourceName+ "/"+ DWCA_FILENAME); }
Retrieves DwC-A file for a resource.
public title addElement(Element element){ addElementToRegistry(element); return (this); }
Adds an Element to the element.
public void testStartViaFaster(){ Fixture f=new Fixture(); TestTimeCost tc=new TestTimeCost(); tc.setData(Id.create(1,Link.class),2.0,2.0); tc.setData(Id.create(2,Link.class),1.0,1.0); tc.setData(Id.create(3,Link.class),3.0,3.0); tc.setData(Id.create(4,Link.class),2.0,2.0); tc.setData(Id.create(5,Link.class),1.0,1.0); tc.setData(Id.create(6,Link.class),3.0,3.0); tc.setData(Id.create(7,Link.class),4.0,4.0); MultiNodeDijkstra dijkstra=new MultiNodeDijkstra(f.network,tc,tc); Map<Node,InitialNode> fromNodes=new HashMap<Node,InitialNode>(); fromNodes.put(f.network.getNodes().get(Id.create(1,Node.class)),new InitialNode(1.0,1.0)); fromNodes.put(f.network.getNodes().get(Id.create(4,Node.class)),new InitialNode(4.0,4.0)); Map<Node,InitialNode> toNodes=new HashMap<Node,InitialNode>(); toNodes.put(f.network.getNodes().get(Id.create(5,Node.class)),new InitialNode(0.0,0.0)); Path p=dijkstra.calcLeastCostPath(fromNodes,toNodes,null); assertNotNull("no path found!",p); assertEquals(3,p.links.size()); assertEquals("1",p.links.get(0).getId().toString()); assertEquals("7",p.links.get(1).getId().toString()); assertEquals("5",p.links.get(2).getId().toString()); }
Both nodes 1 and 4 are part of the start set. Even if the path from 1 to the target leads over node 4, it may be faster, due to the intial cost values. Test that the route does not cut at node 4 as the first node backwards from the start set.
public static final int[] quicksort(final int[] primary,final int[] secondary,final int[] names){ final int items=names.length; final int[] primary_values=new int[items]; final int[] secondary_values=new int[items]; for (int i=0; i < items; i++) { primary_values[i]=primary[i]; secondary_values[i]=secondary[i]; } final int start=0; int i, j, k; int temp, temp2; int temp_name; for (i=start + 1; i < items; i++) { temp=primary_values[i]; temp2=secondary_values[i]; temp_name=names[i]; k=start; for (j=i - 1; j >= start; j--) { if ((temp < primary_values[j]) | ((temp == primary_values[j]) & (temp2 < secondary_values[j]))) { primary_values[j + 1]=primary_values[j]; secondary_values[j + 1]=secondary_values[j]; names[j + 1]=names[j]; } else { k=j + 1; break; } } primary_values[k]=temp; secondary_values[k]=temp2; names[k]=temp_name; } return names; }
quick sort list on 2 values with names as int
public Object read(InputNode node,Object value) throws Exception { Class type=value.getClass(); Composite factory=getComposite(type); Object real=factory.read(node,value); return read(node,type,real); }
This <code>read</code> method will read the contents of the XML document from the provided source and populate the object with the values deserialized. This is used as a means of injecting an object with values deserialized from an XML document. If the XML source cannot be deserialized or there is a problem building the object graph an exception is thrown.
public static boolean isAVPlex(StorageSystem system){ return (system.getSystemType().equals(DiscoveredDataObject.Type.vplex.name())); }
Determines whether or not the passed in Storage System in a VPLEX by checking the System Type.
public boolean exceptionOccurred(){ return getException() != null; }
Returns whether or not an exception occurred during this async method invocation.
public FluentTriFunction<T1,T2,T3,CompletableFuture<R>> liftAsync(final Executor ex){ return FluentFunctions.of(null); }
Convert this TriFunction into one that executes asynchronously and returns a CompleteableFuture with the result
public BPTTCreationDialog(final NetworkPanel panel){ this.panel=panel; setTitle("Build Backprop Through Time Network"); tfNumInputsOutputs.setColumns(5); prefsPanel.addItem("Number of input / outupt nodes:",tfNumInputsOutputs); prefsPanel.addItem("Number of hidden nodes:",tfNumHidden); tfNumInputsOutputs.setText("" + 5); tfNumHidden.setText("" + 5); setContentPane(prefsPanel); }
Constructs a labeled item panel dialog for the creation of a simple recurrent network.
public boolean mergeStack(Frame frame){ boolean changed=false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i=0; i < top; i++) { if (stack[i] != null) { Type prev=stack[i]; Type merged=prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i]=merged; if ((!merged.equals(prev)) || merged.popChanged()) { changed=true; } } } return changed; }
Merges all types on the stack of this frame instance with that of the specified frame. The local variable table is left untouched.
public Spider(PageProcessor pageProcessor){ this.pageProcessor=pageProcessor; this.site=pageProcessor.getSite(); this.startRequests=pageProcessor.getSite().getStartRequests(); }
create a spider with pageProcessor.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:29.178 -0500",hash_original_method="0B011E4041136408340083F55A5156B3",hash_generated_method="407F6F402D6B283873CE3DF652B88B34") public int purge(){ synchronized (impl) { return impl.purge(); } }
Removes all canceled tasks from the task queue. If there are no other references on the tasks, then after this call they are free to be garbage collected.
public boolean canGoForward(){ return pager.getCurrentItem() < (adapter.getCount() - 1); }
TODO should this be public?
public static boolean lazyGaussianElimination(final int var2Eq[][],final long[] c,final int[] variable,final long[] solution){ return lazyGaussianElimination(null,var2Eq,c,variable,solution); }
Solves a system using lazy Gaussian elimination.
public int costInline(int thresh,Environment env,Context ctx){ return thresh; }
Compute cost of inlining this statement
public boolean equals(XObject obj2){ if (obj2.getType() == XObject.CLASS_NODESET) return obj2.equals(this); try { return m_val == obj2.bool(); } catch ( javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } }
Tell if two objects are functionally equal.
public JavaEnvironment(File javaPath){ Objects.requireNonNull(javaPath); this.javaPath=javaPath; }
Creates a JavaEnvironment with the given 'java' path.
public static void main(String[] args){ String outputFolderRunA="f:/data/experiments/parkingSearchOct2013/runs/run179/output/"; String outputFolderRunB="f:/data/experiments/parkingSearchOct2013/runs/run180/output/"; int startIteration=1200; int endIteration=1205; int iterationStep=10; boolean ignoreCasesWithBothPPUse=true; System.out.println("iteration\tpctDifferce-FacilityId\tpctDifferce-parkingStrategy\tpctDifferce-groupName"); for (int i=startIteration; i <= endIteration; i+=iterationStep) { Matrix eventsMatrixA=GeneralLib.readStringMatrix(getEventsFileName(outputFolderRunA,i)); Matrix eventsMatrixB=GeneralLib.readStringMatrix(getEventsFileName(outputFolderRunB,i)); System.out.print(i + "\t" + percentageOfDifferentParkingUsages(eventsMatrixA,eventsMatrixB,"FacilityId",ignoreCasesWithBothPPUse)); System.out.print("\t" + percentageOfDifferentParkingUsages(eventsMatrixA,eventsMatrixB,"parkingStrategy",ignoreCasesWithBothPPUse)); System.out.print("\t" + percentageOfDifferentParkingUsages(eventsMatrixA,eventsMatrixB,"groupName",ignoreCasesWithBothPPUse)); System.out.println(); } }
This script does the following: For two given runs, it compares for the same iteration, what percentage of parking choices are different.
@Override public boolean execute(String action,JSONArray args,CallbackContext callbackContext){ this.callbackContext=callbackContext; if (action.equals(ENCODE)) { JSONObject obj=args.optJSONObject(0); if (obj != null) { String type=obj.optString(TYPE); String data=obj.optString(DATA); if (type == null) { type=TEXT_TYPE; } if (data == null) { callbackContext.error("User did not specify data to encode"); return true; } encode(type,data); } else { callbackContext.error("User did not specify data to encode"); return true; } } else if (action.equals(SCAN)) { scan(args); } else { return false; } return true; }
Executes the request. This method is called from the WebView thread. To do a non-trivial amount of work, use: cordova.getThreadPool().execute(runnable); To run on the UI thread, use: cordova.getActivity().runOnUiThread(runnable);
private boolean needIndexConsistency(){ return _index != null && _index.needConsistency(); }
Time UUID is required to ensure index CF and object CF consistency: both are updated in single shot - all or nothing
public void endElement(QName element,Augmentations augs) throws XNIException { try { if (fDocumentHandler != null) { fDocumentHandler.endElement(element.rawname); } if (fContentHandler != null) { fAugmentations=augs; String uri=element.uri != null ? element.uri : ""; String localpart=fNamespaces ? element.localpart : ""; fContentHandler.endElement(uri,localpart,element.rawname); if (fNamespaces) { endNamespaceMapping(); } } } catch ( SAXException e) { throw new XNIException(e); } }
The end of an element.
public static List<Method> parseSpecMethods(List<String> strs){ LinkedList<Method> methods=new LinkedList<Method>(); for ( String str : strs) { Method m=parseSpecMethod(str); methods.add(m); } return methods; }
Parse a methods that are in the format an api from the spec into a Method object.
public static Year parseYear(String s){ int y; try { y=Integer.parseInt(s.trim()); } catch ( NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch ( IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } }
Parses the string argument as a year. <P> The string format is YYYY.
public static <I0,I1,I2,I3,O>Function<tuple4<I0,I1,I2,I3>,O> Function(Class<?> theClass,String methodName,Class<?> parameterType0,Class<?> parameterType1,Class<?> parameterType2,Class<?> parameterType3){ return FunctionUtils.Function(theClass,methodName,parameterType0,parameterType1,parameterType2,parameterType3); }
Automagically wraps any static Java method having four input parameters of any class into xpresso's Function.
public T caseAnonymous_concreteMethodDeclaration_2_(Anonymous_concreteMethodDeclaration_2_ object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Anonymous concrete Method Declaration 2</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
@Override public void run(){ amIActive=true; String inputHeader=null; boolean alphaChannelOutput=false; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } for (int i=0; i < args.length; i++) { if (i == 0) { inputHeader=args[i]; } else if (i == 1) { alphaChannelOutput=Boolean.getBoolean(args[i]); } } if (inputHeader == null) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { int row, col; double redVal, greenVal, blueVal, alphaVal; double redRange, greenRange, blueRange; double redMin, greenMin, blueMin; double r, g, b, a; double z; double[] data; float progress=0; WhiteboxRaster image=new WhiteboxRaster(inputHeader,"r"); int rows=image.getNumberRows(); int cols=image.getNumberColumns(); double noData=image.getNoDataValue(); String outputHeader=inputHeader.replace(".dep","_Red.dep"); WhiteboxRaster outputFileRed=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFileRed.setPreferredPalette("grey.pal"); outputFileRed.setDataScale(WhiteboxRaster.DataScale.CONTINUOUS); outputHeader=inputHeader.replace(".dep","_Green.dep"); WhiteboxRaster outputFileGreen=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFileGreen.setPreferredPalette("grey.pal"); outputFileGreen.setDataScale(WhiteboxRaster.DataScale.CONTINUOUS); outputHeader=inputHeader.replace(".dep","_Blue.dep"); WhiteboxRaster outputFileBlue=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFileBlue.setPreferredPalette("grey.pal"); outputFileBlue.setDataScale(WhiteboxRaster.DataScale.CONTINUOUS); if (!alphaChannelOutput) { for (row=0; row < rows; row++) { data=image.getRowValues(row); for (col=0; col < cols; col++) { z=data[col]; if (z != noData) { r=(double)((int)z & 0xFF); g=(double)(((int)z >> 8) & 0xFF); b=(double)(((int)z >> 16) & 0xFF); outputFileRed.setValue(row,col,r); outputFileGreen.setValue(row,col,g); outputFileBlue.setValue(row,col,b); } else { outputFileRed.setValue(row,col,noData); outputFileGreen.setValue(row,col,noData); outputFileBlue.setValue(row,col,noData); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } outputFileRed.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileRed.addMetadataEntry("Created on " + new Date()); outputFileRed.close(); outputFileGreen.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileGreen.addMetadataEntry("Created on " + new Date()); outputFileGreen.close(); outputFileBlue.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileBlue.addMetadataEntry("Created on " + new Date()); outputFileBlue.close(); image.close(); } else { outputHeader=inputHeader.replace(".dep","_A.dep"); WhiteboxRaster outputFileA=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFileA.setPreferredPalette("grey.pal"); outputFileA.setDataScale(WhiteboxRaster.DataScale.CONTINUOUS); for (row=0; row < rows; row++) { data=image.getRowValues(row); for (col=0; col < cols; col++) { z=data[col]; if (z != noData) { r=(double)((int)z & 0xFF); g=(double)(((int)z >> 8) & 0xFF); b=(double)(((int)z >> 16) & 0xFF); a=(double)(((int)z >> 24) & 0xFF); outputFileRed.setValue(row,col,r); outputFileGreen.setValue(row,col,g); outputFileBlue.setValue(row,col,b); outputFileA.setValue(row,col,a); } else { outputFileRed.setValue(row,col,noData); outputFileGreen.setValue(row,col,noData); outputFileBlue.setValue(row,col,noData); outputFileA.setValue(row,col,noData); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } outputFileRed.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileRed.addMetadataEntry("Created on " + new Date()); outputFileRed.close(); outputFileGreen.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileGreen.addMetadataEntry("Created on " + new Date()); outputFileGreen.close(); outputFileBlue.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileBlue.addMetadataEntry("Created on " + new Date()); outputFileBlue.close(); outputFileA.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFileA.addMetadataEntry("Created on " + new Date()); outputFileA.close(); image.close(); } returnData(outputHeader); } 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 static boolean fileExists(String filePath){ File file=new File(filePath); return file.exists(); }
Check if a file exists on device
protected ILaunchConfiguration findOrCreateLaunchConfiguration(IResource resource,String startupUrl,boolean isExternal,boolean isGwtSuperDevModeEnabled) throws CoreException, OperationCanceledException { ILaunchConfiguration config=findLaunchConfiguration(resource,startupUrl,isExternal); if (config == null) { config=createNewLaunchConfiguration(resource,startupUrl,isExternal,isGwtSuperDevModeEnabled); } else if (GWTNature.isGWTProject(resource.getProject()) && GWTLaunchConfigurationWorkingCopy.getSuperDevModeEnabled(config) != isGwtSuperDevModeEnabled) { config=turnOnOrOffSuperDevMode(config,isGwtSuperDevModeEnabled); } return config; }
Given a resource, infer the startup URL that the resource points at, then look for an existing launch configuration that points at this URL. If none exists, we'll create a new one.
public List<String> makeKey(final Map<MetaKey,String> metaData,final boolean requireAll){ final List<String> result=new ArrayList<>(this.fields.size()); for ( final MetaKey field : this.fields) { final String value=metaData.get(field); if (requireAll && value == null) { return null; } result.add(value); } return result; }
Make a key from the aggregator fields
@Override public void zoomDomainAxes(double factor,PlotRenderingInfo info,Point2D source,boolean useAnchor){ for ( ValueAxis xAxis : this.domainAxes.values()) { if (xAxis == null) { continue; } if (useAnchor) { double sourceX=source.getX(); if (this.orientation == PlotOrientation.HORIZONTAL) { sourceX=source.getY(); } double anchorX=xAxis.java2DToValue(sourceX,info.getDataArea(),getDomainAxisEdge()); xAxis.resizeRange2(factor,anchorX); } else { xAxis.resizeRange(factor); } } }
Multiplies the range on the domain axis/axes by the specified factor.
public void testDivisionKnuth1(){ byte aBytes[]={-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; byte bBytes[]={-3,-3,-3,-3}; int aSign=1; int bSign=1; byte rBytes[]={0,-5,-12,-33,-96,-36,-105,-56,92,15,48,-109}; BigInteger aNumber=new BigInteger(aSign,aBytes); BigInteger bNumber=new BigInteger(bSign,bBytes); BigInteger result=aNumber.divide(bNumber); byte resBytes[]=new byte[rBytes.length]; resBytes=result.toByteArray(); for (int i=0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign",1,result.signum()); }
Verifies the case when borrow != 0 in the private divide method.
private Object readResolve() throws ObjectStreamException { if (this.equals(DatasetRenderingOrder.FORWARD)) { return DatasetRenderingOrder.FORWARD; } else if (this.equals(DatasetRenderingOrder.REVERSE)) { return DatasetRenderingOrder.REVERSE; } return null; }
Ensures that serialization returns the unique instances.
protected void storeState(){ if (storePartials) { likelihoodCore.storeState(); } super.storeState(); }
Stores the additional state other than model components
public boolean isISnsDiscoverySettable(){ return iSnsDiscoverySettable; }
Gets the value of the iSnsDiscoverySettable property.
protected StdTypeResolverBuilder _constructNoTypeResolverBuilder(){ return StdTypeResolverBuilder.noTypeInfoBuilder(); }
Helper method for dealing with "no type info" marker; can't be null (as it'd be replaced by default typing)
public CCTMXLayer layerNamed(String layerName){ if (children_ == null) return null; for ( CCNode node : children_) { CCTMXLayer layer=(CCTMXLayer)node; if (layer != null) { if (layer.layerName.equals(layerName)) return (CCTMXLayer)layer; } } return null; }
return the TMXLayer for the specific layer
public Matrix(int columns,double... data){ this(data,columns); }
Create a new matrix with a specified dataset.
private void readUidListHeader(String line) throws IOException { if (line == null) throw new IOException("Header entry in uid-file is null"); int gap1=line.indexOf(" "); if (gap1 == -1) { throw new IOException("Corrupted header entry in uid-file"); } int version=Integer.valueOf(line.substring(0,gap1)); if (version != 1) throw new IOException("Cannot read uidlists with versions other than 1."); int gap2=line.indexOf(" ",gap1 + 1); lastUid=Optional.of(MessageUid.of(Long.valueOf(line.substring(gap1 + 1,gap2)))); messageCount=Integer.valueOf(line.substring(gap2 + 1,line.length())); }
Parses the header line in uid list files. The format is: version lastUid messageCount (e.g. 1 615 273)
public ClientMessage createMessage(){ getInternalClient(); return internalClient.createMessage(isUseDurableMessage()); }
Create a ClientMessage If useDurableMessage is false, a non-durable message is created. Otherwise, a durable message is created
public static int compareCanonicalIntegers(String int1,String int2){ if (int1.equals(int2)) { return 0; } if (int1.charAt(0) == '-' && int2.charAt(0) != '-') { return -1; } if (int2.charAt(0) == '-' && int1.charAt(0) != '-') { return 1; } int result=int1.length() - int2.length(); if (result == 0) { for (int i=0; result == 0 && i < int1.length(); i++) { result=int1.charAt(i) - int2.charAt(i); } } if (int1.charAt(0) == '-') { result=-result; } return result; }
Compares two canonical integers to eachother.
private boolean tag(TagData data,Body parent,boolean parseExpression) throws TemplateException { boolean hasBody=false; Position line=data.srcCode.getPosition(); int start=data.srcCode.getPos(); data.srcCode.next(); TagLib tagLib=nameSpace(data); if (tagLib == null) { data.srcCode.previous(); return false; } String strNameNormal=identifier(data.srcCode,false,true); if (strNameNormal == null) { data.srcCode.setPos((data.srcCode.getPos() - tagLib.getNameSpaceAndSeparator().length()) - 1); return false; } String strName=strNameNormal.toLowerCase(); String appendix=null; TagLibTag tagLibTag=tagLib.getTag(strName); if (tagLibTag == null) { tagLibTag=tagLib.getAppendixTag(strName); if (tagLibTag == null) { if (tagLib.getIgnoreUnknowTags()) { data.srcCode.setPos(start); return false; } throw new TemplateException(data.srcCode,"undefined tag [" + tagLib.getNameSpaceAndSeparator() + strName+ "]"); } appendix=StringUtil.removeStartingIgnoreCase(strNameNormal,tagLibTag.getName()); } Tag tag; try { tag=tagLibTag.getTag(data.factory,line,data.srcCode.getPosition()); } catch ( Exception e) { throw new TemplateException(data.srcCode,e); } parent.addStatement(tag); if (appendix != null) { tag.setAppendix(appendix); tag.setFullname(tagLibTag.getFullName().concat(appendix)); } else { tag.setFullname(tagLibTag.getFullName()); } tag.setTagLibTag(tagLibTag); comment(data.srcCode,true); if (tagLibTag.hasTTE()) { data.ep.add(tagLibTag,tag,data.flibs,data.srcCode); } attributes(data,tagLibTag,tag); if (tagLibTag.hasAttributeEvaluator()) { try { tagLibTag=tagLibTag.getAttributeEvaluator().evaluate(tagLibTag,tag); } catch ( AttributeEvaluatorException e) { throw new TemplateException(data.srcCode,e); } } if (data.srcCode.forwardIfCurrent('>')) { hasBody=tagLibTag.getHasBody(); } else if (data.srcCode.forwardIfCurrent('/','>')) { if (tagLibTag.getHasBody()) tag.setBody(new BodyBase(data.factory)); } else { throw createTemplateException(data.srcCode,"tag [" + tagLibTag.getFullName() + "] is not closed",tagLibTag); } if (hasBody) { if (tagLibTag.isTagDependent()) { TagDependentBodyTransformer tdbt=null; try { tdbt=tagLibTag.getBodyTransformer(); } catch ( TagLibException e) { throw new TemplateException(data.srcCode,e); } if (tdbt == null) throw createTemplateException(data.srcCode,"Tag dependent body Transformer is invalid for Tag [" + tagLibTag.getFullName() + "]",tagLibTag); tag.setBody(tdbt.transform(data.factory,data.root,data.ep,data.tlibs,data.flibs,tagLibTag.getFullName(),data.scriptTags,data.srcCode,data.settings)); if (!data.srcCode.forwardIfCurrent("</")) { TemplateException te=new TemplateException(data.srcCode,"invalid construct"); if (tdbt instanceof CFMLScriptTransformer && ASMUtil.containsComponent(tag.getBody())) { throw new CFMLScriptTransformer.ComponentTemplateException(te); } throw te; } TagLib tagLibEnd=nameSpace(data); if (!(tagLibEnd != null && tagLibEnd.getNameSpaceAndSeparator().equals(tagLib.getNameSpaceAndSeparator()))) throw new TemplateException(data.srcCode,"invalid construct"); String strNameEnd=identifier(data.srcCode,true,true).toLowerCase(); if (!strName.equals(strNameEnd)) { data.srcCode.setPos(start); throw new TemplateException(data.srcCode,"Start and End Tag has not the same Name [" + tagLib.getNameSpaceAndSeparator() + strName+ "-"+ tagLibEnd.getNameSpaceAndSeparator()+ strNameEnd+ "]"); } data.srcCode.removeSpace(); if (!data.srcCode.forwardIfCurrent('>')) throw new TemplateException(data.srcCode,"End Tag [" + tagLibEnd.getNameSpaceAndSeparator() + strNameEnd+ "] not closed"); } else { BodyBase body=new BodyBase(data.factory); body.setParent(tag); if (tagLibTag.getParseBody()) parseExpression=true; while (true) { ExprTransformer transfomer=null; if (parseExpression) { try { transfomer=tagLibTag.getTagLib().getExprTransfomer(); } catch ( TagLibException e) { throw new TemplateException(data.srcCode,e); } } body(data,body,parseExpression,transfomer); if (data.srcCode.isAfterLast()) { if (tagLibTag.isBodyReq()) { data.srcCode.setPos(start); throw createTemplateException(data.srcCode,"No matching end tag found for tag [" + tagLibTag.getFullName() + "]",tagLibTag); } body.moveStatmentsTo(parent); return executeEvaluator(data,tagLibTag,tag); } int posBeforeEndTag=data.srcCode.getPos(); if (!data.srcCode.forwardIfCurrent('<','/')) throw createTemplateException(data.srcCode,"Missing end tag for [" + tagLibTag.getFullName() + "]",tagLibTag); int _start=data.srcCode.getPos(); TagLib tagLibEnd=nameSpace(data); if (tagLibEnd != null) { String strNameEnd=""; if (tagLibEnd.getNameSpaceAndSeparator().equals(tagLib.getNameSpaceAndSeparator())) { strNameEnd=identifier(data.srcCode,true,true).toLowerCase(); data.srcCode.removeSpace(); if (strName.equals(strNameEnd)) { if (!data.srcCode.forwardIfCurrent('>')) throw new TemplateException(data.srcCode,"End Tag [" + tagLibEnd.getNameSpaceAndSeparator() + strNameEnd+ "] not closed"); break; } } if (tagLibTag.isBodyReq()) { TagLibTag endTag=tagLibEnd.getTag(strNameEnd); if (endTag != null && !endTag.getHasBody()) throw new TemplateException(data.srcCode,"End Tag [" + tagLibEnd.getNameSpaceAndSeparator() + strNameEnd+ "] is not allowed, for this tag only a Start Tag is allowed"); data.srcCode.setPos(start); if (tagLibEnd.getIgnoreUnknowTags() && (tagLibEnd.getTag(strNameEnd)) == null) { data.srcCode.setPos(_start); } else throw new TemplateException(data.srcCode,"Start and End Tag has not the same Name [" + tagLib.getNameSpaceAndSeparator() + strName+ "-"+ tagLibEnd.getNameSpaceAndSeparator()+ strNameEnd+ "]"); } else { body.moveStatmentsTo(parent); data.srcCode.setPos(posBeforeEndTag); return executeEvaluator(data,tagLibTag,tag); } } body.addPrintOut(data.factory,"</",null,null); } tag.setBody(body); } } if (tag instanceof StatementBase) ((StatementBase)tag).setEnd(data.srcCode.getPosition()); return executeEvaluator(data,tagLibTag,tag); }
Liest einen Tag ein, prueft hierbei ob das Tag innerhalb einer der geladenen Tag-Lib existiert, ansonsten wird ein Tag einfach als literal-string aufgenommen. <br /> EBNF:<br /> <code>name-space identifier spaces attributes ("/>" | ">" [body "</" identifier spaces ">"]);(* Ob dem Tag ein Body und ein End-Tag folgt ist abhaengig von Definition des body-content in Tag-Lib, gleices gilt fuer appendix *)</code>
public BusinessObjectDataStatusEntity createBusinessObjectDataStatusEntity(String statusCode,String description,Boolean preRegistrationStatus){ BusinessObjectDataStatusEntity businessObjectDataStatusEntity=new BusinessObjectDataStatusEntity(); businessObjectDataStatusEntity.setCode(statusCode); businessObjectDataStatusEntity.setDescription(description); businessObjectDataStatusEntity.setPreRegistrationStatus(preRegistrationStatus); return businessObjectDataStatusDao.saveAndRefresh(businessObjectDataStatusEntity); }
Creates and persists a new business object data status entity.
public static int desaturate(int c){ int a=c & 0xff000000; float r=((c & 0xff0000) >> 16); float g=((c & 0x00ff00) >> 8); float b=(c & 0x0000ff); r*=0.2125f; g*=0.7154f; b*=0.0721f; int gray=Math.min(((int)(r + g + b)),0xff) & 0xff; return a | (gray << 16) | (gray << 8)| gray; }
Get a desaturated shade of an input color.
private synchronized void notifyZoomListeners(ZoomEvent e){ for ( ZoomListener listener : mZoomListeners) { listener.zoomApplied(e); } }
Notify the zoom listeners about a zoom change.
public CIMInstance checkExists(StorageSystem storage,Volume volume,boolean propagated,boolean includeClassOrigin) throws Exception { CIMInstance instance=null; CIMObjectPath objectPath=_cimPath.getBlockObjectPath(storage,volume); try { if (objectPath != null) { _log.debug(String.format("checkExists(storage=%s, objectPath=%s, propagated=%s, includeClassOrigin=%s)",storage.getSerialNumber(),objectPath.toString(),String.valueOf(propagated),String.valueOf(includeClassOrigin))); instance=getInstance(storage,objectPath,propagated,includeClassOrigin,null); } } catch ( WBEMException e) { if (e.getID() != WBEMException.CIM_ERR_NOT_FOUND) { throw e; } } catch ( Exception e) { _log.error("checkExists call encountered an exception",e); throw e; } return instance; }
This method is a wrapper for the getInstance. If the object is not found, it returns a null value instead of throwing an exception.
public IntArraySpliterator(int[] array,int origin,int fence,int additionalCharacteristics){ this.array=array; this.index=origin; this.fence=fence; this.characteristics=additionalCharacteristics | Spliterator.SIZED | Spliterator.SUBSIZED; }
Creates a spliterator covering the given array and range