code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
@Category(FlakyTest.class) @Test public void testMissingMemberRedundancy1(){
Host host=Host.getHost(0);
VM vm0=host.getVM(0);
VM vm1=host.getVM(1);
VM vm2=host.getVM(2);
createPR(vm0,1);
createPR(vm1,1);
createData(vm0,0,NUM_BUCKETS,"a");
Set<Integer> vm0Buckets=getBucketList(vm0);
Set<Integer> vm1Buc... | Test the with redundancy 1, we restore the same buckets when the missing member comes back online. |
@Override public Object clone(){
return new NominalStatistics(this);
}
| Returns a clone of this statistics object. The attribute is only cloned by reference. |
public OpenVisionWorldAction(final VisionWorldDesktopComponent desktopComponent){
super("Open...");
if (desktopComponent == null) {
throw new IllegalArgumentException("Desktop component must not be null");
}
this.desktopComponent=desktopComponent;
putValue(SMALL_ICON,ResourceManager.getImageIcon("Open.png... | Create a new create pixel matrix action. |
public static byte[] longToRegisters(long v){
byte[] registers=new byte[8];
registers[0]=(byte)(0xff & (v >> 56));
registers[1]=(byte)(0xff & (v >> 48));
registers[2]=(byte)(0xff & (v >> 40));
registers[3]=(byte)(0xff & (v >> 32));
registers[4]=(byte)(0xff & (v >> 24));
registers[5]=(byte)(0xff & (v >> 16... | Converts a long value to a byte[8]. |
public void message(SerialMessage r){
log.warn("unexpected message");
}
| Dummy routine |
public CChangeFunctionNameAction(final JFrame window,final INaviView view){
super(String.format("Change function name '%s'",view.getName()));
m_window=window;
m_view=view;
}
| Creates a new action object. |
private ReaderTestUtils(){
}
| Prevent construction. |
@Override public int executeUpdate(String sql,int[] columnIndexes) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("executeUpdate(" + quote(sql) + ", "+ quoteIntArray(columnIndexes)+ ");");
}
return executeUpdateInternal(sql);
}
catch ( Exception e) {
throw logAndConvert(e);
... | Executes a statement and returns the update count. This method just calls executeUpdate(String sql) internally. The method getGeneratedKeys supports at most one columns and row. |
public StringList reset(){
curr=root;
return this;
}
| reset the String List |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:52.338 -0400",hash_original_method="AE312126AF817511B6AC9FA9A8EAB6F5",hash_generated_method="5C0FD56F27A38F18958A78AD40CC95DD") @Override public void mark(int readAheadLimit){
mark=idx;
}
| Mark the current position. |
private void overshadowRect(final Rectangle2D rect,final Graphics2D g){
Graphics2D g2=(Graphics2D)g.create();
g2.setColor(GRAY_OUT);
g2.fill(rect);
g2.dispose();
}
| Shadows the given rectangle. Gives a disabled look to the given area. |
public TFloatDoubleHashMap(int initialCapacity,float loadFactor,TFloatHashingStrategy strategy){
super(initialCapacity,loadFactor,strategy);
}
| Creates a new <code>TFloatDoubleHashMap</code> instance with a prime value at or near the specified capacity and load factor. |
@RequestProcessing(value="/admin/user/{userId}/email",method=HTTPRequestMethod.POST) @Before(adviceClass={StopwatchStartAdvice.class,AdminCheck.class}) @After(adviceClass=StopwatchEndAdvice.class) public void updateUserEmail(final HTTPRequestContext context,final HttpServletRequest request,final HttpServletResponse res... | Updates a user's email. |
public void dispose(){
m_model.dispose();
}
| Frees allocated resources. |
@Override public void updateDate(String columnLabel,Date x) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("updateDate(" + quote(columnLabel) + ", x);");
}
update(columnLabel,x == null ? (Value)ValueNull.INSTANCE : ValueDate.get(x));
}
catch ( Exception e) {
throw logAndConver... | Updates a column in the current or insert row. |
public void stop(){
if (started) {
positionUs=elapsedRealtimeMinus(deltaUs);
started=false;
}
}
| Stops the clock. Does nothing if the clock is already stopped. |
protected void visitBounds(AnnotatedTypeMirror boundedType,AnnotatedTypeMirror upperBound,AnnotatedTypeMirror lowerBound,AnnotationMirror qual){
final boolean prevIsUpperBound=isUpperBound;
final boolean prevIsLowerBound=isLowerBound;
final BoundType prevBoundType=boundType;
boundType=getBoundType(boundedType,a... | Visit the bounds of a type variable or a wildcard and potentially apply qual to those bounds. This method will also update the boundType, isLowerBound, and isUpperbound fields. |
@Override public boolean supportsLikeEscapeClause(){
debugCodeCall("supportsLikeEscapeClause");
return true;
}
| Returns whether LIKE... ESCAPE is supported. |
public void unRegister(Object obj){
if (obj instanceof ForceConstraint) objCE.unRegisterForceConstraint((ForceConstraint)obj);
if (obj instanceof ImpulseConstraint) objCE.unRegisterImpulseConstraint((ImpulseConstraint)obj);
}
| Removes a constraint |
public long guest_time(){
return Long.parseLong(fields[42]);
}
| (since Linux 2.6.24) Guest time of the process (time spent running a virtual CPU for a guest operating system), measured in clock ticks (divide by sysconf(_SC_CLK_TCK)). |
public SummaryPanel(final NeuronGroup ng,boolean editable){
setGroup(ng);
this.editable=editable;
incomingGroupLabel.setText("Incoming: ");
outgoingGroupLabel.setText("Outgoing: ");
fillFieldValues();
initializeLayout();
}
| Constructs the summary panel based on a neuron group. Names the incoming and outgoing labels appropriately (Incoming/Outgoing). |
public boolean isTarget(){
return getMeasureTarget().signum() != 0;
}
| Goal has Target |
public boolean addSnappedNode(NodedSegmentString segStr,int segIndex){
Coordinate p0=segStr.getCoordinate(segIndex);
Coordinate p1=segStr.getCoordinate(segIndex + 1);
if (intersects(p0,p1)) {
segStr.addIntersection(getCoordinate(),segIndex);
return true;
}
return false;
}
| Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixel |
public static SipRequest createMultipartInvite(SipDialogPath dialog,String[] featureTags,String[] acceptTags,String multipart,String boundary) throws PayloadException {
try {
ContentTypeHeader contentType=SipUtils.HEADER_FACTORY.createContentTypeHeader("multipart","mixed");
contentType.setParameter("boundary"... | Create a SIP INVITE request |
@Override public boolean cannotStandUpFromHullDown(){
int i=0;
if (isLocationBad(LOC_LARM)) {
i++;
}
if (isLocationBad(LOC_RARM)) {
i++;
}
if (isLocationBad(LOC_LLEG)) {
i++;
}
if (isLocationBad(LOC_RLEG)) {
i++;
}
return i >= 3;
}
| Returns true if the Mech cannot stand up any longer. |
private void loadColumnAccess(boolean reload){
if (m_columnAccess != null && !reload) return;
ArrayList<MColumnAccess> list=new ArrayList<MColumnAccess>();
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="SELECT * FROM AD_Column_Access " + "WHERE AD_Role_ID=? AND IsActive='Y'";
try {
pstmt... | Load Column Access |
@Field(39) public Pointer<Byte> pcVal(){
return this.io.getPointerField(this,39);
}
| VT_BYREF|VT_I1<br> C type : CHAR |
public final void testRead05(){
InputStream is=new ByteArrayInputStream(myMessage);
DigestInputStream dis=new DigestInputStream(is,null);
try {
for (int i=0; i < MY_MESSAGE_LEN; i++) {
dis.read();
}
fail("read() must not work when digest functionality is on");
}
catch ( Exception e) {
}
}
| Test #5 for <code>read()</code> method<br> Assertion: broken <code>DigestInputStream</code>instance: associated <code>MessageDigest</code> not set. <code>read()</code> must not work when digest functionality is on |
public SexecSwitch(){
if (modelPackage == null) {
modelPackage=SexecPackage.eINSTANCE;
}
}
| Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc --> |
public CipherInputStream(InputStream is,AEADBlockCipher cipher,int bufSize){
super(is);
this.aeadBlockCipher=cipher;
this.inBuf=new byte[bufSize];
this.skippingCipher=(cipher instanceof SkippingCipher) ? (SkippingCipher)cipher : null;
}
| Constructs a CipherInputStream from an InputStream, an AEADBlockCipher, and a specified internal buffer size. |
public void appendNode(final CCriteriumTreeNode parent,final CCriteriumTreeNode child){
CCriteriumTreeNode.append(parent,child);
for ( final ICriteriumTreeListener listener : m_listeners) {
try {
listener.appendedNode(this,parent,child);
}
catch ( final Exception exception) {
CUtilityFuncti... | Appends a new node to a parent node. |
public boolean codeMatches(String queryCode){
int length=id.length();
if (Debug.debugging("symbology.detail")) {
Debug.output("Checking " + queryCode + " against |"+ id+ "| starting at "+ startIndex+ " for "+ length);
}
return queryCode.regionMatches(true,startIndex,id,0,length);
}
| A query method that answers of the given 15 digit code applies to this symbol part. |
@Override public String toString(){
return "[Min(" + FormatUtil.format(min,",") + "), Max("+ FormatUtil.format(max,",")+ ")]";
}
| Returns a String representation of the HyperBoundingBox. |
protected void acceptState(){
}
| accept the stored state |
public void error(String message){
errorCallback.invoke(message);
}
| Helper for error callbacks that just returns the Status.ERROR by default |
public static void overScrollBy(final PullToRefreshBase<?> view,final int deltaX,final int scrollX,final int deltaY,final int scrollY,final boolean isTouchEvent){
overScrollBy(view,deltaX,scrollX,deltaY,scrollY,0,isTouchEvent);
}
| Helper method for Overscrolling that encapsulates all of the necessary function. <p/> This should only be used on AdapterView's such as ListView as it just calls through to overScrollBy() with the scrollRange = 0. AdapterView's do not have a scroll range (i.e. getScrollY() doesn't work). |
private void add(EditItem item){
while (mmHistory.size() > mmPosition) {
mmHistory.removeLast();
}
mmHistory.add(item);
mmPosition++;
if (mmMaxHistorySize >= 0) {
trimHistory();
}
}
| Adds a new edit operation to the history at the current position. If executed after a call to getPrevious() removes all the future history (elements with positions >= current history position). |
public void decCqCount(){
this._stats.incInt(_cqCountId,-1);
}
| Decrements the "cqCount" stat. |
public Builder insert(final String inserted){
this.newText=inserted;
return this;
}
| Sets the new text for the change. |
public void componentAdded(ContainerEvent e){
((ContainerListener)a).componentAdded(e);
((ContainerListener)b).componentAdded(e);
}
| Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b. |
public void makePerceptSentence(AgentPercept p,int time){
if (p.isStench()) {
tell(newSymbol(PERCEPT_STENCH,time));
}
else {
tell(new ComplexSentence(Connective.NOT,newSymbol(PERCEPT_STENCH,time)));
}
if (p.isBreeze()) {
tell(newSymbol(PERCEPT_BREEZE,time));
}
else {
tell(new ComplexSentence... | Add to KB sentences that describe the perception p (only about the current time). |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public VersionFilter(AbstractMethod method,UriInfo uriInfo){
this.method=method;
this.uriInfo=uriInfo;
}
| Creates a new version filter |
private Object[] unmarshalParametersChecked(DeserializationChecker checker,Method method,MarshalInputStream in) throws IOException, ClassNotFoundException {
int callID=methodCallIDCount.getAndIncrement();
MyChecker myChecker=new MyChecker(checker,method,callID);
in.setStreamChecker(myChecker);
try {
Class<?... | Unmarshal parameters for the given method of the given instance over the given marshalinputstream. Do perform all additional checks. |
@Inject public ToolbarPresenter(ToolbarView view){
this.view=view;
this.view.setDelegate(this);
this.view.setAddSeparatorFirst(true);
this.view.setPlace(ActionPlaces.MAIN_TOOLBAR);
}
| Create presenter. |
public void buildViews(HashMap<String,Set<RString>> stringListMap){
idFreqMap.put(NONAME,Integer.valueOf(0));
buildViews(view,stringListMap);
}
| build UI views |
public OffsetMask(Mask mask,Vector offset){
checkNotNull(mask);
checkNotNull(offset);
this.mask=mask;
this.offset=offset;
}
| Create a new instance. |
public void testConfigureDefaultWebappsDirectory() throws Exception {
configuration.configure(container);
String config=configuration.getFileHandler().readTextFile(configuration.getHome() + "/conf/server.xml","UTF-8");
XMLAssert.assertXpathEvaluatesTo("webapps","//Host/@appBase",config);
}
| Test webapps directory configuration. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:42.966 -0500",hash_original_method="8ACC6861A4ACA970AEBA8CCFE6984687",hash_generated_method="7B1E5B53927553375DCF3987967EF71D") public SIPHeader parse() throws ParseException {
if (debug) dbg_enter("ContentEncodingParser.parse")... | parse the ContentEncodingHeader String header |
public void reverse(){
float tmp;
int limit=size / 2;
int j=size - 1;
float[] theElements=elements;
for (int i=0; i < limit; ) {
tmp=theElements[i];
theElements[i++]=theElements[j];
theElements[j--]=tmp;
}
}
| Reverses the elements of the receiver. Last becomes first, second last becomes second first, and so on. |
public static Object negativeToMeaningful(Numeric numeric){
Object valToInsert=null;
if (numeric.isNegative()) {
switch (numeric.getColumnSpec().getLength()) {
case 1:
valToInsert=TINYINT_MAX_VALUE + 1 + numeric.getExtractedValue();
break;
case 2:
valToInsert=SMALLINT_MAX_VALUE + 1 + numeric.getExtracte... | Converts raw *negative* extracted from the binary log *unsigned* numeric value into correct *positive* numeric representation. MySQL saves large unsigned values as signed (negative) ones in the binary log, hence the need for transformation.<br/> See Issue 798 for more details.<br/> Make sure your numeric value is reall... |
synchronized void cleanup(long timeout){
long t=System.currentTimeMillis();
synchronized (loaders) {
Iterator i=loaders.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e=(Map.Entry)i.next();
ClassLoaderBox clb=(ClassLoaderBox)e.getValue();
final File f=clb.cl.file;
String name=(... | Removes all loaders (together with used resources) that haven't had any users for the given number of ms-s. |
private void drawVStretch(float stretch){
final float ar=scurve(stretch,7.5f);
final float ag=scurve(stretch,8.0f);
final float ab=scurve(stretch,8.5f);
if (DEBUG) {
Slog.d(TAG,"drawVStretch: stretch=" + stretch + ", ar="+ ar+ ", ag="+ ag+ ", ab="+ ab);
}
GLES10.glBlendFunc(GLES10.GL_ONE,GLES10.GL_ONE);... | Draws a frame where the content of the electron beam is collapsing inwards upon itself vertically with red / green / blue channels dispersing and eventually merging down to a single horizontal line. |
public static int intersectRayAar(Vector2fc origin,Vector2fc dir,Vector2fc min,Vector2fc max,Vector2f result){
return intersectRayAar(origin.x(),origin.y(),dir.x(),dir.y(),min.x(),min.y(),max.x(),max.y(),result);
}
| Determine whether the given ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of ... |
public static int fuzzyScore(CharSequence term,CharSequence query){
return fuzzyScore(term,query,Locale.getDefault());
}
| Copied from Apache FuzzyScore implementation. One point is given for every matched character. Subsequent matches yield two bonus points. A higher score indicates a higher similarity. |
public SSLPermission(String name){
super(name);
}
| Creates a new SSLPermission with the specified name. The name is the symbolic name of the SSLPermission, such as "setDefaultAuthenticator", etc. An asterisk may appear at the end of the name, following a ".", or by itself, to signify a wildcard match. |
public void paintSliderBackground(SynthContext context,Graphics g,int x,int y,int w,int h){
}
| Paints the background of a slider. |
private String computeCss(String mediaUrl,int thumbnailWidth,int thumbnailHeight,int rotationAngle){
String css="body { background-color: #000; height: 100%; width: 100%; margin: 0px; padding: 0px; }" + ".wrap { position: absolute; left: 0px; right: 0px; width: 100%; height: 100%; " + "display: -webkit-box; -webkit-b... | Image rendering subroutine |
public Population breedPopulation(EvolutionState state){
Population oldPop=(Population)state.population;
Population newPop=super.breedPopulation(state);
Individual[] combinedInds;
Subpopulation[] subpops=oldPop.subpops;
Subpopulation oldSubpop;
Subpopulation newSubpop;
int subpopsLength=subpops.length;
... | Override breedPopulation(). We take the result from the super method in SimpleBreeder and append it to the old population. Hence, after generation 0, every subsequent call to <code>NSGA2Evaluator.evaluatePopulation()</code> will be passed a population of 2x<code>originalPopSize</code> individuals. |
public void add(File file,String password) throws IOException, UnsupportedEncodingException {
FileInputStream fis=new FileInputStream(file);
try {
add(file.getPath(),fis,password);
}
finally {
fis.close();
}
}
| Add un-encrypted + un-zipped file to encrypted zip file. |
public static boolean isInArc(IGame game,int attackerId,int weaponId,Targetable t){
Entity ae=game.getEntity(attackerId);
if ((ae instanceof Mech) && (((Mech)ae).getGrappled() == t.getTargetId())) {
return true;
}
int facing=ae.isSecondaryArcWeapon(weaponId) ? ae.getSecondaryFacing() : ae.getFacing();
if ... | Checks to see if a target is in arc of the specified weapon, on the specified entity |
public static ActionErrors validarDatosConfiguracionLdap(ConfiguracionLdapForm configuracionLdapForm){
ActionErrors errores=new ActionErrors();
boolean datosValidos=true;
if (configuracionLdapForm != null) {
if (isNuloOVacio(configuracionLdapForm.getDireccion())) {
datosValidos=false;
ActionError ... | Metodo que comprueba los campos que es obligatorio insertar en la base de datos para configurar Ldap |
@SuppressWarnings("unchecked") public DummyData(int cols,int rows,Comparable<?> value){
value.getClass();
this.cols=cols;
this.rows=rows;
this.value=value;
Class<? extends Comparable<?>>[] types=new Class[cols];
Arrays.fill(types,value.getClass());
setColumnTypes(types);
}
| Creates a new instance with the specified number of columns and rows, which are filled all over with the same specified value. |
@Override protected void onNfcFeatureNotFound(){
toast(getString(R.string.noNfcMessage));
}
| This device does not have NFC hardware |
private void draw(final ExecutionUnit process,final Graphics2D g2,final ProcessRendererModel rendererModel,final boolean printing){
ProcessBackgroundImage image=rendererModel.getBackgroundImage(process);
if (image != null) {
Graphics2D g2D=(Graphics2D)g2.create();
int x=image.getX();
int y=image.getY();... | Draws the background annotations. |
public void showView(View next,AnimationType from){
if (mInAnimation != null) {
mInAnimation.setAnimationListener(null);
}
if (mOutAnimation != null) {
mOutAnimation.setAnimationListener(null);
}
switch (from) {
case RIGHT:
mInAnimation=AnimationUtils.loadAnimation(this,R.anim.push_left_in);
mOutA... | Displays the View specified by the parameter 'next', animating both the current view and next appropriately given the AnimationType. Also updates the progress bar. |
private static Point2D.Double v2Normalize(Point2D.Double v){
double len=v2Length(v);
if (len != 0.0) {
v.x/=len;
v.y/=len;
}
return v;
}
| Normalizes the input vector and returns it. |
public static Bound<String> withSuffix(String nameExtension){
return new Bound<>(DEFAULT_TEXT_CODER).withSuffix(nameExtension);
}
| Returns a transform for writing to text files that appends the specified suffix to the created files. |
public Matrix4x3d swap(Matrix4x3d other){
double tmp;
tmp=m00;
m00=other.m00;
other.m00=tmp;
tmp=m01;
m01=other.m01;
other.m01=tmp;
tmp=m02;
m02=other.m02;
other.m02=tmp;
tmp=m10;
m10=other.m10;
other.m10=tmp;
tmp=m11;
m11=other.m11;
other.m11=tmp;
tmp=m12;
m12=other.m12;
other.m12... | Exchange the values of <code>this</code> matrix with the given <code>other</code> matrix. |
@Subscriber(tag="another") void methodWithAnotherTag(User person){
}
| another tag |
final public MutableString insert(final int index,final String s){
final int length=length();
if (index > length) throw new StringIndexOutOfBoundsException();
final int l=s.length();
if (l == 0) return this;
final int newLength=length + l;
expand(newLength);
System.arraycopy(array,index,array,index + ... | Inserts a <code>String</code> in this mutable string, starting from index <code>index</code>. |
public static DateTimeFormatter year(){
return yearElement();
}
| Returns a formatter for a four digit year. (yyyy) |
public Holder(GeneralNames entityName,int version){
this.entityName=entityName;
this.version=version;
}
| Constructs a holder with an entityName for V2 attribute certificates or with a subjectName for V1 attribute certificates. |
public Class<? extends AbstractAntlrTokenToAttributeIdMapper> bindAbstractAntlrTokenToAttributeIdMapper(){
return TokenToAttributeIdMapper.class;
}
| Bind a proper token mapper for the special token types in N4JS |
private RrdEntry waitEmpty(String path) throws IOException, InterruptedException {
RrdEntry ref=getEntry(path,true);
try {
while (ref.count != 0) {
passNext(ACTION.SWAP,ref);
ref.waitempty.await();
ref=getEntry(path,true);
}
return ref;
}
catch ( InterruptedException e) {
passN... | Wait for a empty reference with no usage |
public boolean isLESS_EQUAL(){
return value == LESS_EQUAL;
}
| Is the condition code LESS EQUAL? |
public TouchHandler(GraphicalView view,AbstractChart chart){
graphicalView=view;
zoomR=graphicalView.getZoomRectangle();
if (chart instanceof XYChart) {
mRenderer=((XYChart)chart).getRenderer();
}
else {
mRenderer=((RoundChart)chart).getRenderer();
}
if (mRenderer.isPanEnabled()) {
mPan=new Pan... | Creates a new graphical view. |
public static void writeX509Certificate(X509Certificate cert,Writer w) throws IOException {
try (JcaPEMWriter jw=new JcaPEMWriter(w)){
jw.writeObject(cert);
}
}
| Writes an X.509 certificate PEM file. |
protected AbstractRecord buildTemplateInsertRow(AbstractSession session){
AbstractRecord result=getReferenceDescriptor().getObjectBuilder().buildTemplateInsertRow(session);
List processedMappings=(List)getReferenceDescriptor().getMappings().clone();
if (getReferenceDescriptor().hasInheritance()) {
for ( Cl... | INTERNAL: Build and return a "template" database row with all the fields set to null. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:13.397 -0500",hash_original_method="5C1E65D88B1AA36ECF03FA5CEB305F59",hash_generated_method="7E7C53D67F6B3E597D57AF7EF225E810") private void parseParameter(String token,Strin... | If the token is a known parameter name, parses and initializes the token value. |
@DSSpec(DSCat.IO) @DSSource({DSSourceKind.IO}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:52.474 -0400",hash_original_method="2C3D85339C2DDA831F01519845123B39",hash_generated_method="AA79F4B08C140AB947EEDF78E949FA4F") @Override public int read(byte[] bts,int off,int len) thr... | Invokes the delegate's <code>read(byte[], int, int)</code> method. |
public IBlockState onBlockPlaced(World worldIn,BlockPos pos,EnumFacing facing,float hitX,float hitY,float hitZ,int meta,EntityLivingBase placer){
return this.getDefaultState().withProperty(FACING,placer.getHorizontalFacing()).withProperty(OPEN,Boolean.valueOf(false)).withProperty(POWERED,Boolean.valueOf(false)).withP... | Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the IBlockstate |
public static void main(String[] args){
int x0=Integer.parseInt(args[0]);
int y0=Integer.parseInt(args[1]);
int n=Integer.parseInt(args[2]);
StdDraw.setCanvasSize(800,800);
StdDraw.setXscale(0,100);
StdDraw.setYscale(0,100);
StdDraw.setPenRadius(0.005);
StdDraw.enableDoubleBuffering();
Point2D[] point... | Unit tests the point data type. |
int parseYear(String source,String token,int ofs) throws ParseException {
int year=parseNumber(source,ofs,"year",-1,-1);
int len=source.length();
int tokenLen=token.length();
int thisYear=Calendar.getInstance().get(Calendar.YEAR);
if ((len == 2) && (tokenLen < 3)) {
int c=(thisYear / 100) * 100;
year+... | Parse a year value. If the year is a two digit value, if the value is within 20 years ahead of the current year, current century will be used (ie. if current year is 2013, a value of "33" will return 2033), otherwise previous century is used (ie. with current year of 2012, a value of 97 will return "1997"). See Java 6 ... |
public AddForeignKeyChange(Table table,ForeignKey newForeignKey){
super(table);
_newForeignKey=newForeignKey;
}
| Creates a new change object. |
private static void def(int opcode,String name,String format,int stackEffect){
def(opcode,name,format,stackEffect,0);
}
| Defines a bytecode by entering it into the arrays that record its name, length and flags. |
public static void fillOppositeField(Class<?> configuredClass,MappedField configuredField,MappedField targetField){
JMapAccessor accessor=getClassAccessors(configuredClass,targetField.getValue().getName(),true);
if (isNull(accessor)) accessor=getFieldAccessors(configuredClass,configuredField.getValue(),true,targe... | Fill target field with custom methods if occur all these conditions:<br> <ul> <li>It's defined a JMapAccessor by configured field to target</li> <li>The target of the configuration hasn't the custom methods defined</li> </ul> |
public ArrayBasedSet(E[] A,int capacity,Comparator<E> comparator){
type=(Class<E>)A.getClass().getComponentType();
array=(E[])java.lang.reflect.Array.newInstance(type,capacity);
size=0;
this.comparator=comparator;
}
| <p> Initialize an empty set with a given initial capacity, and a given comparator. </p> |
@Override public IntInterval toReversed(){
return IntInterval.fromToBy(this.to,this.from,-this.step);
}
| Returns a new IntInterval with the from and to values reversed and the step value negated. |
public synchronized int assignNewLocalId(){
localId=localEventId.incrementAndGet();
return localId;
}
| Generates a new local id for this event. |
private static ASN1Primitive convertValueToObject(Extension ext) throws IllegalArgumentException {
try {
return ASN1Primitive.fromByteArray(ext.getExtnValue().getOctets());
}
catch ( IOException e) {
throw new IllegalArgumentException("can't convert extension: " + e);
}
}
| Convert the value of the passed in extension to an object |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:30.425 -0500",hash_original_method="D53E4189B6E7F0EC0F9883E9844F2140",hash_generated_method="105C77F54F2D3DE304E191D655D9615E") public void onOptionsMenuClosed(Menu menu){
}
| This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected). |
public MemoryIndex(){
this(false);
}
| Constructs an empty instance that will not store offsets or payloads. |
protected void validate(){
if (!url.toLowerCase().startsWith("http")) {
throw new IllegalStateException("Only HTTP urls are supported!");
}
}
| Validates that the request has the required information before being added to the queue e.g. checks if the URL is null. This method should throw an IllegalStateException for a case where one of the values required for this connection request is missing. This method can be overriden by subclasses to add additional tests... |
private RawData(byte[] data,InetSocketAddress address,Principal clientIdentity,CorrelationContext correlationContext,boolean multicast){
if (data == null) {
throw new NullPointerException("Data must not be null");
}
else if (address == null) {
throw new NullPointerException("Address must not be null");
... | Instantiates a new raw data. |
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 Value evaluate(Context context,ClassDefinitionNode node){
super.evaluate(context,node);
TypeAnalyzer typeAnalyzer=symbolTable.getTypeAnalyzer();
String className=NodeMagic.getClassName(node);
if (className == null) return null;
currentContext=context;
typeAnalyzer.evaluate(context,node);
ClassInf... | Evaluates the ClassDefinitionNode instance. The SkinPart metadata is evaluated on a per class basis. |
@GET @Controller @Produces("text/html;charset=utf-8") @Path("view1/{id}") public String view1(@PathParam("id") String id){
book.setId(id);
book.setTitle("Some title");
book.setAuthor("Some author");
book.setIsbn("Some ISBN");
return "book.jsp";
}
| MVC controller to render a book in HTML. Uses CDI and request scope to bind a book instance. |
public Statement limit(int rowAmount,int offset){
limit(rowAmount);
offset(offset);
return this;
}
| Appending the LIMIT-range clause. <p/> About the limit-offset clause, Checking the <a href="http://sqlite.org/lang_select.html#limitoffset">SQLite documentation</a> for more details. |
public boolean isRegisteredType(Class<?> type){
return configuration.isRegisteredType(type);
}
| Checks if provided type is registered with this converter instance. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.