code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public boolean executeKeyEvent(KeyEvent event){
mTempRect.setEmpty();
if (!canScrollX() || !canScrollY()) {
if (isFocused()) {
View currentFocused=findFocus();
if (currentFocused == this) currentFocused=null;
View nextFocused=FocusFinder.getInstance().findNextFocus(this,currentFocused,View.FOCUS_DOWN);
return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN);
}
return false;
}
boolean handled=false;
if (canScrollY()) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_UP:
if (!event.isAltPressed()) {
handled=arrowScroll(View.FOCUS_UP);
}
else {
handled=fullScroll(View.FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
if (!event.isAltPressed()) {
handled=arrowScroll(View.FOCUS_DOWN);
}
else {
handled=fullScroll(View.FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_SPACE:
pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);
break;
}
}
}
if (canScrollX()) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
if (!event.isAltPressed()) {
handled=arrowScroll(View.FOCUS_LEFT);
}
else {
handled=fullScroll(View.FOCUS_LEFT);
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (!event.isAltPressed()) {
handled=arrowScroll(View.FOCUS_RIGHT);
}
else {
handled=fullScroll(View.FOCUS_RIGHT);
}
break;
}
}
}
return handled;
}
|
You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy.
|
static public String executeFunction(String[] values){
try {
if (values[2].equalsIgnoreCase("currentdate")) return DateFunctions.getCurrentDate(values[3]);
else if (values[2].equalsIgnoreCase("adddays")) return DateFunctions.addDays(Integer.valueOf(values[3]),values[4]);
return null;
}
catch ( Exception ex) {
return null;
}
}
|
Process the date request
|
public int executeNativeQuery(String sql){
throwReadOnly();
return 0;
}
|
Execute and commit the native query.
|
public static void init(){
try {
providers=new Vector<CrashInfoProvider>();
crashDir=new File(ToastBootstrap.toastHome,"crash");
crashDir.mkdirs();
}
catch ( Exception e) {
}
dateFormat=new SimpleDateFormat("yyyy-MM-dd_hh-mm-ss");
instance=new CrashHandler();
Thread.setDefaultUncaughtExceptionHandler(instance);
Thread.currentThread().setUncaughtExceptionHandler(instance);
providers.add(new CrashInfoToast());
providers.add(new CrashInfoEnvironment());
providers.add(new CrashInfoModules());
}
|
Initialize the handler. This is handled by Toast.
|
public void testGetAlgorithm() throws Exception {
String secret="secret string";
String algorithm="DES";
KeyGenerator kg=KeyGenerator.getInstance(algorithm);
Key key=kg.generateKey();
Cipher cipher=Cipher.getInstance(algorithm);
cipher.init(Cipher.ENCRYPT_MODE,key);
SealedObject so=new SealedObject(secret,cipher);
assertEquals("The algorithm name should be the same as used " + "in cipher.",algorithm,so.getAlgorithm());
}
|
getAlgorithm() method testing. Tests if the returned value equals to the corresponding value of Cipher object.
|
public static String rowToString(JSONArray ja){
StringBuffer sb=new StringBuffer();
for (int i=0; i < ja.length(); i+=1) {
if (i > 0) {
sb.append(',');
}
Object object=ja.opt(i);
if (object != null) {
String string=object.toString();
if (string.length() > 0 && (string.indexOf(',') >= 0 || string.indexOf('\n') >= 0 || string.indexOf('\r') >= 0 || string.indexOf(0) >= 0 || string.charAt(0) == '"')) {
sb.append('"');
int length=string.length();
for (int j=0; j < length; j+=1) {
char c=string.charAt(j);
if (c >= ' ' && c != '"') {
sb.append(c);
}
}
sb.append('"');
}
else {
sb.append(string);
}
}
}
sb.append('\n');
return sb.toString();
}
|
Produce a comma delimited text row from a JSONArray. Values containing the comma character will be quoted. Troublesome characters may be removed.
|
public FormIndex stepIndexOut(FormIndex index){
if (index.isTerminal()) {
return null;
}
else {
return new FormIndex(stepIndexOut(index.getNextLevel()),index);
}
}
|
used to go up one level in the formIndex. That is, if you're at 5_0, 1 (the second question in a repeating group), this method will return a FormInex of 5_0 (the start of the repeating group). If your at index 16 or 5_0, this will return null;
|
public IndexElemArray(){
this(IndexManager.INDEX_ELEMARRAY_SIZE);
}
|
Constructs an empty list with an initial capacity of ten.
|
@Override public boolean eIsSet(int featureID){
switch (featureID) {
case GamlPackage.BLOCK__STATEMENTS:
return statements != null && !statements.isEmpty();
case GamlPackage.BLOCK__FUNCTION:
return function != null;
}
return super.eIsSet(featureID);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public int availableProcessors(){
return RVMThread.availableProcessors;
}
|
Return the number of processors, always at least one.
|
public void receiveResultgetNumberOfServiceSessions(org.oscm.example.client.SessionServiceStub.GetNumberOfServiceSessionsResponseE result){
}
|
auto generated Axis2 call back method for getNumberOfServiceSessions method override this method for handling normal response from getNumberOfServiceSessions operation
|
public static void startActionBaz(Context context,String param1,String param2){
Intent intent=new Intent(context,MyIntentService1.class);
intent.setAction(ACTION_BAZ);
intent.putExtra(EXTRA_PARAM1,param1);
intent.putExtra(EXTRA_PARAM2,param2);
context.startService(intent);
}
|
Starts this service to perform action Baz with the given parameters. If the service is already performing a task this action will be queued.
|
public WrongClassTypeException(String message,Throwable cause){
super(message,cause);
}
|
Create a new <code>WrongClassTypeException</code> with a message text and the root exception.
|
void acquireReadLock() throws IOException {
try {
readLock.acquire();
}
catch ( InterruptedException e) {
throw new IOException("Interrupted while waiting for read lock",e);
}
}
|
Try to acquire read lock on this connection and block until it is available.
|
public void showDialog(@NotNull AsyncCallback<Void> callback){
this.callback=callback;
view.setUrl("");
view.setName("");
view.setEnableOkButton(false);
view.showDialog();
}
|
Show dialog.
|
Item newInteger(final int value){
key.set(value);
Item result=get(key);
if (result == null) {
pool.putByte(INT).putInt(value);
result=new Item(index++,key);
put(result);
}
return result;
}
|
Adds an integer to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item.
|
public double untransform(double value){
return Math.pow(10.0,value);
}
|
Untransform a value from the log axis
|
private void validateInvalidate(){
Collection entries=((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is " + entries.size());
}
RegionEntry entry=(RegionEntry)entries.iterator().next();
DiskId id=((DiskEntry)entry).getDiskId();
Object obj=((LocalRegion)region).getDiskRegion().get(id);
if (!(obj.equals(Token.INVALID))) {
fail(" incorrect invalidation");
}
}
|
validate whether invalidate was done
|
@Override public String generateLabel(XYDataset dataset,int series,int category){
return null;
}
|
Generates a label for the specified item. The label is typically a formatted version of the data value, but any text can be used.
|
protected String defaultClassifierString(){
return "weka.classifiers.trees.J48";
}
|
String describing default classifier.
|
final boolean matches(String s){
return matches(s,0,s.length());
}
|
Returns true iff the String s matches this regular expression.
|
@Thunk static CharSequence ensureValidName(Context context,Intent intent,CharSequence name){
if (name == null) {
try {
PackageManager pm=context.getPackageManager();
ActivityInfo info=pm.getActivityInfo(intent.getComponent(),0);
name=info.loadLabel(pm);
}
catch ( PackageManager.NameNotFoundException nnfe) {
return "";
}
}
return name;
}
|
Ensures that we have a valid, non-null name. If the provided name is null, we will return the application name instead.
|
public static boolean hasMimeType(String mimeType){
if (mimeType == null || mimeType.isEmpty()) {
return false;
}
return mimeTypeToExtensionMap.containsKey(mimeType);
}
|
Returns true if the given MIME type has an entry in the map.
|
@Override public void visitJumpInsn(final int opcode,final Label lbl){
super.visitJumpInsn(opcode,lbl);
LabelNode ln=((JumpInsnNode)instructions.getLast()).label;
if (opcode == JSR && !subroutineHeads.containsKey(ln)) {
subroutineHeads.put(ln,new BitSet());
}
}
|
Detects a JSR instruction and sets a flag to indicate we will need to do inlining.
|
private void validateText(Class type) throws Exception {
Label label=root.getText();
if (label != null) {
if (!label.isTextList()) {
if (!elements.isEmpty()) {
throw new TextException("Elements used with %s in %s",label,type);
}
if (root.isComposite()) {
throw new TextException("Paths used with %s in %s",label,type);
}
}
}
else {
if (scanner.isEmpty()) {
primitive=isEmpty();
}
}
}
|
This is used to validate the configuration of the scanned class. If a <code>Text</code> annotation has been used with elements then validation will fail and an exception will be thrown.
|
private static Query makeStatKindQuery(String namespace,long timestamp){
Query.Builder statQuery=Query.newBuilder();
if (namespace == null) {
statQuery.addKindBuilder().setName("__Stat_Kind__");
}
else {
statQuery.addKindBuilder().setName("__Stat_Ns_Kind__");
}
statQuery.setFilter(makeAndFilter(makeFilter("kind_name",EQUAL,makeValue(KIND).build()).build(),makeFilter("timestamp",EQUAL,makeValue(timestamp * 1000000L).build()).build()));
return statQuery.build();
}
|
Builds a per-kind statistics query for the given timestamp and namespace.
|
private static BigInteger evaluateOperator(final INaviOperandTreeNode node,final ImmutableList<RegisterValue> registers,final IDebugger debugger,final INaviModule module) throws CExpressionEvaluationException {
final List<INaviOperandTreeNode> children=node.getChildren();
BigInteger initial=evaluateExpression(children.get(0),registers,debugger,module);
for (int i=1; i < children.size(); i++) {
if (node.getValue().equals("+")) {
initial=initial.add(evaluateExpression(children.get(i),registers,debugger,module));
}
else if (node.getValue().equals("-")) {
initial=initial.subtract(evaluateExpression(children.get(i),registers,debugger,module));
}
else if (node.getValue().equals("*")) {
initial=initial.multiply(evaluateExpression(children.get(i),registers,debugger,module));
}
else {
throw new CExpressionEvaluationException(String.format("Unknown operand '%s'",node.getValue()));
}
}
return initial;
}
|
Evaluates an operator node.
|
private void writeQName(javax.xml.namespace.QName qname,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI=qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix=xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix=generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix,namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
|
method to handle Qnames
|
public DistanceCentralityScorer(Hypergraph<V,E> graph,Distance<V> distance,boolean averaging){
this(graph,distance,averaging,true,true);
}
|
Equivalent to <code>this(graph, distance, averaging, true, true)</code>.
|
@Inline public ObjectReference fastTraceObject(TransitiveClosure trace,ObjectReference object){
if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(defrag.determined(false));
traceObjectWithoutMoving(trace,object);
return object;
}
|
Trace a reference to an object in the context of a non-moving collection. This call is optimized for the simpler non-moving case.
|
public FlyweightText(String text){
this.text=text;
}
|
DOCUMENT ME!
|
public static SassValue convertToSassValue(Object value){
if (null == value) {
return SassNull.SINGLETON;
}
if (value instanceof SassValue) {
return (SassValue)value;
}
Class cls=value.getClass();
if (isaBoolean(cls)) {
return new SassBoolean((Boolean)value);
}
if (isaNumber(cls)) {
return new SassNumber(((Number)value).doubleValue(),"");
}
if (isaString(cls) || isaCharacter(cls)) {
return new SassString(value.toString());
}
if (value instanceof Collection) {
return new SassList(((Collection<?>)value).stream().map(null).collect(Collectors.toList()));
}
if (value instanceof Map) {
return ((Map<?,?>)value).entrySet().stream().collect(Collectors.toMap(null,null,null,null));
}
if (value instanceof Throwable) {
Throwable throwable=(Throwable)value;
StringWriter stringWriter=new StringWriter();
PrintWriter printWriter=new PrintWriter(stringWriter);
String message=throwable.getMessage();
if (StringUtils.isNotEmpty(message)) {
printWriter.append(message).append(System.lineSeparator());
}
throwable.printStackTrace(printWriter);
return new SassError(stringWriter.toString());
}
return new SassError(String.format("Could not convert object of type %s into a sass value",value.getClass().toString()));
}
|
Try to convert "any" java object into a responsible sass value.
|
private boolean testPin(int v1,int v2,int v3,int v4){
return testWheelValue(R.id.passw_1,v1) && testWheelValue(R.id.passw_2,v2) && testWheelValue(R.id.passw_3,v3)&& testWheelValue(R.id.passw_4,v4);
}
|
Tests entered PIN
|
public MorphTransition morph(String source,String to){
fromTo.put(source,to);
return this;
}
|
Morphs the component with the given source name in the source container hierarchy to the component with the given name in the destination hierarchy
|
public static URI createVirtualDataCenterId(String vdcId){
return newId(VirtualDataCenter.class,vdcId);
}
|
creates a URI for an VirtualDataCenter object. no vdc short id required
|
public PyClassTypeImpl(@NotNull PyClass source,boolean isDefinition){
PyClass originalElement=CompletionUtil.getOriginalElement(source);
myClass=originalElement != null ? originalElement : source;
myIsDefinition=isDefinition;
}
|
Describes a class-based type. Since everything in Python is an instance of some class, this type pretty much completes the type system :) Note that classes' and instances' member list can change during execution, so it is important to construct an instance of PyClassType right in the place of reference, so that such changes could possibly be accounted for.
|
public WeakHashMap(){
this(DEFAULT_INITIAL_CAPACITY,DEFAULT_LOAD_FACTOR);
}
|
Constructs a new, empty <tt>WeakHashMap</tt> with the default initial capacity (16) and load factor (0.75).
|
public static int value(String s,boolean numberok){
int val=types.getValue(s);
if (val == -1 && numberok) {
val=types.getValue("TYPE" + s);
}
return val;
}
|
Converts a String representation of an Type into its numeric value.
|
boolean matches(JComponent c){
return matches(c,parts.length - 1);
}
|
This LazyStyle is a match for the given component if, and only if, for each part of the prefix the component hierarchy matches exactly. That is, if given "a":something:"b", then: c.getName() must equals "b" c.getParent() can be anything c.getParent().getParent().getName() must equal "a".
|
public void warn(String msg,Object arg0){
innerLog(Level.WARNING,null,msg,arg0,UNKNOWN_ARG,UNKNOWN_ARG,null);
}
|
Log a warning message.
|
public <T>Builder row(T firstCell,T secondCell,T thirdCell,T fourthCell){
return tag("tr").cell(firstCell,false).cell(secondCell,false).cell(thirdCell,false).cell(fourthCell).end();
}
|
Adds a new row with four columns.
|
public boolean contains(Object triangle){
return triGraph.getNodes().contains(triangle);
}
|
True iff triangle is a member of this triangulation. This method isn't required by AbstractSet, but it improves efficiency.
|
public IntStack(int blocksize){
super(blocksize);
}
|
Construct a IntVector, using the given block size.
|
private void computePseudoReferences(String pseudoRefOptions,String tmpPath){
createPseudoReferences=true;
tempDirectory=tmpPath;
String[] options=pseudoRefOptions.split(",");
assert options.length == 2 : "Invalid pseudoreference option string";
numPseudoReferences=Integer.valueOf(options[0]);
pseudoReferenceBurnIn=Integer.valueOf(options[1]);
int tuneSetSize=tuneSource.size();
pseudoReferences=new ArrayList<List<Sequence<IString>>>(tuneSetSize);
for (int i=0; i < tuneSetSize; ++i) {
pseudoReferences.add(new LinkedList<Sequence<IString>>());
}
logger.info("Creating {} pseudoreferences",numPseudoReferences);
logger.info("Pseudoreference temp directory: {}",tempDirectory);
}
|
Configure selection of pseudo-references for the gold scoring metrics.
|
public ReplicationJob createJobForDropTable(long auditLogId,long auditLogEntryCreateTime,Table table) throws StateUpdateException {
ReplicationOperation replicationOperation=ReplicationOperation.DROP_TABLE;
Map<String,String> extras=new HashMap<>();
extras.put(PersistedJobInfo.AUDIT_LOG_ID_EXTRAS_KEY,Long.toString(auditLogId));
extras.put(PersistedJobInfo.AUDIT_LOG_ENTRY_CREATE_TIME_KEY,Long.toString(auditLogEntryCreateTime));
HiveObjectSpec tableSpec=new HiveObjectSpec(table);
PersistedJobInfo persistedJobInfo=jobInfoStore.resilientCreate(replicationOperation,ReplicationStatus.PENDING,ReplicationUtils.getLocation(table),srcCluster.getName(),tableSpec,Collections.emptyList(),ReplicationUtils.getTldt(table),Optional.empty(),Optional.empty(),extras);
return new ReplicationJob(conf,new DropTableTask(srcCluster,destCluster,tableSpec,ReplicationUtils.getTldt(table)),onStateChangeHandler,persistedJobInfo);
}
|
Create a replication job to drop a table.
|
private int[] joinMap(int[] a,int[] b){
if (a == null) {
return b;
}
if (b == null) {
return a;
}
int[] result=new int[a.length + b.length];
System.arraycopy(a,0,result,0,a.length);
System.arraycopy(b,0,result,a.length,b.length);
return result;
}
|
Joins two map arrays (int[]) together.
|
private void unregisterSMSObserver(){
if (crSMS != null) {
crSMS.unregisterContentObserver(observerSMS);
}
if (observerSMS != null) {
observerSMS=null;
}
if (BuildConfig.DEBUG) Log.v("Unregistered SMS Observer");
}
|
Unregisters the observer for call log changes
|
@JmsListener(id=HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING,containerFactory="jmsListenerContainerFactory",destination=HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING) public void processMessage(String payload,@Headers Map<Object,Object> allHeaders){
LOGGER.info("JMS message received from the queue. jmsQueueName=\"{}\" jmsMessageHeaders=\"{}\" jmsMessagePayload={}",HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING,allHeaders,payload);
boolean messageProcessed=processS3Notification(payload);
if (!messageProcessed) {
messageProcessed=processEsbSystemMonitorMessage(payload);
}
if (!messageProcessed) {
LOGGER.error("Failed to process message from the JMS queue. jmsQueueName=\"{}\" jmsMessagePayload={}",HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING,payload);
}
}
|
Processes a JMS message.
|
private void handleSecurityPanel(int idx){
listener.onSecurityPanelButtonClick(idx);
}
|
Handles the security panel
|
public EnhancedForStatement newEnhancedForStatement(){
return new EnhancedForStatement(this);
}
|
Creates a new unparented enhanced for statement node owned by this AST. By default, the paramter and expression are unspecified but legal subtrees, and the body is an empty block.
|
public boolean isCritical(){
return (number & 1) != 0;
}
|
Checks if is this option is critical.
|
protected int addObservationsAfterParamsDetermined(double[] source,double[] destination) throws Exception {
if (source.length != destination.length) {
throw new Exception(String.format("Source and destination lengths (%d and %d) must match!",source.length,destination.length));
}
if (source.length < startTimeForFirstDestEmbedding + 2) {
return 0;
}
double[][] currentDestPastVectors=MatrixUtils.makeDelayEmbeddingVector(destination,k,k_tau,startTimeForFirstDestEmbedding,destination.length - startTimeForFirstDestEmbedding - 1);
double[][] currentDestNextVectors=MatrixUtils.makeDelayEmbeddingVector(destination,1,startTimeForFirstDestEmbedding + 1,destination.length - startTimeForFirstDestEmbedding - 1);
double[][] currentSourcePastVectors=MatrixUtils.makeDelayEmbeddingVector(source,l,l_tau,startTimeForFirstDestEmbedding + 1 - delay,source.length - startTimeForFirstDestEmbedding - 1);
condMiCalc.addObservations(currentSourcePastVectors,currentDestNextVectors,currentDestPastVectors);
return destination.length - startTimeForFirstDestEmbedding - 1;
}
|
Protected method to internally parse and submit observations through to the underlying conditional MI calculator once any internal parameter settings have been finalised (in the case of automatically determining the embedding parameters)
|
public void testStateFormatUpdateWithTimeDelay() throws Exception {
testStateFormatUpdate(false,true);
}
|
ZkStateReader should automatically pick up changes based on ZK watches.
|
public static void longToIntArray(long lValue,int[] buffer,int nStartIndex){
buffer[nStartIndex]=(int)(lValue >>> 32);
buffer[nStartIndex + 1]=(int)lValue;
}
|
converts a long to integers which are put into a given array
|
public LineString toGeometry(GeometryFactory geomFactory){
return geomFactory.createLineString(new Coordinate[]{p0,p1});
}
|
Creates a LineString with the same coordinates as this segment
|
private Token scanFlowScalar(char style){
boolean _double;
if (style == '"') {
_double=true;
}
else {
_double=false;
}
StringBuilder chunks=new StringBuilder();
Mark startMark=reader.getMark();
char quote=reader.peek();
reader.forward();
chunks.append(scanFlowScalarNonSpaces(_double,startMark));
while (reader.peek() != quote) {
chunks.append(scanFlowScalarSpaces(startMark));
chunks.append(scanFlowScalarNonSpaces(_double,startMark));
}
reader.forward();
Mark endMark=reader.getMark();
return new ScalarToken(chunks.toString(),false,startMark,endMark,style);
}
|
Scan a flow-style scalar. Flow scalars are presented in one of two forms; first, a flow scalar may be a double-quoted string; second, a flow scalar may be a single-quoted string.
|
private static String extractClientName(String clientId,String host){
String hostExcludedId="";
if ((isIPv6(host) || isIPv4(host)) && clientId.startsWith(host)) {
hostExcludedId=clientId.substring(host.length());
}
else {
int firstDotIndex=host.indexOf(".");
if (firstDotIndex != -1) {
String hostShortName=host.substring(0,firstDotIndex);
hostExcludedId=clientId.substring(hostShortName.length());
}
}
String vmPIDAndKindRegex="\\(\\w+:\\w+\\)";
String regex="(\\<ec\\>)?:[0-9]+(:\\w+){2}+";
String name=NOT_AVAILABLE;
String temp=hostExcludedId;
int openIndex=temp.indexOf("(");
if (openIndex != -1) {
regex=vmPIDAndKindRegex + regex;
}
if (temp.matches(regex)) {
String[] splitted=temp.split(":");
name=splitted[splitted.length - 1];
}
return name;
}
|
Excludes the host name from the client id and returns the String. If the host name can not be detected, returns an empty string. Typically, the client id looks like: HOST(VM_PID:VM_KIND):PORT:RANDOM_STRING:CLIENT_NAME Extracts the client name from the client id. If the client id is not in the expected format, returns 'N/A'
|
String findParmValue(Element e,String name){
List<Element> l=e.getChildren("parameter");
for (int i=0; i < l.size(); i++) {
Element n=l.get(i);
if (n.getAttributeValue("name").equals(name)) {
return n.getTextTrim();
}
}
return null;
}
|
Service routine to look through "parameter" child elements to find a particular parameter value
|
public static void trackAppOpenedInBackground(Intent intent,SaveCallback callback){
ParseTaskUtils.callbackOnMainThreadAsync(trackAppOpenedInBackground(intent),callback);
}
|
Tracks this application being launched (and if this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push).
|
public boolean isDirectory(){
return false;
}
|
Returns the last modified time.
|
private static boolean hasSuitableSelection(Editor editor){
if (!editor.getSelectionModel().hasSelection()) {
return false;
}
Document document=editor.getDocument();
int selectionStart=editor.getSelectionModel().getSelectionStart();
int selectionEnd=editor.getSelectionModel().getSelectionEnd();
return !CharArrayUtil.containsOnlyWhiteSpaces(document.getCharsSequence().subSequence(selectionStart,selectionEnd));
}
|
Returns true if there is a selection in the editor and it contains at least one non-whitespace character
|
public PluginEntry(String service,CordovaPlugin plugin){
this(service,plugin.getClass().getName(),true,plugin);
}
|
Constructs with a CordovaPlugin already instantiated.
|
public void removeAction(String category,Action action){
JMenu categoryMenu=categories.get(getCaption(category));
if (categoryMenu == null) {
return;
}
for (int i=0; i < categoryMenu.getItemCount(); i++) {
JMenuItem item=categoryMenu.getItem(i);
if (item.getAction() == action) {
categoryMenu.remove(i);
return;
}
}
}
|
Removes an action from a category.
|
public Boolean isNetworkReservationSupported(){
return networkReservationSupported;
}
|
Gets the value of the networkReservationSupported property.
|
public static List<Integer> preorderTraversalIterative(TreeNode root){
List<Integer> res=new ArrayList<Integer>();
if (root == null) {
return res;
}
Stack<TreeNode> stack=new Stack<TreeNode>();
stack.push(root);
while (!stack.isEmpty()) {
TreeNode node=stack.pop();
res.add(node.val);
if (node.right != null) {
stack.push(node.right);
}
if (node.left != null) {
stack.push(node.left);
}
}
return res;
}
|
iterative solution Use stack
|
private void doPut(E kkey){
Comparable<? super E> key=comparable(kkey);
for (; ; ) {
Node<E> b=findPredecessor(key);
Node<E> n=b.next;
for (; ; ) {
if (n != null) {
Node<E> f=n.next;
if (n != b.next) break;
Object v=n.value;
if (v == null) {
n.helpDelete(b,f);
break;
}
if (v == n || b.value == null) break;
int c=key.compareTo(n.key);
if (c >= 0) {
b=n;
n=f;
continue;
}
}
Node<E> z=new Node<E>(kkey,n);
if (!b.casNext(n,z)) break;
int level=randomLevel();
if (level > 0) insertIndex(z,level);
return;
}
}
}
|
Main insertion method. Adds element if not present, or replaces value if present and onlyIfAbsent is false.
|
public void unblock(Address destination){
if (config.isUseNetworkEmulator()) {
networkEmulatorHandler.unblock(destination);
LOGGER.info("Unblock network from {} to {}",address,destination);
}
else {
LOGGER.warn("Noop on 'unblock({})' since network emulator is disabled",destination);
}
}
|
Unblock messages to given destination. If network emulator is disabled do nothing.
|
public Spline3D add(ReadonlyVec3D p){
pointList.add(p.copy());
return this;
}
|
Adds the given point to the list of control points.
|
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
|
Load Meta Data
|
public int cardinality(){
int sum=0;
for (int i=0; i < wordsInUse; i++) sum+=Long.bitCount(words[i]);
return sum;
}
|
Returns the number of bits set to <tt>true</tt> in this <code>BitSet</code>.
|
public void wakeup(){
if (this.waiter == null) {
throw new IllegalStateException("Nobody waiting on this object.");
}
this.cond.signalAll();
}
|
Wakes up the waiting thread. <br/> This method assumes external synchronization.
|
public JSONObject put(String key,long value) throws JSONException {
this.put(key,new Long(value));
return this;
}
|
Put a key/long pair in the JSONObject.
|
private void sendProfileUpdate(){
if (this.getDistributionManager().getSystem().isLoner()) {
return;
}
Assert.assertTrue(!Thread.holdsLock(this),"Attempting to sendProfileUpdate while synchronized may result in deadlock");
final int partitionedRegionId=this.pRegion.getPRId();
final int bucketId=((ProxyBucketRegion)getAdvisee()).getBucketId();
BucketProfile bp=(BucketProfile)createProfile();
updateServerBucketProfile(bp);
InternalDistributedMember primary=basicGetPrimaryMember();
HashSet hostsAndProxyMembers=new HashSet();
if (primary != null && !primary.equals(getDistributionManager().getId())) {
hostsAndProxyMembers.add(primary);
}
hostsAndProxyMembers.addAll(adviseGeneric());
hostsAndProxyMembers.addAll(adviseProfileUpdate());
ReplyProcessor21 reply=BucketProfileUpdateMessage.send(hostsAndProxyMembers,getDistributionManager(),partitionedRegionId,bucketId,bp,true);
if (reply != null) {
reply.waitForRepliesUninterruptibly();
}
}
|
Sends updated profile for this member to every member with the <code>PartitionedRegion</code>. <p> Never call this method while synchronized on this BucketAdvisor. This will result in distributed deadlocks.
|
public StateCaseItemProvider(AdapterFactory adapterFactory){
super(adapterFactory);
}
|
This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
|
public static void resetOnErrorDropped(){
log.info("Reset to factory defaults : onErrorDropped");
onErrorDroppedHook=null;
}
|
Reset global error dropped strategy to bubbling back the error.
|
public void addLiteralResultAttribute(String att){
if (null == m_xslAttr) m_xslAttr=new ArrayList();
m_xslAttr.add(att);
}
|
Set a literal result attribute (used for xsl attributes).
|
public LockingIteration(Lock lock,Iteration<? extends E,X> iter){
super(iter);
assert lock != null;
this.lock=lock;
}
|
Creates a new LockingIteration.
|
public final int size(){
return m_firstFree;
}
|
Get the length of the list.
|
public SimpleType newSimpleType(Name typeName){
SimpleType result=new SimpleType(this);
result.setName(typeName);
return result;
}
|
Creates and returns a new unparented simple type node with the given type name. <p> This method can be used to convert a name (<code>Name</code>) into a type (<code>Type</code>) by wrapping it. </p>
|
public RandomPolicyMin(){
super(Harness.options,"Random Policy Min","Minimum yield interval for the random scheduler policy",Integer.valueOf(System.getProperty("mmtk.harness.yieldpolicy.random.min","1")));
}
|
Create the option.
|
public static boolean isPowerOfTwo(int value){
return (value == powerOfTwoCeiling(value));
}
|
Convenience method for testing whether a value is a power of two.
|
public boolean isExpired(){
return System.currentTimeMillis() >= creationTime + lifetime;
}
|
Return security tokens expired status. Token is expired if its 100% of its life time has elapsed. Note, the token is valid for use until 125% of its life time has passed.
|
public static BufferedImage createCompatibleImage(BufferedImage image){
return createCompatibleImage(image,image.getWidth(),image.getHeight());
}
|
<p>Returns a new compatible image with the same width, height and transparency as the image specified as a parameter.</p>
|
public JSONNode(String name,Integer value){
this(name,value,NodeType.PRIMITIVE);
}
|
Initializes the primitive container.
|
public void paintToolTipBackground(SynthContext context,Graphics g,int x,int y,int w,int h){
paintBackground(context,g,x,y,w,h,null);
}
|
Paints the background of a tool tip.
|
protected boolean skipReceiverSubtypeCheck(MethodInvocationTree node,AnnotatedTypeMirror methodDefinitionReceiver,AnnotatedTypeMirror methodCallReceiver){
return false;
}
|
Indicates whether to skip subtype checks on the receiver when checking method invocability. A visitor may, for example, allow a method to be invoked even if the receivers are siblings in a hierarchy, provided that some other condition (implemented by the visitor) is satisfied.
|
public static void encodeByteIntoTwoAsciiCharBytes(final int decoded,final byte[] encoded){
encoded[0]=(byte)encodeNibbleToHexAsciiCharByte((decoded >> 4) & 0x0F);
encoded[1]=(byte)encodeNibbleToHexAsciiCharByte(decoded & 0x0F);
}
|
Turn a single bytes into two hex character representation.
|
private void clearAllTables(){
if (this.sw.getOFFactory().getVersion().compareTo(OFVersion.OF_10) == 0) {
OFFlowDelete deleteFlows=this.factory.buildFlowDelete().build();
this.sw.write(deleteFlows);
}
else {
OFFlowDelete deleteFlows=this.factory.buildFlowDelete().setTableId(TableId.ALL).build();
this.sw.write(deleteFlows);
OFGroupDelete delgroup=this.sw.getOFFactory().buildGroupDelete().setGroup(OFGroup.ALL).setGroupType(OFGroupType.ALL).build();
this.sw.write(delgroup);
delgroup.createBuilder().setGroupType(OFGroupType.FF).build();
this.sw.write(delgroup);
delgroup.createBuilder().setGroupType(OFGroupType.INDIRECT).build();
this.sw.write(delgroup);
delgroup.createBuilder().setGroupType(OFGroupType.SELECT).build();
this.sw.write(delgroup);
OFBarrierRequest barrier=factory.buildBarrierRequest().setXid(handshakeTransactionIds--).build();
sw.write(barrier);
}
}
|
Removes all present flows
|
public World(Vector2 gravity,boolean doSleep){
world=new org.jbox2d.dynamics.World(tmp.set(gravity.x,gravity.y));
world.setAllowSleep(doSleep);
}
|
Construct a world object.
|
public void adjustBeginLineColumn(int newLine,int newCol){
int start=tokenBegin;
int len;
if (bufpos >= tokenBegin) {
len=bufpos - tokenBegin + inBuf + 1;
}
else {
len=bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i=0, j=0, k=0;
int nextColDiff=0, columnDiff=0;
while (i < len && bufline[j=start % bufsize] == bufline[k=++start % bufsize]) {
bufline[j]=newLine;
nextColDiff=columnDiff + bufcolumn[k] - bufcolumn[j];
bufcolumn[j]=newCol + columnDiff;
columnDiff=nextColDiff;
i++;
}
if (i < len) {
bufline[j]=newLine++;
bufcolumn[j]=newCol + columnDiff;
while (i++ < len) {
if (bufline[j=start % bufsize] != bufline[++start % bufsize]) bufline[j]=newLine++;
else bufline[j]=newLine;
}
}
line=bufline[j];
column=bufcolumn[j];
}
|
Method to adjust line and column numbers for the start of a token.
|
public String displayAST(Node node,int maxDepth,Node markNode){
StringWriter out=new StringWriter();
printTree(new PrintWriter(out),node,maxDepth,markNode);
return out.toString();
}
|
Creates a textual AST display, one line per node, with nesting.
|
public static int dragViewTo(View v,int gravity,int toX,int toY){
int[] xy=new int[2];
getStartLocation(v,gravity,xy);
int fromX=xy[0];
int fromY=xy[1];
int deltaX=fromX - toX;
int deltaY=fromY - toY;
int distance=(int)Math.sqrt(deltaX * deltaX + deltaY * deltaY);
drag(fromX,toX,fromY,toY,distance);
return distance;
}
|
Simulate touching a view and dragging it to a specified location.
|
@Override protected void drawLabels(Canvas c,float pos){
float[] position=new float[]{0f,0f};
BarData bd=mChart.getData();
int step=bd.getDataSetCount();
for (int i=mMinX; i <= mMaxX; i+=mXAxis.mAxisLabelModulus) {
position[0]=i * step + i * bd.getGroupSpace() + bd.getGroupSpace() / 2f;
if (step > 1) {
position[0]+=((float)step - 1f) / 2f;
}
mTrans.pointValuesToPixel(position);
if (mViewPortHandler.isInBoundsX(position[0]) && i >= 0 && i < mXAxis.getValues().size()) {
String label=mXAxis.getValues().get(i);
if (mXAxis.isAvoidFirstLastClippingEnabled()) {
if (i == mXAxis.getValues().size() - 1) {
float width=Utils.calcTextWidth(mAxisLabelPaint,label);
if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth()) position[0]-=width / 2;
}
else if (i == 0) {
float width=Utils.calcTextWidth(mAxisLabelPaint,label);
position[0]+=width / 2;
}
}
c.drawText(label,position[0],pos,mAxisLabelPaint);
}
}
}
|
draws the x-labels on the specified y-position
|
public void disconnect(final IMqttActionListener diconnectionResultHandler) throws SpyException {
reconnectionManager.removeConnection(this);
setConnectionStatus(ConnectionStatus.DISCONNECTING);
unsubscribeAll(true);
try {
logger.info("Disconnecting " + getMqttConnectionDetails().getClientID() + " from "+ getMqttConnectionDetails().getServerURI());
if (getClient() != null && getClient().isConnected()) {
getClient().disconnect(this,diconnectionResultHandler);
}
else {
logger.debug("Already disconnected");
}
}
catch ( MqttException e) {
throw new SpyException("Cannot disconnect from connection " + getMqttConnectionDetails().getId() + " "+ getMqttConnectionDetails().getName(),e);
}
}
|
Disconnect from the currently connected server.
|
@Override public String toString(){
StringBuilder msg=new StringBuilder();
msg.append("x = ").append(FormatUtil.format(x,9,4,"[","]\n",", "));
msg.append("\ny = ").append(FormatUtil.format(y,9,4));
msg.append("\nb = ").append(FormatUtil.format(b,9,4));
msg.append("\ne = ").append(FormatUtil.format(e,9,4));
msg.append("error variance = ").append(FormatUtil.NF4.format(variance));
return msg.toString();
}
|
Returns a string representation of the object.
|
private Ed25519FieldElement pow2to9(){
Ed25519FieldElement f;
f=this.square();
f=f.square();
f=f.square();
return this.multiply(f);
}
|
Computes this field element to the power of (2^9) and returns the result.
|
void _m12(float m12){
this.m12=m12;
}
|
Set the value of the matrix element at column 1 and row 2
|
@Override protected RStarTreeNode createNewDirectoryNode(){
return new RStarTreeNode(dirCapacity,false);
}
|
Creates a new directory node with the specified capacity.
|
public ClientDetailsException(String message,Object params){
this(message,params,false);
}
|
Create new exception object from message and parameters. By default, no stacktrace is returned to the client.
|
final public SyntaxTreeNode Proof() throws ParseException {
SyntaxTreeNode tn;
Token t=null;
Token t0=null;
pushProofLevel();
bpa("Proof");
if ((getToken(1).kind == BY) || (getToken(2).kind == BY)) {
tn=UseOrHideOrBy();
}
else if (jj_2_27(2)) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case PROOF:
t0=jj_consume_token(PROOF);
break;
default :
jj_la1[55]=jj_gen;
;
}
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case OBVIOUS:
t=jj_consume_token(OBVIOUS);
break;
case OMITTED:
t=jj_consume_token(OMITTED);
break;
default :
jj_la1[56]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
SyntaxTreeNode sn[];
if (t0 != null) {
sn=new SyntaxTreeNode[2];
sn[0]=new SyntaxTreeNode(mn,t0);
sn[1]=new SyntaxTreeNode(mn,t);
}
else {
sn=new SyntaxTreeNode[1];
sn[0]=new SyntaxTreeNode(mn,t);
}
;
tn=new SyntaxTreeNode(mn,N_TerminalProof,sn);
}
else if (jj_2_28(1)) {
if (jj_2_26(2)) {
t=jj_consume_token(PROOF);
addHeir(new SyntaxTreeNode(mn,t));
}
else {
;
}
label_14: while (true) {
if (getToken(2).kind != QED) {
;
}
else {
break label_14;
}
tn=Step();
addHeir(tn);
expecting="a proof step";
}
tn=QEDStep();
addHeir(tn);
SyntaxTreeNode sn[]=getLastHeirs();
tn=new SyntaxTreeNode(mn,N_Proof,sn);
}
else {
jj_consume_token(-1);
throw new ParseException();
}
epa();
popProofLevel();
{
if (true) return tn;
}
throw new Error("Missing return statement in function");
}
|
The Grammar of Proofs XXXXXXX THIS IS OBSOLETE Proof ::= InnerProof // Proof checks that we're not inside a proof at the end. * InnerProof ::= TerminalProof | (<PROOF>)? ( Step )* // Terminated by lookahead for "QED" QEDStep * // Note: (InnerProof)? uses lookahead for beginsProof(...) * TerminalProof ::= <BY> ... | (<PROOF>)? OBVIOUS QEDStep ::= (<ProofStepLexeme> | <ProofStepDotLexeme> )? <QED> (InnerProof)? * Step ::= N_DefStep | N_UseOrHide | N_NonLocalInstance | N_NumerableStep | N_QEDStep * NumerableStep == ExprStep | NumberedStep | UnnumberedStep * DefStep ::= (<DEFINE>)? OperatorOrFunctionDefinition * NumberedStep ::= (<ProofStepLexeme> | <ProofStepDotLexeme> ) UnnumberedStep * ExprStep ::= ( <PROVE> | <SUFFICES> | (<ProofStepLexeme> | <ProofStepDotLexeme> ) (<SUFFICES>)? ) Expression * UnnumberedStep ::= Have | Take | Witness | ( Pick | (<SUFFICES>)? (AssumeProve | <CASE> Expression) ) (InnerProof)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.