code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public static byte[] toPrimitive(Byte[] array){
if (array == null) {
return null;
}
else if (array.length == 0) {
return EMPTY_BYTE_ARRAY;
}
final byte[] result=new byte[array.length];
for (int i=0; i < array.length; i++) {
result[i]=array[i].byteValue();
}
return result;
}
| <p>Converts an array of object Bytes to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> |
public Text concat(Text that){
final int length=this._count + that._count;
if (length <= BLOCK_SIZE) {
Text text=Text.newPrimitive(length);
this.getChars(0,this._count,text._data,0);
that.getChars(0,that._count,text._data,this._count);
return text;
}
else {
Text head=this;
Text tail=that;... | Concatenates the specified text to the end of this text. This method is very fast (faster even than <code>StringBuffer.append(String)</code>) and still returns a text instance with an internal binary tree of minimal depth! |
public ClientMessenger(final String host,final int port,final String name,final String mac,final IObjectStreamFactory streamFact,final IConnectionLogin login) throws IOException {
m_socketChannel=SocketChannel.open();
m_socketChannel.configureBlocking(false);
final InetSocketAddress remote=new InetSocketAddress(h... | Note, the name paramater passed in here may not match the name of the ClientMessenger after it has been constructed. |
private List<Entry> reduceWithDouglasPeuker(List<Entry> entries,double epsilon){
if (epsilon <= 0 || entries.size() < 3) {
return entries;
}
keep[0]=true;
keep[entries.size() - 1]=true;
algorithmDouglasPeucker(entries,epsilon,0,entries.size() - 1);
List<Entry> reducedEntries=new ArrayList<Entry>();
fo... | uses the douglas peuker algorithm to reduce the given List of entries |
public static double mapValueFromRangeToRange(double value,double fromLow,double fromHigh,double toLow,double toHigh){
double fromRangeSize=fromHigh - fromLow;
double toRangeSize=toHigh - toLow;
double valueScale=(value - fromLow) / fromRangeSize;
return toLow + (valueScale * toRangeSize);
}
| Map a value within a given range to another range. |
private int buildMessage(StringBuilder message,List<Offer> offers,Map<String,Offer> map,boolean usingFilter){
int counter=0;
for ( Offer offer : offers) {
counter++;
if (counter > MAX_SHOWN_OFFERS) {
message.append("Only " + MAX_SHOWN_OFFERS + " first offers shown.");
if (!usingFilter) {
... | Format a message out of an offer list, and update an offermap to match it. |
public void switchHost(HostInfo hostInfo){
releaseCurrentHost();
currentHostInfo=hostInfo;
if (currentHostInfo != null) {
PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(Settings.KEY_PREF_CURRENT_HOST_ID,currentHostInfo.getId()).apply();
}
}
| Sets the current host. |
public Rectangle modelToView(int pos) throws BadLocationException {
return getUI().modelToView(this,pos);
}
| Converts the given location in the model to a place in the view coordinate system. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized). The component does not have to be visible or painted. |
public void paintToggleButtonBorder(SynthContext context,Graphics g,int x,int y,int w,int h){
}
| Paints the border of a toggle button. |
private static String stripNonCharCodepoints(String input){
StringBuilder stripped=new StringBuilder(input.length());
char ch;
for (int i=0; i < input.length(); i++) {
ch=input.charAt(i);
if (ch % 0x10000 != 0xffff && ch % 0x10000 != 0xfffe && (ch <= 0xfdd0 || ch >= 0xfdef) && (ch > 0x1F || ch == 0x9 || c... | Strip all non-characters, which can cause SolrReducer problems if present. This is borrowed from Apache Nutch. |
private static void toFile(String filePath,Object... msg){
File logFile=null;
try {
logFile=createFile(filePath,true);
}
catch ( IOException e) {
e.printStackTrace();
}
if (logFile != null) {
try {
BufferedWriter buf=new BufferedWriter(new FileWriter(logFile,true));
buf.append(getMsg... | log something to file |
public void done(){
isCompleted=true;
earlier=null;
}
| Called to indicate that the latch completed and a later latch can start. |
public void emitop1w(int op,int od){
if (od > 0xFF) {
emitop(wide);
emitop(op);
emit2(od);
}
else {
emitop(op);
emit1(od);
}
if (!alive) return;
switch (op) {
case iload:
state.push(syms.intType);
break;
case lload:
state.push(syms.longType);
break;
case fload:
state.push(syms.float... | Emit an opcode with a one-byte operand field; widen if field does not fit in a byte. |
public boolean hasDates(){
return hasRepeatingExtension(Date.class);
}
| Returns whether it has the dates. |
static byte[] discardWhitespace(byte[] data){
byte groomedData[]=new byte[data.length];
int bytesCopied=0;
for (int i=0; i < data.length; i++) {
switch (data[i]) {
case (byte)' ':
case (byte)'\n':
case (byte)'\r':
case (byte)'\t':
break;
default :
groomedData[bytesCopied++]=data[i];
}
}
byte packedData[... | Discards any whitespace from a base-64 encoded block. |
boolean collapseGroup(int groupPos){
ExpandableHListPosition elGroupPos=ExpandableHListPosition.obtain(ExpandableHListPosition.GROUP,groupPos,-1,-1);
PositionMetadata pm=getFlattenedPos(elGroupPos);
elGroupPos.recycle();
if (pm == null) return false;
boolean retValue=collapseGroup(pm);
pm.recycle();
ret... | Collapse a group in the grouped list view |
public boolean isFractalNoise(){
return fractalNoise;
}
| Returns true if the turbulence function is using fractal noise, instead of turbulence noise. |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:38.038 -0500",hash_original_method="062E55715164230436BF863A3994A273",hash_generated_method="29D0A8B9D260A09CC32C49AB2CD937C9") public static UUID randomUUID(){
byte[] da... | <p> Generates a variant 2, version 4 (randomly generated number) UUID as per <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>. |
@SuppressWarnings("unused") private static String convertNodeToXML(Node node){
StringWriter writer=new StringWriter();
Transformer transformer;
try {
transformer=TransformerFactory.newInstance().newTransformer();
transformer.transform(new DOMSource(node),new StreamResult(writer));
}
catch ( Transforme... | Converts a node to a raw XML string. |
protected ParameterImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void updateProgress(int progress){
if (myHost != null) {
myHost.updateProgress(progress);
}
else {
System.out.println("Progress: " + progress + "%");
}
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public BinarySearchST(){
this(INIT_CAPACITY);
}
| Initializes an empty symbol table. |
public void test_DELETE_accessPath_delete_c1() throws Exception {
if (TestMode.quads != getTestMode()) return;
doInsertbyURL("POST",packagePath + "test_delete_by_access_path.trig");
final long mutationResult=doDeleteWithAccessPath(null,null,null,new URIImpl("http://www.bigdata.com/c1"));
assertEquals(2,mutati... | Delete everything in a different named graph (context). |
public static void fillStickyDrawerItemFooter(DrawerBuilder drawer,ViewGroup container,View.OnClickListener onClickListener){
for ( IDrawerItem drawerItem : drawer.mStickyDrawerItems) {
int selected_color=UIUtils.getThemeColorFromAttrOrRes(container.getContext(),R.attr.material_drawer_selected,R.color.material_d... | helper method to fill the sticky footer with it's elements |
public RedisStateMachinePersister(StateMachinePersist<S,E,String> stateMachinePersist){
super(stateMachinePersist);
}
| Instantiates a new redis state machine persister. |
void check(ThreadReference thr){
String kind="";
if (thr != null) {
try {
kind="ownedMonitors()";
System.out.println("kind = " + kind);
if (thr.ownedMonitors() == null) {
failure("failure: ownedMonitors = null");
}
kind="ownedMonitorsAndFrames()";
System.out.println("... | test core |
public boolean isReused(){
return isReused;
}
| Is image reused |
public final int yylength(){
return zzMarkedPos - zzStartRead;
}
| Returns the length of the matched text region. |
private static String processIfChildNodesExists(Class cls,Object object,Class[] noparams,String elementName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
String childNodeOutput=null;
Method method=cls.getDeclaredMethod(XMLConstants.CHILD_NODE_METHOD,noparams);
Object output=me... | Process the child nodes if they are present in the object which is passed in. |
static double squaredDistanceTo(final double x2,final double y2){
if (User.isNull()) {
return Double.POSITIVE_INFINITY;
}
return (User.get().getX() - x2) * (User.get().getX() - x2) + (User.get().getY() - y2) * (User.get().getY() - y2);
}
| calculates the squared distance between the user and the specified coordinates |
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
ZogUtils.printLog(getClass(),"onInterceptTouchEvent");
float lastX=ev.getX();
float lastY=ev.getY();
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
mIsHorizontal=null;
mFirstX=lastX;
mFirstY=lastY;
int motionPosition=pointToPosition((i... | return true, deliver to listView. return false, deliver to child. if move, return true |
private static char CallNonvirtualCharMethodV(JNIEnvironment env,int objJREF,int classJREF,int methodID,Address argAddress) throws Exception {
if (traceJNI) VM.sysWrite("JNI called: CallNonvirtualCharMethodV \n");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj=env.getJNIRef(objJREF);
Obje... | CallNonvirtualCharMethodV: invoke a virtual method that returns a char value |
public static void convertActivityToTranslucentBeforeL(Activity activity){
try {
Class<?>[] classes=Activity.class.getDeclaredClasses();
Class<?> translucentConversionListenerClazz=null;
for ( Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
... | Calling the convertToTranslucent method on platforms before Android 5.0 |
private static String generateReference(final String baseName){
int myRefIndex=refIndex.addAndGet(1);
return harnessReference + ":" + baseName+ ":"+ myRefIndex;
}
| Generates a unique reference. |
public NotificationChain basicSetParentRegion(Region newParentRegion,NotificationChain msgs){
msgs=eBasicSetContainer((InternalEObject)newParentRegion,SGraphPackage.STATE__PARENT_REGION,msgs);
return msgs;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
boolean takeIndexWrapped(){
if (isDetached()) return true;
if (itrs.cycles - prevCycles > 1) {
shutdown();
return true;
}
return false;
}
| Called whenever takeIndex wraps around to zero. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
int v=getInt(stack);
CaptureDeviceInput conn=getCapDevInput(stack);
if (conn != null) conn.setSharpness(v);
return null;
}
| Sets the sharpness for capture on this CaptureDeviceInput. This only affects analog capture devices. NOTE: On Linux this currently sets the audio capture volume level |
public FillOutsideLine(Type type){
this.mType=type;
}
| The line fill behavior. |
@Override public String toString(){
if (ActiveMQRACredential.trace) {
ActiveMQRALogger.LOGGER.trace("toString()");
}
return super.toString() + "{ username=" + userName+ ", password=**** }";
}
| String representation |
public static String toLanguageTag(Locale locale){
return locale.getLanguage() + (hasText(locale.getCountry()) ? "-" + locale.getCountry() : "");
}
| Determine the RFC 3066 compliant language tag, as used for the HTTP "Accept-Language" header. |
void dispose(){
Component component=getComponent();
Window window=SwingUtilities.getWindowAncestor(component);
if (component instanceof JWindow) {
((Window)component).dispose();
component=null;
}
if (window instanceof DefaultFrame) {
window.dispose();
}
}
| Frees any resources the <code>Popup</code> may be holding onto. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public boolean inTapSquare(){
return touchDownX != -1;
}
| Returns true if a touch is within the tap square. |
@Override public void actionPerformed(ActionEvent e){
controller.displayHelpContext(helpContextToDisplay);
}
| display the view specified |
public HTMLParser(){
addCharEntity("bull",8226);
addCharEntity("euro",8364);
setIncludeWhitespacesBetweenTags(true);
}
| Constructs a new instance of HTMLParser |
public void print(PrintStream ps){
ps.println("IIR Filter:");
for (int i=0; i < sections.size(); i++) {
ps.println("\n Section " + i + "\n");
sections.get(i).print(ps);
ps.println();
}
}
| Prints the coefficients and states of this IIR filter, section by section. |
public String parse(String inputTemplate,String intputEncoding,String outputFile,String outputEncoding,String objectID,Object object) throws Exception {
if (objectID != null && object != null) {
controlContext.put(objectID,object);
}
Template template=getTemplate(inputTemplate,inputEncoding != null ? inputEnc... | Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. You can add objects to the context with the objs Hashtable. |
public void onFailure(int statusCode,Header[] headers,String responseBody,Throwable error){
onFailure(responseBody,error);
}
| Fired when a request fails to complete, override to handle in your own code |
public void load() throws SAXException, IOException {
final InputStream in=ZonesXMLLoader.class.getResourceAsStream(uri.getPath());
if (in == null) {
throw new FileNotFoundException("Cannot find resource: " + uri);
}
try {
load(in);
}
finally {
in.close();
}
}
| Load a group of zones into a world. |
private void loadOrganisations(){
List<Organisation> associatedOrganisations=registrationManager.list();
organisations=Maps.newLinkedHashMap();
if (!associatedOrganisations.isEmpty()) {
if (associatedOrganisations.size() > 1) {
organisations.put("",getText("admin.organisation.name.select"));
}
O... | Populate organisations dropdown options/list, with placeholder option, followed by list of organisations able to host resources. There must be more than the default organisation "No organisation" in order to include the placeholder option. |
public void testDifferentRange(){
((MergeManyValues)m_Filter).setMergeValueRange("2,3");
Instances result=useFilter();
assertEquals(m_Instances.numAttributes(),result.numAttributes());
assertEquals(m_Instances.numInstances(),result.numInstances());
int mergedIndex=-1;
for (int i=0; i < result.numInstances()... | Tests a different range. |
protected CCProgressTimer(String filename){
this(CCTextureCache.sharedTextureCache().addImage(filename));
}
| Initializes a progress timer with an image filename as the shape the timer goes through |
public static BayesPm serializableInstance(){
return new BayesPm(Dag.serializableInstance());
}
| Generates a simple exemplar of this class to test serialization. |
public void updateClassifier(BayesNet bayesNet,Instance instance) throws Exception {
throw new Exception("Incorrect BayesNetEstimator: use subclass instead.");
}
| Updates the classifier with the given instance. |
public void updateMarbleLocationField(){
marbleLocField.setLocalValue(World.getInstance().getMarble().getTranslation());
}
| Update the marble location field contents when the marble moves. |
@Override public void close() throws SecurityException {
}
| Close the <tt>Handler</tt> and free all associated resources. <p> The close method will perform a <tt>flush</tt> and then close the <tt>Handler</tt>. After close has been called this <tt>Handler</tt> should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions. |
public static FetchRequest createFetchRequest(ParameterList params) throws MessageException {
FetchRequest req=new FetchRequest(params);
if (!req.isValid()) throw new MessageException("Invalid parameters for a fetch request");
if (DEBUG) _log.debug("Created fetch request from parameter list:\n" + params);
r... | Constructs a FetchRequest from a parameter list. <p> The parameter list can be extracted from a received message with the getExtensionParams method of the Message class, and MUST NOT contain the "openid.<extension_alias>." prefix. |
protected String encodeCookie(SerializableHttpCookie cookie){
if (cookie == null) return null;
ByteArrayOutputStream os=new ByteArrayOutputStream();
try {
ObjectOutputStream outputStream=new ObjectOutputStream(os);
outputStream.writeObject(cookie);
}
catch ( IOException e) {
Log.d(LOG_TAG,"IOExc... | Serializes Cookie object into String |
@Override public int generateDirectSurrogateKey(String memberStr){
SimpleDateFormat timeParser=new SimpleDateFormat(CarbonProperties.getInstance().getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
timeParser.setLenient(false);
if (null == memberStr ... | The method take member String as input and converts and returns the dictionary key |
@Override public void configureZone(final StendhalRPZone zone,final Map<String,String> attributes){
buildNPC(zone);
}
| Configure a zone. |
public void deleteByIdProc(String idProc){
String qual=new StringBuffer().append("WHERE ").append(DBUtils.generateEQTokenField(CAMPO_ID_PROC,idProc)).toString();
deleteVO(qual,TABLE_NAME);
}
| Elimina todas las relaciones entre tipos de documentos vitales con un procedimiento. |
public MutableValuesRaba(final int fromIndex,final int toIndex,final int capacity,final byte[][] a){
super(fromIndex,toIndex,capacity,a);
}
| Create a view from a slice of a byte[][]. |
public DrawerBuilder addDrawerItems(@NonNull IDrawerItem... drawerItems){
this.getAdapter().addDrawerItems(IdDistributor.checkIds(drawerItems));
return this;
}
| Add a initial DrawerItem or a DrawerItem Array for the Drawer |
public OpenIntIntHashMap(){
this(defaultCapacity);
}
| Constructs an empty map with default capacity and default load factors. |
public void write(File file,Integer indent,String xmlVersion) throws TransformerException, IOException {
write(file,new XCardOutputProperties(indent,xmlVersion));
}
| Writes the XML document to a file. |
public Builder failOnNoServerResponse(boolean failOnNoServerResponse){
this.failOnNoServerResponse=failOnNoServerResponse;
return this;
}
| Sets whether or not to raise an error if no response is received from the server for an operation. |
public int maxLineLength(){
return DEFAULT_MAX_LINE_LENGTH;
}
| Returns the maximum formatted width |
static Object newInstance(String className,ClassLoader cl,boolean doFallback) throws ConfigurationError {
try {
Class providerClass=findProviderClass(className,cl,doFallback);
Object instance=providerClass.newInstance();
debugPrintln("created new instance of " + providerClass + " using ClassLoader: "+ cl)... | Create an instance of a class using the specified ClassLoader |
private void doFilter(List<CompositeMethodDetailDescriptor> list){
if (list.isEmpty()) {
return;
}
Iterator<CompositeMethodDetailDescriptor> iter=list.iterator();
while (iter.hasNext()) {
CompositeMethodDetailDescriptor descriptor=iter.next();
Method method=descriptor.descriptor().method();
if (... | Do the filter for method return type (Property, Association, ManyAssociation, NamedAssociation) by removing the entry from the list if not the above. |
public void mv(Object src,Object dst){
cmdLine.mv(getProject().file(src),getProject().file(dst));
}
| Removes the given file or directory. |
public void testSimpleLink(){
LOGGER.debug("buildTextFromElement of simple link");
Document document=Jsoup.parse("<a href=\"\"> Text1 Text3 </a>");
Element el=document.select("a").first();
LinkTextElementBuilder instance=new LinkTextElementBuilder();
String expResult="Text1 Text3";
String result=insta... | Test of buildTextFromElement method, of class LinkTextElementBuilder. |
public String toString(int indentFactor) throws JSONException {
StringWriter sw=new StringWriter();
synchronized (sw.getBuffer()) {
return this.write(sw,indentFactor,0).toString();
}
}
| Make a prettyprinted JSON text of this JSONArray. Warning: This method assumes that the data structure is acyclical. |
public static TypeEditorPanel CreatePrototypeEditor(JFrame parent,TypeManager typeManager,INaviFunction function){
Preconditions.checkNotNull(typeManager,"Error: typeManager argument can not be null");
Preconditions.checkNotNull(function,"Error: function argument can not be null");
return new TypeEditorPanel(pare... | Creates a type editor panel instance that only holds the prototype of the given function and ignores all other types. |
private InternalSelectionListener(final JTable table,final ZyGraph graph){
m_table=table;
m_graph=graph;
}
| Creates a new listener object. |
static void parse(Reader r,Map<String,Object> map) throws ParseException, IOException {
final StreamTokenizer st=initTokenizer(r);
final String identifierPattern="[a-zA-Z_$][0-9a-zA-Z_$]*";
final Pattern propertyNamePattern=Pattern.compile("(" + identifierPattern + "\\.)*"+ identifierPattern);
while (true) {
... | Parses the data in the reader. |
public CompoundFilter(BufferedImageOp filter1,BufferedImageOp filter2){
this.filter1=filter1;
this.filter2=filter2;
}
| Construct a CompoundFilter. |
@Override public boolean supportsUnion(){
debugCodeCall("supportsUnion");
return true;
}
| Returns whether UNION SELECT is supported. |
@PostConstruct public void postConstruct(){
addFilter();
}
| Called by spring when bean instantiated and autowired. |
public MutableNodeData(final long nentries,final IRaba keys,final long[] childAddr,final long[] childEntryCounts,final boolean hasVersionTimestamps,final long minimumVersionTimestamp,final long maximumVersionTimestamp){
assert keys != null;
assert childAddr != null;
assert childEntryCounts != null;
assert keys.... | Ctor based on just the "data" -- used by unit tests. |
protected int resolveLevelAsSubtype(char[] simplePattern,char[] qualifiedPattern,ReferenceBinding type,char[] methodName,TypeBinding[] argumentTypes,char[] packageName,boolean isDefault){
if (type == null) return INACCURATE_MATCH;
int level=resolveLevelForType(simplePattern,qualifiedPattern,type);
if (level != ... | Returns whether the given reference type binding matches or is a subtype of a type that matches the given qualified pattern. Returns ACCURATE_MATCH if it does. Returns INACCURATE_MATCH if resolve fails Returns IMPOSSIBLE_MATCH if it doesn't. |
public void kill(){
this.kill=true;
}
| Kills the reader gracefully. |
private void addNewPasswordFormFields(RequestAndResponse requestAndResponse,final User editedUser,final boolean currentIsEditedUser) throws IOException {
requestAndResponse.print("<div class=\"infoheader\">" + servletText.sentenceEnterNewPasswordHereTwice(currentIsEditedUser,editedUser.getUserName()) + "</div>");
r... | Adds the new password and verify password form fields. |
protected static void establishMirror(){
if (m_offline) {
return;
}
try {
String mirrorListURL="http://www.cs.waikato.ac.nz/ml/weka/packageMetaDataMirror.txt";
URLConnection conn=null;
URL connURL=new URL(mirrorListURL);
if (PACKAGE_MANAGER.setProxyAuthentication(connURL)) {
conn=connURL... | Establish the location of a mirror |
public static boolean contains(long[] array,long value){
return indexOf(array,value) != -1;
}
| Returns <code>true</code> if an array contains given value. |
private boolean shouldValidateType(TypeDeclaration typeDecl){
if (!typeDecl.isInterface()) {
return false;
}
ITypeBinding typeBinding=typeDecl.resolveBinding();
if (typeBinding == null) {
return false;
}
if (!isUiBinder(typeBinding)) {
return false;
}
return true;
}
| If true is returned, the type declaration has a resolveable binding. |
public SegmentInfos readLastCommittedSegmentsInfo() throws IOException {
failIfCorrupted();
try {
return readSegmentsInfo(null,directory());
}
catch ( CorruptIndexException ex) {
markStoreCorrupted(ex);
throw ex;
}
}
| Returns the last committed segments info for this store |
public DelegateFactory(final MonitoringHandler monitoringHandler,final HttpClient selfClient,final Map<String,Object> properties,final String delegatesSchema){
this.monitoringHandler=monitoringHandler;
this.selfClient=selfClient;
this.properties=properties;
this.delegatesSchema=delegatesSchema;
}
| Creates a new instance of the DelegateFactory. |
private int calculateNumber(@NonNull String text,int nested){
if (text.length() < 3) {
return -1;
}
int number=-1;
String s=text.substring(nested * KEY_HEADER.length(),text.length());
if (TextUtils.isDigitsOnly(s.substring(0,1))) {
number=Integer.parseInt(s.substring(0,1));
for (int i=1; i < s.len... | calculate the key number |
public String toDenseString(int fractionDigits,boolean quoteNominal){
StringBuffer result=new StringBuffer();
Iterator<Attribute> a=getAttributes().allAttributes();
boolean first=true;
while (a.hasNext()) {
if (first) {
first=false;
}
else {
result.append(SEPARATOR);
}
result.append... | This method returns a dense string representation of the example. It first returns the values of all special attributes and then the values of all regular attributes. |
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
if (sepsets == null) {
throw new NullPointerException();
}
}
| 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 void prevField(EditorState editorState){
prevField(editorState,editorState.getCurrentField());
}
| Find previous field. |
public GenericGF(int primitive,int size,int b){
this.primitive=primitive;
this.size=size;
this.generatorBase=b;
expTable=new int[size];
logTable=new int[size];
int x=1;
for (int i=0; i < size; i++) {
expTable[i]=x;
x*=2;
if (x >= size) {
x^=primitive;
x&=size - 1;
}
}
for (... | Create a representation of GF(size) using the given primitive polynomial. |
public static int Show(Object msg){
return Show(msg,TITLE,INFORMATION_MESSAGE);
}
| Show Default MsgBox |
public static int maxProfitB(int[] prices){
if (prices == null || prices.length < 2) {
return 0;
}
int min=prices[0];
int max=0;
int len=prices.length;
int[] history=new int[len];
for (int i=0; i < len - 1; i++) {
min=min < prices[i] ? min : prices[i];
if (i > 0) {
history[i]=Math.max(hi... | DP, bottom-up. Keep track of minimum price of the stock. Keep track of the maximum profit before today. Get the maximum profit of today, and compare with previous maximum. Update maximum if today's profit is larger. Stop until the array is fully traversed. O(n) Time, O(n) Space. |
public BaleenJob(String name,String yaml,CollectionProcessingEngine engine){
super(name,yaml,engine);
}
| New instance. |
public TIntHash(int initialCapacity,float loadFactor,int no_entry_value){
super(initialCapacity,loadFactor);
this.no_entry_value=no_entry_value;
if (no_entry_value != (int)0) {
Arrays.fill(_set,no_entry_value);
}
}
| Creates a new <code>TIntHash</code> instance with a prime value at or near the specified capacity and load factor. |
private void putRec(O obj,Rec<O> rec){
graph.put(obj,rec);
for (int i=0; i < numelems; ++i) {
if (obj == elems[i]) {
return;
}
}
if (elems.length == numelems) {
elems=Arrays.copyOf(elems,(elems.length << 1) + 1);
}
elems[numelems++]=obj;
}
| Put a record. |
private Zone showIvrZone(String zoneName){
Zone zone=new Zone(zoneName);
SSHPrompt[] prompts={SSHPrompt.POUND,SSHPrompt.GREATER_THAN};
StringBuilder buf=new StringBuilder();
String payload=MessageFormat.format(MDSDialogProperties.getString("MDSDialog.ivr.show.zoneName.cmd"),zoneName);
sendWaitFor(payload,defa... | Get Zone and its members for given ivr zone name. |
public long partSize(){
return size;
}
| Returns part size. |
@Override public void processAuthorize(WebSocketChannel channel,String authorizeToken){
sendHandshakePayload(channel,authorizeToken);
}
| Send authorize token to the Gateway |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.