code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.144 -0400",hash_original_method="276BA2998AD5CA6CB8793024631853D4",hash_generated_method="732998B786CE877AAFBD00A9B900A155") public static String byteCountToDisplaySize(long size){
return byteCountToDisplaySize(BigInteger.valueOf(size));
}
|
Returns a human-readable version of the file size, where the input represents a specific number of bytes. <p> If the size is over 1GB, the size is returned as the number of whole GB, i.e. the size is rounded down to the nearest GB boundary. </p> <p> Similarly for the 1MB and 1KB boundaries. </p>
|
@Override protected EClass eStaticClass(){
return N4JSPackage.Literals.THIS_LITERAL;
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public static void printMessage(int errorCode,String parameter){
printMessage(errorCode,new String[]{parameter});
}
|
Prints the error with one parameter
|
public int V(){
return N * N;
}
|
Returns number of spaces in the maze.
|
public final static boolean isNotNullOrEmptyOrZero(Object object){
return !(isNullOrEmpty(object,true));
}
|
Returns true if the object specified is nor null nor empty (e.g., an empty string, or an empty collection, or in this case a zero-valued number)
|
protected ShaderVar addVarying(IGlobalShaderVar var){
return addVarying(var.getVarString(),var.getDataType());
}
|
Varying variables provide the interface between the vertex shaders, the fragment shaders, and the fixed functionality between them. Vertex shaders will compute values per vertex (such as color, texture coordinates, etc.) and write them to variables declared with the varying qualifier. A vertex shader may also read varying variables, getting back the same values it has written. Reading a varying variable in a vertex shader returns undefined values if it is read before being written.
|
void computeMinMaxScroll(ArrayList<T> data,boolean launchedWithAltTab,boolean launchedFromHome){
mTaskProgressMap.clear();
if (data.isEmpty()) {
mMinScrollP=mMaxScrollP=0;
return;
}
int taskHeight=mTaskRect.height();
float pAtBottomOfStackRect=screenYToCurveProgress(mStackVisibleRect.bottom);
float pWithinAffiliateTop=screenYToCurveProgress(mStackVisibleRect.bottom - mWithinAffiliationOffset);
float scale=curveProgressToScale(pWithinAffiliateTop);
int scaleYOffset=(int)(((1f - scale) * taskHeight) / 2);
pWithinAffiliateTop=screenYToCurveProgress(mStackVisibleRect.bottom - mWithinAffiliationOffset + scaleYOffset);
float pWithinAffiliateOffset=pAtBottomOfStackRect - pWithinAffiliateTop;
float pBetweenAffiliateOffset=pAtBottomOfStackRect - screenYToCurveProgress(mStackVisibleRect.bottom - mBetweenAffiliationOffset);
float pTaskHeightOffset=pAtBottomOfStackRect - screenYToCurveProgress(mStackVisibleRect.bottom - taskHeight);
float pNavBarOffset=pAtBottomOfStackRect - screenYToCurveProgress(mStackVisibleRect.bottom - (mStackVisibleRect.bottom - mStackRect.bottom));
float pAtBackMostCardTop=0.5f;
float pAtFrontMostCardTop=pAtBackMostCardTop;
int taskCount=data.size();
for (int i=0; i < taskCount; i++) {
mTaskProgressMap.put(data.get(i),pAtFrontMostCardTop);
if (i < (taskCount - 1)) {
float pPeek=pBetweenAffiliateOffset;
pAtFrontMostCardTop+=pPeek;
}
}
mMaxScrollP=pAtFrontMostCardTop - ((1f - pTaskHeightOffset - pNavBarOffset));
mMinScrollP=data.size() == 1 ? Math.max(mMaxScrollP,0f) : 0f;
if (launchedWithAltTab && launchedFromHome) {
mInitialScrollP=mMaxScrollP;
}
else {
mInitialScrollP=pAtFrontMostCardTop - 0.825f;
}
mInitialScrollP=Math.min(mMaxScrollP,Math.max(0,mInitialScrollP));
}
|
Computes the minimum and maximum scroll progress values. This method may be called before the RecentsConfiguration is set, so we need to pass in the alt-tab state.
|
protected boolean labelsHaveSameBaselines(){
if (!checkedLabelBaselines) {
checkedLabelBaselines=true;
Dictionary dictionary=slider.getLabelTable();
if (dictionary != null) {
sameLabelBaselines=true;
Enumeration elements=dictionary.elements();
int baseline=-1;
while (elements.hasMoreElements()) {
JComponent label=(JComponent)elements.nextElement();
Dimension pref=label.getPreferredSize();
int labelBaseline=label.getBaseline(pref.width,pref.height);
if (labelBaseline >= 0) {
if (baseline == -1) {
baseline=labelBaseline;
}
else if (baseline != labelBaseline) {
sameLabelBaselines=false;
break;
}
}
else {
sameLabelBaselines=false;
break;
}
}
}
else {
sameLabelBaselines=false;
}
}
return sameLabelBaselines;
}
|
Returns true if all the labels from the label table have the same baseline.
|
private static String formatTo2Digits(String str){
if (str.length() < 2) {
str="0" + str;
}
return str;
}
|
Makes values consist of 2 letters "01"
|
private static TreeNode next(TreeNode x){
if (x == null) {
return null;
}
TreeNode r=x.right;
if (r != null) {
x=r;
TreeNode l=x.left;
while (l != null) {
x=l;
l=x.left;
}
return x;
}
TreeNode ch=x;
x=x.parent;
while (x != null && ch == x.right) {
ch=x;
x=x.parent;
}
return x;
}
|
Get the next node if there is one.
|
public void runTest() throws Throwable {
String namespaceURI=null;
String qualifiedName="emp:qualifiedName";
Document doc;
NodeList elementList;
Node testAddr;
doc=(Document)load("staff",true);
elementList=doc.getElementsByTagName("employee");
testAddr=elementList.item(0);
{
boolean success=false;
try {
((Element)testAddr).setAttributeNS(namespaceURI,qualifiedName,"newValue");
}
catch ( DOMException ex) {
success=(ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR",success);
}
}
|
Runs the test case.
|
public boolean gaussianElimination(final long[] solution){
assert solution.length == numVars;
for ( Modulo2Equation equation : equations) equation.updateFirstVar();
if (!echelonForm()) return false;
for (int i=equations.size(); i-- != 0; ) {
final Modulo2Equation equation=equations.get(i);
if (equation.isIdentity()) continue;
assert solution[equation.firstVar] == 0 : equation.firstVar;
solution[equation.firstVar]=equation.c ^ Modulo2Equation.scalarProduct(equation.bits,solution);
}
return true;
}
|
Solves the system using Gaussian elimination.
|
public void addEmail(Email email){
email.save();
emails.add(email);
}
|
add to user's alternate email list
|
public static int deleteMovementMA(int M_Movement_ID,String trxName){
String sql="DELETE FROM M_MovementLineMA ma WHERE EXISTS " + "(SELECT * FROM M_MovementLine l WHERE l.M_MovementLine_ID=ma.M_MovementLine_ID" + " AND M_Movement_ID=" + M_Movement_ID + ")";
return DB.executeUpdate(sql,trxName);
}
|
Delete all Material Allocation for Movement
|
public static boolean isXML11NameStart(int c){
return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME_START) != 0) || (0x10000 <= c && c < 0xF0000);
}
|
Returns true if the specified character is a valid name start character as defined by production [4] in the XML 1.1 specification.
|
@Override public void putAll(K key,V value,Object... others){
throw new UnsupportedOperationException(ERROR_MSG);
}
|
Guaranteed to throw an exception and leave the map unmodified.
|
public void removeClientDirection(final Direction direction){
directions.remove(direction);
}
|
Remove an active client direction.
|
protected UnManagedFileSystem checkUnManagedFileSystemExistsInDB(String nativeGuid){
UnManagedFileSystem filesystemInfo=null;
URIQueryResultList result=new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getFileSystemInfoNativeGUIdConstraint(nativeGuid),result);
List<URI> filesystemUris=new ArrayList<URI>();
Iterator<URI> iter=result.iterator();
while (iter.hasNext()) {
URI unFileSystemtURI=iter.next();
filesystemUris.add(unFileSystemtURI);
}
if (!filesystemUris.isEmpty()) {
filesystemInfo=_dbClient.queryObject(UnManagedFileSystem.class,filesystemUris.get(0));
}
return filesystemInfo;
}
|
check Pre Existing Storage filesystem exists in DB
|
public String attributeIndicesTipText(){
return "Specify range of attributes to act on." + " This is a comma separated list of attribute indices, with" + " \"first\" and \"last\" valid values. Specify an inclusive"+ " range with \"-\". E.g: \"first-3,5,6-10,last\".";
}
|
Returns the tip text for this property
|
public String toString(){
StringBuffer text=new StringBuffer();
for (int i=0; i < m_AttValues.length; i++) {
if (i > 0) text.append(",");
text.append(toString(i));
}
return text.toString();
}
|
Returns the description of one instance. If the instance doesn't have access to a dataset, it returns the internal floating-point values. Quotes string values that contain whitespace characters.
|
public static <T extends Object & Comparable<? super T>>T max(Collection<? extends T> collection){
Iterator<? extends T> it=collection.iterator();
T max=it.next();
while (it.hasNext()) {
T next=it.next();
if (max.compareTo(next) < 0) {
max=next;
}
}
return max;
}
|
Searches the specified collection for the maximum element.
|
private void buildKDCConfigurations(OMElement kdcConfigElement) throws EmbeddingLDAPException {
Map<String,String> propertyMap=getChildPropertyElements(kdcConfigElement);
String booleanString;
if ((booleanString=propertyMap.get("enabled")) != null) {
this.kdcEnabled=Boolean.parseBoolean(booleanString);
if (!this.kdcEnabled) {
logger.info("KDC server is disabled.");
return;
}
}
else {
logger.info("KDC server is disabled.");
return;
}
this.kdcConfigurations=new KdcConfiguration();
this.kdcConfigurations.setKdcName(propertyMap.get("name"));
try {
this.kdcConfigurations.setKdcCommunicationProtocol(propertyMap.get("protocol"));
}
catch ( DirectoryServerException e) {
String errorMessage="Can not read/set protocol parameter in KDCConfig.";
logger.error(errorMessage,e);
throw new EmbeddingLDAPException(errorMessage,e);
}
this.kdcConfigurations.setKdcHostAddress(propertyMap.get("host"));
int port=Integer.parseInt(propertyMap.get("port"));
if (port == -1) {
logger.warn("KDC port defined in carbon.xml's " + CARBON_KDC_PORT_CONFIG_SECTION + " config section or embedded-ldap.xml is invalid. "+ "Setting KDC server port to default - "+ DEFAULT_KDC_SERVER_PORT);
port=DEFAULT_KDC_SERVER_PORT;
}
this.kdcConfigurations.setKdcCommunicationPort(port);
this.kdcConfigurations.setMaxTicketLifeTime(getIntegerValue(propertyMap.get("maximumTicketLifeTime")));
this.kdcConfigurations.setMaxRenewableLifeTime(getIntegerValue(propertyMap.get("maximumRenewableLifeTime")));
if ((booleanString=propertyMap.get("preAuthenticationTimeStampEnabled")) != null) {
boolean preAuthenticationTSEnabled=Boolean.parseBoolean(booleanString);
this.kdcConfigurations.setPreAuthenticateTimeStampRequired(preAuthenticationTSEnabled);
}
}
|
Read properties from KDCConfiguration element in configuration and set them in the kdcConfigurations object. KDC configurations <p> <KDCServer> <Property name="name">defaultKDC</Property> <Property name="enabled">false</Property> <Property name="protocol">UDP</Property> <Property name="host">localhost</Property> <Property name="maximumTicketLifeTime">8640000</Property> <Property name="maximumRenewableLifeTime">604800000</Property> <Property name="preAuthenticationTimeStampEnabled">true</Property> </KDCServer>
|
public boolean addAll(int index,Collection<? extends E> c){
hashCodeUpToDate=false;
Object[] a=c.toArray();
int numNew=a.length;
ensureCapacityInternal(size + numNew);
int numMoved=size - index;
if (numMoved > 0) System.arraycopy(elementData,index,elementData,index + numNew,numMoved);
System.arraycopy(a,0,elementData,index,numNew);
size+=numNew;
return numNew != 0;
}
|
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.
|
public static void registerMetadata(MetadataRegistry registry){
if (registry.isRegistered(KEY)) {
return;
}
Entry.registerMetadata(registry);
ElementCreator builder=registry.build(KEY);
builder.addElement(Comments.KEY);
builder.addElement(EventStatus.KEY);
builder.addElement(Where.KEY).setCardinality(ElementMetadata.Cardinality.MULTIPLE);
builder.addElement(OriginalEvent.KEY);
builder.addElement(Who.KEY).setCardinality(ElementMetadata.Cardinality.MULTIPLE);
builder.addElement(Recurrence.KEY);
builder.addElement(RecurrenceException.KEY).setCardinality(ElementMetadata.Cardinality.MULTIPLE);
builder.addElement(Reminder.KEY).setCardinality(ElementMetadata.Cardinality.MULTIPLE);
builder.addElement(When.KEY).setCardinality(ElementMetadata.Cardinality.MULTIPLE);
builder.addElement(Transparency.KEY);
builder.addElement(Visibility.KEY);
registry.adapt(Entry.KEY,KIND,KEY);
}
|
Registers the metadata for this element.
|
protected boolean isIncludePayload(){
return includePayload;
}
|
Return whether or not the request payload (body) should be included in the log message.
|
public final int yylength(){
return zzMarkedPos - zzStartRead;
}
|
Returns the length of the matched text region.
|
public void successExecutionCycle(){
if (nextUnloadPointer != null) {
nextUnloadPointer.setNext(firstCutpointPointer);
}
else {
firstPointer=firstCutpointPointer;
}
nextLoadPointer=firstPointer;
nextUnloadPointer=null;
firstCutpointPointer=null;
}
|
Do not use -- for internal use only.
|
public static double blackFormulaImpliedStdDevApproximation(final Option.Type optionType,@Real final double strike,@Real final double forward,@Real final double blackPrice){
return blackFormulaImpliedStdDevApproximation(optionType,strike,forward,blackPrice,1.0,0.0);
}
|
Approximated Black 1976 implied standard deviation, i.e. volatility*sqrt(timeToMaturity). <p> It is calculated using Brenner and Subrahmanyan (1988) and Feinstein (1988) approximation for at-the-money forward option, with the extended moneyness approximation by Corrado and Miller (1996)
|
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
|
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
|
private int watchProcess(Process proc) throws Exception {
BufferedReader reader=new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;
while ((line=reader.readLine()) != null) log().info(line);
return proc.waitFor();
}
|
Waits for process exit and prints the its output.
|
public boolean isRepresentationClassCharBuffer(){
return java.nio.CharBuffer.class.isAssignableFrom(representationClass);
}
|
Returns whether the representation class for this <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a subclass thereof.
|
public Shingles manySeriesToShingles(Map<String,ArrayList<double[]>> data,int windowSize,int paaSize,int alphabetSize,NumerosityReductionStrategy strategy,double normalizationThreshold,int shingleSize) throws SAXException {
Shingles res=new Shingles(alphabetSize,shingleSize);
for ( Entry<String,ArrayList<double[]>> e : data.entrySet()) {
for ( double[] series : e.getValue()) {
Map<String,Integer> shingles=ts2Shingles(series,windowSize,paaSize,alphabetSize,strategy,normalizationThreshold,shingleSize);
int[] counts=new int[res.getIndex().size()];
for ( String str : shingles.keySet()) {
Integer idx=res.getIndex().get(str);
counts[idx]=shingles.get(str);
}
res.addShingledSeries(e.getKey(),counts);
}
}
return res;
}
|
Converts a time-series data frame into shingled data frame.
|
public TimeReachedCondition(final String questname){
this.questname=checkNotNull(questname);
this.index=-1;
}
|
Creates a new TimeReachedCondition for checking wether or not a timestamp in quest slot has been reached
|
@BeforeMethod public void init(){
MockitoAnnotations.initMocks(this);
cmrStorageRecorder=new CmrStorageRecorder();
cmrStorageRecorder.storageDataDao=storageDataDao;
cmrStorageRecorder.cmrStorageManager=cmrStorageManager;
cmrStorageRecorder.executorService=executorService;
cmrStorageRecorder.log=LoggerFactory.getLogger(CmrStorageRecorder.class);
when(storageWriter.isWritingOn()).thenReturn(true);
}
|
Init method.
|
private CloseableReference(SharedReference<T> sharedReference){
mSharedReference=Preconditions.checkNotNull(sharedReference);
sharedReference.addReference();
}
|
The caller should guarantee that reference count of sharedReference is not decreased to zero, so that the reference is valid during execution of this method.
|
public static long moduloSignedPowerOfTwo(long value,long spot){
if (ASSERTIONS) assert (isSignedPowerOfTwo(spot));
if (spot == Long.MIN_VALUE) {
return (value != Long.MIN_VALUE) ? value : 0;
}
else {
long s=(value >> 63);
return ((((value + s) ^ s) & (abs(spot) - 1)) + s) ^ s;
}
}
|
This treatment being designed for optimization, the fact that spot is a signed power of two is only checked if assertions are enabled.
|
private Protos.TaskInfo createTask(Protos.Offer offer,IgniteTask igniteTask,Protos.TaskID taskId){
String cfgUrl=clusterProps.igniteConfigUrl() != null ? clusterProps.igniteConfigUrl() : resourceProvider.igniteConfigUrl();
Protos.CommandInfo.Builder builder=Protos.CommandInfo.newBuilder().setEnvironment(Protos.Environment.newBuilder().addVariables(Protos.Environment.Variable.newBuilder().setName("IGNITE_TCP_DISCOVERY_ADDRESSES").setValue(getAddress(offer.getHostname()))).addVariables(Protos.Environment.Variable.newBuilder().setName("JVM_OPTS").setValue(clusterProps.jmvOpts()))).addUris(Protos.CommandInfo.URI.newBuilder().setValue(clusterProps.ignitePackageUrl() != null ? clusterProps.ignitePackageUrl() : resourceProvider.igniteUrl()).setExtract(true)).addUris(Protos.CommandInfo.URI.newBuilder().setValue(cfgUrl));
Collection<String> usersLibs=new ArrayList<>();
if (clusterProps.usersLibsUrl() != null && !clusterProps.usersLibsUrl().isEmpty()) Collections.addAll(usersLibs,clusterProps.usersLibsUrl().split(DELIM));
if (resourceProvider.resourceUrl() != null && !resourceProvider.resourceUrl().isEmpty()) usersLibs.addAll(resourceProvider.resourceUrl());
for ( String url : usersLibs) builder.addUris(Protos.CommandInfo.URI.newBuilder().setValue(url));
String cfgName=resourceProvider.configName();
if (clusterProps.igniteConfigUrl() != null) cfgName=fileName(clusterProps.igniteConfigUrl());
String licenceFile=null;
if (clusterProps.licenceUrl() != null) licenceFile=fileName(clusterProps.licenceUrl());
builder.setValue((licenceFile != null ? "find . -maxdepth 1 -name \"" + licenceFile + "\" -exec cp {} ./*/ \\; && " : "") + "find . -maxdepth 1 -name \"*.jar\" -exec cp {} ./*/libs/ \\; && " + "./*/bin/ignite.sh "+ cfgName+ " -J-Xmx"+ String.valueOf((int)igniteTask.mem() + "m")+ " -J-Xms"+ String.valueOf((int)igniteTask.mem())+ "m");
return Protos.TaskInfo.newBuilder().setName("Ignite node " + taskId.getValue()).setTaskId(taskId).setSlaveId(offer.getSlaveId()).setCommand(builder).addResources(Protos.Resource.newBuilder().setName(CPU).setType(Protos.Value.Type.SCALAR).setScalar(Protos.Value.Scalar.newBuilder().setValue(igniteTask.cpuCores()))).addResources(Protos.Resource.newBuilder().setName(MEM).setType(Protos.Value.Type.SCALAR).setScalar(Protos.Value.Scalar.newBuilder().setValue(igniteTask.mem()))).addResources(Protos.Resource.newBuilder().setName(DISK).setType(Protos.Value.Type.SCALAR).setScalar(Protos.Value.Scalar.newBuilder().setValue(igniteTask.disk()))).build();
}
|
Create Task.
|
public void startWorkflow(final ReceiptHeader receiptHeader) throws ApplicationRuntimeException {
final Boolean createVoucherForBillingService=collectionsUtil.checkVoucherCreation(receiptHeader);
Position position=null;
if (!collectionsUtil.isEmployee(receiptHeader.getCreatedBy())) position=collectionsUtil.getPositionByDeptDesgAndBoundary(receiptHeader.getReceiptMisc().getBoundary());
else position=collectionsUtil.getPositionOfUser(receiptHeader.getCreatedBy());
if (receiptHeader.getState() == null && !createVoucherForBillingService) receiptHeader.transition().start().withSenderName(receiptHeader.getCreatedBy().getUsername() + "::" + receiptHeader.getCreatedBy().getName()).withComments(CollectionConstants.WF_STATE_RECEIPT_CREATED).withStateValue(CollectionConstants.WF_STATE_RECEIPT_CREATED).withOwner(position).withDateInfo(new Date()).withNextAction(CollectionConstants.WF_ACTION_SUBMIT);
else if (createVoucherForBillingService) {
createVoucherForReceipt(receiptHeader);
receiptHeader.transition().start().withSenderName(receiptHeader.getCreatedBy().getUsername() + "::" + receiptHeader.getCreatedBy().getName()).withComments("Receipt voucher created").withStateValue(CollectionConstants.WF_ACTION_CREATE_VOUCHER).withOwner(position).withDateInfo(new Date()).withNextAction(CollectionConstants.WF_ACTION_SUBMIT);
}
if (receiptHeader.getReceiptMisc().getDepositedInBank() != null) receiptHeader.transition(true).withSenderName(receiptHeader.getCreatedBy().getUsername() + "::" + receiptHeader.getCreatedBy().getName()).withComments("Receipts Submitted for Approval").withStateValue(CollectionConstants.WF_ACTION_CREATE_VOUCHER).withOwner(position).withDateInfo(new Date()).withNextAction(CollectionConstants.WF_ACTION_SUBMIT);
LOGGER.debug("Workflow state transition complete");
}
|
Starts workflow for given set of receipt headers. Internally performs the following: 1. Start workflow 2. Transition workflow state with action "Create Receipt" 3. Create vouchers (if required) 4. If vouchers created, transition workflow state with action "Create Voucher"
|
public RowSet createShared() throws SQLException {
throw new UnsupportedOperationException();
}
|
Returns a new <code>RowSet</code> object backed by the same data as that of this <code>CachedRowSetImpl</code> object and sharing a set of cursors with it. This allows cursors to interate over a shared set of rows, providing multiple views of the underlying data.
|
public static void selectAllText(Element e){
Range range=Browser.getDocument().createRange();
range.selectNode(e);
Browser.getWindow().getSelection().addRange(range);
}
|
Selects all text in the specified element.
|
public E replace(int key,E value){
if (value == null) {
return get(key);
}
synchronized (this) {
Object[] arr=array;
if (arr.length <= key) {
return null;
}
E prev=(E)arr[key];
if (prev != null) {
arr[key]=value;
array=arr;
size++;
}
return prev;
}
}
|
Replaces the entry for the specified key only if it is currently mapped to some value.
|
public void clear(){
for (int i=0; i < individuals.length; i++) individuals[i]=null;
}
|
Sets all Individuals in the Subpopulation to null, preparing it to be reused.
|
public static void main(String[] args) throws IOException {
boolean enableOutput=true;
boolean outputToFile=false;
String inputFolder=IqrMc.class.getClassLoader().getResource("workload/planetlab").getPath();
String outputFolder="output";
String workload="20110303";
String vmAllocationPolicy="iqr";
String vmSelectionPolicy="mc";
String parameter="1.5";
new PlanetLabRunner(enableOutput,outputToFile,inputFolder,outputFolder,workload,vmAllocationPolicy,vmSelectionPolicy,parameter);
}
|
The main method.
|
public byte[] serializeValue(Object value) throws IOException {
serializeObject(value,dataInputOutput.reset(),compression);
return dataInputOutput.toByteArray();
}
|
Serializes the value object and returns it as a byte array.
|
public final void addElement(int value){
if ((m_firstFree + 1) >= m_mapSize) {
m_mapSize+=m_blocksize;
int newMap[]=new int[m_mapSize];
System.arraycopy(m_map,0,newMap,0,m_firstFree + 1);
m_map=newMap;
}
m_map[m_firstFree]=value;
m_firstFree++;
}
|
Append a int onto the vector.
|
public static List propertyDescriptors(int apiLevel){
return PROPERTY_DESCRIPTORS;
}
|
Returns a list of structural property descriptors for this node type. Clients must not modify the result.
|
public static String decode(String s1){
StringBuffer buf=new StringBuffer();
int i;
for (i=0; i < s1.length(); ++i) {
char ch=s1.charAt(i);
if (ch == '&') {
int semi=s1.indexOf(';',i + 1);
if (semi == -1) {
buf.append(ch);
continue;
}
String entity=s1.substring(i + 1,semi);
Integer iso;
if (entity.charAt(0) == '#') {
iso=new Integer(entity.substring(1));
}
else {
iso=e2i.get(entity);
}
if (iso == null) {
buf.append("&" + entity + ";");
}
else {
buf.append((char)(iso.intValue()));
}
i=semi;
}
else {
buf.append(ch);
}
}
return buf.toString();
}
|
Given a string containing entity escapes, returns a string containing the actual Unicode characters corresponding to the escapes. Adapted from http://www.purpletech.com/code/src/com/purpletech/util/Utils.java.
|
public double[] computeLocalJointEntropyUsingPreviousObservations(double states[][]){
return computeLocalJointEntropyUsingPreviousObservations(states,false);
}
|
Compute the local joint entropy values for these given values, using the previously provided observations to compute the probabilities. Calls to this method will not harness dynamic correlation exclusion (if set) since we don't know whether it's the same time set or not.
|
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 CSVReaderBuilder withCSVParser(final CSVParser csvParser){
this.csvParser=csvParser;
return this;
}
|
Sets the parser to use to parse the input.
|
public boolean hasAnnotatedQuery(){
return getAnnotatedQuery() != null;
}
|
Returns whether the method has an annotated query.
|
public Block(NetworkParameters params,long version,Sha256Hash prevBlockHash,Sha256Hash merkleRoot,long time,long difficultyTarget,long nonce,List<Transaction> transactions){
super(params);
this.version=version;
this.prevBlockHash=prevBlockHash;
this.merkleRoot=merkleRoot;
this.time=time;
this.difficultyTarget=difficultyTarget;
this.nonce=nonce;
this.transactions=new LinkedList<Transaction>();
this.transactions.addAll(transactions);
}
|
Construct a block initialized with all the given fields.
|
protected void endNode(Node node) throws org.xml.sax.SAXException {
switch (node.getNodeType()) {
case Node.DOCUMENT_NODE:
break;
case Node.DOCUMENT_TYPE_NODE:
serializeDocType((DocumentType)node,false);
break;
case Node.ELEMENT_NODE:
serializeElement((Element)node,false);
break;
case Node.CDATA_SECTION_NODE:
break;
case Node.ENTITY_REFERENCE_NODE:
serializeEntityReference((EntityReference)node,false);
break;
default :
}
}
|
End processing of given node
|
public LayerSupport(Object sourceBean){
super(sourceBean);
logger.fine("LayerSupport created");
}
|
Construct a LayerSupport.
|
@Beta public static <K,V>ImmutableListMultimap<K,V> copyOf(Iterable<? extends Entry<? extends K,? extends V>> entries){
return new Builder<K,V>().putAll(entries).build();
}
|
Returns an immutable multimap containing the specified entries. The returned multimap iterates over keys in the order they were first encountered in the input, and the values for each key are iterated in the order they were encountered.
|
public XString(String val){
super(val);
}
|
Construct a XNodeSet object.
|
public int currentAsSource(){
return currentAsSource.get();
}
|
Number of ongoing recoveries for which a shard serves as a source
|
private static int bitCount(long val){
val-=(val & 0xaaaaaaaaaaaaaaaaL) >>> 1;
val=(val & 0x3333333333333333L) + ((val >>> 2) & 0x3333333333333333L);
val=(val + (val >>> 4)) & 0x0f0f0f0f0f0f0f0fL;
val+=val >>> 8;
val+=val >>> 16;
return ((int)(val) + (int)(val >>> 32)) & 0xff;
}
|
Returns the number of bits set in val. For a derivation of this algorithm, see "Algorithms and data structures with applications to graphics and geometry", by Jurg Nievergelt and Klaus Hinrichs, Prentice Hall, 1993.
|
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
|
Load Meta Data
|
public static void assertAlmostEquals(String message,Number expected,Number actual,int decimals){
double exp;
double act;
double factor;
factor=Math.pow(10,decimals);
exp=Math.round(expected.doubleValue() * factor) / factor;
act=Math.round(actual.doubleValue() * factor) / factor;
if (message == null) TestCase.assertEquals(exp,act);
else TestCase.assertEquals(message,exp,act);
}
|
Tests whether numbers are the same up to the specified decimals.
|
public synchronized void removeSession(Session session){
if (session != null) {
userSessions.remove(session);
}
}
|
Remove a session. This method is called after the user has disconnected.
|
public synchronized void store(String fileName) throws IOException {
ByteArrayOutputStream out=new ByteArrayOutputStream();
store(out,null);
ByteArrayInputStream in=new ByteArrayInputStream(out.toByteArray());
InputStreamReader reader=new InputStreamReader(in,"ISO8859-1");
LineNumberReader r=new LineNumberReader(reader);
Writer w;
try {
w=new OutputStreamWriter(FileUtils.newOutputStream(fileName,false));
}
catch ( Exception e) {
throw new IOException(e.toString(),e);
}
PrintWriter writer=new PrintWriter(new BufferedWriter(w));
while (true) {
String line=r.readLine();
if (line == null) {
break;
}
if (!line.startsWith("#")) {
writer.print(line + "\n");
}
}
writer.close();
}
|
Store a properties file. The header and the date is not written.
|
DoublesAuxiliary(DoublesSketch qs){
int k=qs.getK();
long n=qs.getN();
long bitPattern=qs.getBitPattern();
double[] combinedBuffer=qs.getCombinedBuffer();
int baseBufferCount=qs.getBaseBufferCount();
int numSamples=qs.getRetainedItems();
double[] itemsArr=new double[numSamples];
long[] cumWtsArr=new long[numSamples + 1];
populateFromQuantilesSketch(k,n,bitPattern,combinedBuffer,baseBufferCount,numSamples,itemsArr,cumWtsArr);
DoublesMergeImpl.blockyTandemMergeSort(itemsArr,cumWtsArr,numSamples,k);
long subtot=0;
for (int i=0; i < numSamples + 1; i++) {
long newSubtot=subtot + cumWtsArr[i];
cumWtsArr[i]=subtot;
subtot=newSubtot;
}
assert subtot == n;
auxN_=n;
auxSamplesArr_=itemsArr;
auxCumWtsArr_=cumWtsArr;
}
|
Constructs the Auxiliary structure from the DoublesSketch
|
public static boolean canSwapRows(Matrix matrix,int row1,int row2,int col1){
boolean response=true;
for (int col=0; col < col1; ++col) {
if (0 == matrix.getAsDouble(row1,col)) {
if (0 != matrix.getAsDouble(row2,col)) {
response=false;
break;
}
}
}
return response;
}
|
Check to see if a non-zero and a zero value in the rows leading up to this column can be swapped. This is part of the bandwidth reduction algorithm.
|
public Move makeMove(int startSquare,int endSquare,int promotePiece) throws IllegalArgumentException {
Move move=null;
Move[] legals=getLegalMoves().asArray();
for (int i=0; move == null && i < legals.length; i++) {
Move candidate=legals[i];
if (candidate.getFrom() == startSquare && candidate.getTo() == endSquare && candidate.getPiecePromotedTo() == promotePiece) {
move=candidate;
}
}
if (move == null) {
throw new IllegalArgumentException("Invalid move: " + getSan(startSquare) + "-"+ getSan(endSquare)+ "="+ toString());
}
else {
forceMove(move);
}
return move;
}
|
Makes a move using the start/end square and the specified promotion piece.
|
public boolean isMediaProfileSource(){
return mediaProfileSource;
}
|
Ruft den Wert der mediaProfileSource-Eigenschaft ab.
|
public boolean isLeftMouseButton(MouseEvent me){
return SwingUtilities.isLeftMouseButton(me);
}
|
A method to set how a left mouse button is interpreted. We count control-clicks as not a left mouse click.
|
public LabelRenderer(){
}
|
Create a new LabelRenderer. By default the field "label" is used as the field name for looking up text, and no image is used.
|
public void clear(){
Assert.check(currentState != BitsState.UNKNOWN);
for (int i=0; i < bits.length; i++) {
bits[i]=0;
}
currentState=BitsState.NORMAL;
}
|
This set = {}.
|
@Override public boolean swipe(String obj,String dir,int steps) throws UiObjectNotFoundException {
return swipe(getUiObject(obj),dir,steps);
}
|
Performs the swipe up/down/left/right action on the UiObject
|
private static int packBits(byte[] input,int inOffset,int inCount,byte[] output,int outOffset){
int inMax=inOffset + inCount - 1;
int inMaxMinus1=inMax - 1;
while (inOffset <= inMax) {
int run=1;
byte replicate=input[inOffset];
while (run < 127 && inOffset < inMax && input[inOffset] == input[inOffset + 1]) {
run++;
inOffset++;
}
if (run > 1) {
inOffset++;
output[outOffset++]=(byte)(-(run - 1));
output[outOffset++]=replicate;
}
run=0;
int saveOffset=outOffset;
while (run < 128 && ((inOffset < inMax && input[inOffset] != input[inOffset + 1]) || (inOffset < inMaxMinus1 && input[inOffset] != input[inOffset + 2]))) {
run++;
output[++outOffset]=input[inOffset++];
}
if (run > 0) {
output[saveOffset]=(byte)(run - 1);
outOffset++;
}
if (inOffset == inMax) {
if (run > 0 && run < 128) {
output[saveOffset]++;
output[outOffset++]=input[inOffset++];
}
else {
output[outOffset++]=(byte)0;
output[outOffset++]=input[inOffset++];
}
}
}
return outOffset;
}
|
Performs PackBits compression for a single buffer of data. This should be called for each row of each tile. The returned value is the offset into the output buffer after compression.
|
public void testMergeOneFilterIntoDocumentWithSameFilter() throws Exception {
String srcXml="<web-app>" + " <filter>" + " <filter-name>f1</filter-name>"+ " <filter-class>fclass1</filter-class>"+ " </filter>"+ "</web-app>";
WebXml srcWebXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(srcXml.getBytes("UTF-8")),null);
WebXml mergeWebXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(srcXml.getBytes("UTF-8")),null);
WebXmlMerger merger=new WebXmlMerger(srcWebXml);
merger.mergeFilters(mergeWebXml);
assertTrue(WebXmlUtils.hasFilter(srcWebXml,"f1"));
}
|
Tests whether a single filter in the merge descriptor is ignored because a filter with the same name already exists in the source descriptor.
|
public Object jjtAccept(ParserVisitor visitor,Object data){
return visitor.visit(this,data);
}
|
Accept the visitor.
|
public void yypushback(int number){
if (number > yylength()) zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos-=number;
}
|
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method
|
public JEditorPassword(){
super();
}
|
Creates a new instance of JEditorPassword
|
static int computePreferredBufferSize(int dataLength){
if (dataLength > DEFAULT_BUFFER_SIZE) return DEFAULT_BUFFER_SIZE;
return dataLength;
}
|
Returns the buffer size to efficiently write dataLength bytes to this CodedOutputStream. Used by AbstractMessageLite.
|
public void update(Graphics a,JComponent b){
for (int i=0; i < uis.size(); i++) {
((ComponentUI)(uis.elementAt(i))).update(a,b);
}
}
|
Invokes the <code>update</code> method on each UI handled by this object.
|
public Cache(int pref_size){
this(pref_size,9);
}
|
Creates the Cache object of size of 9.
|
public Inference(){
}
|
Instantiates a new inference.
|
public void testOneTrackTwoSegments() throws Exception {
Capture<Track> track=new Capture<Track>();
Location location0=createLocation(0,DATE_FORMAT_0.parse(TRACK_TIME_0).getTime());
myTracksProviderUtils.clearTrack(getContext(),TRACK_ID_0);
expectFirstTrackPoint(location0,TRACK_ID_0,TRACK_POINT_ID_0);
expect(myTracksProviderUtils.bulkInsertTrackPoint((Location[])AndroidMock.anyObject(),eq(5),eq(TRACK_ID_0))).andStubReturn(5);
expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID_0)).andReturn(TRACK_POINT_ID_3);
expect(myTracksProviderUtils.getTrack(PreferencesUtils.getLong(getContext(),R.string.recording_track_id_key))).andStubReturn(null);
expectUpdateTrack(track,true,TRACK_ID_0);
AndroidMock.replay(myTracksProviderUtils);
InputStream inputStream=new ByteArrayInputStream(VALID_ONE_TRACK_TWO_SEGMENTS_GPX.getBytes());
KmlFileTrackImporter kmlFileTrackImporter=new KmlFileTrackImporter(getContext(),TRACK_ID_0,myTracksProviderUtils);
long trackId=kmlFileTrackImporter.importFile(inputStream);
assertEquals(TRACK_ID_0,trackId);
long time0=DATE_FORMAT_0.parse(TRACK_TIME_0).getTime();
long time1=DATE_FORMAT_1.parse(TRACK_TIME_1).getTime();
long time2=DATE_FORMAT_1.parse(TRACK_TIME_2).getTime();
long time3=DATE_FORMAT_1.parse(TRACK_TIME_3).getTime();
assertEquals(time1 - time0 + time3 - time2,track.getValue().getTripStatistics().getTotalTime());
AndroidMock.verify(myTracksProviderUtils);
verifyTrack(track.getValue(),TRACK_NAME_0,TRACK_DESCRIPTION_0,DATE_FORMAT_0.parse(TRACK_TIME_0).getTime());
}
|
Tests one track with two segments.
|
public void preferenceChanged(View child,boolean width,boolean height){
super.preferenceChanged(child,width,height);
if (TableView.this.multiRowCells && height) {
for (int i=rowIndex - 1; i >= 0; i--) {
RowView rv=TableView.this.getRow(i);
if (rv.multiRowCells) {
rv.preferenceChanged(null,false,true);
break;
}
}
}
}
|
This is called by a child to indicate its preferred span has changed. This is implemented to execute the superclass behavior and well as try to determine if a row with a multi-row cell hangs across this row. If a multi-row cell covers this row it also needs to propagate a preferenceChanged so that it will recalculate the multi-row cell.
|
public OutputModelObject buildParserOutputModel(){
Grammar g=delegate.getGrammar();
CodeGenerator gen=delegate.getGenerator();
ParserFile file=parserFile(gen.getRecognizerFileName());
setRoot(file);
Parser parser=parser(file);
file.parser=parser;
for ( Rule r : g.rules.values()) {
buildRuleFunction(parser,r);
}
return file;
}
|
Build a file with a parser containing rule functions. Use the controller as factory in SourceGenTriggers so it triggers codegen extensions too, not just the factory functions in this factory.
|
public int FindSym(int type,String id,String context){
int i=0;
while (i < symtab.size()) {
SymTabEntry se=(SymTabEntry)symtab.elementAt(i);
if (se.id.equals(id) && se.context.equals(context) && se.type == type) return i;
i=i + 1;
}
return i;
}
|
Various ways to look up something in the symbol table. Returns the index in the table. If the index equals symtab.size() (which makes no sense), then it isn't in the symbol table.
|
private JSONObject extractMetaDataFromFields(JSONObject metaData){
try {
metaData.put("title",mTitleText.getText().toString());
metaData.put("caption",mCaptionText.getText().toString());
metaData.put("alt",mAltText.getText().toString());
if (mAlignmentSpinner.getSelectedItemPosition() < mAlignmentKeyArray.length) {
metaData.put("align",mAlignmentKeyArray[mAlignmentSpinner.getSelectedItemPosition()]);
}
metaData.put("linkUrl",mLinkTo.getText().toString());
int newWidth=getEditTextIntegerClamped(mWidthText,10,mMaxImageWidth);
metaData.put("width",newWidth);
metaData.put("height",getRelativeHeightFromWidth(newWidth));
}
catch ( JSONException e) {
AppLog.d(AppLog.T.EDITOR,"Unable to build JSON object from new meta data");
}
return metaData;
}
|
Extracts the meta data from the dialog fields and updates the entries in the given JSONObject.
|
public String optString(String key,String defaultValue){
Object object=this.opt(key);
return NULL.equals(object) ? defaultValue : object.toString();
}
|
Get an optional string associated with a key. It returns the defaultValue if there is no such key.
|
@Override public Object clone() throws CloneNotSupportedException {
return super.clone();
}
|
Returns a clone of the annotation.
|
public Protos.TaskInfo createTask(Configuration configuration,FrameworkState frameworkState,Protos.Offer offer,Clock clock){
long elasticSearchNodeId=configuration.getExternalVolumeDriver() != null && configuration.getExternalVolumeDriver().length() > 0 ? clusterState.getElasticNodeId() : ExecutorEnvironmentalVariables.EXTERNAL_VOLUME_NOT_CONFIGURED;
LOGGER.debug("Elastic Search Node Id: " + elasticSearchNodeId);
if (configuration.isFrameworkUseDocker()) {
LOGGER.debug("Building Docker task");
Protos.TaskInfo taskInfo=buildDockerTask(offer,configuration,clock,elasticSearchNodeId);
LOGGER.debug(taskInfo.toString());
return taskInfo;
}
else {
LOGGER.debug("Building native task");
Protos.TaskInfo taskInfo=buildNativeTask(offer,configuration,clock,elasticSearchNodeId);
LOGGER.debug(taskInfo.toString());
return taskInfo;
}
}
|
Creates TaskInfo for Elasticsearch execcutor running in a Docker container
|
public static final byte[] encodeQuotedPrintable(BitSet printable,byte[] bytes){
if (bytes == null) {
return null;
}
if (printable == null) {
printable=PRINTABLE_CHARS;
}
ByteArrayOutputStream buffer=new ByteArrayOutputStream();
for (int i=0; i < bytes.length; i++) {
int b=bytes[i];
if (b < 0) {
b=256 + b;
}
if (printable.get(b)) {
buffer.write(b);
}
else {
encodeQuotedPrintable(b,buffer);
}
}
return buffer.toByteArray();
}
|
Encodes an array of bytes into an array of quoted-printable 7-bit characters. Unsafe characters are escaped. <p> This function implements a subset of quoted-printable encoding specification (rule #1 and rule #2) as defined in RFC 1521 and is suitable for encoding binary data and unformatted text. </p>
|
public PEModule(File peFile,Architecture arch) throws IOException, BinaryParseException {
InputStream inStream=new FileInputStream(peFile);
fileName=peFile.getName();
inBuf=new BinaryFileInputBuffer(inStream);
msdos_stub=new MSDOS_Stub(inBuf);
inBuf.seek(msdos_stub.getHeaderAddress());
if (!inBuf.match(PE_Header.PE_TAG)) throw new BinaryParseException("PEModule: Missing PE signature");
coff_header=new COFF_Header(inBuf);
pe_header=new PE_Header(inBuf);
section_headers=new SectionHeader[coff_header.getNumberOfSections()];
for (int i=0; i < coff_header.getNumberOfSections(); i++) {
section_headers[i]=new SectionHeader(inBuf);
}
long expTableRVA=pe_header.getDataDirectory()[ImageDataDirectory.EXPORT_TABLE_INDEX].VirtualAddress;
if (expTableRVA > 0) {
logger.debug("-- Reading export table...");
inBuf.seek(getFilePointerFromRVA(expTableRVA));
ImageExportDirectory imageExportDirectory=new ImageExportDirectory(inBuf);
inBuf.seek(getFilePointerFromRVA(imageExportDirectory.AddressOfFunctions));
ExportEntry[] tmpEntries=new ExportEntry[(int)imageExportDirectory.NumberOfFunctions];
int eatEntries=0;
for (int i=0; i < tmpEntries.length; i++) {
long rva=inBuf.readDWORD();
if (rva > 0) {
tmpEntries[i]=new ExportEntry((int)(i + imageExportDirectory.Base),new AbsoluteAddress(rva + getBaseAddress()));
eatEntries++;
}
}
long namePtr=getFilePointerFromRVA(imageExportDirectory.AddressOfNames);
long ordPtr=getFilePointerFromRVA(imageExportDirectory.AddressOfNameOrdinals);
for (int i=0; i < imageExportDirectory.NumberOfNames; i++) {
inBuf.seek(namePtr);
long rva=inBuf.readDWORD();
namePtr=inBuf.getCurrent();
inBuf.seek(getFilePointerFromRVA(rva));
String expName=inBuf.readASCII();
inBuf.seek(ordPtr);
int ord=inBuf.readWORD();
ordPtr=inBuf.getCurrent();
tmpEntries[ord].setName(expName);
}
exportEntries=new ExportEntry[eatEntries];
int j=0;
for (int i=0; i < tmpEntries.length; i++) if (tmpEntries[i] != null) exportEntries[j++]=tmpEntries[i];
logger.debug("-- Got " + exportEntries.length + " exported symbols.");
}
else logger.debug("-- File contains no exports");
importTable=new HashMap<AbsoluteAddress,Pair<String,String>>();
long impTableRVA=pe_header.getDataDirectory()[ImageDataDirectory.IMPORT_TABLE_INDEX].VirtualAddress;
if (impTableRVA > 0) {
logger.debug("-- Reading image import descriptors...");
inBuf.seek(getFilePointerFromRVA(impTableRVA));
List<ImageImportDescriptor> imageImportDescriptors=new LinkedList<ImageImportDescriptor>();
while (true) {
ImageImportDescriptor cur=new ImageImportDescriptor(inBuf);
if (cur.isZero()) break;
imageImportDescriptors.add(cur);
}
for ( ImageImportDescriptor descriptor : imageImportDescriptors) {
inBuf.seek(getFilePointerFromRVA(descriptor.Name));
String libraryFileName=inBuf.readASCII();
logger.debug("-- Parsing imports from " + libraryFileName + "...");
libraryFileName=libraryFileName.toLowerCase();
boolean bound=descriptor.TimeDateStamp != 0;
long iatFilePtr;
if (bound) iatFilePtr=getFilePointerFromRVA(descriptor.OriginalFirstThunk);
else iatFilePtr=getFilePointerFromRVA(descriptor.FirstThunk);
AbsoluteAddress iatAddress=new AbsoluteAddress(descriptor.FirstThunk + getBaseAddress());
while (true) {
inBuf.seek(iatFilePtr);
long thunk=inBuf.readDWORD();
iatFilePtr=inBuf.getCurrent();
if (thunk == 0) break;
if ((thunk & 0x80000000) != 0) {
int ord=(int)(thunk & 0x7FFFFFFF);
String ordName="ord(" + ord + ")";
importTable.put(iatAddress,Pair.create(libraryFileName,ordName));
}
else {
long rva=getFilePointerFromRVA(thunk);
if (rva < 0) throw new BinaryParseException("RVA in thunk points outside of image!");
inBuf.seek(rva + 2);
String funcName=inBuf.readASCII();
importTable.put(iatAddress,Pair.create(libraryFileName,funcName));
}
iatAddress=new AbsoluteAddress(iatAddress.getValue() + 4);
}
}
}
logger.debug("-- Got " + importTable.size() + " imported function symbols.");
symbolFinder=new PESymbolFinder(this);
}
|
Parses a PEModule from a specified file
|
public PriceModelException(Reason reason){
super(reason.toString());
setMessageKey(getMessageKey() + "." + reason.toString());
}
|
Constructs a new exception with the specified reason set as its detail message and appended to the message key.
|
public PathTool(SVGPathFigure pathPrototype,SVGBezierFigure bezierPrototype,@Nullable Map<AttributeKey,Object> attributes){
super(bezierPrototype,attributes);
this.pathPrototype=pathPrototype;
}
|
Creates a new instance.
|
public void clearLearnedTable(){
macVlanToSwitchPortMap.clear();
}
|
Clears the MAC/VLAN -> SwitchPort map for all switches
|
public BigdataLiteral evaluate(final BigdataValueFactory valueFactory,final Value... args) throws ValueExprEvaluationException {
if (args.length < 3 || args.length > 4) {
throw new ValueExprEvaluationException("Incorrect number of arguments for REPLACE: " + args.length);
}
try {
Literal arg=(Literal)args[0];
Literal pattern=(Literal)args[1];
Literal replacement=(Literal)args[2];
Literal flags=null;
if (args.length == 4) {
flags=(Literal)args[3];
}
if (!QueryEvaluationUtil.isStringLiteral(arg)) {
throw new ValueExprEvaluationException("incompatible operand for REPLACE: " + arg);
}
if (!QueryEvaluationUtil.isSimpleLiteral(replacement)) {
throw new ValueExprEvaluationException("incompatible operand for REPLACE: " + replacement);
}
String argString=arg.getLabel();
String replacementString=replacement.getLabel();
Pattern p=(Pattern)getProperty(Annotations.PATTERN);
if (p == null) {
p=getPattern(pattern,flags);
}
String result=p.matcher(argString).replaceAll(replacementString);
String lang=arg.getLanguage();
URI dt=arg.getDatatype();
if (lang != null) {
return valueFactory.createLiteral(result,lang);
}
else if (dt != null) {
return valueFactory.createLiteral(result,dt);
}
else {
return valueFactory.createLiteral(result);
}
}
catch ( ClassCastException e) {
throw new ValueExprEvaluationException("literal operands expected",e);
}
}
|
Lifted directly from Sesame's Replace operator. FIXME The Pattern should be cached if the pattern argument and flags are constants.
|
public QualityDirectedStagedDeepening(IScore eval,IVisitor visitor){
super(visitor);
this.eval=eval;
}
|
Target a specific goal in mind, using the provided evaluation score
|
private Constants(){
}
|
Disallow instantiation
|
public boolean isInDiscoveryOnlyMode(){
return _inDiscoveryOnlyMode;
}
|
Returns whether or not the context is in Discovery-Only mode. If true, then the VPLEX API will NOT be queried for new data and only data present in the database can be used for ingestion.
|
private List<AuditRecord> auditUpdate(DatabaseDataSet databaseDataSet,OperationGroup updateGroup) throws IllegalPersistStateException {
List<AuditRecord> records=new LinkedList<>();
for ( Entity entity : updateGroup.getEntities()) {
AuditRecord auditRecord=null;
Entity originalEntity=databaseDataSet.getEntity(entity.getEntityType(),entity.getKey().getValue());
for ( Node node : entity.getChildren()) {
if (node instanceof ValueNode) {
ValueNode updatedNode=(ValueNode)node;
ValueNode origNode=originalEntity.getChild(node.getName(),ValueNode.class);
if (!Objects.equals(origNode.getValue(),updatedNode.getValue())) {
if (auditRecord == null) {
auditRecord=new AuditRecord(entity.getEntityType(),entity.getKey().getValue());
}
auditRecord.addChange(node,origNode.getValue(),updatedNode.getValue());
}
}
else if (node instanceof RefNode) {
RefNode origNode=originalEntity.getChild(node.getName(),RefNode.class);
RefNode updatedNode=(RefNode)node;
if (!Objects.equals(origNode.getEntityKey(),updatedNode.getEntityKey())) {
if (auditRecord == null) {
auditRecord=new AuditRecord(entity.getEntityType(),entity.getKey().getValue());
}
auditRecord.addChange(node,origNode.getEntityKey(),updatedNode.getEntityKey());
}
}
}
if (auditRecord != null) {
records.add(auditRecord);
LOG.debug("Changes found for " + entity);
}
else {
LOG.debug("No changes found for " + entity);
}
}
return records;
}
|
Audit entities which are updated again only changes are audited
|
private TestClient(Socket sock,InetAddress addr,int port,int connTimeout) throws IgniteCheckedException {
this.sock=sock;
try {
sock.connect(new InetSocketAddress(addr,port),connTimeout);
if (sock instanceof SSLSocket) ((SSLSocket)sock).startHandshake();
out=sock.getOutputStream();
in=sock.getInputStream();
}
catch ( IOException e) {
close();
throw new IgniteCheckedException(e);
}
}
|
Creates test client.
|
private void noSuccessor(){
if (compute == FRAMES) {
Label l=new Label();
l.frame=new Frame();
l.frame.owner=l;
l.resolve(this,code.length,code.data);
previousBlock.successor=l;
previousBlock=l;
}
else {
currentBlock.outputStackMax=maxStackSize;
}
currentBlock=null;
}
|
Ends the current basic block. This method must be used in the case where the current basic block does not have any successor.
|
protected void addNewDocument(String name,int parentId,String fileExt,int sortOrder,InputStream inputStreamDocumentFile,Reader readerAnnFile) throws Exception {
FolderTokenDocument doc;
int id;
id=super.generateNextNewNodeId();
doc=new FolderTokenDocument(id,name,parentId,id,fileExt,sortOrder,inputStreamDocumentFile,readerAnnFile,FolderEditFlag.NEW);
super.add(doc);
}
|
Agrega un nuevo documento a la lista. Genera el nuevo identificador para dicho documento
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.