code
stringlengths
10
174k
nl
stringlengths
3
129k
public cudaFuncAttributes(){ }
Creates new, uninitialized cudaFuncAttributes
protected void dispatchBindingChangedEvent(Element bindableElement,Element shadowTree){ Object[] ls=bindingListenerList.getListenerList(); for (int i=ls.length - 2; i >= 0; i-=2) { BindingListener l=(BindingListener)ls[i + 1]; l.bindingChanged(bindableElement,shadowTree); } }
Dispatches a BindingEvent the registered listeners.
protected Element invokeWriteToXML(Element parent,Object o,String name) throws Exception { Method method; Class<?>[] methodClasses; Object[] methodArgs; boolean array; Element node; boolean useDefault; node=null; method=null; useDefault=false; m_CurrentNode=parent; if (o == null) { useDefault=true; } try { if (!useDefault) { array=o.getClass().isArray(); if (m_CustomMethods.write().contains(name)) { method=m_CustomMethods.write().get(o.getClass()); } else if ((!array) && (m_CustomMethods.write().contains(o.getClass()))) { method=m_CustomMethods.write().get(o.getClass()); } else { method=null; } useDefault=(method == null); } if (!useDefault) { methodClasses=new Class[3]; methodClasses[0]=Element.class; methodClasses[1]=Object.class; methodClasses[2]=String.class; methodArgs=new Object[3]; methodArgs[0]=parent; methodArgs[1]=o; methodArgs[2]=name; node=(Element)method.invoke(this,methodArgs); } else { node=writeToXML(parent,o,name); } } catch ( Exception e) { if (DEBUG) { e.printStackTrace(); } if (m_CurrentNode != null) { System.out.println("Happened near: " + getPath(m_CurrentNode)); m_CurrentNode=null; } System.out.println("PROBLEM (write): " + name); throw (Exception)e.fillInStackTrace(); } return node; }
either invokes a custom method to write a specific property/class or the standard method <code>writeToXML(Element,Object,String)</code>
public void insert(final AbstractInsnNode location,final AbstractInsnNode insn){ ++size; AbstractInsnNode next=location.next; if (next == null) { last=insn; } else { next.prev=insn; } location.next=insn; insn.next=next; insn.prev=location; cache=null; insn.index=0; }
Inserts the given instruction after the specified instruction.
public InlineQueryResultGif.InlineQueryResultGifBuilder id(String id){ this.id=id; return this; }
*Optional Sets the ID to the provided value. If none is set a random 32 char long ID will be generated.
protected AbstractSet(){ }
Constructs a new instance of this AbstractSet.
public Workflow.Method rollbackMethodNullMethod(){ return new Workflow.Method(ROLLBACK_METHOD_NULL); }
Creates a rollback workflow method that does nothing, but allows rollback to continue to prior steps back up the workflow chain.
public static boolean isRuntimeStubMethod(SootMethod method){ if (stubExceptionMethod == null) { String signature="<java.lang.RuntimeException: void <init>(java.lang.String)>"; stubExceptionMethod=Scene.v().getMethod(signature); } if (!method.hasActiveBody()) return true; for ( Tag t : method.getTags()) { if (t instanceof GeneratedPhantomMethodTag) return true; } for ( Unit unit : method.getActiveBody().getUnits()) { Stmt stmt=(Stmt)unit; if (stmt.containsInvokeExpr()) { try { InvokeExpr invokeExpr=stmt.getInvokeExpr(); SootMethod invokeMethod=resolve(invokeExpr.getMethodRef()); if (invokeMethod == stubExceptionMethod) { Value arg=invokeExpr.getArg(0); if (arg.toString().equalsIgnoreCase("stub")) { return true; } } } catch ( CannotFindMethodException e) { continue; } } } return false; }
check if a given method is a runtime stub
public static CreateStatement orReplace(CharSequence table){ return produce(table,"REPLACE"); }
Producing an "INSERT OR REPLACE INTO ..."(equivalent to "REPLACE INTO ...") statement. <p/> When an UNIQUE or PRIMARY KEY constraint violation occurs, the REPLACE algorithm silently deletes pre-existing rows that are causing the constraint violation prior to inserting the current row. <p/> Checking the <a href="http://sqlite.org/lang_conflict.html">SQLite documentation</a> for more details. <p/> <strong>Note:</strong> For compatibility with MySQL, SQLite allows us use the single keyword REPLACE as an alias for "INSERT OR REPLACE". So if you're looking for a method which building a statement like "REPLACE INTO ...", then this would be equivalent.
public void initialize(int lteSignalStrength,int rsrp,int rsrq,int rssnr,int cqi,int timingAdvance){ mSignalStrength=lteSignalStrength; mRsrp=rsrp; mRsrq=rsrq; mRssnr=rssnr; mCqi=cqi; mTimingAdvance=timingAdvance; }
Initialize all the values
public ColumnSpec(Size size){ super(DEFAULT,size,NO_GROW); }
Constructs a ColumnSpec for the given size using the default alignment, and no resizing.
public static String toString(final Object obj){ return (obj == null ? null : obj.toString()); }
Null-safe implementation of the Object.toString method. </p>
protected void updateSelectedDriver(){ signalHeadPanel.setVisible(false); turnoutMastScroll.setVisible(false); disabledAspectsScroll.setVisible(false); dccMastScroll.setVisible(false); matrixMastBitnumPanel.setVisible(false); matrixMastScroll.setVisible(false); if (Bundle.getMessage("TurnCtlMast").equals(signalMastDriver.getSelectedItem())) { updateTurnoutAspectPanel(); turnoutMastScroll.setVisible(true); } else if (Bundle.getMessage("HeadCtlMast").equals(signalMastDriver.getSelectedItem())) { updateHeads(); updateDisabledOption(); signalHeadPanel.setVisible(true); disabledAspectsScroll.setVisible(true); } else if (Bundle.getMessage("VirtualMast").equals(signalMastDriver.getSelectedItem())) { updateDisabledOption(); disabledAspectsScroll.setVisible(true); } else if ((Bundle.getMessage("DCCMast").equals(signalMastDriver.getSelectedItem())) || (Bundle.getMessage("LNCPMast").equals(signalMastDriver.getSelectedItem()))) { updateDCCMastPanel(); dccMastScroll.setVisible(true); } else if (Bundle.getMessage("MatrixCtlMast").equals(signalMastDriver.getSelectedItem())) { updateMatrixMastPanel(); matrixMastBitnumPanel.setVisible(true); matrixMastScroll.setVisible(true); } updateUnLit(); validate(); if (getTopLevelAncestor() != null) { ((jmri.util.JmriJFrame)getTopLevelAncestor()).setSize(((jmri.util.JmriJFrame)getTopLevelAncestor()).getPreferredSize()); ((jmri.util.JmriJFrame)getTopLevelAncestor()).pack(); } repaint(); }
Update contents of Add/Edit mast panel appropriate for chosen Driver type hide the other JPanels invoked when selecting a Signal Mast Driver
@Override public boolean isShifted(){ if (mShiftKeys[0] != null) { return mShiftState != SHIFT_OFF; } else { return super.isShifted(); } }
Whether or not keyboard is shifted.
private static String toJson(Entity entity) throws EntityException { try { TSerializer serializer=new TSerializer(new TJSONProtocol.Factory()); switch (entity.getType()) { case DATABASE: Database db=entity.getDatabase(); return serializer.toString(db); case TABLE: Table tableWithLocation=new Table(entity.getTable().getTTable()); URI dataLocation; try { dataLocation=entity.getLocation(); } catch (Exception e) { throw new EntityException(e); } tableWithLocation.getSd().setLocation(dataLocation == null ? null : dataLocation.toString()); return serializer.toString(entity.getTable().getTTable()); case PARTITION: case DUMMYPARTITION: Partition partitionWithLocation=new Partition(entity.getPartition().getTPartition()); partitionWithLocation.getSd().setLocation(entity.getPartition().getDataLocation().toString()); return serializer.toString(entity.getPartition().getTPartition()); case LOCAL_DIR: case DFS_DIR: try { return entity.getLocation().toString(); } catch (Exception e) { throw new EntityException(e); } default : throw new EntityException("Unhandled type: " + entity.getType() + " entity: "+ entity); } } catch (TException e) { throw new EntityException(e); } }
Converts the object that the entity represents into a JSON string
public void deleteTrigger(BigInteger alertId,BigInteger triggerId) throws IOException { String requestUrl=RESOURCE + "/" + alertId.toString()+ "/triggers/"+ triggerId.toString(); ArgusResponse response=getClient().executeHttpRequest(ArgusHttpClient.RequestType.DELETE,requestUrl,null); assertValidResponse(response,requestUrl); }
Deletes a trigger having the given ID and removes any associations with the alert or notifications.
public static boolean isCurrentUser(final String userId){ final String currentUserId=AppConstants.UserInfo.INSTANCE.getId(); return !TextUtils.isEmpty(currentUserId) && currentUserId.equals(userId); }
Checks whether the given user id is the current user or not
@Deprecated public static String openUrl(String url,String method,Bundle params) throws MalformedURLException, IOException { String strBoundary="3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f"; String endLine="\r\n"; OutputStream os; if (method.equals("GET")) { url=url + "?" + encodeUrl(params); } Utility.logd("Facebook-Util",method + " URL: " + url); HttpURLConnection conn=(HttpURLConnection)new URL(url).openConnection(); conn.setRequestProperty("User-Agent",System.getProperties().getProperty("http.agent") + " FacebookAndroidSDK"); if (!method.equals("GET")) { Bundle dataparams=new Bundle(); for ( String key : params.keySet()) { Object parameter=params.get(key); if (parameter instanceof byte[]) { dataparams.putByteArray(key,(byte[])parameter); } } if (!params.containsKey("method")) { params.putString("method",method); } if (params.containsKey("access_token")) { String decoded_token=URLDecoder.decode(params.getString("access_token")); params.putString("access_token",decoded_token); } conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type","multipart/form-data;boundary=" + strBoundary); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestProperty("Connection","Keep-Alive"); conn.connect(); os=new BufferedOutputStream(conn.getOutputStream()); try { os.write(("--" + strBoundary + endLine).getBytes()); os.write((encodePostBody(params,strBoundary)).getBytes()); os.write((endLine + "--" + strBoundary+ endLine).getBytes()); if (!dataparams.isEmpty()) { for ( String key : dataparams.keySet()) { os.write(("Content-Disposition: form-data; filename=\"" + key + "\""+ endLine).getBytes()); os.write(("Content-Type: content/unknown" + endLine + endLine).getBytes()); os.write(dataparams.getByteArray(key)); os.write((endLine + "--" + strBoundary+ endLine).getBytes()); } } os.flush(); } finally { os.close(); } } String response=""; try { response=read(conn.getInputStream()); } catch ( FileNotFoundException e) { response=read(conn.getErrorStream()); } return response; }
Connect to an HTTP URL and return the response as a string. Note that the HTTP method override is used on non-GET requests. (i.e. requests are made as "POST" with method specified in the body).
public Road(int id,String name,Intersection from,Intersection to,RoadClass roadClass,RoadLayer roadLayer){ this.id=id; this.name=name; this.roadLayer=roadLayer; points=new Waypoint[2]; setIntersections(from,to); this.roadClass=roadClass; createLines(); modified=false; }
Create a road between two Intersections. The detailed segments between the intersections may be filled in later.
public String product(Properties ctx,int WindowNo,GridTab mTab,GridField mField,Object value){ if (isCalloutActive() || value == null) return ""; int S_ResourceAssignment_ID=((Integer)value).intValue(); if (S_ResourceAssignment_ID == 0) return ""; int M_Product_ID=0; String Name=null; String Description=null; BigDecimal Qty=null; String sql="SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty " + "FROM S_ResourceAssignment ra" + " INNER JOIN M_Product p ON (p.S_Resource_ID=ra.S_Resource_ID) "+ "WHERE ra.S_ResourceAssignment_ID=?"; PreparedStatement pstmt=null; ResultSet rs=null; try { pstmt=DB.prepareStatement(sql,null); pstmt.setInt(1,S_ResourceAssignment_ID); rs=pstmt.executeQuery(); if (rs.next()) { M_Product_ID=rs.getInt(1); Name=rs.getString(2); Description=rs.getString(3); Qty=rs.getBigDecimal(4); } } catch ( SQLException e) { log.log(Level.SEVERE,"product",e); } finally { DB.close(rs,pstmt); rs=null; pstmt=null; } log.fine("S_ResourceAssignment_ID=" + S_ResourceAssignment_ID + " - M_Product_ID="+ M_Product_ID); if (M_Product_ID != 0) { mTab.setValue("M_Product_ID",new Integer(M_Product_ID)); if (Description != null) Name+=" (" + Description + ")"; if (!".".equals(Name)) mTab.setValue("Description",Name); String variable="Qty"; if (mTab.getTableName().startsWith("C_Order")) variable="QtyOrdered"; else if (mTab.getTableName().startsWith("C_Invoice")) variable="QtyInvoiced"; if (Qty != null) mTab.setValue(variable,Qty); mTab.setValue("QtyEntered",Qty); } return ""; }
Assignment_Product. - called from S_ResourceAssignment_ID - sets M_Product_ID, Description - Qty..
public Builder diskCacheExtraOptions(int maxImageWidthForDiskCache,int maxImageHeightForDiskCache,BitmapProcessor processorForDiskCache){ this.maxImageWidthForDiskCache=maxImageWidthForDiskCache; this.maxImageHeightForDiskCache=maxImageHeightForDiskCache; this.processorForDiskCache=processorForDiskCache; return this; }
Sets options for resizing/compressing of downloaded images before saving to disk cache.<br /> <b>NOTE: Use this option only when you have appropriate needs. It can make ImageLoader slower.</b>
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){ switch (featureID) { case UmplePackage.ANONYMOUS_PARAMETER_LIST_1__PARAMETER_1: return ((InternalEList<?>)getParameter_1()).basicRemove(otherEnd,msgs); } return super.eInverseRemove(otherEnd,featureID,msgs); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public CommandButtonGroup(@JdkConstants.BoxLayoutAxis int axis){ myAxis=axis; setLayout(new BoxLayout(this,axis)); if (axis == BoxLayout.X_AXIS) { add(Box.createHorizontalGlue()); } else { } }
Creates new <code>CommandButtonGroup</code> panel with specified orientation.
public static List<String> readLines(File file,String encoding) throws IOException { return readLines(file,Charsets.toCharset(encoding)); }
Reads the contents of a file line by line to a List of Strings. The file is always closed.
public boolean isBoundsInGrid(){ return boundsInGrid; }
Returns if the absolute <code>pos</code> value should be corrections to the component that is in a normal cell. If <code>false</code> the value of <code>pos</code> is truly absolute in that it will not affect the grid or have a default bounds in the grid. <p> For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
public void testRangeFacetInfiniteLoopDetection(){ for ( String field : new String[]{"foo_f","foo_d","foo_i"}) { assertQEx("no zero gap error: " + field,req("q","*:*","facet","true","facet.range",field,"facet.range.start","23","facet.range.gap","0","facet.range.end","100"),400); } String field="foo_dt"; assertQEx("no zero gap error for facet.range: " + field,req("q","*:*","facet","true","facet.range",field,"facet.range.start","NOW","facet.range.gap","+0DAYS","facet.range.end","NOW+10DAY"),400); field="foo_f"; assertQEx("no float underflow error: " + field,req("q","*:*","facet","true","facet.range",field,"facet.range.start","100000000000","facet.range.end","100000086200","facet.range.gap","2160"),400); field="foo_d"; assertQEx("no double underflow error: " + field,req("q","*:*","facet","true","facet.range",field,"facet.range.start","9900000000000","facet.range.end","9900000086200","facet.range.gap","0.0003"),400); }
kind of an absurd test because if there is an infinite loop, it would never finish -- but at least it ensures that <i>if</i> one of these requests return, they return an error
void checkClosed(){ if (result == null) { throw DbException.get(ErrorCode.OBJECT_CLOSED); } if (stat != null) { stat.checkClosed(); } if (conn != null) { conn.checkClosed(); } }
Check if this result set is closed.
private SavedState(Parcel in){ super(in); prevFirstVisiblePosition=in.readInt(); prevFirstVisibleChildHeight=in.readInt(); prevScrolledChildrenHeight=in.readInt(); prevScrollY=in.readInt(); scrollY=in.readInt(); childrenHeights=new SparseIntArray(); final int numOfChildren=in.readInt(); if (0 < numOfChildren) { for (int i=0; i < numOfChildren; i++) { final int key=in.readInt(); final int value=in.readInt(); childrenHeights.put(key,value); } } }
Called by CREATOR.
private List<String> findMXRecordsRaw(String hostname) throws TemporaryResolutionException { Record answers[]=lookup(hostname,Type.MX,"MX"); List<String> servers=new ArrayList<String>(); if (answers == null) { return servers; } MXRecord[] mxAnswers=new MXRecord[answers.length]; for (int i=0; i < answers.length; i++) { mxAnswers[i]=(MXRecord)answers[i]; } Arrays.sort(mxAnswers,mxComparator); int currentPrio=-1; List<String> samePrio=new ArrayList<String>(); for (int i=0; i < mxAnswers.length; i++) { boolean same=false; boolean lastItem=i + 1 == mxAnswers.length; MXRecord mx=mxAnswers[i]; if (i == 0) { currentPrio=mx.getPriority(); } else { same=currentPrio == mx.getPriority(); } String mxRecord=mx.getTarget().toString(); if (same) { samePrio.add(mxRecord); } else { Collections.shuffle(samePrio); servers.addAll(samePrio); samePrio.clear(); samePrio.add(mxRecord); } if (lastItem) { Collections.shuffle(samePrio); servers.addAll(samePrio); } logger.debug("Found MX record " + mxRecord); } return servers; }
Return a prioritized unmodifiable list of MX records obtained from the server.
public void translateEventInScreenToAppWindow(MotionEvent event){ event.scale(applicationInvertedScale); }
Translate the motion event captured on screen to the application's window.
public LikeExpression(boolean isNot){ this.not=isNot; }
Ctor - for use to create an expression tree, without child expression. <p> Use add methods to add child expressions to acts upon.
private void finish(){ updatePreviousNode(); for ( final IVisualCoverageListener listener : new ArrayList<IVisualCoverageListener>(listeners)) { listener.finishedCoverage(); } }
Notifies all attached listeners that the Visual Trace is complete.
@Deprecated public final IOContainer run(final IOContainer input,final int logVerbosity,final boolean cleanUp,final Map<String,String> macroMap) throws OperatorException { return run(input,logVerbosity,macroMap); }
Starts the process with the given input. The process uses the given log verbosity. The boolean flag indicates if some static initializations should be cleaned before the process is started. This should usually be true but it might be useful to set this to false if, for example, several process runs uses the same object visualizer which would have been cleaned otherwise. Since the macros are cleaned then as well it is not possible to set macros to a process but with the given macroMap of this method.
public DynamicTreeNode(Object o){ super(o); }
Constructs a new DynamicTreeNode instance with o as the user object.
@Override public void onCheckedChanged(CompoundButton switchView,boolean isChecked){ if (!isResumed()) { return; } if (isChecked) { if (mCapabilities != null && mCapabilities.getFilesSharingPublicPasswordEnforced().isTrue()) { ((FileActivity)getActivity()).getFileOperationsHelper().requestPasswordForShareViaLink(mFile,true); } else { ((FileActivity)getActivity()).getFileOperationsHelper().shareFileViaLink(mFile,null); } } else { ((FileActivity)getActivity()).getFileOperationsHelper().unshareFileViaLink(mFile); } switchView.setOnCheckedChangeListener(null); switchView.toggle(); switchView.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener); }
Called by R.id.shareViaLinkSectionSwitch to create or delete a public link.
boolean canBeWalkedInNaturalDocOrderStatic(){ if (null != m_firstWalker) { AxesWalker walker=m_firstWalker; int prevAxis=-1; boolean prevIsSimpleDownAxis=true; for (int i=0; null != walker; i++) { int axis=walker.getAxis(); if (walker.isDocOrdered()) { boolean isSimpleDownAxis=((axis == Axis.CHILD) || (axis == Axis.SELF) || (axis == Axis.ROOT)); if (isSimpleDownAxis || (axis == -1)) walker=walker.getNextWalker(); else { boolean isLastWalker=(null == walker.getNextWalker()); if (isLastWalker) { if (walker.isDocOrdered() && (axis == Axis.DESCENDANT || axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE)) return true; } return false; } } else return false; } return true; } return false; }
Tell if the nodeset can be walked in doc order, via static analysis.
public boolean equals(Object o){ if (o == null) { return false; } if (o instanceof FreeCellNode) { return equivalent((FreeCellNode)o); } return false; }
Determine equals via equivalence of state.
public boolean isElement(){ return false; }
This is used to determine if this node is an element. This node instance can not be an element so this method returns false. Returning null tells the users of this node that any attributes added to the node map will be permenantly lost.
private static Map<String,String> resourceBundleMap(ResourceBundle bundle){ final HashMap<String,String> map=new HashMap<String,String>(); final Enumeration<String> e=bundle.getKeys(); while (e.hasMoreElements()) { final String key=e.nextElement(); map.put(key,(String)bundle.getObject(key)); } return Collections.unmodifiableMap(map); }
Returns an unmodifiable Map of the given bundle.
public void sendDeliveredNotification(String to,String packetID){ Message msg=new Message(to); MessageEvent messageEvent=new MessageEvent(); messageEvent.setDelivered(true); messageEvent.setPacketID(packetID); msg.addExtension(messageEvent); con.sendPacket(msg); }
Sends the notification that the message was delivered to the sender of the original message
public static NgnAVSession createOutgoingSession(NgnSipStack sipStack,NgnMediaType mediaType){ synchronized (sSessions) { final NgnAVSession avSession=new NgnAVSession(sipStack,null,mediaType,InviteState.INPROGRESS); sSessions.put(avSession.getId(),avSession); return avSession; } }
Creates an outgoing audio/video call session.
public boolean isExternal(){ EList<N4Modifier> _declaredModifiers=this.getDeclaredModifiers(); return _declaredModifiers.contains(N4Modifier.EXTERNAL); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static void dumpAllocatedMemories(){ dumpAllocatedMemories(System.out); }
Dumps the allocated memories to console (standard output).
public void detach(@NotNull Component childComponent) throws MismatchDetachException { if (childComponent.parentComponent != this) { String msg=String.format("The child component(%s) doesn't belong to component(%s)",childComponent.name == null ? "unnamed" : childComponent.getComponentId(),getComponentId()); throw new MismatchDetachException(msg); } childComponent.parentComponent=null; if (childrenComponents != null) { childrenComponents.remove(childComponent); } Component root=getRootComponent(); for ( String key : childComponent.providers.keySet()) { childComponent.componentLocator.put(key,childComponent); List<Component> chain=null; if (root.overriddenChain != null) { chain=root.overriddenChain.get(key); } if (chain != null) { if (!chain.isEmpty()) { Component removingItem=null; int size=chain.size(); for (int i=size - 1; i >= 0; i--) { Component c=chain.get(i); if (c == childComponent) { removingItem=c; break; } } chain.remove(removingItem); } if (chain.isEmpty()) { if (root.providers.containsKey(key)) { root.componentLocator.put(key,root); } else { root.componentLocator.remove(key); } } else { root.componentLocator.put(key,chain.get(chain.size() - 1)); } } else { root.componentLocator.remove(key); } } }
Detach the child component from this component. Once a component is detached the component tree won't use this component to locate suitable injection candidates and all its cached instances will be removed
public static void picture(double x,double y,String s,double w,double h,double degrees){ Image image=getImage(s); double xs=scaleX(x); double ys=scaleY(y); double ws=factorX(w); double hs=factorY(h); if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + s + " is corrupt"); if (ws <= 1 && hs <= 1) pixel(x,y); offscreen.rotate(Math.toRadians(-degrees),xs,ys); offscreen.drawImage(image,(int)Math.round(xs - ws / 2.0),(int)Math.round(ys - hs / 2.0),(int)Math.round(ws),(int)Math.round(hs),null); offscreen.rotate(Math.toRadians(+degrees),xs,ys); draw(); }
Draw picture (gif, jpg, or png) centered on (x, y), rotated given number of degrees, rescaled to w-by-h.
public StaticNameCoder(final Map<String,String> java2Node,final Map<String,String> java2Attribute){ this.java2Node=new HashMap<>(java2Node); if (java2Node == java2Attribute || java2Attribute == null) { this.java2Attribute=this.java2Node; } else { this.java2Attribute=new HashMap<>(java2Attribute); } readResolve(); }
Construct a StaticNameCoder.
public static boolean isNotEmpty(Object object){ return x.len(object) != 0; }
Checks if the input object is empty (does not contains any element).
protected Size2D arrangeNR(BlockContainer container,Graphics2D g2,RectangleConstraint constraint){ RectangleConstraint c1=constraint.toUnconstrainedHeight(); Size2D size1=arrange(container,g2,c1); if (constraint.getHeightRange().contains(size1.getHeight())) { return size1; } else { double h=constraint.getHeightRange().constrain(size1.getHeight()); RectangleConstraint c2=constraint.toFixedHeight(h); return arrange(container,g2,c2); } }
Arrange with a fixed height and no width constraint.
public com.lynden.gmapsfx.shapes.Polyline convert(){ return line; }
Returns the GMapsFX model Polyline
CSSBgPainter(Component parent){ this.parent=parent; }
Construct a background painter for the given component
public void onEndDrag(){ }
Called when the drag event is ended.
public noscript addElement(String element){ addElementToRegistry(element); return (this); }
Adds an Element to the element.
public XmlAttribute(String type,String value){ type_=type; value_=value; }
Creates an XmlAttribute.
public final int hashCode(){ final int PRIME=37; final int SEED=5; int result=SEED; result+=result * PRIME + Double.doubleToLongBits(getLatitude()); result+=result * PRIME + Double.doubleToLongBits(getLongitude()); result+=result * PRIME + Double.doubleToLongBits(getAltitude()); result+=result * PRIME + Double.doubleToLongBits(getAccuracy()); result+=result * PRIME + (int)(getOpenBmapTimestamp() ^ (getOpenBmapTimestamp() >>> 32)); result+=result * PRIME + getSession(); return result; }
taken from http://stackoverflow.com/questions/113511/hash-code-implementation
public void trimToSize(){ if (_data.length > size()) { long[] tmp=new long[size()]; toNativeArray(tmp,0,tmp.length); _data=tmp; } }
Sheds any excess capacity above and beyond the current size of the list.
@CanIgnoreReturnValue public final double addAndGet(double delta){ while (true) { long current=value; double currentVal=longBitsToDouble(current); double nextVal=currentVal + delta; long next=doubleToRawLongBits(nextVal); if (updater.compareAndSet(this,current,next)) { return nextVal; } } }
Atomically adds the given value to the current value.
@Override public void incomingObject(IAnalyzedInterval analyzedInterval) throws AdeException, AdeFlowException { if (analyzedInterval.getInterval().getSource().getSourceId().equals(m_source)) { throw new AdeFlowException("Cannot process analyzed interval of source other than " + m_source.getSourceId() + ". Got analyzed interval from source "+ analyzedInterval.getInterval().getSource().getSourceId()); } Date periodStart=PeriodUtils.getContainingPeriodStart(new Date(analyzedInterval.getIntervalEndTime() - 1)); if (!periodStart.equals(m_periodStartDate)) { if (m_inPeriod) { closePeriod(); } startNewPeriod(analyzedInterval); } int index=getIntervalIndex(analyzedInterval); m_lastKnownModelInternalID=analyzedInterval.getModelInternalId(); m_xmlMetaData.retrieveXMLMetaData(m_lastKnownModelInternalID,true,m_framingFlowType.getDuration()); m_aiVec[index].m_results_file=Ade.getAde().getConfigProperties().getOutputFilenameGenerator().getIntervalXmlFileRelativeToIndex(analyzedInterval,m_framingFlowType); m_aiVec[index].m_num_unique_msg_ids=analyzedInterval.getNumUniqueMessageIds(); m_aiVec[index].m_anomaly_score=analyzedInterval.getScore(); m_aiVec[index].m_modelQualityIndicator=m_xmlMetaData.getLimitedModelIndicator(); NewAndNeverSeenBeforeMessages messages=NewAndNeverSeenBeforeMessagesUtils.processAnalyzedInterval(analyzedInterval); m_aiVec[index].m_numNewMessages=messages.getNumNewMessages(); m_aiVec[index].m_numNeverSeenBeforeMessages=messages.getNumNeverSeenBeforeMessages(); if (m_refreash_periods) { writePeriod(); } }
Override superclass to use the new JAXB classes.
protected WMouseDragGestureRecognizer(DragSource ds,Component c){ this(ds,c,DnDConstants.ACTION_NONE); }
construct a new WMouseDragGestureRecognizer
public void addListener(final IMemoryListener listener){ m_listeners.add(listener); }
Adds an object that is notified about changes in the simulated memory.
public static String readFileToString(Context ctx,String path) throws IOException { StringBuilder sb=new StringBuilder(); char[] buffer=new char[INPUT_BUFFER_SIZE]; InputStream is=null; try { is=ctx.getAssets().open(path); InputStreamReader reader=new InputStreamReader(is); int numRead=reader.read(buffer); while (numRead > 0) { sb.append(buffer,0,numRead); numRead=reader.read(buffer); } return sb.toString(); } catch ( IOException e) { Log.e(TAG,"Failed to open asset file " + path); throw e; } finally { if (is != null) is.close(); } }
reads a file in the assets into a string
public static boolean isHovis(){ return sBuildModel.startsWith("hovis_box_"); }
Whether the stack is running on a Hovis box
public static String hashSHA(String str){ byte[] b=str.getBytes(); MessageDigest md=null; try { md=MessageDigest.getInstance("SHA1"); md.update(b); } catch ( NoSuchAlgorithmException e) { e.printStackTrace(); } return toHexString(md.digest()); }
Returns the SHA hash of a String.
private void sincronizarBase(){ listaSetor=ControleDAO.getBanco().getSetorDAO().listar(); }
Sincronizar dados com banco de dados
public static <T>T[] toArray(Collection<? extends T> list,Class<T> componentType){ if (list == null) { return null; } return list.toArray(create(componentType,list.size())); }
Create an array from the given list, with the given cpType as the run-time component type. If the list is null, null is returned.
private static final ImmutableMap<String,LaunchPhase> initEnumMapping(){ ImmutableMap.Builder<String,LaunchPhase> builder=new ImmutableMap.Builder<>(); for ( Entry<String,LaunchPhase> entry : getTypesafeEnumMapping(LaunchPhase.class).entrySet()) { builder.put(UPPER_UNDERSCORE.to(LOWER_CAMEL,entry.getKey()),entry.getValue()); } return builder.build(); }
Returns a map of the static final fields to their values, case-converted.
public void translate(double dx,double dy){ for ( MapNode n : nodes) { n.getLocation().translate(dx,dy); } minBound.translate(dx,dy); maxBound.translate(dx,dy); offset.translate(dx,dy); needsRehash=true; }
Translate whole map by dx and dy
public DataTableITCase(String name){ super(name); }
Construct a new instance of this test case.
public PrinterStateReasons(int initialCapacity){ super(initialCapacity); }
super a new, empty printer state reasons attribute; the underlying hash map has the given initial capacity and the default load factor.
@Override public void onDownloadProgress(DownloadProgressInfo progress){ mAverageSpeed.setText(getString(R.string.kilobytes_per_second,Helpers.getSpeedString(progress.mCurrentSpeed))); mTimeRemaining.setText(getString(R.string.time_remaining,Helpers.getTimeRemaining(progress.mTimeRemaining))); progress.mOverallTotal=progress.mOverallTotal; mPB.setMax((int)(progress.mOverallTotal >> 8)); mPB.setProgress((int)(progress.mOverallProgress >> 8)); mProgressPercent.setText(Long.toString(progress.mOverallProgress * 100 / progress.mOverallTotal) + "%"); mProgressFraction.setText(Helpers.getDownloadProgressString(progress.mOverallProgress,progress.mOverallTotal)); }
Sets the state of the various controls based on the progressinfo object sent from the downloader service.
private static void startLogSystem(){ prepareLoggingSystemEnviroment(); logger.debug("XXXXXXX"); logger.info("-Setting base at :" + STENDHAL_FOLDER); Log4J.init("data/conf/log4j.properties"); logger.debug("XXXXXXX"); logger.info("Setting base at :" + STENDHAL_FOLDER); logger.info("Stendhal " + VERSION); logger.info(Debug.PRE_RELEASE_VERSION); logger.info("Logging to directory: " + getLogFolder()); String patchLevel=System.getProperty("sun.os.patch.level"); if ((patchLevel == null) || (patchLevel.equals("unknown"))) { patchLevel=""; } logger.info("OS: " + System.getProperty("os.name") + " "+ patchLevel+ " "+ System.getProperty("os.version")+ " "+ System.getProperty("os.arch")); logger.info("Java-Runtime: " + System.getProperty("java.runtime.name") + " "+ System.getProperty("java.runtime.version")+ " from "+ System.getProperty("java.home")); logger.info("Java-VM: " + System.getProperty("java.vm.vendor") + " "+ System.getProperty("java.vm.name")+ " "+ System.getProperty("java.vm.version")); LogUncaughtExceptionHandler.setup(); }
Starts the LogSystem.
public Element store(Object o){ LayoutSlip p=(LayoutSlip)o; Element element=new Element("layoutSlip"); element.setAttribute("ident",p.getName()); element.setAttribute("slipType","" + p.getSlipType()); if (p.getBlockName().length() > 0) { element.setAttribute("blockname",p.getBlockName()); } if (p.getConnectA() != null) { element.setAttribute("connectaname",((TrackSegment)p.getConnectA()).getID()); } if (p.getConnectB() != null) { element.setAttribute("connectbname",((TrackSegment)p.getConnectB()).getID()); } if (p.getConnectC() != null) { element.setAttribute("connectcname",((TrackSegment)p.getConnectC()).getID()); } if (p.getConnectD() != null) { element.setAttribute("connectdname",((TrackSegment)p.getConnectD()).getID()); } if (p.getSignalA1Name().length() > 0) { element.addContent(new Element("signala1name").addContent(p.getSignalA1Name())); } if (p.getSignalB1Name().length() > 0) { element.addContent(new Element("signalb1name").addContent(p.getSignalB1Name())); } if (p.getSignalC1Name().length() > 0) { element.addContent(new Element("signalc1name").addContent(p.getSignalC1Name())); } if (p.getSignalD1Name().length() > 0) { element.addContent(new Element("signald1name").addContent(p.getSignalD1Name())); } if (p.getSignalA2Name().length() > 0) { element.addContent(new Element("signala2name").addContent(p.getSignalA2Name())); } if (p.getSignalB2Name().length() > 0) { element.addContent(new Element("signalb2name").addContent(p.getSignalB2Name())); } if (p.getSignalC2Name().length() > 0) { element.addContent(new Element("signalc2name").addContent(p.getSignalC2Name())); } if (p.getSignalD2Name().length() > 0) { element.addContent(new Element("signald2name").addContent(p.getSignalD2Name())); } Point2D coords=p.getCoordsCenter(); element.setAttribute("xcen","" + coords.getX()); element.setAttribute("ycen","" + coords.getY()); coords=p.getCoordsA(); element.setAttribute("xa","" + coords.getX()); element.setAttribute("ya","" + coords.getY()); coords=p.getCoordsB(); element.setAttribute("xb","" + coords.getX()); element.setAttribute("yb","" + coords.getY()); if (p.getSignalAMastName().length() > 0) { element.addContent(new Element("signalAMast").addContent(p.getSignalAMastName())); } if (p.getSignalBMastName().length() > 0) { element.addContent(new Element("signalBMast").addContent(p.getSignalBMastName())); } if (p.getSignalCMastName().length() > 0) { element.addContent(new Element("signalCMast").addContent(p.getSignalCMastName())); } if (p.getSignalDMastName().length() > 0) { element.addContent(new Element("signalDMast").addContent(p.getSignalDMastName())); } if (p.getSensorAName().length() > 0) { element.addContent(new Element("sensorA").addContent(p.getSensorAName())); } if (p.getSensorBName().length() > 0) { element.addContent(new Element("sensorB").addContent(p.getSensorBName())); } if (p.getSensorCName().length() > 0) { element.addContent(new Element("sensorC").addContent(p.getSensorCName())); } if (p.getSensorDName().length() > 0) { element.addContent(new Element("sensorD").addContent(p.getSensorDName())); } if (p.getTurnoutName().length() > 0) { element.addContent(new Element("turnout").addContent(p.getTurnoutName())); } if (p.getTurnoutBName().length() > 0) { element.addContent(new Element("turnoutB").addContent(p.getTurnoutBName())); } Element states=new Element("states"); Element state=new Element("A-C"); state.addContent(new Element("turnout").addContent("" + p.getTurnoutState(LayoutSlip.STATE_AC))); state.addContent(new Element("turnoutB").addContent("" + p.getTurnoutBState(LayoutSlip.STATE_AC))); states.addContent(state); state=new Element("A-D"); state.addContent(new Element("turnout").addContent("" + p.getTurnoutState(LayoutSlip.STATE_AD))); state.addContent(new Element("turnoutB").addContent("" + p.getTurnoutBState(LayoutSlip.STATE_AD))); states.addContent(state); state=new Element("B-D"); state.addContent(new Element("turnout").addContent("" + p.getTurnoutState(LayoutSlip.STATE_BD))); state.addContent(new Element("turnoutB").addContent("" + p.getTurnoutBState(LayoutSlip.STATE_BD))); states.addContent(state); if (p.getSlipType() == LayoutSlip.DOUBLE_SLIP) { state=new Element("B-C"); state.addContent(new Element("turnout").addContent("" + p.getTurnoutState(LayoutSlip.STATE_BC))); state.addContent(new Element("turnoutB").addContent("" + p.getTurnoutBState(LayoutSlip.STATE_BC))); states.addContent(state); } element.addContent(states); element.setAttribute("class",getClass().getName()); return element; }
Default implementation for storing the contents of a LayoutSlip
private static Matrix buildMatrix(int dataShards,int totalShards){ Matrix vandermonde=vandermonde(totalShards,dataShards); Matrix top=vandermonde.submatrix(0,0,dataShards,dataShards); return vandermonde.times(top.invert()); }
Create the matrix to use for encoding, given the number of data shards and the number of total shards. The top square of the matrix is guaranteed to be an identity matrix, which means that the data shards are unchanged after encoding.
public CLQueue createDefaultOutOfOrderQueue(){ return new CLDevice(platform,deviceIds.getSizeT()).createOutOfOrderQueue(this); }
Create an out-of-order OpenCL queue on the first device of this context.<br> Equivalent to calling <code>getDevices()[0].createOutOfOrderQueue(context)</code>
private boolean zzRefill() throws java.io.IOException { if (zzStartRead > 0) { System.arraycopy(zzBuffer,zzStartRead,zzBuffer,0,zzEndRead - zzStartRead); zzEndRead-=zzStartRead; zzCurrentPos-=zzStartRead; zzMarkedPos-=zzStartRead; zzStartRead=0; } if (zzCurrentPos >= zzBuffer.length) { char newBuffer[]=new char[zzCurrentPos * 2]; System.arraycopy(zzBuffer,0,newBuffer,0,zzBuffer.length); zzBuffer=newBuffer; } int numRead=zzReader.read(zzBuffer,zzEndRead,zzBuffer.length - zzEndRead); if (numRead > 0) { zzEndRead+=numRead; return false; } if (numRead == 0) { int c=zzReader.read(); if (c == -1) { return true; } else { zzBuffer[zzEndRead++]=(char)c; return false; } } return true; }
Refills the input buffer.
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
private String readUTFBody(long utfLen) throws IOException { StringBuilder sbuf=new StringBuilder(); end=pos=0; while (utfLen > 0) { int avail=end - pos; if (avail >= 3 || (long)avail == utfLen) utfLen-=readUTFSpan(sbuf,utfLen); else { if (avail > 0) GridUnsafe.copyMemory(utfBuf,BYTE_ARR_OFF + pos,utfBuf,BYTE_ARR_OFF,avail); pos=0; end=(int)Math.min(MAX_BLOCK_SIZE,utfLen); readFully(utfBuf,avail,end - avail); } } return sbuf.toString(); }
Reads in the "body" (i.e., the UTF representation minus the 2-byte or 8-byte length header) of a UTF encoding, which occupies the next utfLen bytes.
public boolean empty(){ return vstack.empty(); }
Indicate whether the stack is empty.
@Override public void flush(){ }
Flushing this writer has no effect.
public String encode(ByteBuffer aBuffer){ byte[] buf=getBytes(aBuffer); return encode(buf); }
A 'streamless' version of encode that simply takes a ByteBuffer and returns a string containing the encoded buffer. <P> The ByteBuffer's position will be advanced to ByteBuffer's limit.
public void addVersionHistory(VersionHistory history){ Preconditions.checkNotNull(history); boolean exists=false; for ( VersionHistory vh : getVersionHistory()) { if (vh.getVersion().equals(history.getVersion())) { exists=true; } } if (!exists) { log.debug("Adding new version history: " + history.getVersion()); versionHistory.add(0,history); } }
Add new VersionHistory, as long as a VersionHistory with same version hasn't been added yet. The new version gets added at the top of the list.
static int readInt(final byte[] b,final int index){ return ((b[index] & 0xFF) << 24) | ((b[index + 1] & 0xFF) << 16) | ((b[index + 2] & 0xFF) << 8)| (b[index + 3] & 0xFF); }
Reads a signed int value in the given byte array.
public CacheObject load(Object key){ if (key != null) { String xAndY=key.toString(); int commaIndex=xAndY.indexOf(','); int x=Integer.parseInt(xAndY.substring(0,commaIndex)); int y=Integer.parseInt(xAndY.substring(commaIndex + 1)); if (Debug.debugging("asrpdetail")) { Debug.output("Getting tiled image " + x + ", "+ y+ " (from "+ xAndY+ ")"); } try { OMGraphic block=getBlock(x,y); if (block != null) { return new ASRPBlockCacheObject(xAndY.intern(),block); } } catch ( IOException ioe) { Debug.error("ASRPDirectory caught exception creating tiled image for " + xAndY); } } return null; }
Load a block image into the cache, based on the relative coordinates of the block as a key.
public final void push(Node value){ int ff=m_firstFree; if ((ff + 1) >= m_mapSize) { if (null == m_map) { m_map=new Node[m_blocksize]; m_mapSize=m_blocksize; } else { m_mapSize+=m_blocksize; Node newMap[]=new Node[m_mapSize]; System.arraycopy(m_map,0,newMap,0,ff + 1); m_map=newMap; } } m_map[ff]=value; ff++; m_firstFree=ff; }
Append a Node onto the vector.
public boolean isColorMaskBlueEnabled(){ return mColorMaskB; }
Queries whether blue channel is written
public Adapter createEObjectAdapter(){ return null; }
Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!-- end-user-doc -->
public GroupCategorySet(GroupCategory category){ Assert.isNotNull(category); fContent=new ArrayList(1); fContent.add(category); }
Creates a new list of group categories initialized with the given group category.
@SuppressWarnings("unchecked") public static <K extends Comparable<? super K>,V>ImmutableSortedMap<K,V> of(K k1,V v1,K k2,V v2,K k3,V v3,K k4,V v4){ return ofEntries(entryOf(k1,v1),entryOf(k2,v2),entryOf(k3,v3),entryOf(k4,v4)); }
Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.
public void visitEnd(){ if (fv != null) { fv.visitEnd(); } }
Visits the end of the field. This method, which is the last one to be called, is used to inform the visitor that all the annotations and attributes of the field have been visited.
public SendableStickerMessage.SendableStickerMessageBuilder replyTo(Message replyTo){ this.replyTo=replyTo != null ? replyTo.getMessageId() : 0; return this; }
*Optional Sets the Message object that you want to reply to
public FBNBackupManager(String gdsType){ super(gdsType); }
Create a new instance of <code>FBNBackupManager</code> based on a given GDSType.
public CloseableIteratorIteration(Iterator<? extends E> iter){ setIterator(iter); }
Creates a CloseableIteratorIteration that wraps the supplied iterator.
static boolean isValid(String name){ return JMXSupport.isValid(name); }
We simply assume a pool is valid if it is in the list of pool names we maintain.
public boolean reuseAddress(){ return reader.getBoolean(REUSE_ADDRESS,DEFAULT_REUSE_ADDRESS); }
The SO_REUSEADDR option.
protected DeterministicKeyChain(DeterministicKey watchKey,boolean isFollowing){ this(watchKey); this.isFollowing=isFollowing; }
<p>Creates a deterministic key chain with the given watch key. If <code>isFollowing</code> flag is set then this keychain follows some other keychain. In a married wallet following keychain represents "spouse's" keychain.</p> <p>Watch key has to be an account key.</p>
private void sortChildDrawingOrder(){ if (drawingOrderedChildren == null) { drawingOrderedChildren=new ArrayList<>(); } else { drawingOrderedChildren.clear(); } final int childCount=getChildCount(); for (int i=0; i < childCount; i++) { final View child=getChildAt(i); drawingOrderedChildren.add(child); } Collections.sort(drawingOrderedChildren,VIEW_COMPARATOR); }
Sorts children in reverse order for drawing.
public boolean isModifiedNow(){ return isModified(); }
Returns true if the underlying dependencies have changed, forcing a check.
@Override public int pushMessageSync(Message msg) throws org.apache.thrift.TException { if (msg == null) { log.error("Could not push empty message"); return 0; } List<String> sessionids=msg.getSessionIDs(); for ( String sid : sessionids) { SessionQueue pQueue=null; if (!msgQueues.containsKey(sid)) { pQueue=new SessionQueue(); msgQueues.put(sid,pQueue); } else { pQueue=msgQueues.get(sid); } log.debug("pushMessageSync: SessionId: " + sid + " Receive a message, "+ msg.toString()+ "\n"); ByteBuffer bb=ByteBuffer.wrap(msg.getPacket().getData()); BlockingQueue<ByteBuffer> queue=pQueue.getQueue(); if (queue != null) { if (!queue.offer(bb)) { log.error("Failed to queue message for session: " + sid); } else { log.debug("insert a message to session: " + sid); } } else { log.error("queue for session {} is null",sid); } } return 1; }
The implementation for pushMessageSync() function.
private static void restoreSolr5Index(Properties properties) throws IOException, SolrServerException { String solrHome=properties.getProperty("dhus.solr.home"); String coreName=properties.getProperty("dhus.solr.core.name"); final String name=properties.getProperty("dhus.solr.backup.name"); final String location=properties.getProperty("dhus.solr.backup.location"); if (solrHome == null || coreName == null || name == null || location == null) { throw new UnsupportedOperationException(); } System.setProperty("solr.solr.home",solrHome); CoreContainer core=new CoreContainer(solrHome); EmbeddedSolrServer server=new EmbeddedSolrServer(core,coreName); server.getCoreContainer().load(); SolrQuery query=new SolrQuery(); query.setRequestHandler("/replication"); query.set("command","restore"); query.set("name",name); query.set("location",location); server.query(query); server.shutdown(); logger.info("SolR indexes restored."); }
Performs Solr restoration.
private boolean isGroupOnWhiteList(String groupId){ Pattern[] patterns=_groupWhiteList.getCompiledPatterns(); if (patterns != null && patterns.length > 0) { for ( Pattern pattern : patterns) { if (pattern.matcher(groupId).matches()) { return true; } } } else { return true; } return false; }
Check if a group is on the whitelist for this authN provider
public static boolean hasEntryLowerThan(List<Integer> list,Integer border){ for ( Integer pos : list) if (pos < border) return true; return false; }
<p> hasEntryLowerThan </p>