code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
@CallSuper protected void onCompletion(){
Toro.sInstance.onPlaybackCompletion(this.player);
}
| Complete the playback |
private void updateZoningMap(List<NetworkFCZoneInfo> lastReferenceZoneInfo,URI exportGroupURI,List<URI> exportMaskURIs){
List<URI> emURIs=new ArrayList<URI>();
if (exportMaskURIs == null || exportMaskURIs.isEmpty()) {
ExportGroup exportGroup=_dbClient.queryObject(ExportGroup.class,exportGroupURI);
List<Expo... | This method updates zoning map. This will mostly be called when volume(s) is/are removed from the ExportMask which is shared across two/more varrays and varrays do not have same storage ports which results in creating zoning based on the ports in the varray. lastReferenceZoneInfo contains the zones that were removed fr... |
private static void copySingleProjectToLocation(String projectName,Path target) throws RuntimeException {
File fromFile=new File(new File("probands/" + projectName + "/").getAbsolutePath());
if (fromFile.exists() == false || fromFile.isDirectory() == false) {
throw new RuntimeException("can't obtain proper prob... | Copies given folder structure form resources to the given location in the file system. Symlinks are not followed. |
public List<FeedItem> loadAllDeepFromCursor(Cursor cursor){
int count=cursor.getCount();
List<FeedItem> list=new ArrayList<FeedItem>(count);
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();
identityScope.reserveRoom(count);
}
try {
do {
list.add(... | Reads all available rows from the given cursor and returns a list of new ImageTO objects. |
public void testSSLPubSub() throws Exception {
MqttAndroidClient mqttClient=null;
IMqttToken connectToken=null;
IMqttToken disconnectToken=null;
IMqttToken subToken=null;
IMqttDeliveryToken pubToken=null;
try {
mqttClient=new MqttAndroidClient(mContext,mqttSSLServerURI,"testSSLPubSub");
MqttConnectO... | An SSL connection with server cert authentication, simple pub/sub of an message |
public boolean reverseAccrualIt(){
m_processMsg=ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) return false;
boolean ok_reverse=(reverseAccrualIt(getGL_JournalBatch_ID()) != null);
if (!ok_reverse) return false;
m_processMsg=ModelVa... | Reverse Accrual (sane batch). Flip Dr/Cr - Use Today's date |
public static void flushMethod(){
try {
((LocalRegion)region).getDiskRegion().forceFlush();
}
catch ( Exception ex) {
ex.printStackTrace();
}
}
| Force flush the data to disk |
public Property basicGetProperty(){
return property;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public int currentSegment(float[] coords){
if (isDone()) {
throw new NoSuchElementException("line iterator out of bounds");
}
int type;
if (index == 0) {
coords[0]=(float)line.getX1();
coords[1]=(float)line.getY1();
type=SEG_MOVETO;
}
else {
coords[0]=(float)line.getX2();
coords[1]=(f... | Returns the coordinates and type of the current path segment in the iteration. The return value is the path segment type: SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. A float array of length 6 must be passed in and may be used to store the coordinates of the point(s). Each point is stored as a pair of... |
private boolean zzRefill() throws java.io.IOException {
if (zzStartRead > 0) {
System.arraycopy(zzBuffer,zzStartRead,zzBuffer,0,zzEndRead - zzStartRead);
zzEndRead-=zzStartRead;
zzCurrentPos-=zzStartRead;
zzMarkedPos-=zzStartRead;
zzStartRead=0;
}
if (zzCurrentPos >= zzBuffer.length) {
cha... | Refills the input buffer. |
public void treeNodesRemoved(TreeModelEvent e){
if (e != null) {
int changedIndexs[];
int maxCounter;
TreePath parentPath=SwingUtilities2.getTreePath(e,getModel());
FHTreeStateNode changedParentNode=getNodeForPath(parentPath,false,false);
changedIndexs=e.getChildIndices();
if (changedParentNod... | <p>Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.</p> <p>e.path() returns the former parent of the deleted nodes.</p> <p>e.childIndices(... |
public void onChanging(InputEvent evt){
if (!evt.isChangingBySelectBack()) {
refresh(evt.getValue());
}
}
| Event handler responsible to reducing number of items Method is invoked each time something is typed in the combobox |
static Bundle loadBundle(BundleContext context) throws BundleException, IOException {
for ( Bundle bundle : context.getBundles()) {
if (OsgiExecImp.BUNDLE_SYMBOLIC_NAME.equals(bundle.getSymbolicName())) {
return bundle;
}
}
URLClassLoader classLoader=(URLClassLoader)OsgiExecImp.class.getClassLoader... | Returns this bundle within the given OSGi context, initializing it if necessary. |
public static void sort(short[] array,int start,int end){
DualPivotQuicksort.sort(array,start,end);
}
| Sorts the specified range in the array in ascending numerical order. |
public static IProject createSimpleProject(String projectName,String... natureIds) throws CoreException {
IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
if (project.exists()) {
project.delete(true,true,npm());
}
project.create(npm());
project.open(npm());
if (natureId... | Creates a simple project. |
public static void llenarInformacionError(InformacionError ie,int codigoError,Exception e){
llenarInformacionError(ie,codigoError + "",e);
}
| introducir la informacion de la excepcion en ie |
public CustomShortcutSet(@NotNull Shortcut... shortcuts){
myShortcuts=shortcuts.length == 0 ? Shortcut.EMPTY_ARRAY : shortcuts.clone();
}
| Creates <code>CustomShortcutSet</code> which contains specified keyboard and mouse shortcuts. |
public static void join(byte[] baggageBytes){
join(DetachedBaggage.deserialize(baggageBytes));
}
| Deserialize the provided baggage and merge its contents into the current thread's baggage. |
public void reverse(){
short tmp;
int limit=size / 2;
int j=size - 1;
short[] 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 void openDriver(SurfaceHolder holder) throws IOException {
if (camera == null) {
camera=Camera.open();
if (camera == null) {
throw new IOException();
}
camera.setPreviewDisplay(holder);
if (!initialized) {
initialized=true;
configManager.initFromCameraParameters(camera);
... | Opens the camera driver and initializes the hardware parameters. |
public font addElement(String hashcode,String element){
addElementToRegistry(hashcode,element);
return (this);
}
| Adds an Element to the element. |
public void nextGeneration(){
generation++;
}
| Increase the generation number by one. |
public static void main(String[] args) throws IOException {
InputStream is=new BufferedInputStream(new FileInputStream(args[0]));
try {
if (BlockCompressedInputStream.isValidFile(is)) {
is=new BlockCompressedInputStream(is);
System.out.println(tbiIndexToUniqueString(is));
}
else {
System.... | prints the index file in string form |
protected AbstractMatrix3D vDice(int axis0,int axis1,int axis2){
int d=3;
if (axis0 < 0 || axis0 >= d || axis1 < 0 || axis1 >= d || axis2 < 0 || axis2 >= d || axis0 == axis1 || axis0 == axis2 || axis1 == axis2) {
throw new IllegalArgumentException("Illegal Axes: " + axis0 + ", "+ axis1+ ", "+ axis2);
}
int[... | Self modifying version of viewDice(). |
@SuppressWarnings({"unchecked"}) public static <T>OperatorSwitchThenUnsubscribe<T> instance(){
return (OperatorSwitchThenUnsubscribe<T>)Holder.INSTANCE;
}
| Returns a singleton instance of the operator for non delayed. |
public int ping() throws RecoverPointException {
String mgmtIPAddress=_endpoint.toASCIIString();
if (null == mgmtIPAddress) {
throw RecoverPointException.exceptions.noRecoverPointEndpoint();
}
try {
logger.info("RecoverPoint service: Checking RP access for endpoint: " + _endpoint.toASCIIString());
f... | tests credentials to ensure they are correct, and that the RP site is up and running |
public static boolean isChildRecordFoundError(Exception e){
if (DB.isPostgreSQL()) return isSQLState(e,"23503");
return isErrorCode(e,2292);
}
| Check if "child record found" exception (aka ORA-02292) |
public static int readInts(final File f,final LongIndex a,final long offset,final long addend) throws IOException {
return readInts(f,0,(int)f.length() / 4,a,offset,addend);
}
| Read an array of longs from a file. |
String writeToNamedTmpFile(String filename,String... data) throws IOException {
return writeToNamedTmpFile(filename,Joiner.on('\n').join(data).getBytes(UTF_8));
}
| Writes the data to a named temporary file and then returns a path to the file. |
private Uri insertWifiMeasurement(final Uri baseUri,final ContentValues values){
if (values.containsKey(Schema.COL_BEGIN_POSITION_ID) && values.containsKey(Schema.COL_END_POSITION_ID) && values.containsKey(Schema.COL_TIMESTAMP)) {
final long rowId=mDbHelper.getWritableDatabase().insert(Schema.TBL_WIFIS,null,value... | Inserts a wifi measurement |
public void writeURL(String url) throws IOException {
writeUTF('U',url);
}
| Writes a URL to the stream. |
public boolean only_stack_locals(){
return soot.PhaseOptions.getBoolean(options,"only-stack-locals");
}
| Only Stack Locals -- . Only propagate copies through locals that represent stack locations in the original bytecode. |
public static void convertUTMCoordinatesToGeographic(int zone,String hemisphere,DoubleBuffer buffer){
if (zone < 1 || zone > 60) {
String message=Logging.getMessage("generic.ZoneIsInvalid",zone);
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (!AVKey.NORTH.equals(h... | Converts the specified buffer of UTM tuples to geographic coordinates, according to the specified UTM zone and hemisphere. The buffer must be organized as pairs of tightly packed UTM tuples in the order <code>(easting, northing)</code>. Each UTM tuple is replaced with its corresponding geographic location in the order ... |
public NodeFigure(){
RectangleFigure rf=new RectangleFigure();
setDecorator(rf);
createConnectors();
set(DECORATOR_INSETS,new Insets2D.Double(6,10,6,10));
ResourceBundleUtil labels=ResourceBundleUtil.getBundle("org.jhotdraw.samples.net.Labels");
setText(labels.getString("nodeDefaultName"));
setAttributeEn... | Creates a new instance. |
public Adapter createEObjectAdapter(){
return null;
}
| Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!-- end-user-doc --> |
public void loadMedia(MediaInfo media,boolean autoPlay,int position,JSONObject customData) throws TransientNetworkDisconnectionException, NoConnectionException {
loadMedia(media,null,autoPlay,position,customData);
}
| Loads a media. For this to succeed, you need to have successfully launched the application. |
@Override public int numPendingOutput(){
return m_attributeFilter.numPendingOutput();
}
| Returns the number of instances pending output |
private static void readJson() throws IOException {
String str="{\"message\":\"Hi\",\"place\":{\"name\":\"World!\"}}";
InputStream in=new ByteArrayInputStream(str.getBytes(Charset.forName("UTF-8")));
JsonReader reader=new JsonReader(new InputStreamReader(in,"UTF-8"));
while (reader.hasNext()) {
JsonToken js... | Example to readJson using StreamingAPI |
public static void print(PrintWriter self,Object value){
self.print(InvokerHelper.toString(value));
}
| Print a value formatted Groovy style to the print writer. |
public boolean isDescendentOf(Node node1,Node node2){
return (node1 == node2) || isProperDescendentOf(node1,node2);
}
| Determines whether one node is a descendent of another. |
public void reset(){
token=null;
status=S_INIT;
handlerStatusStack=null;
}
| Reset the parser to the initial state without resetting the underlying reader. |
public static SimpleNode parse(Reader reader,String templateName) throws ParseException {
return RuntimeSingleton.parse(reader,templateName);
}
| Parse the input and return the root of AST node structure. <br><br> In the event that it runs out of parsers in the pool, it will create and let them be GC'd dynamically, logging that it has to do that. This is considered an exceptional condition. It is expected that the user will set the PARSER_POOL_SIZE property ... |
public boolean isURL(){
return url != null;
}
| public void launchInBrowser() { if (isURL()) { try { browserLauncher = new BrowserLauncher(); browserLauncher.openURLinBrowser(url.toString()); } catch (BrowserLaunchingInitializingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedOperatingSystemException e) { // TODO Auto-gener... |
private TennisBall(int ttl,boolean ping){
this.ttl=ttl;
this.ping=ping;
}
| Creates a new ball with the specified TTL value and PING/PONG state. |
private String installCode(){
return "if (typeof(" + jsLookupTable + ") == 'undefined'){"+ jsLookupTable+ "=[]}";
}
| Stock Javascript code that is included before all javascript requests to create a lookup table for the JS objects if one hasn't been created yet. |
public boolean isInStandbyMode(){
return schedThread.isPaused();
}
| <p> Reports whether the <code>Scheduler</code> is paused. </p> |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:52.816 -0400",hash_original_method="DA70D8E8EFCF4CE896E4E17AB2D27792",hash_generated_method="808C5618E8DCBABF47C90F606652224D") @Override public synchronized void reset() throws IOException {
if (!markSupp... | Reset the stream to the point when mark was last called. |
public void waitForSchemaAgreement(String targetSchemaVersion,int nodeCount){
long start=System.currentTimeMillis();
Map<String,List<String>> versions=null;
while (System.currentTimeMillis() - start < MAX_SCHEMA_WAIT_MS) {
log.info("schema version to sync to: {}, required node count: {}",targetSchemaVersion,n... | Waits for schema change to propagate through all nodes of cluster It doesn't check if all nodes are of this version when nodeCount == -1 |
public void testSenderWithSpringXmlUsingSpring2NamespacesWithEmbeddedBrokerConfiguredViaXml() throws Exception {
String config="spring-embedded-xbean.xml";
assertSenderConfig(config);
}
| Spring configured test case that tests the remotely deployed xsd http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-SNAPSHOT.xsd |
protected void parseSkew() throws ParseException, IOException {
current=reader.read();
if (current != 'e') {
reportCharacterExpectedError('e',current);
skipTransform();
return;
}
current=reader.read();
if (current != 'w') {
reportCharacterExpectedError('w',current);
skipTransform();
re... | Parses a skew transform. 'e' is assumed to be the current character. |
public void addProperty(String name,String value){
properties.put(name,value);
}
| Adds a property. |
public static long convert(String stringValue){
if (Strings.isNullOrEmpty(stringValue) || TypeUtils.MISSING_INDICATORS.contains(stringValue)) {
return (long)ColumnType.LONG_INT.getMissingValue();
}
Matcher matcher=COMMA_PATTERN.matcher(stringValue);
return Long.parseLong(matcher.replaceAll(""));
}
| Returns a float that is parsed from the given String <p> We remove any commas before parsing |
public ProportionVectors(FlagConfig flagConfig){
Random random=new Random(randomSeed);
while (true) {
this.vectorStart=VectorFactory.generateRandomVector(flagConfig.vectortype(),flagConfig.dimension(),flagConfig.seedlength(),random);
this.vectorEnd=VectorFactory.generateRandomVector(flagConfig.vectortype(),... | Constructs an instance from the given flag config. |
public void exit(){
synchronized (statemachine) {
statemachine.exit();
}
}
| exit() will be delegated thread-safely to the wrapped state machine. |
public NokiaGroupGraphic(byte[] bitmapData){
super(SmsPort.NOKIA_CLI_LOGO,SmsPort.ZERO);
bitmapData_=bitmapData;
}
| Creates a group graphic SMS message <p> The given byte array must be in the Nokia OTA image format. |
private JsonObject readConfig(File f){
try {
return (new JsonParser()).parse(new FileReader(f)).getAsJsonObject();
}
catch ( JsonIOException e) {
Log.error("IOException while reading remote config.");
e.printStackTrace();
return null;
}
catch ( FileNotFoundException e) {
Log.error("Couldn't... | Parses the MCEF configuration file. |
private static double distance(double[] subseries,double[] series,int from,int to,double nThreshold) throws Exception {
double[] subsequence=tp.znorm(tp.subseriesByCopy(series,from,to),nThreshold);
Double sum=0D;
for (int i=0; i < subseries.length; i++) {
double tmp=subseries[i] - subsequence[i];
sum=sum ... | Calculates the Euclidean distance between two points. Don't use this unless you need that. |
@SuppressWarnings("unchecked") public static <O>Map<String,? extends Attribute<O,?>> createAttributes(Class<O> pojoClass){
final Map<String,Attribute<O,?>> attributes=new TreeMap<String,Attribute<O,?>>();
Class currentClass=pojoClass;
while (currentClass != null && currentClass != Object.class) {
for ( Fie... | Auto-generates and instantiates a set of attributes which read values from the fields in the given POJO class. <p> Attributes will be generated for all non-private fields declared directly in the POJO class, and for inherited fields as well, as long as the access modifiers on inherited fields in their superclass(es) al... |
GuiProgressListener(JProgressBar progressBar,JTextComponent textComponent){
this.progressBar=checkNotNull(progressBar);
this.textComponent=checkNotNull(textComponent);
}
| Creates a new GuiProgressListener that updates the given progress bar and text component. |
protected byte[] hexStringToByteArray(String hexString){
int len=hexString.length();
byte[] data=new byte[len / 2];
for (int i=0; i < len; i+=2) {
data[i / 2]=(byte)((Character.digit(hexString.charAt(i),16) << 4) + Character.digit(hexString.charAt(i + 1),16));
}
return data;
}
| Converts hex values from strings to byte arra |
private String generateFileForFramework(Framework fw,Width arch) throws Exception {
File tempfile=File.createTempFile("JObjC-SOR-" + fw.name + "-"+ arch+ "-",".mm");
PrintWriter out=new PrintWriter(new FileWriter(tempfile));
out.println("#include<iostream>");
printHeaderLines(fw,arch,out);
out.println("");
... | Generates Objective-C file and returns absolute path name. |
public RealmSampleUserItem withEnabled(boolean enabled){
this.mEnabled=enabled;
return this;
}
| set if this item is enabled |
private void createFromAssets(String dbName,File dbfile,InputStream assetFileInputStream){
OutputStream out=null;
try {
Log.v("info","Copying pre-populated DB content");
String dbPath=dbfile.getAbsolutePath();
dbPath=dbPath.substring(0,dbPath.lastIndexOf("/") + 1);
File dbPathFile=new File(dbPath);
... | If a prepopulated DB file exists in the assets folder it is copied to the dbPath. Only runs the first time the app runs. |
@Override public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
mListName=getArguments().getString(Constants.KEY_LIST_NAME);
}
| Initialize instance variables with data from bundle |
public void removeListener(EnvLoaderListener listener){
super.removeListener(listener);
ArrayList<EnvLoaderListener> listeners=_listeners;
if (_listeners == null) return;
synchronized (listeners) {
for (int i=listeners.size() - 1; i >= 0; i--) {
EnvLoaderListener oldListener=listeners.get(i);
if... | Adds a listener to detect environment lifecycle changes. |
protected IElementType parseCloseAngle(){
if (myOpenedAngles.isEmpty()) {
return POD_SYMBOL;
}
int bufferEnd=getBufferEnd();
int tokenStart=getTokenStart();
int run=tokenStart;
CharSequence buffer=getBuffer();
int lastIndex=myOpenedAngles.size() - 1;
int anglesNumber=myOpenedAngles.get(lastIndex);
... | Pre-parses closing angles |
private void addTrackFromGpxFile(){
EndToEndTestUtils.deleteAllTracks();
deleteExternalStorageFiles(TrackFileFormat.GPX);
createOneGpxFile();
importTracks(TrackFileFormat.GPX);
checkImportSuccess();
checkTrackFromGpxFile();
}
| Adds one track by importing it from a GPX file. |
public boolean isInSegment(double angle){
return angle >= mStartAngle && angle <= mEndAngle;
}
| Checks if angle falls in segment. |
public void testAdd(){
try {
LinkedBlockingQueue q=new LinkedBlockingQueue(SIZE);
for (int i=0; i < SIZE; ++i) {
assertTrue(q.add(new Integer(i)));
}
assertEquals(0,q.remainingCapacity());
q.add(new Integer(SIZE));
shouldThrow();
}
catch ( IllegalStateException success) {
}
}
| add succeeds if not full; throws ISE if full |
public DictionaryInfo forceSave(Dictionary<?> newDict,DictionaryInfo newDictInfo) throws IOException {
initDictInfo(newDict,newDictInfo);
logger.info("force to save dict directly");
return saveNewDict(newDictInfo);
}
| Save the dictionary as it is. More often you should consider using its alternative trySaveNewDict to save dict space |
int minInsertionsDP(String s){
int n=s.length();
int[][] dp=new int[n][n];
for (int gap=1; gap < n; gap++) {
for (int l=0, h=gap; h < n; l++, h++) {
dp[l][h]=s.charAt(l) == s.charAt(h) ? dp[l + 1][h - 1] : Math.min(dp[l][h - 1],dp[l + 1][h]) + 1;
}
}
return dp[0][n - 1];
}
| DP, bottom-up Fill a table in diagonal direction |
public void next(){
pos++;
}
| moves the internal pointer to the next position, no check if the next position is still valid |
public void show(Animation anim){
show(true,anim);
}
| Make the badge visible in the UI. |
public synchronized boolean removeSuspendedResponse(WorkerCategory category,Response response){
Deque<Response> deque=workersByCategory.get(category);
if (deque == null) {
return false;
}
if (deque.remove(response)) {
nWaitingConsumers-=1;
LOG.debug("Removed closed connection from queue.");
retu... | When we notice that a long poll connection has closed, we remove it here. |
private void installProperties(){
System.setProperty("http.agent",UserAgentGenerator.getUserAgent());
if (OSUtils.isMacOSX()) {
System.setProperty("apple.laf.useScreenMenuBar","true");
}
}
| Installs any system properties. |
@Override protected void processData(int offsetInchunk,byte[] buf,int off,int len){
if (skipBytes && offsetInchunk < 4) {
for (int oc=offsetInchunk; oc < 4 && len > 0; oc++, off++, len--) skippedBytes[oc]=buf[off];
}
if (len > 0) {
deflatedChunksSet.processBytes(buf,off,len);
if (alsoBuffer) {
... | Delegates to ChunkReaderDeflatedSet.processData() |
public void test_getLowestSetBitNeg(){
byte aBytes[]={-1,-128,56,100,-2,-76,89,45,91,3,-15,35,26};
int aSign=-1;
int iNumber=1;
BigInteger aNumber=new BigInteger(aSign,aBytes);
int result=aNumber.getLowestSetBit();
assertTrue("incorrect value",result == iNumber);
}
| java.math.BigInteger#getLowestSetBit() getLowestSetBit for negative BigInteger |
@Override public void mark(int markLimit){
}
| Since we do not support marking just yet, we do nothing. |
@Override public void close() throws IOException {
if (null != dictionaryFileReader) {
dictionaryFileReader.close();
dictionaryFileReader=null;
}
}
| Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. |
public PathfindingAction(final Module module){
super("Pathfinder");
m_module=module;
setEnabled(module.isLoaded());
m_module.addListener(m_updater);
}
| Creates a new pathfinding action object. |
private GraphNode[] fillGraphModel(GraphModel graph){
GraphNode[] nodes=new GraphNode[7];
GraphBuilder builder=graph.getBuilder();
nodes[0]=builder.newNode(new MockElement("Package1"));
nodes[1]=builder.newNode(new MockElement("Package2"));
nodes[2]=builder.newNode(new MockElement("Package3"));
nodes[3]=bui... | Creates new GraphNodes, adds edges and puts them in the provided graph so that it can be used in tests. |
public static String join(String[] array,String separator){
int len=array.length;
if (len == 0) return "";
StringBuilder out=new StringBuilder();
out.append(array[0]);
for (int i=1; i < len; i++) {
out.append(separator).append(array[i]);
}
return out.toString();
}
| Join an array of strings with the given separator. <p> Note: This might be replaced by utility method from commons-lang or guava someday if one of those libraries is added as dependency. </p> |
public double length(){
return Math.sqrt(x * x + y * y + z * z);
}
| <p> computes the length of the vector. </p> |
public void processPendingDeletes(Index index,Settings indexSettings,TimeValue timeout) throws IOException {
logger.debug("{} processing pending deletes",index);
final long startTimeNS=System.nanoTime();
final List<ShardLock> shardLocks=nodeEnv.lockAllForIndex(index,indexSettings,timeout.millis());
try {
Ma... | Processes all pending deletes for the given index. This method will acquire all locks for the given index and will process all pending deletes for this index. Pending deletes might occur if the OS doesn't allow deletion of files because they are used by a different process ie. on Windows where files might still be open... |
public LargeValueFormatter(String appendix){
this();
mText=appendix;
}
| Creates a formatter that appends a specified text to the result string |
public void commitChanges(Collection<Synapse> synapses){
double uB=Utils.doubleParsable(tfUpBound);
if (!Double.isNaN(uB)) {
for ( Synapse s : synapses) {
s.setUpperBound(uB);
}
}
double lB=Utils.doubleParsable(tfLowBound);
if (!Double.isInfinite(lB)) {
for ( Synapse s : synapses) {
... | Uses the values from text fields to alter corresponding values in the synapse(s) being edited. Called externally to apply changes. |
@SuppressWarnings("unchecked") private void validateAndPopulate(Boolean allowNonUpnFormat) throws InvalidTokenException {
JAXBElement<AssertionType> jaxbParserResult=null;
try {
Unmarshaller unmarshaller=_jaxbContext.createUnmarshaller();
unmarshaller.setSchema(SAML_SCHEMA);
jaxbParserResult=(JAXBElemen... | Parses the xml string representing the SAML token.<br> Validates that the schema format is correct and the token fields are semantically correct.<br> Populates the class members with the values provided in the token.<br> |
public boolean containsValue(V v){
for ( LinkedList<V> l : boxedHashMap.values()) {
if (l.contains(v)) {
return true;
}
}
return false;
}
| Returns <tt>true</tt> if this map maps one or more keys to the specified value. |
private static void sort(int[] a,int left,int right,boolean leftmost){
int length=right - left + 1;
if (length < INSERTION_SORT_THRESHOLD) {
if (leftmost) {
for (int i=left, j=i; i < right; j=++i) {
int ai=a[i + 1];
while (ai < a[j]) {
a[j + 1]=a[j];
if (j-- == left) {
... | Sorts the specified range of the array by Dual-Pivot Quicksort. |
public FastAdapterDialog<Item> add(int position,List<Item> items){
mFastItemAdapter.add(position,items);
return this;
}
| add a list of items at the given position within the existing items |
public CViewSearcherDialog(final Window owner,final IViewContainer viewContainer,final IAddress address){
super(owner,"Select a graph",ModalityType.APPLICATION_MODAL);
Preconditions.checkNotNull(viewContainer,"IE02057: View container can't be null");
m_viewContainer=viewContainer;
createGui();
new CDialogEsca... | Creates a new dialog. |
public static void main(final String[] args){
DOMTestCase.doMain(hc_attrname.class,args);
}
| Runs this test from the command line. |
@Override public void write(byte[] buffer,int offset,int length) throws IOException {
while ((mByteToSkip > 0 || mByteToCopy > 0 || mState != STATE_JPEG_DATA) && length > 0) {
if (mByteToSkip > 0) {
int byteToProcess=length > mByteToSkip ? mByteToSkip : length;
length-=byteToProcess;
mByteToSkip... | Writes the image out. The input data should be a valid JPEG format. After writing, it's Exif header will be replaced by the given header. |
public static <T,R>int highSum(Function<T,Integer> f1,Function<R,Integer> f2,T data1,R data2){
return f1.apply(data1) + f2.apply(data2);
}
| A higher order function - sums the results of two other functions, passed to it as parameters. |
public HashCodeBuilder append(final double[] array){
if (array == null) {
iTotal=iTotal * iConstant;
}
else {
for ( final double element : array) {
append(element);
}
}
return this;
}
| <p> Append a <code>hashCode</code> for a <code>double</code> array. </p> |
public boolean isError(final OneDriveErrorCodes expectedCode){
if (code.equalsIgnoreCase(expectedCode.toString())) {
return true;
}
OneDriveInnerError innerError=innererror;
while (null != innerError) {
if (innerError.code.equalsIgnoreCase(expectedCode.toString())) {
return true;
}
innerEr... | Determine if the given error code is the one that is expected. |
public static Play copy(Play play){
Play copy=new Play(play.playId,play.gameId,play.gameName);
copy.setDate(play.getDate());
copy.quantity=play.quantity;
copy.length=play.length;
copy.location=play.location;
copy.setIncomplete(play.Incomplete());
copy.setNoWinStats(play.NoWinStats());
copy.comments=play... | Copy the semantic play information to a new play. Does not include data related to syncing. |
public ScMappingProfile[] findMappingProfiles(String serverId,String volumeId) throws StorageCenterAPIException {
PayloadFilter filter=new PayloadFilter();
filter.append("server",serverId);
filter.append("volume",volumeId);
RestResult rr=restClient.post("StorageCenter/ScMappingProfile/GetList",filter.toJson());... | Finds mapping between a server and volume. |
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
}
| Adds semantic checks to the default deserialization method. This method must have the standard signature for a readObject method, and the body of the method must begin with "s.defaultReadObject();". Other than that, any semantic checks can be specified and do not need to stay the same from version to version. A readObj... |
public JSONArray put(int value){
this.put(new Integer(value));
return this;
}
| Append an int value. This increases the array's length by one. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.