code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public static String escapeHTML(String str,short version){
String[][] data;
int[] offset;
StringBuilder rtn=new StringBuilder(str.length());
char[] chars=str.toCharArray();
if (version == HTMLV20) {
data=HTML20_DATA;
offset=HTML20_OFFSET;
}
else if (version == HTMLV32) {
data=HTML32_DATA;
... | escapes html character inside a string |
public static void removeMapping(TransitSchedule schedule){
log.info("... Removing reference links and link sequences from schedule");
for ( TransitStopFacility stopFacility : schedule.getFacilities().values()) {
stopFacility.setLinkId(null);
}
for ( TransitLine line : schedule.getTransitLines().values())... | Changes the schedule to an unmapped schedule by removes all link sequences from a transit schedule and removing referenced links from stop facilities. |
public static <A,B>Pair<A,B> create(A a,B b){
return new Pair<A,B>(a,b);
}
| Convenience method for creating an appropriately typed pair. |
public IBlockState withRotation(IBlockState state,Rotation rot){
switch (rot) {
case CLOCKWISE_180:
return state.withProperty(NORTH,state.getValue(SOUTH)).withProperty(EAST,state.getValue(WEST)).withProperty(SOUTH,state.getValue(NORTH)).withProperty(WEST,state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return sta... | Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate. |
public int count(){
if (root == null) return 0;
return count(root);
}
| Counts the number of items in the tree. |
private String defaultPrimitiveValue(Class<?> clazz){
return clazz == byte.class || clazz == short.class || clazz == int.class ? "0" : clazz == long.class ? "0L" : clazz == float.class ? "0.0f" : clazz == double.class ? "0.0d" : clazz == char.class ? "'\u0000'" : clazz == boolean.class ? "false" : "null";
}
| Returns the default values of primitive types in the form of strings. |
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) {... | method to handle Qnames |
public Camping(){
super();
}
| Needed by CGLib |
protected SVGDescriptiveElement(String prefix,AbstractDocument owner){
super(prefix,owner);
}
| Creates a new SVGDescriptiveElement object. |
public KeyPair generateKeyPair(KeyPairGenerator keyPairGen){
try {
keyPair=keyPairGen.genKeyPair();
privateKey=keyPair.getPrivate();
publicKey=keyPair.getPublic();
}
catch ( Exception e) {
LOG.error("Error generating KeyPair",e);
}
return keyPair;
}
| * * |
public static void deleteDirectory(final File dir){
deleteDirectory(dir,true);
}
| shortcut for deleteDirectory( dir, true ) |
public void closeParent(){
Dialog dialog;
Frame frame;
if (getParentDialog() != null) {
dialog=getParentDialog();
dialog.setVisible(false);
dialog.dispose();
}
else if (getParentFrame() != null) {
frame=getParentFrame();
frame.setVisible(false);
frame.dispose();
}
}
| Closes the parent dialog/frame. Dispose the parent! |
private XmlHandler deleteAnnotatedClass(Class<?> aClass) throws LoadingFileException, IOException {
String path=getElement(FilesManager.classesPath(),getClassPath(aClass));
if (FilesManager.isFileAnnotated(path,aClass)) deleteClasses(aClass);
for ( Class<?> it : aClass.getClasses()) if (it.isMemberClass()) ... | Deletes the Class, given in input, from xml mapping file, only if it's annotated. |
public boolean isUnicodeAware(){
return unicodeAware;
}
| Return true if lengths are measured in unicode code-points rather than bytes |
private boolean isDeprecatedComponent(String name){
String json=catalog.componentJSonSchema(name);
List<Map<String,String>> rows=JsonSchemaHelper.parseJsonSchema("component",json,false);
for ( Map<String,String> row : rows) {
if (row.get("deprecated") != null) {
return "true".equals(row.get("deprecated... | Is the component deprecated? |
public static LocalAttribute localAttribute(String name){
return new LocalAttribute(name);
}
| Permits to define a local attribute. |
public static <T>Class<T> loadClass(String className) throws ClassNotFoundException {
Class<T> clazz=null;
try {
clazz=(Class<T>)Thread.currentThread().getContextClassLoader().loadClass(className);
}
catch ( ClassNotFoundException nf) {
clazz=(Class<T>)Class.forName(className);
}
return clazz;
}
| Loads a class with the given name. |
void updateMatcher(){
int begin=getPosition();
int end=getText().length();
matcher.reset(getText());
matcher.region(begin,end);
}
| Reset the parser and specify the region focused on by it, to go from the current cursor position to the end of the text. |
private String toIndentedString(Object o){
if (o == null) {
return "null";
}
return o.toString().replace("\n","\n ");
}
| Convert the given object to string with each line indented by 4 spaces (except the first line). |
private Coord calculateInitLocation(LinearFormation proto){
double dx, dy;
double placementFraction;
int formationIndex=proto.lastIndex++;
Coord c=proto.startLoc.clone();
placementFraction=(1.0 * formationIndex / proto.nodeCount);
dx=placementFraction * (proto.endLoc.getX() - proto.startLoc.getX());
dy=pl... | Calculates and returns the location of this node in the formation |
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
Rect rect=getFramingRectInPreview();
int previewFormat=configManager.getPreviewFormat();
String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelForm... | A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters. |
private Set<StoragePort> andStoragePortSets(Set<StoragePort> a,Set<StoragePort> b){
Set<StoragePort> result=new HashSet<StoragePort>();
for ( StoragePort port : a) {
if (b.contains(port)) {
result.add(port);
}
}
return result;
}
| Logical AND of a and b |
public static void main(final String[] args){
DOMTestCase.doMain(setAttributeNS09.class,args);
}
| Runs this test from the command line. |
protected boolean afterDelete(boolean success){
if (!success) return success;
StringBuffer sb=new StringBuffer("DELETE FROM AD_TreeNodeCMS ").append(" WHERE Node_ID=").append(get_IDOld()).append(" AND AD_Tree_ID=").append(getAD_Tree_ID());
int no=DB.executeUpdate(sb.toString(),get_TrxName());
if (no > 0) lo... | After Delete |
public static Double calculate(CpuStats previous,CpuStats current){
if (previous == null || current == null) {
return null;
}
double userDiff=current.getUser() - previous.getUser();
double niceDiff=current.getNice() - previous.getNice();
double systemDiff=current.getSystem() - previous.getSystem();
doub... | Calculates idle percent the same way as UNIX 'top' utility does. |
public InputStream fetchQuotaDirInfo(final Argument argument,final Map<String,Object> keyMap,int index) throws VNXFilePluginException {
_logger.info("Creating quota tree info query");
InputStream iStream=null;
try {
Query query=new Query();
verifyPreviousResults(keyMap);
TreeQuotaQueryParams queryPara... | Create Quota Tree information input XML request and returns stream after marshalling. |
public void testGetRandomColorByLevel(){
try {
for ( String level : MaterialPalettes.NON_ACCENT_COLOR_LEVELS) {
List<Integer> colorList=MaterialPalettes.getColorsByLevel(level);
Integer randomColor=MaterialPalettes.getRandomColorByLevel(level);
assertTrue(colorList.contains(randomColor));
... | Ensures the color returned has the appropriate level. |
private VCardParameters parseParameters(Element element){
VCardParameters parameters=new VCardParameters();
List<Element> roots=XmlUtils.toElementList(element.getElementsByTagNameNS(PARAMETERS.getNamespaceURI(),PARAMETERS.getLocalPart()));
for ( Element root : roots) {
List<Element> parameterElements=XmlUtil... | Parses the property parameters. |
public static void salsaCore(int rounds,int[] input,int[] x){
if (input.length != 16) {
throw new IllegalArgumentException();
}
if (x.length != 16) {
throw new IllegalArgumentException();
}
if (rounds % 2 != 0) {
throw new IllegalArgumentException("Number of rounds must be even");
}
int x00=in... | Salsa20 function |
@Override public boolean equals(Object obj){
if (obj == this) {
return true;
}
if (!(obj instanceof XYDifferenceRenderer)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
XYDifferenceRenderer that=(XYDifferenceRenderer)obj;
if (!PaintUtilities.equal(this.positivePaint,that.positi... | Tests this renderer for equality with an arbitrary object. |
public void registerNode(String oidString,SnmpMibNode node) throws IllegalAccessException {
SnmpOid oid=new SnmpOid(oidString);
registerNode(oid.longValue(),0,node);
}
| Registers a specific node in the tree. |
public void finishTransition(){
if (mViewToHide != null) {
removeView(mViewToHide);
}
getLayoutParams().height=ViewGroup.LayoutParams.WRAP_CONTENT;
requestLayout();
mViewToHide=null;
mViewToShow=null;
mInfoBar.setControlsEnabled(true);
}
| Called when the animation is done. At this point, we can get rid of the View that used to represent the InfoBar and re-enable controls. |
static StringBuilder newStringBuilderForCollection(int size){
checkNonnegative(size,"size");
return new StringBuilder((int)Math.min(size * 8L,Ints.MAX_POWER_OF_TWO));
}
| Returns best-effort-sized StringBuilder based on the given collection size. |
public void focusLost(FocusEvent e){
log.fine("focusLost");
try {
String text=getText();
fireVetoableChange(m_columnName,text,null);
}
catch ( PropertyVetoException pve) {
}
}
| Data Binding to MTable (via GridController) |
public void removeHexEditorListener(HexEditorListener l){
listenerList.remove(HexEditorListener.class,l);
}
| Removes the specified hex editor listener from this editor. |
public void populateDAO(Object value,int row,int column){
final TradelogDetail element=getData().getTradelogDetail().get(row);
switch (column) {
case 1:
{
element.setOpen((String)value);
break;
}
case 2:
{
element.setSymbol((String)value);
break;
}
case 3:
{
element.setLongShort(((Side)val... | getData() - |
public void testEOF() throws Exception {
String JSON="{ \"key\": [ { \"a\" : { \"name\": \"foo\", \"type\": 1\n" + "}, \"type\": 3, \"url\": \"http://www.google.com\" } ],\n" + "\"name\": \"xyz\", \"type\": 1, \"url\" : null }\n ";
JsonFactory jf=new JsonFactory();
ObjectMapper mapper=new ObjectMapper();
Jso... | Type mappers should be able to gracefully deal with end of input. |
public XMLString concat(String str){
return new XMLStringDefault(m_str.concat(str));
}
| Concatenates the specified string to the end of this string. |
public N4JSDocletParser(){
super(new TagDictionary<>(N4JS_LINE_TAGS),DESCRIPTION_DICT);
}
| Creates N4JSDoclet parser with default N4JS line tags. |
public void shutdown(){
for ( Topic topic : _topics.values()) {
if (topic.getConsumerConnector() != null) {
topic.getConsumerConnector().shutdown();
}
topic.getStreamExecutorService().shutdownNow();
try {
topic.getStreamExecutorService().awaitTermination(60,TimeUnit.SECONDS);
}
catch... | Enqueue un-flushed messages back on to Kafka. |
public Unit createUnit(){
UnitImpl unit=new UnitImpl();
return unit;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:20.237 -0500",hash_original_method="A7026FD3DE10525F382BCFDA63577851",hash_generated_method="D83D82C75D0C85838D7CC6E60BE8AA26") public void drawPoints(float[] pts,int offse... | Draw a series of points. Each point is centered at the coordinate specified by pts[], and its diameter is specified by the paint's stroke width (as transformed by the canvas' CTM), with special treatment for a stroke width of 0, which always draws exactly 1 pixel (or at most 4 if antialiasing is enabled). The shape of ... |
private boolean zzRefill(){
return zzCurrentPos >= s.offset + s.count;
}
| Refills the input buffer. |
public synchronized String count(String nonce){
Integer count=nonces.get(nonce);
if (count == null) {
count=Integer.valueOf(1);
}
else {
count=Integer.valueOf(count.intValue() + 1);
}
nonces.put(nonce,count);
return String.format("%08x",count.intValue());
}
| Count returns a hexadecimal string counting the number of times nonce has been seen. The first value returned for a nonce is 00000001. |
void prepareEnterRecentsAnimation(){
}
| Prepares this task view for the enter-recents animations. This is called earlier in the first layout because the actual animation into recents may take a long time. |
protected static String normalizeUrlEnding(String link){
if (link.indexOf("#") > -1) link=link.substring(0,link.indexOf("#"));
if (link.endsWith("?")) link=link.substring(0,link.length() - 1);
if (link.endsWith("/")) link=link.substring(0,link.length() - 1);
return link;
}
| Normalizes a URL string by removing anchor part and trailing slash |
public void onResume(){
hasSavedState=false;
unlock();
}
| Call this method from your Activity or Fragment's onResume method |
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:28:38.324 -0500",hash_original_method="D0996D4DFB9F5585E3927B19545BE3E4",hash_generated_method="BA24E7C3A8B18A175AD4E4B71A2B86FC") public static void dumpCurrentRow(Cursor cursor,PrintStrea... | Prints the contents of a Cursor's current row to a PrintSteam. |
public synchronized void internalRemoveAllRelationships(){
for (Iterator<Relationship> iterator=allRelationships(); iterator.hasNext(); ) {
this.network.removeRelationship(iterator.next());
}
getRelationships().clear();
if (this.allRelationships != null) {
this.allRelationships.clear();
}
}
| Remove all relationships. |
private ResourceCommand loadEppResourceCommand(String filename) throws Exception {
EppInput eppInput=new EppLoader(this,filename).getEpp();
return ((ResourceCommandWrapper)eppInput.getCommandWrapper().getCommand()).getResourceCommand();
}
| Loads the EppInput from the given filename and returns its ResourceCommand element. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case N4JSPackage.EXPORTED_VARIABLE_STATEMENT__ANNOTATION_LIST:
return getAnnotationList();
case N4JSPackage.EXPORTED_VARIABLE_STATEMENT__DECLARED_MODIFIERS:
return getDeclaredModifiers();
}
return super.eGet(feature... | <!-- begin-user-doc --> <!-- end-user-doc --> |
public DecoderResult decode(boolean[][] image) throws FormatException, ChecksumException {
int dimension=image.length;
BitMatrix bits=new BitMatrix(dimension);
for (int i=0; i < dimension; i++) {
for (int j=0; j < dimension; j++) {
if (image[i][j]) {
bits.set(j,i);
}
}
}
return dec... | <p>Convenience method that can decode a Data Matrix Code represented as a 2D array of booleans. "true" is taken to mean a black module.</p> |
public static String classNameFor(Connection connection){
return "connection-" + connection.getOutputSocket().getSocketHint().getIdentifier() + "-to-"+ connection.getInputSocket().getSocketHint().getIdentifier();
}
| Return the CSS class name for a connection. To use as a css selector then prepend the string with a '.'. |
public final void addAllConstraints(@NonNull final Collection<Constraint<CharSequence>> constraints){
ensureNotNull(constraints,"The collection may not be null");
for ( Constraint<CharSequence> constraint : constraints) {
addConstraint(constraint);
}
}
| Adds all constraints, which are contained by a specific collection. |
public long create_time_to_sample_atom(MP4DataStream bitstream) throws IOException {
log.trace("Time to sample atom");
create_full_atom(bitstream);
timeToSamplesRecords=new Vector<TimeSampleRecord>();
entryCount=(int)bitstream.readBytes(4);
log.trace("Time to sample entries: {}",entryCount);
readed+=4;
fo... | Loads MP4TimeToSampleAtom atom from the input bitstream. |
protected void createODataUri(String serviceRoot){
odataUri=TestUtils.createODataUri(serviceRoot);
}
| Create a test OData URI specifying only the service root. |
public static void LDC(int x){
if (ignoreCallback) return;
ignoreCallback=true;
vm.countCallback();
try {
for ( IVM listener : vm.listeners) listener.LDC(x);
}
catch ( Throwable t) {
handleException(t);
}
ignoreCallback=false;
}
| http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2. doc8. html#ldc |
public AbstractGraphics2D(AbstractGraphics2D g){
this.gc=(GraphicContext)g.gc.clone();
this.gc.validateTransformStack();
this.textAsShapes=g.textAsShapes;
}
| Creates a new AbstractGraphics2D from an existing instance. |
public BufferObject unitSquareBuffer(){
if (this.unitSquareBuffer != null) {
return this.unitSquareBuffer;
}
float[] points=new float[]{0,1,0,0,1,1,1,0};
int size=points.length * 4;
FloatBuffer buffer=ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()).asFloatBuffer();
buffer.put(points).rewi... | Returns an OpenGL buffer object containing a unit square expressed as four vertices at (0, 1), (0, 0), (1, 1) and (1, 0). Each vertex is stored as two 32-bit floating point coordinates. The four vertices are in the order required by a triangle strip. <p/> The OpenGL buffer object is created on first use and cached. Sub... |
public JsonArrayRequest(String url,Listener<JSONArray> listener,ErrorListener errorListener){
super(Method.GET,url,null,listener,errorListener);
}
| Creates a new request. |
private boolean isChangePwdOnLogin(){
StringBuffer contextPath=getRequest().getRequestURL();
return contextPath.indexOf("public/pwd.jsf") != -1;
}
| Check if the password change occurs on login. |
public List<JetstreamEvent> readEvents() throws OffsetOutOfRangeException {
List<JetstreamEvent> events=new ArrayList<JetstreamEvent>();
if (m_nextBatchSizeBytes < 0) m_nextBatchSizeBytes=m_config.getBatchSizeBytes();
if (m_nextBatchSizeBytes == 0) {
m_nextBatchSizeBytes=m_config.getBatchSizeBytes();
re... | consumer events from kafka by one FetchRequest |
public Attributes(Attributes attr){
map=new HashMap<>(attr);
}
| Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes. |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public void remove() throws InterruptedException {
List peekedIds=(List)HARegionQueue.peekedEventsContext.get();
if (peekedIds == null) {
if (logger.isDebugEnabled()) {
logger.debug("Remove() called before peek(), nothing to remove.");
}
return;
}
if (!this.checkPrevAcks()) {
return;
}
... | Removes the events that were peeked by this thread. The events are destroyed from the queue and conflation map and DispatchedAndCurrentEvents are updated accordingly. |
public BoundedHashMap(int capacity){
this(capacity,false);
}
| Creates a BoundedHashMap with a specified maximum capacity, in insertion order mode. |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
private synchronized int decreaseRefCount(){
ensureValid();
Preconditions.checkArgument(mRefCount > 0);
mRefCount--;
return mRefCount;
}
| Decrements reference count for the shared reference. Returns value of mRefCount after decrementing |
public DeregisterRequest(String registrationID){
Validate.notNull(registrationID);
this.registrationID=registrationID;
}
| Creates a request for removing the registration information from the LWM2M Server. |
public static long readQwordLittleEndian(final byte[] data,final int offset){
return ((data[offset + 7] & 0xFFL) * 0x100 * 0x100* 0x100* 0x100* 0x100* 0x100* 0x100) + ((data[offset + 6] & 0xFFL) * 0x100 * 0x100* 0x100* 0x100* 0x100* 0x100) + ((data[offset + 5] & 0xFFL) * 0x100 * 0x100* 0x100* 0x100* 0x100)+ ((data[of... | Reads a Little Endian QWORD value from a byte array. |
public void initialize(UISearchResult sr){
super.initialize(sr);
RESULT=sr;
_mediaType=NamedMediaType.getFromExtension(getExtension());
addedOn=sr.getCreationTime() > 0 ? new Date(sr.getCreationTime()) : null;
actionsHolder=new SearchResultActionsHolder(sr);
name=new SearchResultNameHolder(sr);
seeds=RESU... | Initializes this line with the specified search result. |
public Object nextMeta() throws JSONException {
char c;
char q;
do {
c=next();
}
while (Character.isWhitespace(c));
switch (c) {
case 0:
throw syntaxError("Misshaped meta tag");
case '<':
return XML.LT;
case '>':
return XML.GT;
case '/':
return XML.SLASH;
case '=':
return XML.EQ;
case '!':
return XML... | Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public int write(Connection conn,String outputFileName,String sql,String charset) throws SQLException {
Statement stat=conn.createStatement();
ResultSet rs=stat.executeQuery(sql);
int rows=write(outputFileName,rs,charset);
stat.close();
return rows;
}
| Writes the result set of a query to a file in the CSV format. |
private void depthInc(int index){
depths[index]++;
depthCalc();
}
| increment the depth at index and calc the new depthSum |
public void declareStartOfScopeVariable(Identifier id){
Scope s=getClosestDeclarationContainer();
s.addStartOfScopeStatement((Statement)substV("var @id;","id",id));
}
| Add a variable declaration to the start of the closest enclosing true scope. |
public byte[] remove(QueueEvent event) throws KeeperException, InterruptedException {
TimerContext time=stats.time(dir + "_remove_event");
try {
String path=event.getId();
String responsePath=dir + "/" + response_prefix+ path.substring(path.lastIndexOf("-") + 1);
if (zookeeper.exists(responsePath,true))... | Remove the event and save the response into the other path. |
public void createTables(DatabaseSession session,JPAMSchemaManager schemaManager,boolean build){
createTables(session,schemaManager,build,true,true,true);
}
| This creates the tables on the database. If the table already exists this will fail. |
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:36.520 -0500",hash_original_method="0DA9D5A0C7EE7D2AFD4BCC53AD3802F3",hash_generated_method="72956D90BC7B32B0D39A00538E67E3E0") @Deprecated public void putIBinder(String key,IBinder valu... | Inserts an IBinder value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. |
@SuppressWarnings("unchecked") public SimpleIoProcessorPool(Class<? extends IoProcessor<S>> processorType,Executor executor,int size,SelectorProvider selectorProvider){
if (processorType == null) {
throw new IllegalArgumentException("processorType");
}
if (size <= 0) {
throw new IllegalArgumentException("... | Creates a new instance of SimpleIoProcessorPool with an executor |
public void add(String string,Image image){
checkWidget();
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
TableItem newItem=new TableItem(this.table,SWT.NONE);
newItem.setText(string);
if (image != null) newItem.setImage(image);
}
| Adds the argument to the end of the receiver's list. |
public void onDamaged(final Entity attacker,final int damage){
resolution=Resolution.HIT;
combatIconTime=System.currentTimeMillis();
boolean showAttackInfoForPlayer=(this.isUser() || attacker.isUser());
showAttackInfoForPlayer=showAttackInfoForPlayer & (!stendhal.FILTER_ATTACK_MESSAGES);
if (stendhal.SHOW_EVE... | Called when this entity is damaged by attacker with damage amount. |
public String buildQuery(String[] projectionIn,String selection,String groupBy,String having,String sortOrder,String limit){
String[] projection=computeProjection(projectionIn);
StringBuilder where=new StringBuilder();
boolean hasBaseWhereClause=mWhereClause != null && mWhereClause.length() > 0;
if (hasBaseWher... | Construct a SELECT statement suitable for use in a group of SELECT statements that will be joined through UNION operators in buildUnionQuery. |
public static final GCodeFlavor tasteFlavor(Resources res,int resId) throws IOException, NotFoundException {
BufferedInputStream buffer=new BufferedInputStream(res.openRawResource(resId));
GCodeFlavor ret=tasteFlavor(buffer);
buffer.close();
return ret;
}
| Determine the content generator (i.e. Slic3r, Skeinforge) for the given resource. |
public static void devicePermissions(Context context,String accessToken,String identifier,AsyncHttpResponseHandler responseHandler){
List<Header> headerList=new ArrayList<Header>();
headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN,accessToken));
get(context,String.format(getApiServerUrl() + DEVICE_PERMI... | get all authorized devices information(/v1/devices/{identifier}/permissions) <p>Method: get</p> |
public Object parse() throws XMLException {
try {
this.builder.startBuilding(this.reader.getSystemID(),this.reader.getLineNr());
this.scanData();
return this.builder.getResult();
}
catch ( XMLException e) {
throw e;
}
catch ( Exception e) {
XMLException error=new XMLException(e);
error.... | Parses the data and lets the builder create the logical data structure. |
public void onRetry(R result,Throwable failure,ExecutionContext context){
}
| Called before an execution is retried. |
public void pressed(){
state=STATE_PRESSED;
repaint();
}
| Invoked to change the state of the button to the pressed state |
private static List<AclEntry> decode(long address,int n){
ArrayList<AclEntry> acl=new ArrayList<>(n);
for (int i=0; i < n; i++) {
long offset=address + i * SIZEOF_ACE_T;
int uid=unsafe.getInt(offset + OFFSETOF_UID);
int mask=unsafe.getInt(offset + OFFSETOF_MASK);
int flags=(int)unsafe.getShort(offse... | Decode the buffer, returning an ACL |
@Override public int eDerivedStructuralFeatureID(int baseFeatureID,Class<?> baseClass){
if (baseClass == TypableElement.class) {
switch (baseFeatureID) {
default :
return -1;
}
}
if (baseClass == TypeDefiningElement.class) {
switch (baseFeatureID) {
case N4JSPackage.TYPE_DEFINING_ELEMENT__DEFINED_TYPE:
re... | <!-- begin-user-doc --> <!-- end-user-doc --> |
private void putResize(long key,V value){
if (key == 0) {
zeroValue=value;
hasZeroValue=true;
return;
}
int index1=(int)(key & mask);
long key1=keyTable[index1];
if (key1 == EMPTY) {
keyTable[index1]=key;
valueTable[index1]=value;
if (size++ >= threshold) resize(capacity << 1);
... | Skips checks for existing keys. |
private void updateHoveringState(final MouseEvent e){
int hoveringProcessIndex=model.getHoveringProcessIndex();
if (model.getHoveringProcessIndex() != -1) {
int relativeX=(int)model.getMousePositionRelativeToProcess().getX();
int relativeY=(int)model.getMousePositionRelativeToProcess().getY();
OutputPor... | Updates the currently hovered element |
public void testNegNegFirstShorter(){
byte aBytes[]={-2,-3,-4,-4,5,14,23,39,48,57,66,5,14,23};
byte bBytes[]={-128,9,56,100,-2,-76,89,45,91,3,-15,35,26,-117,23,87,-25,-75};
int aSign=-1;
int bSign=-1;
byte rBytes[]={-1,1,75,-89,-45,-2,-3,-18,-36,-17,-10,-3,-6,-7,-21};
BigInteger aNumber=new BigInteger(aSign... | Or for two negative numbers; the first is shorter |
public final CC gapAfter(String boundsSize){
hor.setGapAfter(ConstraintParser.parseBoundSize(boundsSize,true,true));
return this;
}
| Sets the horizontal gap after the component. <p> Note! This is currently same as gapRight(). This might change in 4.x. |
public static Lattice<String> plfStringToLattice(String plfString,boolean predictPinchPoints){
final Pattern nodePattern=Pattern.compile("(.+?)\\((\\(.+?\\),)\\)(.*)");
final Pattern arcPattern=Pattern.compile("\\('(.+?)',(-?\\d+.?\\d*),(\\d+)\\),(.*)");
Matcher nodeMatcher=nodePattern.matcher(plfString);
final... | Constructs a lattice from a lattice encoded in PLF. NOTE: For the predictPinchPoints functionality to work, cdec (or whichever lattice generator) must include the unsegmented tokens in the output lattice. TODO: This language can be recognized with a PDA. We really should just have a lexer that returns lists of tuples. ... |
@Override protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
Log.d(TAG,"onCreate(): activity re-created");
}
else {
Log.d(TAG,"onCreate(): activity created anew");
}
}
| Hook method called when a new instance of Activity is created. One time initialization code should go here e.g. UI layout, some class scope variable initialization. if finish() is called from onCreate no other lifecycle callbacks are called except for onDestroy(). |
public Metaphone(){
super();
}
| Creates an instance of the Metaphone encoder |
public ColorTintFilter(Color mixColor,float mixValue){
if (mixColor == null) {
throw new IllegalArgumentException("mixColor cannot be null");
}
this.mixColor=mixColor;
if (mixValue < 0.0f) {
mixValue=0.0f;
}
else if (mixValue > 1.0f) {
mixValue=1.0f;
}
this.mixValue=mixValue;
int mix_r=(i... | <p>Creates a new color mixer filter. The specified color will be used to tint the source image, with a mixing strength defined by <code>mixValue</code>.</p> |
public static ZTauElement partModReduction(BigInteger k,int m,byte a,BigInteger[] s,byte mu,byte c){
BigInteger d0;
if (mu == 1) {
d0=s[0].add(s[1]);
}
else {
d0=s[0].subtract(s[1]);
}
BigInteger[] v=getLucas(mu,m,true);
BigInteger vm=v[1];
SimpleBigDecimal lambda0=approximateDivisionByN(k,s[0],v... | Partial modular reduction modulo <code>(τ<sup>m</sup> - 1)/(τ - 1)</code>. |
private Collection<GraphNode> buildSingleSet(GraphNode inputNode){
Collection<GraphNode> input=Sets.newHashSet();
input.add(inputNode);
return input;
}
| Creates a new input set including the given node. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.