code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
private boolean isCacheServerPortEquals(CacheServer other){
return (this.getPort() == 0) ? true : this.getPort() == other.getPort();
}
| Compare configured cacheServer port against the running cacheServer port. If the current cacheServer port is set to 0 a random ephemeral port will be used so there is no need to compare returning <code>true</code>. If a port is specified, return the proper comparison. |
Property(YearMonthDay partial,int fieldIndex){
super();
iYearMonthDay=partial;
iFieldIndex=fieldIndex;
}
| Constructs a property. |
public E push(E item){
top=new Node<>(item,top);
return item;
}
| Pushes an item onto the top of this stack. |
public static byte[] asByteArray(final List<Byte> l){
final byte[] a=new byte[l.size()];
for (int i=0; i < a.length; i++) {
a[i]=l.get(i);
}
return a;
}
| Return list of boxed bytes as a primitive array. |
public double nextDouble(double lambda){
return -Math.log(randomGenerator.raw()) / lambda;
}
| Returns a random number from the distribution; bypasses the internal state. |
public void addObserver(AppMenuObserver observer){
mObservers.add(observer);
}
| Adds the observer to App Menu. |
private static void initClamp(){
for (int i=0; i < 256; i++) {
clamp[CLAMP_BASE + i]=i;
}
for (int i=0; i < CLAMP_BASE; i++) {
clamp[i]=0;
clamp[i + CLAMP_BASE + 256]=255;
}
}
| Initialize array to clamp values in range [0..255] |
public void detachDatastore(Datastore datastore){
for ( HostScsiDisk disk : listDisks(datastore)) {
try {
host.getHostStorageSystem().detachScsiLun(disk.getUuid());
}
catch ( RemoteException e) {
throw new VMWareException(e);
}
}
}
| Detach all of the disks associated with the datastore on this host |
public static _Fields findByName(String name){
return byName.get(name);
}
| Find the _Fields constant that matches name, or null if its not found. |
@SuppressWarnings("deprecation") public static Expression create(String expression,StatsCollector[] statsCollectors){
int paren=expression.indexOf('(');
if (paren <= 0) {
throw new SolrException(ErrorCode.BAD_REQUEST,"The expression [" + expression + "] has no arguments and is not supported.");
}
String top... | Creates a single expression that contains delegate expressions and/or a StatsCollector. StatsCollectors are given as input and not created within the method so that expressions can share the same StatsCollectors, minimizing computation. |
protected SystemMember createSystemMember(InternalDistributedMember member) throws org.apache.geode.admin.AdminException {
return new SystemMemberImpl(this,member);
}
| Constructs & returns a SystemMember instance using the corresponding InternalDistributedMember object. |
void writeData(int streamId,byte[] buffer,int offset,int length,int flags) throws IOException {
WriteStream os=_os;
if (os == null) {
return;
}
if (offset >= 8) {
offset-=8;
BitsUtil.writeInt16(buffer,offset,length);
buffer[offset + 2]=Http2Constants.FRAME_DATA;
buffer[offset + 3]=(byte)flag... | data (0) |
private final void yybegin(int newState){
zzLexicalState=newState;
}
| Enters a new lexical state |
private ShellUtil(){
throw new Error("Do not need instantiate!");
}
| Don't let anyone instantiate this class. |
private String preparePath(String path){
if (path.endsWith("/") || path.endsWith(pathSeparator)) {
path+=DEFAULT_RAML_FILENAME;
}
return path;
}
| Checks the path and adds default file name if what was entered appears to be a directory |
@Override public void configureZone(final StendhalRPZone zone,final Map<String,String> attributes){
buildhotdoglady(zone);
}
| Configure a zone. |
public static Scs cs_multiply(Scs A,Scs B){
int p, j, nz=0, anz, Cp[], Ci[], Bp[], m, n, bnz, w[], Bi[];
float x[], Bx[], Cx[];
boolean values;
Scs C;
if (!Scs_util.CS_CSC(A) || !Scs_util.CS_CSC(B)) return (null);
if (A.n != B.m) return (null);
m=A.m;
anz=A.p[A.n];
n=B.n;
Bp=B.p;
Bi=B.i;
Bx=... | Sparse matrix multiplication, C = A*B |
@Override public void topologyChanged(List<LDUpdate> updateList){
Iterator<Device> diter=deviceMap.values().iterator();
if (updateList != null) {
if (logger.isTraceEnabled()) {
for ( LDUpdate update : updateList) {
logger.trace("Topo update: {}",update);
}
}
}
while (diter.hasNe... | Topology listener method. |
private TreePath findShallowestPath(TreePath[] paths){
int shallowest=-1;
TreePath shallowestPath=null;
for (int counter=paths.length - 1; counter >= 0; counter--) {
if (paths[counter] != null) {
if (shallowest != -1) {
if (paths[counter].getPathCount() < shallowest) {
shallowest=paths... | Returns the TreePath with the smallest path count in <code>paths</code>. Will return null if there is no non-null TreePath is <code>paths</code>. |
public AppUser addNewUser(String username,String pwd,String priv,String email,boolean confirmed){
if (this.retrieveUserInfoFromMetaDB(username) != null) return null;
AppUser newUser=new AppUser();
newUser.setName(username.trim().toLowerCase());
newUser.setPassword(pwd);
newUser.setUserprivilege(AppUser.PRIV... | Add a new user. Return AppUser object if succeed. Otherwise null. |
protected FinallyBlockImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private Compiler(){
}
| Prevent this class from being instantiated. |
public boolean initLogin(){
m_cc=CConnection.get(Adempiere.getCodeBaseHost());
hostField.setValue(m_cc);
if (Ini.isPropertyBool(Ini.P_VALIDATE_CONNECTION_ON_STARTUP)) {
validateConnection();
}
userTextField.setText(Ini.getProperty(Ini.P_UID));
if (Ini.isPropertyBool(Ini.P_STORE_PWD)) passwordField.set... | Set Initial & Ini Parameters Optional Automatic login |
public final double doOperation() throws OperatorFailedException {
List<NodeRef> candidates=new ArrayList<NodeRef>();
for (int i=0; i < tree.getNodeCount(); i++) {
NodeRef node=tree.getNode(i);
if (tree.getNodeTrait(node,indicatorTrait) == 1.0) candidates.add(node);
}
if (candidates.size() == 0) t... | Pick a parent-child node pair involving a single rate change and swap the rate change location and corresponding rate parameters. |
public void serializationPerformanceRoutine(ShoppingCartStateSerializer serializer,int sampleSize,int skuCount,int giftCount,int couponCount) throws Exception {
final List<ShoppingCart> carts=new ArrayList<ShoppingCart>(sampleSize);
final List<byte[]> cartsB=new ArrayList<byte[]>(sampleSize);
for (int i=0; i < sa... | This routine create sampleSize number of shopping carts with 25 SKU, 3 gifts serialises all of them then deserialises all of them to measure time it takes for both. |
public void writeSample(MediaSample sample){
mRtpDummySender.incomingStarted();
VideoOrientation orientation=((VideoSample)sample).getVideoOrientation();
if (orientation != null) {
this.videoOrientation=orientation;
}
int[] decodedFrame=NativeH264Decoder.DecodeAndConvert(sample.getData(),videoOrientation.... | Write a media sample |
public void save() throws IOException {
try {
final FileOutputStream fos=new FileOutputStream(new File(configfile.getFile()));
final Document doc=new DocumentImpl();
final Element collections=doc.createElement(Subcollection.TAG_COLLECTIONS);
final Iterator iterator=collectionMap.values().iterator();
... | Save collections into file |
public ModifierSlot(final String enumName,final String typeName){
super(enumName);
this.typeName=typeName;
}
| Construct new ModifierSlot. |
public int nnz(){
return st.size();
}
| Returns the number of nonzero entries in this vector. |
public InternalStatisticsDisabledException(String msg,Throwable cause){
super(msg,cause);
}
| Constructs an instance of <code>StatisticsDisabledException</code> with the specified detail message and cause. |
public void tickSyncScheduler(){
this.syncScheduler.tick();
}
| Ticks the synchronous scheduler. |
@Override public boolean equals(Object o){
if (o == this) return true;
if (!(o instanceof Set)) return false;
Collection c=(Collection)o;
if (c.size() != size()) return false;
try {
return containsAll(c);
}
catch ( ClassCastException unused) {
return false;
}
catch ( NullPointerException ... | Compares the specified object with this set for equality. Returns <tt>true</tt> if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set. This ensures that the <tt>equals</tt> method works properly across different implementations of the <tt>Set</t... |
public ProviderNotFoundException(String name,Throwable cause){
super(MessageFormat.format("no provider for {0}",name),cause);
}
| Constructs an exception indicating the specified provider was not found. |
public static boolean fileCopy(String src,String dest){
SuperUserCommand superUserCommand=new SuperUserCommand(new String[]{"rm -f '" + dest + "'","cat '" + src + "' >> '"+ dest+ "'","chmod 0777 '" + dest + "'","echo 'done'"});
superUserCommand.setHideStandardOutput(true);
superUserCommand.execute();
return sup... | Copy a file with root permissions |
@Override public WeightVector train(SLProblem problem,SLParameters params) throws Exception {
WeightVector init=new WeightVector(10000);
return train(problem,params,init);
}
| To train with the default choice(zero vector) of initial weight vector. Often this suffices. |
private void messageDeliveredAction(Bundle data){
IMqttToken token=removeMqttToken(data);
if (token != null) {
if (callback != null) {
Status status=(Status)data.getSerializable(MqttServiceConstants.CALLBACK_STATUS);
if (status == Status.OK && token instanceof IMqttDeliveryToken) {
callback.... | Process notification of a published message having been delivered |
private static void initFont(String fontName){
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
boolean needsLoading=true;
for ( String font : ge.getAvailableFontFamilyNames()) {
if (fontName.equals(font)) {
needsLoading=false;
break;
}
}
if (needsLoading) {
S... | Load a custom font. |
public void printMissingDeps(List<Map<String,Set<String>>> result){
assert result.size() == 2;
@SuppressWarnings("unused") Map<String,Set<String>> deps=result.get(0);
Map<String,Set<String>> missing=result.get(1);
for ( String fqcn : missing.keySet()) {
mLog.info("%s",fqcn);
}
}
| Prints only a summary of the missing dependencies to the current logger. |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public int size(){
return size;
}
| Returns the number of bytes in the backing array that are valid. |
public static boolean usingLocalGraphics(Context context){
SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
String sunshineArtPack=context.getString(R.string.pref_art_pack_sunshine);
return prefs.getString(context.getString(R.string.pref_art_pack_key),sunshineArtPack).equals(sunshin... | Helper method to return whether or not Sunshine is using local graphics. |
private void findAllModifiedClasses(String name,PathImpl sourceDir,PathImpl classDir,String sourcePath,ArrayList<String> sources) throws IOException, ClassNotFoundException {
String[] list;
try {
list=sourceDir.list();
}
catch ( IOException e) {
return;
}
for (int i=0; list != null && i < list.lengt... | Returns the classes which need compilation. |
public static MethodTraceCoverageTestFitness createMethodTestFitness(String className,String method){
return new MethodTraceCoverageTestFitness(className,method.substring(method.lastIndexOf(".") + 1));
}
| Create a fitness function for branch coverage aimed at covering the root branch of the given method in the given class. Covering a root branch means entering the method. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:59:50.439 -0500",hash_original_method="EB3E524D388CAA0001E918D3BE2E0050",hash_generated_method="F8904635ACB2C47E51F6597E693D3268") public static void start(){
if (!enabled) {
return;
}
if (samplingProfiler != null) {
Log.... | Starts the profiler if profiling is enabled. |
@Inject public NewMyFileAction(SampleActionsResources resources,DialogFactory dialogFactory,CoreLocalizationConstant coreLocalizationConstant,EventBus eventBus,AppContext appContext,NotificationManager notificationManager){
super("Create my file","Create a new file",resources.icon(),dialogFactory,coreLocalizationCons... | Creates new action. |
static String pathToCookiePath(String path){
if (path == null) {
return "/";
}
int lastSlash=path.lastIndexOf('/');
return path.substring(0,lastSlash + 1);
}
| Returns a cookie-safe path by truncating everything after the last "/". When request path like "/foo/bar.html" yields a cookie, that cookie's default path is "/foo/". |
public void error(SourceLocator srcLctr,String msg,Exception e) throws TransformerException {
error(srcLctr,msg,null,e);
}
| Tell the user of an error, and probably throw an exception. |
public void destroy(){
EventBus.getDefault().post(new ControllerDestroyedEvent(this));
EventBus.getDefault().unregister(this);
}
| Call this from onDestroy() of an activity or fragment, or from an equivalent point in time, to tear down the entire controller. A fresh controller should be created if you want to use the camera again in the future. |
public boolean equals(Object obj){
if (this == obj) return true;
if (!(obj instanceof Path)) return false;
Path target=(Path)obj;
if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) return false;
String[] targetSegments=target.segments;
int i=segments.length;
if (i != targetSegments.len... | Returns whether this path equals the given object. <p> Equality for paths is defined to be: same sequence of segments, same absolute/relative status, and same device. Trailing separators are disregarded. Paths are not generally considered equal to objects other than paths. </p> |
public ActiveMQRAMessageListener(final MessageListener listener,final ActiveMQRAMessageConsumer consumer){
if (ActiveMQRAMessageListener.trace) {
ActiveMQRALogger.LOGGER.trace("constructor(" + listener + ", "+ consumer+ ")");
}
this.listener=listener;
this.consumer=consumer;
}
| Create a new wrapper |
@Override protected void sendDispositionHeader(final OutputStream out) throws IOException {
LOG.trace("enter sendDispositionHeader(OutputStream out)");
super.sendDispositionHeader(out);
final String filename=source.getFileName();
if (filename != null) {
out.write(FILE_NAME_BYTES);
out.write(QUOTE_BYTES)... | Write the disposition header to the output stream |
void traceError(Throwable e){
if (trace) {
e.printStackTrace();
}
}
| Write the stack trace if trace is enabled. |
public void statistics(Statistic stats){
log(Level.STATISTICS,stats.getKey() + ": " + stats.formatValue());
}
| Log a statistics object. |
public LineView(Element elem){
super(elem);
}
| Creates a LineView object. |
public void enableVM(String hostname) throws IllegalStateException {
logger.info("Enabling VM " + hostname);
assignableVMs.enableVM(hostname);
}
| Enable the VM with the specified host name. Hosts start in an enabled state, so you only need to call this method if you have previously explicitly disabled the host. |
private List<StoragePool> returnMatchedVNXPoolsForGivenAutoTieringPolicy(List<StoragePool> pools,String auto_tier_policy_name){
if (AutoTieringPolicy.VnxFastPolicy.DEFAULT_NO_MOVEMENT.toString().equalsIgnoreCase(auto_tier_policy_name)) {
_logger.info("Auto Tiering {} Matcher Ended {} :",auto_tier_policy_name,Joi... | Ranking Algorithm to find matched Pools NO_DATA_MOVEMENT : return all the Pools AUTO_TIER : Find Pools which contains more than one tier, if not found return all the Pools HIGHEST_TIER: Find Pools which contains max tierPercentage looping through each Derive Type starting from SSD,FC,SAS,NL_SAS,SATA. If a pool is being... |
final public boolean isInLayout(){
return mInLayout;
}
| Return true if the layout is included as part of an activity view hierarchy via the <fragment> tag. This will always be true when fragments are created through the <fragment> tag, <em>except</em> in the case where an old fragment is restored from a previous state and it does not appear in the layout of the... |
public void traverse(int pos,int top) throws org.xml.sax.SAXException {
while (DTM.NULL != pos) {
startNode(pos);
int nextNode=m_dtm.getFirstChild(pos);
while (DTM.NULL == nextNode) {
endNode(pos);
if ((DTM.NULL != top) && top == pos) break;
nextNode=m_dtm.getNextSibling(pos);
... | Perform a non-recursive pre-order/post-order traversal, operating as a Visitor. startNode (preorder) and endNode (postorder) are invoked for each node as we traverse over them, with the result that the node is written out to m_contentHandler. |
public LatLng toLatLng(){
double OSGB_F0=0.9996012717;
double N0=-100000.0;
double E0=400000.0;
double phi0=Math.toRadians(49.0);
double lambda0=Math.toRadians(-2.0);
double a=RefEll.AIRY_1830.getMaj();
double b=RefEll.AIRY_1830.getMin();
double eSquared=RefEll.AIRY_1830.getEcc();
double phi=0.0;
do... | Convert this OSGB grid reference to a latitude/longitude pair using the OSGB36 datum. Note that, the LatLng object may need to be converted to the WGS84 datum depending on the application. |
public static String toSVG(Object... objects){
List<Object> flattened=new ArrayList<>();
for ( Object o : objects) {
if (o instanceof Polygon[]) {
flattened.addAll(Arrays.asList((Polygon[])o));
}
else {
flattened.add(o);
}
}
double minLat=Double.POSITIVE_INFINITY;
double maxLat=Doubl... | Returns svg of polygon for debugging. <p> You can pass any number of objects: Polygon: polygon with optional holes Polygon[]: arrays of polygons for convenience Rectangle: for a box double[2]: as latitude,longitude for a point <p> At least one object must be a polygon. The viewBox is formed around all polygons found i... |
@SuppressWarnings("deprecation") public void rewardMoney(Player player,int amount){
if (plugin.setUpEconomy(true)) {
try {
plugin.getEconomy().depositPlayer(player,amount);
}
catch ( NoSuchMethodError e) {
plugin.getEconomy().depositPlayer(player.getName(),amount);
}
if (amount > 1) ... | Give money reward to a player (specified in configuration file). |
public boolean isSmallestMinY(final PlanetModel planetModel){
if (minY == null) return false;
return minY - planetModel.getMinimumYValue() < Vector.MINIMUM_RESOLUTION;
}
| Return true if minY is as small as the planet model allows. |
List<String> linesToStatements(List<String> lines){
List<String> statements=new ArrayList<>();
Delimiter nonStandardDelimiter=null;
CqlStatementBuilder cqlStatementBuilder=new CqlStatementBuilder();
for (int lineNumber=1; lineNumber <= lines.size(); lineNumber++) {
String line=lines.get(lineNumber - 1);
... | Turns these lines in a series of statements. |
public NSDate(String textRepresentation) throws ParseException {
date=parseDateString(textRepresentation);
}
| Parses a date from its textual representation. That representation has the following pattern: <code>yyyy-MM-dd'T'HH:mm:ss'Z'</code> |
public boolean textIsPresent(String courseWareErrorText,String text){
if (courseWareErrorText.equals(text)) {
return true;
}
else {
return false;
}
}
| Verify that whether the text is present or not |
public IssueMatcher equals(URI expectedValue){
return addPropertyMatcher(URIPropertyMatcher.Mode.Equals,expectedValue);
}
| Returns a URI property matcher that matches a URI property against the given URI. |
boolean fitsIntoLong(boolean isPositive,boolean ignoreNegativeZero){
while (count > 0 && digits[count - 1] == '0') {
--count;
}
if (count == 0) {
return isPositive || ignoreNegativeZero;
}
if (decimalAt < count || decimalAt > MAX_COUNT) {
return false;
}
if (decimalAt < MAX_COUNT) return tru... | Return true if the number represented by this object can fit into a long. |
public LineIterator(final Reader reader) throws IllegalArgumentException {
if (reader == null) {
throw new IllegalArgumentException("Reader must not be null");
}
if (reader instanceof BufferedReader) {
bufferedReader=(BufferedReader)reader;
}
else {
bufferedReader=new BufferedReader(reader);
}
}
| Constructs an iterator of the lines for a <code>Reader</code>. |
private Patterns(){
}
| Do not create this static utility class. |
public static double pdf(double x,double location,double shape){
final double v=(x - location) / shape;
return 1. / (Math.PI * shape * (1 + v * v));
}
| PDF function, static version. |
@Deprecated public String templateName(){
return template == null ? null : template.getScript();
}
| The name of the stored template |
public final int allocateNodeNumber(){
return numberOfNodes++;
}
| Get the next node number |
public ActivityMap(ActivityMap parent){
m_map=new HashMap();
m_parent=parent;
}
| Creates a new ActivityMap instance with the specified parent map. |
void doVolunteerForPrimary(){
if (!beginVolunteering()) {
return;
}
boolean dlsDestroyed=false;
try {
if (logger.isDebugEnabled()) {
logger.debug("Begin volunteerForPrimary for {}",BucketAdvisor.this);
}
DistributedMemberLock thePrimaryLock=null;
while (continueVolunteering()) {
... | Invoked by the thread that performs the actual volunteering work. |
public static byte[] decodeHex(String hexString){
int length=hexString.length();
if ((length & 0x01) != 0) {
throw new IllegalArgumentException("Odd number of characters.");
}
boolean badHex=false;
byte[] out=new byte[length >> 1];
for (int i=0, j=0; j < length; i++) {
int c1=hexString.charAt(j++);
... | Quickly converts a hexadecimal string to a byte array. |
public boolean isSortingProperties(){
return sortingProperties;
}
| Get whether this model is currently sorting properties. |
private void startQuest(){
setTimings();
getPhases().add(new InactivePhase(timings));
getPhases().add(new InvasionPhase(timings));
getPhases().add(new AwaitingPhase(timings));
setNewNotificationTime(getDefaultPhaseClass().getMinTimeOut(),getDefaultPhaseClass().getMaxTimeOut());
}
| first start |
public String toleranceTipText(){
return "tolerance parameter used for checking stopping criterion b.up < b.low + 2 tol";
}
| Returns the tip text for this property |
protected List<MemoryPoolMXBean> loadRawDatas(Map<Object,Object> userData){
return ManagementFactory.getMemoryPoolMXBeans();
}
| Call ManagementFactory.getMemoryPoolMXBeans() to load the raw data of this table. |
public static Schema load(final JSONObject schemaJson,final SchemaClient httpClient){
SchemaLoader loader=builder().schemaJson(schemaJson).httpClient(httpClient).build();
return loader.load().build();
}
| Creates Schema instance from its JSON representation. |
public static CommandResult execCommand(String command,boolean isRoot,boolean isNeedResultMsg){
return execCommand(new String[]{command},isRoot,isNeedResultMsg);
}
| execute shell command |
public OMColor(int a,int r,int g,int b){
super(r,g,b);
argb=(a << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8)| ((b & 0xFF) << 0);
}
| Create a color with the specified alpha, red, green, and blue components. The four arguments must each be in the range 0-255. // |
public boolean merge(final Frame<? extends V> frame,final boolean[] access){
boolean changes=false;
for (int i=0; i < locals; ++i) {
if (!access[i] && !values[i].equals(frame.values[i])) {
values[i]=frame.values[i];
changes=true;
}
}
return changes;
}
| Merges this frame with the given frame (case of a RET instruction). |
public static void assign(int[] n1,int n2[]){
int idx=n1.length - 1;
int i;
for (i=n2.length - 1; i >= 0; i--) {
n1[idx--]=n2[i];
}
while (idx > 0) {
n1[idx--]=0;
}
}
| Assign n1 to be the same value as n2. n1's length must be >= n2's length |
@SuppressWarnings("unchecked") public static <K,V>Map<K,V> mapOf(Object... keyValPair){
if (keyValPair.length % 2 != 0) throw new IllegalArgumentException("Keys and values must be in pairs");
Map<K,V> map=new HashMap<K,V>(keyValPair.length / 2);
for (int i=0; i < keyValPair.length; i+=2) {
map.put((K)keyVal... | Constructs a map of the key-value pairs, passed as parameters |
@Deprecated @Override public boolean commit() throws InstantiationError {
if (mEditor != null) {
return mEditor.commit();
}
throw new InstantiationError("\n ======================================== \nError : " + "Do not call " + tag + "'s `commit()`."+ "\n This method is not supported directly."+ " \n =======... | <h1><u>Do not use this method</u></h1> <br> |
private static double createSubscore(double value,double bestValue,double variance,double bias,boolean ignoreSign){
return Math.min(MathUtil.normalPDFNormalized((ignoreSign ? value - bestValue : Math.max((value - bestValue),0)) / bestValue,variance,0) * bias,bias);
}
| Create a normalized subscore around a current and expected value, using the normalized Normal CDF. <p/> This function is derived from the statistical probability of achieving the optimal value. Values that are less than the best value will return the best subscore, or the bias (unless ignoreSign = true). |
public void append(StringBuffer buffer,String fieldName,boolean[] array,Boolean fullDetail){
appendFieldStart(buffer,fieldName);
if (array == null) {
appendNullText(buffer,fieldName);
}
else if (isFullDetail(fullDetail)) {
appendDetail(buffer,fieldName,array);
}
else {
appendSummary(buffer,field... | <p>Append to the <code>toString</code> a <code>boolean</code> array.</p> |
@CanIgnoreReturnValue @Override public boolean put(@Nullable K key,@Nullable V value){
addNode(key,value,null);
return true;
}
| Stores a key-value pair in the multimap. |
public void ReInit(SimpleCharStream stream,int lexState){
ReInit(stream);
SwitchTo(lexState);
}
| Reinitialise parser. |
public static RPairList create(int size){
return create(size,null);
}
| Creates a new pair list of given size > 0. Note: pair list of size 0 is NULL. |
public WebgraphConfiguration(final File configurationFile,boolean lazy) throws IOException {
super(configurationFile);
this.lazy=lazy;
if (this.isEmpty()) return;
Iterator<Entry> it=this.entryIterator();
for (SchemaConfiguration.Entry etr=it.next(); it.hasNext(); etr=it.next()) {
try {
WebgraphSch... | initialize the schema with a given configuration file the configuration file simply contains a list of lines with keywords or keyword = value lines (while value is a custom Solr field name |
public void testPingPongShortSegments(){
PseudoTcpTestPingPong test=new PseudoTcpTestPingPong();
test.setLocalMtu(1500);
test.setRemoteMtu(1500);
test.setOptAckDelay(5000);
test.setBytesPerSend(50);
test.doTestPingPong(100,5);
}
| Test sending a ping as pair of short (non-full) segments. Should take ~1s, due to Delayed ACK interaction with Nagling. |
protected void messageLoop(){
try {
byte[] buffer=new byte[40000];
while (isConnected()) {
int numRead=socket.getInputStream().read(buffer);
if (numRead > 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("TimesealSocketMessageProducer " + "Read " + numRead + " bytes.");
}
... | The messageLoop. Reads the inputChannel and then invokes publishInput with the text read. Should really never be invoked. |
public void useDropdownVisibleText(String locator,String option){
Select select=new Select(findElement(locator));
select.selectByVisibleText(option);
}
| useDropdownVisibleText - |
public HdfsFileIO(URI uri,TungstenProperties props){
this.uri=uri;
hdfsConfig=new Configuration();
for ( String key : props.keyNames()) {
String value=props.get(key);
hdfsConfig.set(key,value);
}
try {
this.hdfs=FileSystem.get(uri,hdfsConfig);
}
catch ( IOException e) {
throw new FileIOEx... | Creates a new instance with connection to HDFS. |
public Constant(long value){
this(Long.class,value);
}
| Constructs a new node for defining a constant integer value. |
public static ConversionMethod toConversionMethod(XmlConversion xmlConversion){
if (isEmpty(xmlConversion.name)) {
xmlConversion.name="undefinedName";
throw new XmlConversionNameException("it's mandatory define a name");
}
String name=xmlConversion.name;
String conversionType=xmlConversion.type;
boole... | This method transforms a XmlConversion given in input, into a ConversionMethod. |
public final int pop(){
m_firstFree--;
int n=m_map[m_firstFree];
m_map[m_firstFree]=DTM.NULL;
return n;
}
| Pop a node from the tail of the vector and return the result. |
public static void main(String[] args) throws AdeException {
final AdeExtRequestType requestType=AdeExtRequestType.CONTROL_DB;
System.err.println("Running Ade: " + requestType);
final AdeExtMessageHandler messageHandler=new AdeExtMessageHandler();
final ControlDB controlDB=new ControlDB();
try {
controlDB... | The entry point of ControlDB |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.