code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static URI createUriFromServerSet(ServerSet serverSet,String path) throws URISyntaxException {
return createUriFromServerSet(serverSet,path,"http");
}
| Returns the URI of a random server. |
@Override protected AccessCheckingPortal createPortal(final ConfigurableFactoryContext ctx){
return new RandomDestinationPortal();
}
| Create a portal with random destination. |
protected void garbageCollect(VisualTable labels){
Iterator iter=labels.tuples();
while (iter.hasNext()) {
VisualItem item=(VisualItem)iter.next();
if (!item.isStartVisible() && !item.isEndVisible()) {
labels.removeTuple(item);
}
}
}
| Remove axis labels no longer being used. |
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject();
s.writeInt(attrs.size());
Enumeration<Attribute> attrEnum=attrs.elements();
while (attrEnum.hasMoreElements()) {
s.writeObject(attrEnum.nextElement());
}
}
| Overridden to avoid exposing implementation details. |
protected void resetOptions(){
m_starting=null;
m_startRange=new Range();
m_attributeList=null;
m_attributeMerit=null;
m_threshold=-Double.MAX_VALUE;
}
| Resets stuff to default values |
public static String createDigest(String sessionID,String initiatorJID,String targetJID){
StringBuilder b=new StringBuilder();
b.append(sessionID).append(initiatorJID).append(targetJID);
return StringUtils.hash(b.toString());
}
| Returns a SHA-1 digest of the given parameters as specified in <a href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>. |
@Override public void connectionNotification(String eventName,Object source){
if (connectionAllowed(eventName)) {
m_listenee=source;
}
}
| Notify this object that it has been registered as a listener with a source for receiving events described by the named event This object is responsible for recording this fact. |
public static void sendBroadcast(Context mContext){
mContext.sendBroadcast(mScrobbleDroidIntent);
}
| Fires the broadcast intent that connects to Scrobble Droid. |
private void prefixTree(StringBuffer text) throws Exception {
text.append("[");
text.append(m_localModel.leftSide(m_train) + ":");
for (int i=0; i < m_sons.length; i++) {
if (i > 0) {
text.append(",\n");
}
text.append(m_localModel.rightSide(i,m_train));
}
for (int i=0; i < m_sons.length; i++) {
if (m_sons[i].m_isLeaf) {
text.append("[");
text.append(m_localModel.dumpLabel(i,m_train));
text.append("]");
}
else {
m_sons[i].prefixTree(text);
}
}
text.append("]");
}
| Prints the tree in prefix form |
void testString(){
String a=randomString();
if (returnNew) {
String b=StringUtils.fromCacheOrNew(a);
try {
assertEquals(a,b);
}
catch ( Exception e) {
TestBase.logError("error",e);
}
if (a != null && a == b && a.length() > 0) {
throw new AssertionError("a=" + System.identityHashCode(a) + " b="+ System.identityHashCode(b));
}
}
else {
String b;
if (useIntern) {
b=a == null ? null : a.intern();
}
else {
b=StringUtils.cache(a);
}
try {
assertEquals(a,b);
}
catch ( Exception e) {
TestBase.logError("error",e);
}
}
}
| Test one string operation using the string cache. |
public static int parseHexInt(String x){
try {
return (int)Long.parseLong(x,16);
}
catch ( NumberFormatException e) {
throw newIllegalStateException(ERROR_FILE_CORRUPT,"Error parsing the value {0}",x,e);
}
}
| Parse an unsigned, hex long. |
public PrinterBuffer(){
m_list=new LinkedList();
}
| Creates a new instance of PrinterBuffer |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-18 21:46:35.916 -0400",hash_original_method="F07D2B002CE8D32774BDF7E27A216F8A",hash_generated_method="142BEDC549A1782A1BD4D492BEFB1726") public boolean hideOverflowMenu(){
if (mPostedOpenRunnable != null && mMenuView != null) {
((View)mMenuView).removeCallbacks(mPostedOpenRunnable);
mPostedOpenRunnable=null;
return true;
}
MenuPopupHelper popup=mOverflowPopup;
if (popup != null) {
popup.dismiss();
return true;
}
return false;
}
| Hide the overflow menu if it is currently showing. |
protected void sequence_RequiredRuntimeLibraryDependency(ISerializationContext context,RequiredRuntimeLibraryDependency semanticObject){
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject,N4mfPackage.Literals.PROJECT_REFERENCE__PROJECT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject,N4mfPackage.Literals.PROJECT_REFERENCE__PROJECT));
}
SequenceFeeder feeder=createSequencerFeeder(context,semanticObject);
feeder.accept(grammarAccess.getRequiredRuntimeLibraryDependencyAccess().getProjectSimpleProjectDescriptionParserRuleCall_0(),semanticObject.getProject());
feeder.finish();
}
| Contexts: RequiredRuntimeLibraryDependency returns RequiredRuntimeLibraryDependency Constraint: project=SimpleProjectDescription |
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
| The doPost method of the servlet. <br> This method is called when a form has its tag value method equals to post. |
public void addInfo(List<String> list){
list.add(getColorForState(state) + "[ " + MOStringHelper.translateToLocal("task.state." + getState() + ".name")+ " ]");
String unlocalizedDescription="task." + getUnlocalizedName() + ".state."+ state+ ".description";
String[] infos;
if (MOStringHelper.hasTranslation(unlocalizedDescription)) {
infos=MOStringHelper.translateToLocal(unlocalizedDescription).split("\n");
}
else {
infos=MOStringHelper.translateToLocal("task.state." + state + ".description").split("\n");
}
Collections.addAll(list,infos);
}
| This method is called by the tooltip of the task. All the lines in list will be displayed on the task's tooltip. |
private void makeCompactMutableString(final int length){
array=length != 0 ? new char[length] : CharArrays.EMPTY_ARRAY;
hashLength=-1;
}
| Creates a new compact mutable string with given length. |
public static boolean isAnnotation(int mod){
return (mod & ANNOTATION) != 0;
}
| Returns true if the modifiers include the <tt>annotation</tt> modifier. |
public Bundler putBoolean(String key,boolean value){
bundle.putBoolean(key,value);
return this;
}
| Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. |
private TestSuiteLocalSearchObjective(List<TestSuiteFitnessFunction> fitness,TestSuiteChromosome suite,int index){
this.fitnessFunctions.addAll(fitness);
this.suite=suite;
this.testIndex=index;
for ( TestSuiteFitnessFunction ff : fitness) {
if (ff.isMaximizationFunction()) isMaximization=true;
else isMaximization=false;
break;
}
updateLastFitness();
updateLastCoverage();
}
| Creates a Local Search objective for a TestCase that will be optimized using a containing TestSuite to measure the changes in fitness values. |
private void sendAsync(){
if (mDisposed.get()) return;
mSender.sendAsync(this);
}
| Start asynchronous send buffer |
@VisibleForTesting protected Extension loadFromFile(File localFile) throws InvalidConfigException {
Preconditions.checkNotNull(localFile);
Preconditions.checkState(localFile.exists());
Closer closer=Closer.create();
try {
InputStream fileIn=closer.register(new FileInputStream(localFile));
Extension extension=factory.build(fileIn);
extension.setRowType(normalizeRowType(extension.getRowType()));
log.info("Successfully loaded extension " + extension.getRowType());
return extension;
}
catch ( IOException e) {
log.error("Can't access local extension file (" + localFile.getAbsolutePath() + ")",e);
throw new InvalidConfigException(TYPE.INVALID_EXTENSION,"Can't access local extension file");
}
catch ( SAXException e) {
log.error("Can't parse local extension file (" + localFile.getAbsolutePath() + ")",e);
throw new InvalidConfigException(TYPE.INVALID_EXTENSION,"Can't parse local extension file: " + e.getMessage());
}
catch ( ParserConfigurationException e) {
log.error("Can't create sax parser",e);
throw new InvalidConfigException(TYPE.INVALID_EXTENSION,"Can't create sax parser");
}
finally {
try {
closer.close();
}
catch ( IOException e) {
log.debug("Failed to close input stream on extension file",e);
}
}
}
| Reads an extension from file and returns it. |
public VfsStreamOld(InputStream is){
init(is,null);
}
| Create a new VfsStream based on the java.io.* stream. |
private void displayFullScreenAvatar(){
String avatarUrl=null;
String userId=mMemberId;
if (null != mRoomMember) {
avatarUrl=mRoomMember.avatarUrl;
if (TextUtils.isEmpty(avatarUrl)) {
userId=mRoomMember.getUserId();
}
}
if (TextUtils.isEmpty(avatarUrl) && !TextUtils.isEmpty(userId)) {
User user=mSession.getDataHandler().getStore().getUser(mMemberId);
if (null != user) {
avatarUrl=user.getAvatarUrl();
}
}
if (!TextUtils.isEmpty(avatarUrl)) {
mFullMemberAvatarLayout.setVisibility(View.VISIBLE);
mSession.getMediasCache().loadBitmap(mSession.getHomeserverConfig(),mFullMemberAvatarImageView,avatarUrl,0,ExifInterface.ORIENTATION_UNDEFINED,null);
}
}
| Display the user/member avatar in fullscreen. |
public int size(){
return i + 1;
}
| Returns the number of elements contained. |
public DatatypeSwitch(){
if (modelPackage == null) {
modelPackage=DatatypePackage.eINSTANCE;
}
}
| Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc --> |
public void write(final RandomAccessFile raf) throws IOException {
FileChannelUtility.writeAll(raf.getChannel(),asReadOnlyBuffer(),0L);
if (log.isInfoEnabled()) {
log.info("wrote checkpoint record: " + this);
}
}
| Write the checkpoint record at the start of the file. |
public void call(String method,Object[] args) throws IOException {
startCall(method);
if (args != null) {
for (int i=0; i < args.length; i++) writeObject(args[i]);
}
completeCall();
}
| Writes a complete method call. |
public void addSeries(final String title,final double[] values){
int cnt=1;
for ( double value : values) {
String category=(cnt > this.categories.length ? Integer.toString(cnt) : this.categories[cnt - 1]);
this.dataset.addValue(value,title,category);
cnt++;
}
}
| Adds a new data series to the chart with the specified title. |
public BandwidthPartitioner(int partitionCount){
super(partitionCount);
}
| This creates a partitioner which creates partitonCount partitions. |
private void validateVPlexProtection(final BlockVirtualPoolUpdateParam updateParam,DbClient dbClient){
if (updateParam.specifiesHighAvailability()) {
if (updateParam.getProtection() != null && updateParam.getProtection().getRemoteCopies() != null && updateParam.getProtection().getRemoteCopies().getAdd() != null) {
for ( VirtualPoolRemoteProtectionVirtualArraySettingsParam remoteSettings : updateParam.getProtection().getRemoteCopies().getAdd()) {
if (Mode.ACTIVE.name().equals(remoteSettings.getRemoteCopyMode())) {
throw APIException.badRequests.vplexNotSupportedWithSRDFActive();
}
if (null != remoteSettings.getVpool()) {
URI uri=remoteSettings.getVpool();
VirtualPool vpool=dbClient.queryObject(VirtualPool.class,uri);
if (vpool != null && VirtualPool.vPoolSpecifiesHighAvailabilityDistributed(vpool)) {
throw APIException.badRequests.vplexDistributedNotSupportedOnSRDFTarget();
}
}
}
}
}
}
| Check vplex / srdf compatibility on update. |
public TimeLimitExceededException(String explanation){
super(explanation);
}
| Constructs a new instance of TimeLimitExceededException using the argument supplied. |
public Color color(){
return color(0,0,0);
}
| Returns hardcoded black |
public boolean match(TypeDeclarationStatement node,Object other){
if (!(other instanceof TypeDeclarationStatement)) {
return false;
}
TypeDeclarationStatement o=(TypeDeclarationStatement)other;
return safeSubtreeMatch(node.getDeclaration(),o.getDeclaration());
}
| Returns whether the given node and the other object match. <p> The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed. </p> |
protected ConstantNode createConstVar(final Value value) throws VisitorException {
final BigdataValue v=vocab.get(value);
if (v == null) throw new VisitorException("Undefined vocabulary: " + value);
return new ConstantNode(v.getIV());
}
| Return a constant for a pre-defined vocabulary item. |
protected void incorporateRevocationValues(final Element parentDom,final ValidationContext validationContext){
final DefaultAdvancedSignature.RevocationDataForInclusion revocationsForInclusion=xadesSignature.getRevocationDataForInclusion(validationContext);
if (!revocationsForInclusion.isEmpty()) {
final Element revocationValuesDom=DSSXMLUtils.addElement(documentDom,parentDom,XAdESNamespaces.XAdES,"xades:RevocationValues");
incorporateCrlTokens(revocationValuesDom,revocationsForInclusion.crlTokens);
incorporateOcspTokens(revocationValuesDom,revocationsForInclusion.ocspTokens);
}
}
| This method incorporates revocation values. |
public SigmoidKernel(double alpha){
this(alpha,1);
}
| Creates a new Sigmoid Kernel with a bias term of 1 |
public boolean burnInferno(Coords coords){
boolean result=false;
InfernoTracker tracker=null;
tracker=infernos.get(coords);
if (null != tracker) {
tracker.newRound(-1);
if (tracker.isStillBurning()) {
result=true;
}
else {
infernos.remove(coords);
}
}
return result;
}
| Record that a new round of burning has passed for the given coordinates. This routine also determines if the fire is still burning. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:42.903 -0500",hash_original_method="58145D33150957DD46A1ADD9032FDB9F",hash_generated_method="3CE421B65E2729738ED02C12C7AD40C1") public final TestSuiteBuilder includeAllPackagesUnderHere(){
StackTraceElement[] stackTraceElements=Thread.currentThread().getStackTrace();
String callingClassName=null;
String thisClassName=TestSuiteBuilder.class.getName();
for (int i=0; i < stackTraceElements.length; i++) {
StackTraceElement element=stackTraceElements[i];
if (thisClassName.equals(element.getClassName()) && "includeAllPackagesUnderHere".equals(element.getMethodName())) {
callingClassName=stackTraceElements[i + 1].getClassName();
break;
}
}
String packageName=parsePackageNameFromClassName(callingClassName);
return includePackages(packageName);
}
| Include all junit tests that satisfy the requirements in the calling class' package and all sub-packages. |
AttributeMetaData registerOwner(ExampleSetMetaData owner){
if (this.owner == null) {
this.owner=owner;
return this;
}
else {
AttributeMetaData clone=this.clone();
clone.owner=owner;
return clone;
}
}
| This method is only to be used by ExampleSetMetaData to register as owner of this attributeMetaData. Returnes is this object or a clone if this object already has an owner. |
public ObjectFactory(){
}
| Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated |
public static final byte[] unzipBestEffort(byte[] in,int sizeLimit){
try {
ByteArrayOutputStream outStream=new ByteArrayOutputStream(EXPECTED_COMPRESSION_RATIO * in.length);
GZIPInputStream inStream=new GZIPInputStream(new ByteArrayInputStream(in));
byte[] buf=new byte[BUF_SIZE];
int written=0;
while (true) {
try {
int size=inStream.read(buf);
if (size <= 0) break;
if ((written + size) > sizeLimit) {
outStream.write(buf,0,sizeLimit - written);
break;
}
outStream.write(buf,0,size);
written+=size;
}
catch ( Exception e) {
break;
}
}
try {
outStream.close();
}
catch ( IOException e) {
}
return outStream.toByteArray();
}
catch ( IOException e) {
return null;
}
}
| Returns an gunzipped copy of the input array, truncated to <code>sizeLimit</code> bytes, if necessary. If the gzipped input has been truncated or corrupted, a best-effort attempt is made to unzip as much as possible. If no data can be extracted <code>null</code> is returned. |
public SelectionTracker(@Nonnull Multiselectable<T> selectable){
this.selectable=selectable;
}
| Costructs a Tracker with the specified backing object |
public boolean isSetStoreName(){
return this.storeName != null;
}
| Returns true if field storeName is set (has been assigned a value) and false otherwise |
public static void print(Object x){
out.print(x);
out.flush();
}
| Prints an object to standard output and flushes standard output. |
public boolean isFemale(){
return FEMALE.equals(gender);
}
| Determines if the gender is "female" or not. |
public StorageSpecification(TungstenProperties props){
this();
this.version=props.getString(VERSION);
this.agent=props.getString(AGENT);
this.uri=props.getString(URI);
String propFilesCount=props.getString(FILE_COUNT);
if (propFilesCount != null) {
this.filesCount=Integer.parseInt(propFilesCount);
for (int i=0; i < this.filesCount; i++) {
this.fileNames.add(props.getString(buildPropertyName(FILE_NAME,i)));
this.fileLengths.add(props.getLong(buildPropertyName(FILE_LENGTH,i)));
this.fileCrcs.add(props.getLong(buildPropertyName(FILE_CRC,i)));
String dbName=props.getString(buildPropertyName(DB_NAME,i));
if (dbName != null) {
this.databaseNames.add(dbName);
}
}
}
else {
this.filesCount=1;
this.fileNames.add(props.getString(FILE_NAME));
this.fileLengths.add(props.getLong(FILE_LENGTH));
this.fileCrcs.add(props.getLong(FILE_CRC));
}
this.backupDate=props.getDate(BACKUP_DATE);
}
| Creates a storage specification from existing properties. |
protected ComplexTypeImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private static boolean matches(String arg,String p){
if (p.endsWith(" ")) {
return arg.equals(p.substring(0,p.length() - 1)) || arg.startsWith(p);
}
if (p.endsWith("$")) {
return arg.equals(p.substring(0,p.length() - 1));
}
return arg.startsWith(p);
}
| Does the argument match the prefix? |
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
| Util method to write an attribute without the ns prefix |
public static String quote(String string){
StringWriter sw=new StringWriter();
synchronized (sw.getBuffer()) {
try {
return quote(string,sw).toString();
}
catch ( IOException ignored) {
return "";
}
}
}
| Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within </, producing <\/, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a control character or an unescaped quote or backslash. |
@SuppressWarnings("unchecked") private T[] newArray(final int capacity){
return (T[])java.lang.reflect.Array.newInstance(elementClass,capacity);
}
| Return a new instance of an array of the correct generic type. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case N4JSPackage.COMMA_EXPRESSION__EXPRS:
return getExprs();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public Enumeration<V> elements(){
return new ValueIterator();
}
| Returns an enumeration of the values in this table. |
private boolean waitForMessageWindow(MessageType type,short nodeId,long maxWait) throws InterruptedException {
if (!windowedTypes.contains(type)) return true;
long start=System.nanoTime();
MessageWindow mw=getMW(nodeId);
if (!mw.disconnected && mw.pending.get() >= MAX_PENDING_MESSAGES) {
mw.lock.lock();
try {
while (!mw.disconnected && mw.pending.get() >= MAX_PENDING_MESSAGES) {
long now=System.nanoTime();
if (maxWait > 0 && (now - start) > maxWait * 1000) return false;
mw.full.awaitNanos(now - start);
}
}
finally {
mw.lock.unlock();
}
}
mw=getMW(nodeId);
if (mw != null) mw.pending.getAndIncrement();
return true;
}
| Wait for a message window slow to be available for the given node and message type |
public void savePoiTag(PoiTypeTag poiTypeTag){
bus.post(new InternalSavePoiTagEvent(poiTypeTag));
}
| Create or edit a poi type tag. |
public ParallelTaskBuilder(){
super();
logger.info("Initialized task builder with default config");
}
| Instantiates a new parallel task builder. |
public void createInitiator(VNXeHostInitiator newInit,String hostId){
HostInitiatorCreateParam initCreateParam=new HostInitiatorCreateParam();
VNXeBase host=new VNXeBase(hostId);
initCreateParam.setHost(host);
if (newInit.getType() == HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI) {
initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI.getValue());
initCreateParam.setInitiatorWWNorIqn(newInit.getChapUserName());
initCreateParam.setChapUser(newInit.getChapUserName());
}
else {
initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_FC.getValue());
initCreateParam.setInitiatorWWNorIqn(newInit.getInitiatorId());
}
HostInitiatorRequest req=new HostInitiatorRequest(_khClient);
req.createHostInitiator(initCreateParam);
}
| Create host initiator in the array |
@Override protected void initialize(){
super.initialize();
m_FileChooser=new EvaluationStatisticsExporterFileChooser();
m_FileChooserMeasurement=new MeasurementEvaluationStatisticsExporterFileChooser();
m_FileChooserStatistics=new EvaluationStatisticsFileChooser();
m_IgnoreChanges=false;
}
| Initializes the members. |
private static void byte2hex(byte b,StringBuffer buf){
char[] hexChars={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int high=((b & 0xf0) >> 4);
int low=(b & 0x0f);
buf.append(hexChars[high]);
buf.append(hexChars[low]);
}
| Converts a byte to hex digit and writes to the supplied buffer |
public float distanceTo3(AnimatableValue other){
AnimatableTransformListValue o=(AnimatableTransformListValue)other;
if (transforms.isEmpty() || o.transforms.isEmpty()) {
return 0f;
}
AbstractSVGTransform t1=(AbstractSVGTransform)transforms.lastElement();
AbstractSVGTransform t2=(AbstractSVGTransform)o.transforms.lastElement();
short type1=t1.getType();
if (type1 != t2.getType()) {
return 0f;
}
if (type1 == SVGTransform.SVG_TRANSFORM_ROTATE) {
return Math.abs(t1.getY() - t2.getY());
}
return 0f;
}
| Returns the distance between this value's third component and the specified other value's third component. |
public void showInNewWindow(){
if (m_frame == null) {
m_frame=new JFrame();
m_frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
m_frame.setContentPane(getPanel());
m_frame.pack();
m_frame.setVisible(true);
}
}
| Call this method to open chart in a new window. The only difference between this method and showInNewFrame() is in return value. This method was implemented because MAtlab did not recognize method showInNewFrame() possibly because of unknown class JFrame??? |
protected void prepare(){
ProcessInfoParameter[] para=getParameter();
for (int i=0; i < para.length; i++) {
String name=para[i].getParameterName();
if (para[i].getParameter() == null) ;
if (name.equals("MovementDate")) p_MovementDate=(Timestamp)para[i].getParameter();
else log.log(Level.SEVERE,"Unknown Parameter: " + name);
}
if (p_MovementDate == null) p_MovementDate=Env.getContextAsDate(getCtx(),"#Date");
if (p_MovementDate == null) p_MovementDate=new Timestamp(System.currentTimeMillis());
p_C_OrderLine_ID=getRecord_ID();
}
| Prepare - e.g., get Parameters. |
public GetStreamTask(YouTubeVideo youTubeVideo,boolean reloadVideo){
this.youTubeVideo=youTubeVideo;
if (reloadVideo) {
boolean isVideoPlaying=videoView.isPlaying();
videoView.pause();
this.currentVideoPosition=isVideoPlaying ? videoView.getCurrentPosition() : 0;
videoView.stopPlayback();
loadingVideoView.setVisibility(View.VISIBLE);
}
}
| Returns a stream for the given video. If reloadVideo is set to true, then it will stop the current video, get a NEW stream and then resume playing. |
public void removeLeafListener(ActionListener l){
leafListener.removeListener(l);
}
| Removes the listener that fires when a leaf is clicked |
private boolean readReply() throws IOException {
lastReplyCode=FtpReplyCode.find(readServerResponse());
if (lastReplyCode.isPositivePreliminary()) {
replyPending=true;
return true;
}
if (lastReplyCode.isPositiveCompletion() || lastReplyCode.isPositiveIntermediate()) {
if (lastReplyCode == FtpReplyCode.CLOSING_DATA_CONNECTION) {
getTransferName();
}
return true;
}
return false;
}
| Read the reply from the FTP server. |
public static _Fields findByThriftIdOrThrow(int fieldId){
_Fields fields=findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
| Find the _Fields constant that matches fieldId, throwing an exception if it is not found. |
public static byte[] encodeMPI(BigInteger value,boolean includeLength){
if (value.equals(BigInteger.ZERO)) {
if (!includeLength) return new byte[]{};
else return new byte[]{0x00,0x00,0x00,0x00};
}
boolean isNegative=value.signum() < 0;
if (isNegative) value=value.negate();
byte[] array=value.toByteArray();
int length=array.length;
if ((array[0] & 0x80) == 0x80) length++;
if (includeLength) {
byte[] result=new byte[length + 4];
System.arraycopy(array,0,result,length - array.length + 3,array.length);
uint32ToByteArrayBE(length,result,0);
if (isNegative) result[4]|=0x80;
return result;
}
else {
byte[] result;
if (length != array.length) {
result=new byte[length];
System.arraycopy(array,0,result,1,array.length);
}
else result=array;
if (isNegative) result[0]|=0x80;
return result;
}
}
| MPI encoded numbers are produced by the OpenSSL BN_bn2mpi function. They consist of a 4 byte big endian length field, followed by the stated number of bytes representing the number in big endian format (with a sign bit). |
public StateData(Object parent,Object region,S state,Collection<E> deferred,Collection<? extends Action<S,E>> entryActions,Collection<? extends Action<S,E>> exitActions){
this(parent,region,state,deferred,entryActions,exitActions,false);
}
| Instantiates a new state data. |
public static char toCharValue(char c){
return c;
}
| cast a char value to a char value (do nothing) |
public synchronized void needHeartBeat(){
threadsNeedingHeartBeat++;
progress.progress();
if (threadsNeedingHeartBeat == 1) {
}
}
| inform the background thread that heartbeats are to be issued. Issue a heart beat also |
private IgniteNodeAttributes(){
}
| Enforces singleton. |
public boolean acceptsPickupTrain(Train train){
if (_pickupOption.equals(ANY)) {
return true;
}
if (getTrackType().equals(YARD)) {
return true;
}
if (_pickupOption.equals(TRAINS)) {
return containsPickupId(train.getId());
}
if (_pickupOption.equals(EXCLUDE_TRAINS)) {
return !containsPickupId(train.getId());
}
else if (train.getRoute() == null) {
return false;
}
return acceptsPickupRoute(train.getRoute());
}
| Determine if train can pick up cars from this track. Based on the train's id or train's route id. See setPickupOption(option). |
public final void addElements(int value,int numberOfElements){
if ((m_firstFree + numberOfElements) >= m_mapSize) {
m_mapSize+=(m_blocksize + numberOfElements);
int newMap[]=new int[m_mapSize];
System.arraycopy(m_map,0,newMap,0,m_firstFree + 1);
m_map=newMap;
}
for (int i=0; i < numberOfElements; i++) {
m_map[m_firstFree]=value;
m_firstFree++;
}
}
| Append several int values onto the vector. |
public static void i(String msg){
if (DEBUG) Log.i(TAG,buildMessage(msg));
}
| Send an INFO log message. |
public void stop(BundleContext context) throws Exception {
CodenvyAPI.setClient(previous);
}
| Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle. In general, this method should undo the work that the <code>BundleActivator.start</code> method started. There should be no active threads that were started by this bundle when this bundle returns. A stopped bundle must not call any Framework objects. <p/> <p/> This method must complete and return to its caller in a timely manner. |
public Builder id(Long collectionId){
this.collectionId=collectionId;
return this;
}
| Sets the id for the CollectionTimeline. |
private JsonToken readingConstant(JsonTokenType type,JsonToken token){
try {
int numCharsToRead=((String)type.getValidator()).length();
char[] chars=new char[numCharsToRead];
reader.read(chars);
String stringRead=new String(chars);
if (stringRead.equals(type.getValidator())) {
token.setEndColumn(token.getStartColumn() + numCharsToRead);
token.setText(stringRead);
return token;
}
else {
throwJsonException(stringRead,type);
}
}
catch ( IOException ioe) {
throw new JsonException("An IO exception occurred while reading the JSON payload",ioe);
}
return null;
}
| When a constant token type is expected, check that the expected constant is read, and update the content of the token accordingly. |
private Round(Round prev,Set<JavaFileObject> newSourceFiles,Map<String,JavaFileObject> newClassFiles){
this(prev.nextContext(),prev.number + 1,prev.compiler.log.nerrors,prev.compiler.log.nwarnings,null);
this.genClassFiles=prev.genClassFiles;
List<JCCompilationUnit> parsedFiles=compiler.parseFiles(newSourceFiles);
roots=cleanTrees(prev.roots).appendList(parsedFiles);
if (unrecoverableError()) return;
enterClassFiles(genClassFiles);
List<ClassSymbol> newClasses=enterClassFiles(newClassFiles);
genClassFiles.putAll(newClassFiles);
enterTrees(roots);
if (unrecoverableError()) return;
topLevelClasses=join(getTopLevelClasses(parsedFiles),getTopLevelClassesFromClasses(newClasses));
packageInfoFiles=join(getPackageInfoFiles(parsedFiles),getPackageInfoFilesFromClasses(newClasses));
findAnnotationsPresent();
}
| Create a new round. |
private ArrayList<String> buildLoreString(String achMessage,String level,List<String> rewards,String date,double statistic,boolean inelligibleSeriesItem){
ArrayList<String> lore=new ArrayList<>();
if (date != null) lore.add(ChatColor.translateAlternateColorCodes('&',"&r" + achMessage));
else if (obfuscateNotReceived || (obfuscateProgressiveAchievements && inelligibleSeriesItem)) lore.add(ChatColor.translateAlternateColorCodes('&',"&8&k" + achMessage.replaceAll(REGEX_PATTERN.pattern(),"")));
else lore.add(ChatColor.translateAlternateColorCodes('&',"&8&o" + achMessage.replaceAll(REGEX_PATTERN.pattern(),"")));
lore.add("");
if (date != null) {
lore.add(ChatColor.translateAlternateColorCodes('&',"&r" + date.replaceAll(REGEX_PATTERN.pattern(),"")));
lore.add("");
}
else if (!obfuscateNotReceived && Math.round(statistic) >= 0) {
StringBuilder barDisplay=new StringBuilder("&7[");
int textSize;
if (FONT.isValid(achMessage)) textSize=FONT.getWidth(achMessage.replaceAll(REGEX_PATTERN.pattern(),""));
else textSize=(achMessage.replaceAll(REGEX_PATTERN.pattern(),"")).length() * 3;
for (int i=1; i < textSize / 2; i++) {
if (i < ((textSize / 2 - 1) * statistic) / Integer.parseInt(level)) {
barDisplay.append(plugin.getColor()).append('|');
}
else {
barDisplay.append("&8|");
}
}
barDisplay.append("&7]");
lore.add(ChatColor.translateAlternateColorCodes('&',barDisplay.toString()));
lore.add("");
}
if (!rewards.isEmpty() && !hideRewardDisplay) {
if (date != null) {
lore.add(ChatColor.translateAlternateColorCodes('&',"&r" + plugin.getPluginLang().getString("list-reward","Reward: ")));
for ( String reward : rewards) lore.add(ChatColor.translateAlternateColorCodes('&',"&r- " + reward));
}
else {
lore.add(ChatColor.translateAlternateColorCodes('&',"&o&8" + plugin.getPluginLang().getString("list-reward","Reward: ")));
for ( String reward : rewards) lore.add(ChatColor.translateAlternateColorCodes('&',"&o&8- " + reward));
}
}
return lore;
}
| Create the lore for the current achievement, containing information about the progress, date of reception, description, rewards. |
private void runEnterAnimation(){
final long duration=ANIM_DURATION;
ViewHelper.setPivotX(mViewPager,0);
ViewHelper.setPivotY(mViewPager,0);
ViewHelper.setScaleX(mViewPager,(float)thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager,(float)thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager,thumbnailLeft);
ViewHelper.setTranslationY(mViewPager,thumbnailTop);
ViewPropertyAnimator.animate(mViewPager).setDuration(duration).scaleX(1).scaleY(1).translationX(0).translationY(0).setInterpolator(new DecelerateInterpolator());
ObjectAnimator bgAnim=ObjectAnimator.ofInt(mViewPager.getBackground(),"alpha",0,255);
bgAnim.setDuration(duration);
bgAnim.start();
ObjectAnimator colorizer=ObjectAnimator.ofFloat(ImagePagerFragment.this,"saturation",0,1);
colorizer.setDuration(duration);
colorizer.start();
}
| The enter animation scales the picture in from its previous thumbnail size/location, colorizing it in parallel. In parallel, the background of the activity is fading in. When the pictue is in place, the text description drops down. |
void pluginMessage(Throwable ex){
log.printLines(PrefixKind.JAVAC,"msg.plugin.uncaught.exception");
ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
}
| Print a message reporting an uncaught exception from an annotation processor. |
protected CellEditorListener createCellEditorListener(){
return getHandler();
}
| Creates a listener to handle events from the current editor. |
public static boolean isFileNewer(File file,Date date){
if (date == null) {
throw new IllegalArgumentException("No specified date");
}
return isFileNewer(file,date.getTime());
}
| Tests if the specified <code>File</code> is newer than the specified <code>Date</code>. |
public MonitorStatus(List inserted,List removed){
this.inserted=inserted;
this.removed=removed;
}
| Create a MonitorStatus instance. |
public MutableInterval(long startInstant,long endInstant){
super(startInstant,endInstant,null);
}
| Constructs an interval from a start and end instant with the ISO default chronology. |
public SQLTransientConnectionException(String reason,Throwable cause){
super(reason,cause);
}
| Creates an SQLTransientConnectionException object. The Reason string is set to the given and the cause Throwable object is set to the given cause Throwable object. |
private void reset(){
mLayoutTabs=null;
mAnimatedTab=null;
mClosedTab=null;
}
| Resets the internal state. |
private CalculatorAction(DataWrapper wrapper){
super("Calculator ...");
if (wrapper == null) {
throw new NullPointerException("DataWrapper was null.");
}
this.wrapper=wrapper;
}
| Constructs the calculator action given the data wrapper to operate on. |
public GuacamoleClientTooManyException(String message,Throwable cause){
super(message,cause);
}
| Creates a new GuacamoleClientTooManyException with the given message and cause. |
private void makeDummy(){
dDat=factory2D.make(n,lsum);
for (int i=0; i < q; i++) {
for (int j=0; j < l[i]; j++) {
DoubleMatrix1D curCol=yDat.viewColumn(i).copy().assign(Functions.equals(j + 1));
if (curCol.zSum() == 0) throw new IllegalArgumentException("Discrete data is missing a level: variable " + i + " level "+ j);
dDat.viewColumn(lcumsum[i] + j).assign(curCol);
}
}
}
| Convert discrete data (in yDat) to a matrix of dummy variables (stored in dDat) |
public boolean visit(ParenthesizedExpression node){
return true;
}
| Visits the given type-specific AST node. <p> The default implementation does nothing and return true. Subclasses may reimplement. </p> |
public boolean unlockIt(){
log.info("unlockIt - " + toString());
setProcessing(false);
return true;
}
| Unlock Document. |
protected JavaCompletionProposal createJavaCompletionProposal(CompletionProposal proposal){
switch (proposal.getKind()) {
case CompletionProposal.KEYWORD:
return createKeywordProposal(proposal);
case CompletionProposal.PACKAGE_REF:
return createPackageProposal(proposal);
case CompletionProposal.TYPE_REF:
return createTypeProposal(proposal);
case CompletionProposal.JAVADOC_TYPE_REF:
return createJavadocLinkTypeProposal(proposal);
case CompletionProposal.FIELD_REF:
case CompletionProposal.JAVADOC_FIELD_REF:
case CompletionProposal.JAVADOC_VALUE_REF:
return createFieldProposal(proposal);
case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER:
return createFieldWithCastedReceiverProposal(proposal);
case CompletionProposal.METHOD_REF:
case CompletionProposal.CONSTRUCTOR_INVOCATION:
case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
case CompletionProposal.METHOD_NAME_REFERENCE:
case CompletionProposal.JAVADOC_METHOD_REF:
return createMethodReferenceProposal(proposal);
case CompletionProposal.METHOD_DECLARATION:
return createMethodDeclarationProposal(proposal);
case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
return createAnonymousTypeProposal(proposal,getInvocationContext());
case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
return createAnonymousTypeProposal(proposal,getInvocationContext());
case CompletionProposal.LABEL_REF:
return createLabelProposal(proposal);
case CompletionProposal.LOCAL_VARIABLE_REF:
case CompletionProposal.VARIABLE_DECLARATION:
return createLocalVariableProposal(proposal);
case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
return createAnnotationAttributeReferenceProposal(proposal);
case CompletionProposal.JAVADOC_BLOCK_TAG:
case CompletionProposal.JAVADOC_PARAM_REF:
return createJavadocSimpleProposal(proposal);
case CompletionProposal.JAVADOC_INLINE_TAG:
return createJavadocInlineTagProposal(proposal);
case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
default :
return null;
}
}
| Creates a new java completion proposal from a core proposal. This may involve computing the display label and setting up some context. <p> This method is called for every proposal that will be displayed to the user, which may be hundreds. Implementations should therefore defer as much work as possible: Labels should be computed lazily to leverage virtual table usage, and any information only needed when <em>applying</em> a proposal should not be computed yet. </p> <p> Implementations may return <code>null</code> if a proposal should not be included in the list presented to the user. </p> <p> Subclasses may extend or replace this method. </p> |
@Override public Registrar build(){
checkNotNull(getInstance().type,"Registrar type cannot be null");
checkArgument(getInstance().type.isValidIanaId(getInstance().ianaIdentifier),String.format("Supplied IANA ID is not valid for %s registrar type: %s",getInstance().type,getInstance().ianaIdentifier));
return cloneEmptyToNull(super.build());
}
| Build the registrar, nullifying empty fields. |
public byte[] embedData(byte[] msg,String msgFileName,byte[] cover,String coverFileName,String stegoFileName) throws OpenStegoException {
BufferedImage image=null;
DctLSBOutputStream os=null;
int imgType=0;
try {
if (cover == null) {
image=ImageUtil.generateRandomImage((DCTDataHeader.getMaxHeaderSize() + msg.length) * 8 * DCT.NJPEG* DCT.NJPEG);
}
else {
image=ImageUtil.byteArrayToImage(cover,coverFileName);
}
imgType=image.getType();
os=new DctLSBOutputStream(image,msg.length,msgFileName,this.config);
os.write(msg);
os.close();
return ImageUtil.imageToByteArray(os.getImage(imgType),stegoFileName,this);
}
catch ( IOException ioEx) {
throw new OpenStegoException(ioEx);
}
}
| Method to embed the message into the cover data |
@Override public String validate(Player player,RPAction action,ActionData data){
String playerName=action.get(targetAttribute);
Player targetPlayer=SingletonRepository.getRuleProcessor().getPlayer(playerName);
final String grumpy=targetPlayer.getGrumpyMessage();
if (grumpy == null) {
return null;
}
if (!targetPlayer.containsKey("buddies",player.getName())) {
if (grumpy.length() == 0) {
return playerName + " has a closed mind, and is seeking solitude from all but close friends";
}
else {
return playerName + " is seeking solitude from all but close friends: " + grumpy;
}
}
return null;
}
| validates an RPAction. |
public Entry toCacheEntry(byte[] data){
Entry e=new Entry();
e.data=data;
e.etag=etag;
e.serverDate=serverDate;
e.lastModified=lastModified;
e.ttl=ttl;
e.softTtl=softTtl;
e.responseHeaders=responseHeaders;
return e;
}
| Creates a cache entry for the specified data. |
public Select<Model> or(DataFilterClause filterClause){
filterCriteria.addClause(filterClause,DataFilterConjunction.OR);
return this;
}
| Adds the specified clause with an OR conjunction |
private String obtainGateway(String token){
String gateway=null;
try {
GatewayResponse response=DiscordUtils.GSON.fromJson(REQUESTS.GET.makeRequest(DiscordEndpoints.GATEWAY,new BasicNameValuePair("authorization",token)),GatewayResponse.class);
gateway=response.url;
}
catch ( RateLimitException|DiscordException e) {
Discord4J.LOGGER.error(LogMarkers.API,"Discord4J Internal Exception",e);
}
Discord4J.LOGGER.debug(LogMarkers.API,"Obtained gateway {}.",gateway);
return gateway;
}
| Gets the WebSocket gateway |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.