code
stringlengths
10
174k
nl
stringlengths
3
129k
protected void onDeop(String channel,String sourceNick,String sourceLogin,String sourceHostname,String recipient){ }
Called when a user (possibly us) gets operator status taken away. <p> This is a type of mode change and is also passed to the onMode method in the PircBot class. <p> The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
@Override public void capabilitiesFilterChanged(CapabilitiesFilterChangeEvent e){ if (e.getFilter() == null) { updateCapabilitiesFilter(null); } else { updateCapabilitiesFilter((Capabilities)e.getFilter().clone()); } }
method gets called in case of a change event.
String login(String password) throws LoginFailedException { if (Arrays.equals(hashPassword(this.passwordHashSalt,password),this.passwordHash)) { return UUID.randomUUID().toString(); } else { throw new LoginFailedException(); } }
Checks the password, returning a valid login token.
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"STR"); translateAll(environment,instruction,"STR",instructions); }
STR{<cond>}B <Rd>, <addressing_mode>
private static MyPresenceManager createInstance(Context context,MXSession session){ MyPresenceManager instance=new MyPresenceManager(context,session); instances.put(session,instance); return instance; }
Create an instance without any check.
protected void parseFontInfo(InStream in,int length2) throws IOException { int fontId=in.readUI16(); int length=length2; int nameLength=in.readUI8(); byte[] chars=in.read(nameLength); String fontName=new String(chars); int flags=in.readUI8(); length-=4 + nameLength; boolean wide=(flags & FONT_WIDECHARS) != 0; int[] codes=new int[wide ? (length / 2) : length]; for (int i=0; i < codes.length; i++) { codes[i]=wide ? in.readUI16() : in.readUI8(); } tagtypes.tagDefineFontInfo(fontId,fontName,flags,codes); }
Description of the Method
@Override public boolean eIsSet(int featureID){ switch (featureID) { case GamlPackage.SKILL_REF__REF: return ref != null; } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private OptionScanNode createTree(List<OptionScanNode> treeNodes,int nodeType){ if (treeNodes == null || treeNodes.isEmpty()) { return null; } else if (treeNodes.size() == 1) { return treeNodes.get(0); } else { List<OptionScanNode> otherChildren=treeNodes.subList(2,treeNodes.size()); if (nodeType == CONTEXT_MENU_NODE) { return new ContextMenuNode((ContextMenuItem)treeNodes.get(0),(ContextMenuItem)treeNodes.get(1),otherChildren.toArray(new ContextMenuItem[otherChildren.size()])); } else if (nodeType == OPTION_SCAN_SELECTION_NODE) { return new OptionScanSelectionNode(treeNodes.get(0),treeNodes.get(1),otherChildren.toArray(new OptionScanNode[otherChildren.size()])); } return null; } }
Given a list of nodes, unites the nodes under a common parent, by making them children of a common OptionScanNode
public static void close(){ try { log.info("Closing AnalysisCellBasedAccessibilityCSVWriterV2 ..."); assert (AnalysisCellBasedAccessibilityCSVWriterV2.accessibilityDataWriter != null); accessibilityDataWriter.flush(); accessibilityDataWriter.close(); log.info("... done!"); } catch ( IOException e) { e.printStackTrace(); } }
finalize and close csv file
public boolean hasAdditionalText(){ return mAdditionalText != null; }
Returns true if the line contains an "additional text" field.
public void clear(){ mMap.clear(); }
Invokes <code>clear</code> on backing Map.
protected void onDayTapped(Time day){ day.hour=mSelectedDay.hour; day.minute=mSelectedDay.minute; day.second=mSelectedDay.second; setSelectedDay(day); }
Maintains the same hour/min/sec but moves the day to the tapped day.
public PostscriptWriter(JComponent c,File f){ super(c,f); }
initializes the object with the given Component and filename
public int truePositives(){ int tp=0; for (int i=0; i < confusion.length; i++) { tp+=truePositives(i); } return tp; }
The number of correctly classified instances.
public final void rotY(double angle){ double sinAngle, cosAngle; sinAngle=Math.sin(angle); cosAngle=Math.cos(angle); this.m00=cosAngle; this.m01=0.0; this.m02=sinAngle; this.m10=0.0; this.m11=1.0; this.m12=0.0; this.m20=-sinAngle; this.m21=0.0; this.m22=cosAngle; }
Sets the value of this matrix to a counter clockwise rotation about the y axis.
private void storeSendDetails(final String topic,final MqttMessage msg,final IMqttDeliveryToken messageToken,final String invocationContext,final String activityToken){ savedTopics.put(messageToken,topic); savedSentMessages.put(messageToken,msg); savedActivityTokens.put(messageToken,activityToken); savedInvocationContexts.put(messageToken,invocationContext); }
Store details of sent messages so we can handle "deliveryComplete" callbacks from the mqttClient
public static boolean requestRoot(){ d("(requestRoot) Requesting root permission..."); try { Process p=Runtime.getRuntime().exec("su"); Thread.sleep(20); p.destroy(); d("(requestRoot) Done!"); return true; } catch ( IOException ioex) { return false; } catch ( Exception ex) { return false; } }
Requests root permission
public static char[] encode(final byte[] data,final boolean toLowerCase){ return encode(data,toLowerCase ? DIGITS_LOWER : DIGITS_UPPER); }
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
public void search(String keyword){ execute(keyword); }
Call this method to execute the file search task.
public Map<String,String> merge(Map<String,String> curProps,Map<String,String> newProps) throws IOException { Map<String,String> props=new HashMap<>(newProps); for ( Map.Entry<String,String> e : curProps.entrySet()) { String name=e.getKey(); String curValue=e.getValue(); if (props.containsKey(name)) { props.put(name,curValue); } } return props; }
Merges two bunches of the properties from current and new configurations.
public static String formatDate(Date date){ SimpleDateFormat dateFormat=new SimpleDateFormat(DATE_TIME,Locale.getDefault()); return dateFormat.format(date); }
dd MMM yyyy HH:mm:ss z
public void testPassiveJoinEvent() throws Throwable { testJoinEvent(Member.Type.PASSIVE); }
Tests a passive member join event.
public TeXParser(String parseString,TeXFormula formula){ this(parseString,formula,true); }
Create a new TeXParser
public void close(){ synchronized (mDiskCacheLock) { if (mDiskLruCache != null) { try { if (!mDiskLruCache.isClosed()) { mDiskLruCache.close(); mDiskLruCache=null; if (BuildConfig.DEBUG) { Log.d(TAG,"Disk cache closed"); } } } catch ( IOException e) { Log.e(TAG,"close - " + e); } } } }
Closes the disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread.
private void decodeEndRule(){ useDaylight=(startDay != 0) && (endDay != 0); if (endDay != 0) { if (endMonth < Calendar.JANUARY || endMonth > Calendar.DECEMBER) { throw new IllegalArgumentException("Illegal end month " + endMonth); } if (endTime < 0 || endTime > millisPerDay) { throw new IllegalArgumentException("Illegal end time " + endTime); } if (endDayOfWeek == 0) { endMode=DOM_MODE; } else { if (endDayOfWeek > 0) { endMode=DOW_IN_MONTH_MODE; } else { endDayOfWeek=-endDayOfWeek; if (endDay > 0) { endMode=DOW_GE_DOM_MODE; } else { endDay=-endDay; endMode=DOW_LE_DOM_MODE; } } if (endDayOfWeek > Calendar.SATURDAY) { throw new IllegalArgumentException("Illegal end day of week " + endDayOfWeek); } } if (endMode == DOW_IN_MONTH_MODE) { if (endDay < -5 || endDay > 5) { throw new IllegalArgumentException("Illegal end day of week in month " + endDay); } } else if (endDay < 1 || endDay > staticMonthLength[endMonth]) { throw new IllegalArgumentException("Illegal end day " + endDay); } } }
Decode the end rule and validate the parameters. This method is exactly analogous to decodeStartRule().
public final void writeFloat(float v){ if (this.ignoreWrites) return; checkIfWritable(); ensureCapacity(4); buffer.putFloat(v); }
Writes a <code>float</code> value, which is comprised of four bytes, to the output stream. It does this as if it first converts this <code>float</code> value to an <code>int</code> in exactly the manner of the <code>Float.floatToIntBits</code> method and then writes the <code>int</code> value in exactly the manner of the <code>writeInt</code> method. The bytes written by this method may be read by the <code>readFloat</code> method of interface <code>DataInput</code>, which will then return a <code>float</code> equal to <code>v</code>.
public static String padString(String s,int fieldSize){ StringBuffer buf=new StringBuffer(s); while (buf.length() < fieldSize) { buf.append(" "); } return buf.toString(); }
Adjusts string to be a certain number of characters by adding spaces to the end of the string.
@Override public void fatalError(SAXParseException ex) throws SAXException { throw ex; }
Rethrow the <code>SAXParseException</code>
public void restoreFragments(Activity activity){ StartMenuFragment foundStartMenuFragment=(StartMenuFragment)activity.getFragmentManager().findFragmentByTag(START_MENU_TAG); if (foundStartMenuFragment != null) { mStartMenuFragment=foundStartMenuFragment; } else { mStartMenuFragment=new StartMenuFragment(); } MissionSelectionFragment foundMissionSelectionFragment=(MissionSelectionFragment)activity.getFragmentManager().findFragmentByTag(LIST_OF_MISSIONS_TAG); if (foundMissionSelectionFragment != null) { mMissionSelectionFragment=foundMissionSelectionFragment; } else { mMissionSelectionFragment=new MissionSelectionFragment(); } RunSpecificationSelectionFragment foundRunSpecificationSelectionFragment=(RunSpecificationSelectionFragment)activity.getFragmentManager().findFragmentByTag(RUN_SPECIFICATIONS_TAG); if (foundRunSpecificationSelectionFragment != null) { mRunSpecificationsFragment=foundRunSpecificationSelectionFragment; } else { mRunSpecificationsFragment=new RunSpecificationSelectionFragment(); } MusicSelectionFragment foundMusicSelectionFragment=(MusicSelectionFragment)activity.getFragmentManager().findFragmentByTag(MUSIC_SELECTION_TAG); if (foundMissionSelectionFragment != null) { mMusicSelectionFragment=foundMusicSelectionFragment; } else { mMusicSelectionFragment=new MusicSelectionFragment(); } EndSummaryFragment foundEndSummaryFragment=(EndSummaryFragment)activity.getFragmentManager().findFragmentByTag(END_SUMMARY_TAG); if (foundEndSummaryFragment != null) { mEndSummaryFragment=foundEndSummaryFragment; } else { mEndSummaryFragment=new EndSummaryFragment(); } FitnessDataDisplayFragment foundFitnessDataDisplayFragment=(FitnessDataDisplayFragment)activity.getFragmentManager().findFragmentByTag(FITNESS_DATA_DISPLAY_TAG); if (foundFitnessDataDisplayFragment != null) { mFitnessDataDisplayFragment=foundFitnessDataDisplayFragment; } else { mFitnessDataDisplayFragment=new FitnessDataDisplayFragment(); } }
Restores information and fragments from the Bundle upon lifecycle restart. Called by the 'restoreFragments' method in the Game class.
public Transaction(NetworkParameters params,byte[] payloadBytes) throws ProtocolException { super(params,payloadBytes,0); }
Creates a transaction from the given serialized bytes, eg, from a block or a tx network message.
public boolean rewrite(){ return rewrite; }
Indicates whether the query should be rewritten into primitive queries
public void addEntry(RemoveAllEntryData removeAllEntry){ this.removeAllData[this.removeAllDataSize]=removeAllEntry; this.removeAllDataSize+=1; }
Add an entry that this removeAll operation should distribute.
public ParallelTask(){ this.setTaskId(generateTaskId()); this.responsedNum=0; this.requestNum=0; this.state=ParallelTaskState.WAITING; this.config=new ParallelTaskConfig(); }
Instantiates a new parallel task.
public String sqlObject_createTable(String sourceVendorName,String targetVendorName,String catalogName,String schemaName,String tableName,ArrayList<String> columnNames,ArrayList<String> columnTypes,ArrayList<Integer> columnSizes,ArrayList<Integer> columnScales,ArrayList<Boolean> columnNullables,ArrayList<String> columnDefaults){ tableName=normalizeIdentifier(targetVendorName,tableName); ArrayList<String> normalizedColumnNames=new ArrayList<String>(); ArrayList<String> translatedColumnTypes=new ArrayList<String>(); ArrayList<String> translatedColumnDefaults=new ArrayList<String>(); for (int i=0; i < columnNames.size(); i++) { normalizedColumnNames.add(normalizeColumnName(targetVendorName,columnNames.get(i))); translatedColumnTypes.add(translateDataType(sourceVendorName,targetVendorName,columnTypes.get(i),columnSizes.get(i),columnScales.get(i))); translatedColumnDefaults.add(translateExpression(sourceVendorName,targetVendorName,columnDefaults.get(i))); } return m_interfaces.get(getDBVendorID(targetVendorName)).sqlObject_createTable(catalogName,schemaName,tableName,normalizedColumnNames,translatedColumnTypes,columnNullables,translatedColumnDefaults); }
gets the database specific SQL command to create tables
public KMLSurfacePolygonImpl(KMLTraversalContext tc,KMLPlacemark placemark,KMLAbstractGeometry geom){ if (tc == null) { String msg=Logging.getMessage("nullValue.TraversalContextIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (placemark == null) { String msg=Logging.getMessage("nullValue.ParentIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } this.parent=placemark; KMLPolygon polygon=(KMLPolygon)geom; this.setPathType(AVKey.LINEAR); KMLLinearRing outerBoundary=polygon.getOuterBoundary(); if (outerBoundary != null) { Position.PositionList coords=outerBoundary.getCoordinates(); if (coords != null && coords.list != null) this.setOuterBoundary(outerBoundary.getCoordinates().list); } Iterable<? extends KMLLinearRing> innerBoundaries=polygon.getInnerBoundaries(); if (innerBoundaries != null) { for ( KMLLinearRing ring : innerBoundaries) { Position.PositionList coords=ring.getCoordinates(); if (coords != null && coords.list != null) this.addInnerBoundary(ring.getCoordinates().list); } } if (placemark.getName() != null) this.setValue(AVKey.DISPLAY_NAME,placemark.getName()); if (placemark.getDescription() != null) this.setValue(AVKey.DESCRIPTION,placemark.getDescription()); if (placemark.getSnippetText() != null) this.setValue(AVKey.SHORT_DESCRIPTION,placemark.getSnippetText()); this.setValue(AVKey.CONTEXT,this.parent); }
Create an instance.
private void analize(){ StringTokenizer tokenizer2=new StringTokenizer(tokenizer.nextToken(),","); String nextToken=tokenizer2.nextToken(); title=nextToken.substring(1,nextToken.length() - 1); l=Integer.parseInt(tokenizer2.nextToken()); t=Integer.parseInt(tokenizer2.nextToken()); r=Integer.parseInt(tokenizer2.nextToken()); b=Integer.parseInt(tokenizer2.nextToken()); numPages=Integer.parseInt(tokenizer2.nextToken()); FPageDef pageDef=null; for (int i=0; i < numPages; i++) { pageDef=new FPageDef(tokenizer); pagedefs.put(new Integer(i),pageDef); } }
Private methods
public Element create(String prefix,Document doc){ return new XBLOMImportElement(prefix,(AbstractDocument)doc); }
Creates an instance of the associated element type.
protected void dispatchSVGResizeEvent(){ if (bridgeContext.isSVG12()) { dispatchSVGDocEvent("resize"); } else { dispatchSVGDocEvent("SVGResize"); } }
Method to dispatch SVG Resize event.
private synchronized void trim(){ while (mCurrentSize > mSizeLimit) { byte[] buf=mBuffersByLastUse.remove(0); mBuffersBySize.remove(buf); mCurrentSize-=buf.length; } }
Removes buffers from the pool until it is under its size limit.
private Bookmarks(){ }
This utility class cannot be instantiated.
public DeterministicHierarchy(DeterministicKey rootKey){ putKey(rootKey); rootPath=rootKey.getPath(); }
Constructs a new hierarchy rooted at the given key. Note that this does not have to be the top of the tree. You can construct a DeterministicHierarchy for a subtree of a larger tree that you may not own.
@Override public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.video_list,menu); return true; }
Hook method called to initialize the contents of the Activity's standard options menu.
public double[] distributionForInstance(Instance instance) throws Exception { double[] returnedDist=null; if (m_Attribute > -1) { if (instance.isMissing(m_Attribute)) { returnedDist=new double[m_Info.numClasses()]; for (int i=0; i < m_Successors.length; i++) { double[] help=m_Successors[i].distributionForInstance(instance); if (help != null) { for (int j=0; j < help.length; j++) { returnedDist[j]+=m_Prop[i] * help[j]; } } } } else if (m_Info.attribute(m_Attribute).isNominal()) { returnedDist=m_Successors[(int)instance.value(m_Attribute)].distributionForInstance(instance); } else { if (instance.value(m_Attribute) < m_SplitPoint) { returnedDist=m_Successors[0].distributionForInstance(instance); } else { returnedDist=m_Successors[1].distributionForInstance(instance); } } } if ((m_Attribute == -1) || (returnedDist == null)) { if (m_ClassDistribution == null) { if (getAllowUnclassifiedInstances()) { double[] result=new double[m_Info.numClasses()]; if (m_Info.classAttribute().isNumeric()) { result[0]=Utils.missingValue(); } return result; } else { return null; } } double[] normalizedDistribution=m_ClassDistribution.clone(); if (m_Info.classAttribute().isNominal()) { Utils.normalize(normalizedDistribution); } return normalizedDistribution; } else { return returnedDist; } }
Computes class distribution of an instance using the decision tree.
public void killNotification(){ mService.stopForeground(true); mNotification=null; }
Remove notification
public void reset(){ super.reset(); sendCommand(CMD.RESET,0); }
reset ELM adapter
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
@Override public synchronized void updateObject(int columnIndex,Object x,int scale) throws SQLException { updateObjectInternal(columnIndex,x,null,scale); }
JDBC 2.0 Update a column with an Object value. The updateXXX() methods are used to update column values in the current row, or the insert row. The updateXXX() methods do not update the underlying database, instead the updateRow() or insertRow() methods are called to update the database.
public boolean isEmoteIgnored(Emoticon emote){ return ignoredEmotes.contains(emote.code); }
Check if the given emote is on the list of ignored emotes. Compares the emote code to the codes on the list.
public ChooseLocationDialog(java.awt.Frame parent,boolean modal){ this(parent,modal,null,null); }
Creates new form ChooseLocationDialog
public final void makeMove(Move move,UndoInfo ui){ ui.capturedPiece=squares[move.to]; ui.castleMask=castleMask; ui.epSquare=epSquare; ui.halfMoveClock=halfMoveClock; boolean wtm=whiteMove; int p=squares[move.from]; int capP=squares[move.to]; boolean nullMove=(move.from == 0) && (move.to == 0); if (nullMove || (capP != Piece.EMPTY) || (p == (wtm ? Piece.WPAWN : Piece.BPAWN))) { halfMoveClock=0; } else { halfMoveClock++; } if (!wtm) { fullMoveCounter++; } int king=wtm ? Piece.WKING : Piece.BKING; int k0=move.from; if (p == king) { if (move.to == k0 + 2) { setPiece(k0 + 1,squares[k0 + 3]); setPiece(k0 + 3,Piece.EMPTY); } else if (move.to == k0 - 2) { setPiece(k0 - 1,squares[k0 - 4]); setPiece(k0 - 4,Piece.EMPTY); } if (wtm) { setCastleMask(castleMask & ~(1 << Position.A1_CASTLE)); setCastleMask(castleMask & ~(1 << Position.H1_CASTLE)); } else { setCastleMask(castleMask & ~(1 << Position.A8_CASTLE)); setCastleMask(castleMask & ~(1 << Position.H8_CASTLE)); } } if (!nullMove) { int rook=wtm ? Piece.WROOK : Piece.BROOK; if (p == rook) { removeCastleRights(move.from); } int oRook=wtm ? Piece.BROOK : Piece.WROOK; if (capP == oRook) { removeCastleRights(move.to); } } int prevEpSquare=epSquare; setEpSquare(-1); if (p == Piece.WPAWN) { if (move.to - move.from == 2 * 8) { int x=Position.getX(move.to); if (((x > 0) && (squares[move.to - 1] == Piece.BPAWN)) || ((x < 7) && (squares[move.to + 1] == Piece.BPAWN))) { setEpSquare(move.from + 8); } } else if (move.to == prevEpSquare) { setPiece(move.to - 8,Piece.EMPTY); } } else if (p == Piece.BPAWN) { if (move.to - move.from == -2 * 8) { int x=Position.getX(move.to); if (((x > 0) && (squares[move.to - 1] == Piece.WPAWN)) || ((x < 7) && (squares[move.to + 1] == Piece.WPAWN))) { setEpSquare(move.from - 8); } } else if (move.to == prevEpSquare) { setPiece(move.to + 8,Piece.EMPTY); } } setPiece(move.from,Piece.EMPTY); if (move.promoteTo != Piece.EMPTY) { setPiece(move.to,move.promoteTo); } else { setPiece(move.to,p); } setWhiteMove(!wtm); }
Apply a move to the current position.
public static <T>void acceptChildren(T visitor,Iterable<? extends IVisitable<T>> children){ if (children == null) return; for ( IVisitable<T> child : children) { acceptChildren(visitor,child); } }
Accepts the visitor on the children. If children is null, nothing happens.
private void notifyFailure(final UserActionAttachment uaa){ getSoundChannel().playSoundForAll(SoundPath.CLIP_USER_ACTION_FAILURE,m_player); final String transcriptText=m_bridge.getPlayerID().getName() + " fails on action: " + MyFormatter.attachmentNameToText(uaa.getName()); m_bridge.getHistoryWriter().addChildToEvent(transcriptText); sendNotification(UserActionText.getInstance().getNotificationFailure(uaa.getText())); notifyOtherPlayers(uaa,UserActionText.getInstance().getNotificationFailureOthers(uaa.getText())); }
Let all players involved in this action know the action has failed.
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
public boolean match(Object o1,Object o2){ if (key1 != null) { if (!key1.equals(o1)) { return false; } } else if (o1 != null) { return false; } if (key2 != null) { return key2.equals(o2); } return o2 == null; }
Whether this entry match the given keys.
public String toString(){ return _displayName; }
Defines the class' representation as a <tt>String</tt> object, used in determining how it is displayed in the <tt>JTree</tt>.
StringArraySetting(Properties defaultProps,Properties props,String key,String[] defaultValue){ super(defaultProps,props,key,encode(defaultValue)); }
Creates a new <tt>StringArraySetting</tt> instance with the specified key and default value.
public ColorTrackImageProducer(int w,int h,int trackBuffer,boolean isHorizontal){ super(w,h,null,0,w); pixels=new int[w * h]; this.w=w; this.h=h; this.trackBuffer=((trackBuffer & 1) == 0) ? trackBuffer : trackBuffer - 1; this.isHorizontal=isHorizontal; newPixels(pixels,new DirectColorModel(24,0x00ff0000,0x0000ff00,0x000000ff),0,w); setAnimated(true); }
Creates a new instance.
static boolean isToplevelWindow(long window){ if (XToolkit.windowToXWindow(window) instanceof XDecoratedPeer) { return true; } XToolkit.awtLock(); try { WindowPropertyGetter wpg=new WindowPropertyGetter(window,XWM.XA_WM_STATE,0,1,false,XWM.XA_WM_STATE); try { wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); if (wpg.getActualType() == XWM.XA_WM_STATE.getAtom()) { return true; } } finally { wpg.dispose(); } return false; } finally { XToolkit.awtUnlock(); } }
NOTICE: Right now returns only decorated top-levels (not Window)
public String RM2Code(String mac){ JsonObject out=broadlinkExecuteCommand(BroadlinkConstants.CMD_RM2_CODE_ID,BroadlinkConstants.CMD_RM2_CODE,mac); int code=out.get(BroadlinkConstants.CODE).getAsInt(); if (0 != code) return null; String data=out.get("data").getAsString(); Log.e("RM2StudyCode",data); return data; }
Retrieve the studied code from RM2
public String useShortIdentifiersTipText(){ return "Whether to use short identifiers for the merged values."; }
Returns the tip text for this property
public Object clone() throws CloneNotSupportedException { return copy(); }
Standard <tt>Object</tt> clone method.
public DataBufferUShort(int size,int numBanks){ super(STABLE,TYPE_USHORT,size,numBanks); bankdata=new short[numBanks][]; for (int i=0; i < numBanks; i++) { bankdata[i]=new short[size]; } data=bankdata[0]; }
Constructs an unsigned-short based <CODE>DataBuffer</CODE> with the specified number of banks, all of which are the specified size.
public float sigmoid(float input){ float val=(float)(1 / (1 + Math.exp(-input))); return val; }
simple sigmoid func
public X509Certificate generateX509Certificate(PrivateKey key,SecureRandom random) throws SecurityException, SignatureException, InvalidKeyException { try { return generateX509Certificate(key,"BC",random); } catch ( NoSuchProviderException e) { throw new SecurityException("BC provider not installed!"); } }
generate an X509 certificate, based on the current issuer and subject using the default provider "BC" and the passed in source of randomness
protected TypedPosition findClosestPosition(int offset){ try { int index=fDocument.computeIndexInCategory(fPositionCategory,offset); Position[] category=getPositions(); if (category.length == 0) return null; if (index < category.length) { if (offset == category[index].offset) return (TypedPosition)category[index]; } if (index > 0) index--; return (TypedPosition)category[index]; } catch ( BadPositionCategoryException x) { } catch ( BadLocationException x) { } return null; }
Returns the position in the partitoner's position category which is close to the given offset. This is, the position has either an offset which is the same as the given offset or an offset which is smaller than the given offset. This method profits from the knowledge that a partitioning is a ordered set of disjoint position. <p> May be extended or replaced by subclasses. </p>
private int indexOf(int c){ int start=0; int end=intervals.size() - 1; while (start <= end) { int check=(start + end) / 2; Interval i=intervals.get(check); if (start == end) return i.contains(c) ? start : -1; if (c < i.start) { end=check - 1; continue; } if (c > i.end) { start=check + 1; continue; } return check; } return -1; }
returns the index of the interval that contains the character c, -1 if there is no such interval
public void acquire() throws InterruptedException { Counter.acquire(1); }
Blockingly acquire the semaphore
public String toString(){ return getValue().replace('$','.') + ".class"; }
Obtains the string representation of this object.
public void initOptions(){ _playerField.setText(URLHandlerSettings.AUDIO_PLAYER.getValue()); }
Sets the options for the fields in this <tt>PaneItem</tt> when the window is shown.
public void computeJobExecute(long jobPtr,int cancel,long memPtr){ enter(); try { PlatformCallbackUtils.computeJobExecute(envPtr,jobPtr,cancel,memPtr); } finally { leave(); } }
Execute native job on a node other than where it was created.
public ReflectiveOperationException(String message,Throwable cause){ super(message,cause); }
Constructs a new exception with the given detail message and cause.
@Override @SuppressWarnings("unchecked") HashMap.Entry<K,V>[] newElementArray(int s){ return new LinkedHashMapEntry[s]; }
Create a new element array
static public BindableRockerModel template(String templatePath){ RockerModel model=RockerRuntime.getInstance().getBootstrap().model(templatePath); return new BindableRockerModel(templatePath,model.getClass().getCanonicalName(),model); }
Creates a template at runtime with properties that can be set (bindable) dynamically at runtime via Java reflection.
MultistepExprHolder(ExpressionOwner exprOwner,int stepCount,MultistepExprHolder next){ m_exprOwner=exprOwner; assertion(null != m_exprOwner,"exprOwner can not be null!"); m_stepCount=stepCount; m_next=next; }
Create a MultistepExprHolder.
private final void throwException2(int index) throws IndexOutOfBoundsException { throw new IndexOutOfBoundsException("Index " + index + ", not in range [0-"+ size+ "]"); }
Throws an exception. This method isolates error-handling code from the error-checking code, so that callers can be both small enough to be inlined, as well as not usually make any expensive method calls (since their callers will usually not pass illegal arguments to them). See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5103956"> this Sun bug report</a> for more information.
@Override public boolean eIsSet(int featureID){ switch (featureID) { case UmplePackage.CONSTRAINT_EXPR___NEGATIVE_CONSTRAINT_1: return negativeConstraint_1 != null && !negativeConstraint_1.isEmpty(); case UmplePackage.CONSTRAINT_EXPR___STRING_EXPR_1: return stringExpr_1 != null && !stringExpr_1.isEmpty(); case UmplePackage.CONSTRAINT_EXPR___BOOL_EXPR_1: return boolExpr_1 != null && !boolExpr_1.isEmpty(); case UmplePackage.CONSTRAINT_EXPR___GEN_EXPR_1: return genExpr_1 != null && !genExpr_1.isEmpty(); case UmplePackage.CONSTRAINT_EXPR___NUM_EXPR_1: return numExpr_1 != null && !numExpr_1.isEmpty(); case UmplePackage.CONSTRAINT_EXPR___LONE_BOOLEAN_1: return LONE_BOOLEAN_1_EDEFAULT == null ? loneBoolean_1 != null : !LONE_BOOLEAN_1_EDEFAULT.equals(loneBoolean_1); case UmplePackage.CONSTRAINT_EXPR___ANONYMOUS_CONSTRAINT_EXPR_11: return anonymous_constraintExpr_1_1 != null && !anonymous_constraintExpr_1_1.isEmpty(); } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public Document read(File file) throws DocumentException, IOException, XmlPullParserException { String systemID=file.getAbsolutePath(); return read(new BufferedReader(new FileReader(file)),systemID); }
<p> Reads a Document from the given <code>File</code> </p>
private DSSASN1Utils(){ }
This class is an utility class and cannot be instantiated.
public final String yytext(){ return new String(zzBuffer,zzStartRead,zzMarkedPos - zzStartRead); }
Returns the text matched by the current regular expression.
protected BaseEntry(){ state=new EntryState(); }
Constructs a new BaseEntry instance.
@Override public void prepare(){ String shortName=entity.getShortName(); Font font=new Font("SansSerif",Font.PLAIN,10); Rectangle tempRect=new Rectangle(47,55,bv.getFontMetrics(font).stringWidth(shortName) + 1,bv.getFontMetrics(font).getAscent()); image=ImageUtil.createAcceleratedImage(bounds.width,bounds.height); Graphics graph=image.getGraphics(); Image wreck=bv.tileManager.wreckMarkerFor(entity,-1); if (null != wreck) { graph.drawImage(wreck,0,0,this); } if ((secondaryPos == -1) && GUIPreferences.getInstance().getBoolean(GUIPreferences.ADVANCED_DRAW_ENTITY_LABEL)) { Color text=Color.lightGray; Color bkgd=Color.darkGray; Color bord=Color.black; graph.setFont(font); graph.setColor(bord); graph.fillRect(tempRect.x,tempRect.y,tempRect.width,tempRect.height); tempRect.translate(-1,-1); graph.setColor(bkgd); graph.fillRect(tempRect.x,tempRect.y,tempRect.width,tempRect.height); graph.setColor(text); graph.drawString(shortName,tempRect.x + 1,(tempRect.y + tempRect.height) - 1); } image=bv.getScaledImage(image,false); graph.dispose(); }
Creates the sprite for this entity. It is an extra pain to create transparent images in AWT.
public FunctionExpression createFunctionExpression(){ FunctionExpressionImpl functionExpression=new FunctionExpressionImpl(); return functionExpression; }
<!-- begin-user-doc --> <!-- end-user-doc -->
protected boolean writeXMLType(Output out,Object xml){ if (xml instanceof Document) { writeDocument(out,(Document)xml); } else { return false; } return true; }
Writes an xml type out to the output
public void onLoad(){ this.world.addTileEntities(this.tileEntityMap.values()); this.world.loadEntities(this.entities.getEntities()); this.isCubeLoaded=true; }
Finish the cube loading process
public double calculateValue(double log){ return Math.pow(this.base,log); }
Calculates the value from a given log.
public Matrix transpose(){ Matrix X=new Matrix(n,m); double[][] C=X.getArray(); for (int i=0; i < m; i++) { for (int j=0; j < n; j++) { C[j][i]=A[i][j]; } } return X; }
Matrix transpose.
public void randomizeRow(int nodeIndex,int rowIndex){ final int size=getNumColumns(nodeIndex); setNextRowTotal(getRowPseudocount(nodeIndex,rowIndex)); pseudocounts[nodeIndex][rowIndex]=getRandomPseudocounts(size); }
Assigns random probability values to the child values of this row that add to 1.
public static void write(String filename,Instances data) throws Exception { DataSink sink; sink=new DataSink(filename); sink.write(data); }
writes the data to the given file.
private boolean init(URL policy,PolicyInfo newInfo){ boolean success=false; PolicyParser pp=new PolicyParser(expandProperties); InputStreamReader isr=null; try { if (notUtf8) { isr=new InputStreamReader(PolicyUtil.getInputStream(policy)); } else { isr=new InputStreamReader(PolicyUtil.getInputStream(policy),"UTF-8"); } pp.read(isr); KeyStore keyStore=null; try { keyStore=PolicyUtil.getKeyStore(policy,pp.getKeyStoreUrl(),pp.getKeyStoreType(),pp.getKeyStoreProvider(),pp.getStorePassURL(),debug); } catch ( Exception e) { if (debug != null) { e.printStackTrace(); } } Enumeration<PolicyParser.GrantEntry> enum_=pp.grantElements(); while (enum_.hasMoreElements()) { PolicyParser.GrantEntry ge=enum_.nextElement(); addGrantEntry(ge,keyStore,newInfo); } } catch ( PolicyParser.ParsingException pe) { MessageFormat form=new MessageFormat(ResourcesMgr.getString(POLICY + ".error.parsing.policy.message")); Object[] source={policy,pe.getLocalizedMessage()}; System.err.println(form.format(source)); if (debug != null) pe.printStackTrace(); } catch ( Exception e) { if (debug != null) { debug.println("error parsing " + policy); debug.println(e.toString()); e.printStackTrace(); } } finally { if (isr != null) { try { isr.close(); success=true; } catch ( IOException e) { } } else { success=true; } } return success; }
Reads a policy configuration into the Policy object using a Reader object.
public void addColumn(String name,Class type){ throw new UnsupportedOperationException(); }
Unsupported by default.
public String parse(List<String> args,Map<String,String> properties){ String resultString=null; TreeMap<String,String[]> optmap=optionMap; ListIterator<String> argp=args.listIterator(); ListIterator<String> pbp=new ArrayList<String>().listIterator(); doArgs: for (; ; ) { String arg; if (pbp.hasPrevious()) { arg=pbp.previous(); pbp.remove(); } else if (argp.hasNext()) { arg=argp.next(); } else { break doArgs; } tryOpt: for (int optlen=arg.length(); ; optlen--) { String opt; findOpt: for (; ; ) { opt=arg.substring(0,optlen); if (optmap.containsKey(opt)) { break findOpt; } if (optlen == 0) { break tryOpt; } SortedMap<String,String[]> pfxmap=optmap.headMap(opt); int len=pfxmap.isEmpty() ? 0 : pfxmap.lastKey().length(); optlen=Math.min(len,optlen - 1); opt=arg.substring(0,optlen); } opt=opt.intern(); assert (arg.startsWith(opt)); assert (opt.length() == optlen); String val=arg.substring(optlen); boolean didAction=false; boolean isError=false; int pbpMark=pbp.nextIndex(); String[] specs=optmap.get(opt); eachSpec: for ( String spec : specs) { if (spec.length() == 0) { continue eachSpec; } if (spec.startsWith("#")) { break eachSpec; } int sidx=0; char specop=spec.charAt(sidx++); boolean ok; switch (specop) { case '+': ok=(val.length() != 0); specop=spec.charAt(sidx++); break; case '*': ok=true; specop=spec.charAt(sidx++); break; default : ok=(val.length() == 0); break; } if (!ok) { continue eachSpec; } String specarg=spec.substring(sidx); switch (specop) { case '.': resultString=(specarg.length() != 0) ? specarg.intern() : opt; break doArgs; case '?': resultString=(specarg.length() != 0) ? specarg.intern() : arg; isError=true; break eachSpec; case '@': opt=specarg.intern(); break; case '>': pbp.add(specarg + val); val=""; break; case '!': String negopt=(specarg.length() != 0) ? specarg.intern() : opt; properties.remove(negopt); properties.put(negopt,null); didAction=true; break; case '$': String boolval; if (specarg.length() != 0) { boolval=specarg; } else { String old=properties.get(opt); if (old == null || old.length() == 0) { boolval="1"; } else { boolval="" + (1 + Integer.parseInt(old)); } } properties.put(opt,boolval); didAction=true; break; case '=': case '&': boolean append=(specop == '&'); String strval; if (pbp.hasPrevious()) { strval=pbp.previous(); pbp.remove(); } else if (argp.hasNext()) { strval=argp.next(); } else { resultString=arg + " ?"; isError=true; break eachSpec; } if (append) { String old=properties.get(opt); if (old != null) { String delim=specarg; if (delim.length() == 0) { delim=" "; } strval=old + specarg + strval; } } properties.put(opt,strval); didAction=true; break; default : throw new RuntimeException("bad spec for " + opt + ": "+ spec); } } if (didAction && !isError) { continue doArgs; } while (pbp.nextIndex() > pbpMark) { pbp.previous(); pbp.remove(); } if (isError) { throw new IllegalArgumentException(resultString); } if (optlen == 0) { break tryOpt; } } pbp.add(arg); break doArgs; } args.subList(0,argp.nextIndex()).clear(); while (pbp.hasPrevious()) { args.add(0,pbp.previous()); } return resultString; }
Remove a set of command-line options from args, storing them in the properties map in a canonicalized form.
public GameEvent(final String source,final String event,final String... params){ this.source=source; this.event=event; this.params=params; }
creates a new GameEvent object
public static boolean containsScript(String str){ if (str.length() > 0) { for ( String scriptPrefix : SCRIPT_PREFIXES) { if (str.contains(scriptPrefix)) { return true; } } } return false; }
Returns <code>true</code> if <code>str</code> contains a script.
public void errorsTo(Parameterization config){ this.errorTarget=config; }
Set the error target, since there is no unique way where errors can be reported.
public Discipline discipline(){ return discipline; }
Returns <strong>this</strong> company's discipline.
public void tupleMatched(Map<K,V> tuple){ match.emit(cloneTuple(tuple)); }
Emits tuple if it. Call cloneTuple to allow users who have mutable objects to make a copy
@Override public int compareTo(RequestConditionHolder other,ServerWebExchange exchange){ if (this.condition == null && other.condition == null) { return 0; } else if (this.condition == null) { return 1; } else if (other.condition == null) { return -1; } else { assertEqualConditionTypes(other); return this.condition.compareTo(other.condition,exchange); } }
Compare the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. Or if one holder is empty, the other holder is preferred.
public static boolean compareDeclarations(Method first,Method second){ if (first.getReturnType() != second.getReturnType()) { return false; } return compareSignatures(first,second); }
Compares method declarations: signature and return types.
@Override int calculateEndTopBound(float yAxisDelta){ return getView().getTop() + (int)yAxisDelta; }
Calculates the resulting Y coordinate of the view's top bound based on the top position of the view relative to its parent container and the Y-axis delta
public boolean othersInsertsAreVisible(int type) throws SQLException { return false; }
Indicates whether inserts made by others are visible.