code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public Object runSafely(Catbert.FastStack stack) throws Exception {
UIManager uiMgr=stack.getUIMgr();
if (uiMgr == null) return new Integer(0);
else {
java.awt.Dimension d=uiMgr.getUIDisplayResolution();
return (d == null) ? new Integer(720) : new Integer(d.width);
}
}
|
Returns the width in pixels of the current display resolution set
|
public String toString(){
if (m_barcode == null) return super.toString();
return super.toString() + " " + m_barcode.getData();
}
|
String Representation
|
public void startSpinning(){
isSpinning=true;
postInvalidate();
}
|
Puts the view on spin mode
|
public static String javaDecode(String s){
int length=s.length();
StringBuilder buff=new StringBuilder(length);
for (int i=0; i < length; i++) {
char c=s.charAt(i);
if (c == '\\') {
if (i + 1 >= s.length()) {
throw getFormatException(s,i);
}
c=s.charAt(++i);
switch (c) {
case 't':
buff.append('\t');
break;
case 'r':
buff.append('\r');
break;
case 'n':
buff.append('\n');
break;
case 'b':
buff.append('\b');
break;
case 'f':
buff.append('\f');
break;
case '#':
buff.append('#');
break;
case '=':
buff.append('=');
break;
case ':':
buff.append(':');
break;
case '"':
buff.append('"');
break;
case '\\':
buff.append('\\');
break;
case 'u':
{
try {
c=(char)(Integer.parseInt(s.substring(i + 1,i + 5),16));
}
catch (NumberFormatException e) {
throw getFormatException(s,i);
}
i+=4;
buff.append(c);
break;
}
default :
if (c >= '0' && c <= '9') {
try {
c=(char)(Integer.parseInt(s.substring(i,i + 3),8));
}
catch (NumberFormatException e) {
throw getFormatException(s,i);
}
i+=2;
buff.append(c);
}
else {
throw getFormatException(s,i);
}
}
}
else {
buff.append(c);
}
}
return buff.toString();
}
|
Decode a text that is encoded as a Java string literal. The Java properties file format and Java source code format is supported.
|
public final void testSetMaxPathLength() throws Exception {
KeyStore keyTest=KeyStore.getInstance(KeyStore.getDefaultType());
keyTest.load(null,null);
ByteArrayInputStream certArray=new ByteArrayInputStream(certificate.getBytes());
ByteArrayInputStream certArray2=new ByteArrayInputStream(certificate2.getBytes());
CertificateFactory cf=CertificateFactory.getInstance("X.509");
X509Certificate cert[]=new X509Certificate[2];
cert[0]=(X509Certificate)cf.generateCertificate(certArray);
cert[1]=(X509Certificate)cf.generateCertificate(certArray2);
keyTest.setCertificateEntry("alias1",cert[0]);
keyTest.setCertificateEntry("alias2",cert[0]);
keyTest.setCertificateEntry("alias3",cert[1]);
PKIXBuilderParameters p=new PKIXBuilderParameters(keyTest,new X509CertSelector());
assertEquals(5,p.getMaxPathLength());
p.setMaxPathLength(10);
assertEquals(10,p.getMaxPathLength());
p.setMaxPathLength(0);
assertEquals(0,p.getMaxPathLength());
p.setMaxPathLength(-1);
assertEquals(-1,p.getMaxPathLength());
int[] maxPathLength={-2,-10,Integer.MIN_VALUE};
for (int i=0; i < maxPathLength.length; i++) {
try {
p.setMaxPathLength(maxPathLength[i]);
fail("InvalidParameterException expected ");
}
catch ( InvalidParameterException e) {
}
}
}
|
Test for <code>setMaxPathLength()</code>
|
private static <T extends AbstractBlockBase<T>>void computeCodeEmittingOrder(List<T> order,PriorityQueue<T> worklist,BitSet visitedBlocks){
while (!worklist.isEmpty()) {
T nextImportantPath=worklist.poll();
addPathToCodeEmittingOrder(nextImportantPath,order,worklist,visitedBlocks);
}
}
|
Iteratively adds paths to the code emission block order.
|
public void selectEvent(final Event event){
final XTableModel model=table.getXTableModel();
for (int i=table.getRowCount() - 1; i >= 0; i--) {
final Event e=(Event)model.getValueAt(table.convertRowIndexToModel(i),eventColIdx);
if (e == event) {
programmaticSelection=true;
table.getSelectionModel().setSelectionInterval(i,i);
table.scrollRectToVisible(table.getCellRect(i,i,true));
programmaticSelection=false;
break;
}
}
}
|
Selects the specified event.
|
@Override public String toString(){
if (methOp != null) return methOp.toString();
switch (type) {
case METHOD_ACCESS:
return "<mem loc: methOp is null!>";
case FIELD_ACCESS:
return "<mem loc: " + fieldRef.getType().getName() + "."+ fieldRef.getName()+ ">";
case ARRAY_ACCESS:
return "<mem loc: array " + arrayElementType + "[]>";
case JTOC_ACCESS:
return "<mem loc: JTOC @" + Services.addressAsHexString(JTOCoffset.toWord().toAddress()) + ">";
case SPILL_ACCESS:
return "<mem loc: spill FP " + spillOffset + ">";
case ALENGTH_ACCESS:
return "<mem loc: array length>";
}
return "<mem loc: no aliases>";
}
|
Returns the string representation of this operand.
|
protected void executeTasksUntilEmpty(String queueName,@Nullable FakeClock clock) throws Exception {
while (true) {
ofy().clearSessionCache();
List<QueueStateInfo.TaskStateInfo> taskInfo=taskQueue.getQueueStateInfo().get(queueName).getTaskInfo();
if (taskInfo.isEmpty()) {
break;
}
QueueStateInfo.TaskStateInfo taskStateInfo=taskInfo.get(0);
taskQueue.deleteTask(queueName,taskStateInfo.getTaskName());
executeTask(queueName,taskStateInfo);
if (clock != null) {
clock.advanceOneMilli();
}
}
}
|
Executes mapreduce tasks, increment the clock between each task. <p>Incrementing the clock between tasks is important if tasks have transactions inside the mapper or reducer, which don't have access to the fake clock.
|
public Vector2i add(Vector2i v){
x+=v.x;
y+=v.y;
return this;
}
|
Add <code>v</code> to this vector.
|
public static void main(String[] args){
System.out.println("\nFeet Meters | Meters Feet\n" + "----------------------------------------------");
for (double feet=1.0, meters=20.0; feet <= 10.0; feet++, meters+=5) {
System.out.printf("%4.1f ",feet);
System.out.printf("%6.3f",footToMeter(feet));
System.out.print(" | ");
System.out.printf("%-11.1f",meters);
System.out.printf("%7.3f\n",meterToFoot(meters));
}
}
|
Main Method
|
public Object newTransport(HttpEngine httpEngine) throws IOException {
return (spdyConnection != null) ? new SpdyTransport(httpEngine,spdyConnection) : new HttpTransport(httpEngine,out,in);
}
|
Returns the transport appropriate for this connection.
|
public boolean isCovered(final Coordinate point){
Envelope e=new Envelope(point);
List<?> gList=spatialIndex.query(e);
PreparedPoint p=new PreparedPoint(geomFactory.createPoint(point));
for (int i=0; i < gList.size(); i++) {
Geometry g1=((MasonGeometry)gList.get(i)).getGeometry();
if (p.intersects(g1)) {
return true;
}
}
return false;
}
|
Returns true if the coordinate is within any geometry in the field. <p> However, it offers no guarantee for points on the boundaries. Use this version if you want to check if an agent is within a geometry; its roughly an order of magnitude faster than using the Geometry version.
|
public void showPassiveFocusIndicator(){
if (mFocusRing != null) {
mFocusRing.startPassiveFocus();
}
}
|
Show the passive focus indicator.
|
public OCSPAndCRLCertificateVerifier(final CRLSource crlSource,final OCSPSource ocspSource,final CertificatePool validationCertPool){
this.crlSource=crlSource;
this.ocspSource=ocspSource;
this.validationCertPool=validationCertPool;
}
|
Build a OCSPAndCRLCertificateVerifier that will use the provided CRLSource and OCSPSource
|
private void updatePostFailoverCancel(Volume volume) throws InternalException {
_log.info("Setting respective flags after failover of failover");
ProtectionSet protectionSet=_dbClient.queryObject(ProtectionSet.class,volume.getProtectionSet());
List<URI> volumeIDs=new ArrayList<URI>();
for ( String volumeString : protectionSet.getVolumes()) {
URI volumeURI;
try {
volumeURI=new URI(volumeString);
volumeIDs.add(volumeURI);
}
catch ( URISyntaxException e) {
_log.error("URI syntax incorrect: ",e);
}
}
for ( URI protectionVolumeID : volumeIDs) {
Volume protectionVolume=_dbClient.queryObject(Volume.class,protectionVolumeID);
if ((protectionVolume.checkPersonality(Volume.PersonalityTypes.TARGET.toString())) && (protectionVolume.getRpCopyName().equals(volume.getRpCopyName()))) {
_log.info("Change flags of failover target " + RPHelper.getRPWWn(protectionVolume.getId(),_dbClient));
protectionVolume.setAccessState(Volume.VolumeAccessState.NOT_READY.name());
protectionVolume.setLinkStatus(Volume.LinkStatus.IN_SYNC.name());
_dbClient.updateObject(protectionVolume);
}
else if (protectionVolume.checkPersonality(Volume.PersonalityTypes.SOURCE.toString())) {
_log.info("Change flags of failover source " + RPHelper.getRPWWn(protectionVolume.getId(),_dbClient));
protectionVolume.setLinkStatus(Volume.LinkStatus.IN_SYNC.name());
_dbClient.updateObject(protectionVolume);
}
}
}
|
After a failover of a failover (without swap), we need to set specific flags
|
public int next(){
int node=_currentNode;
int nodeType=_nodeType;
if (nodeType >= DTM.NTYPES) {
while (true) {
node=node + 1;
if (_sp < 0) {
node=NULL;
break;
}
else if (node >= _stack[_sp]) {
if (--_sp < 0) {
node=NULL;
break;
}
}
else if (_exptype(node) == nodeType) {
break;
}
}
}
else {
int expType;
while (true) {
node=node + 1;
if (_sp < 0) {
node=NULL;
break;
}
else if (node >= _stack[_sp]) {
if (--_sp < 0) {
node=NULL;
break;
}
}
else {
expType=_exptype(node);
if (expType < DTM.NTYPES) {
if (expType == nodeType) {
break;
}
}
else {
if (m_expandedNameTable.getType(expType) == nodeType) {
break;
}
}
}
}
}
_currentNode=node;
return (node == NULL) ? NULL : returnNode(makeNodeHandle(node));
}
|
Get the next node in the iteration.
|
public void disableCompatibilityMode(){
flags|=(FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS | FLAG_SUPPORTS_SMALL_SCREENS| FLAG_RESIZEABLE_FOR_SCREENS| FLAG_SUPPORTS_SCREEN_DENSITIES| FLAG_SUPPORTS_XLARGE_SCREENS);
}
|
Disable compatibility mode
|
public boolean isGuideLinesVisible(){
return this.guideLinesVisible;
}
|
Returns a flag that controls whether or not guide lines are drawn for each data item (the lines are horizontal and vertical "crosshairs" linking the data point to the axes).
|
public GridReversedLinesFileReader(final File file,final int blockSize,final Charset charset) throws IOException {
this.blockSize=blockSize;
this.encoding=charset;
randomAccessFile=new RandomAccessFile(file,"r");
totalByteLength=randomAccessFile.length();
int lastBlockLength=(int)(totalByteLength % blockSize);
if (lastBlockLength > 0) {
totalBlockCount=totalByteLength / blockSize + 1;
}
else {
totalBlockCount=totalByteLength / blockSize;
if (totalByteLength > 0) {
lastBlockLength=blockSize;
}
}
currentFilePart=new FilePart(totalBlockCount,lastBlockLength,null);
CharsetEncoder charsetEncoder=charset.newEncoder();
float maxBytesPerChar=charsetEncoder.maxBytesPerChar();
if (maxBytesPerChar == 1f) {
byteDecrement=1;
}
else if (charset == Charset.forName("UTF-8")) {
byteDecrement=1;
}
else if (charset == Charset.forName("Shift_JIS")) {
byteDecrement=1;
}
else if (charset == Charset.forName("UTF-16BE") || charset == Charset.forName("UTF-16LE")) {
byteDecrement=2;
}
else if (charset == Charset.forName("UTF-16")) {
throw new UnsupportedEncodingException("For UTF-16, you need to specify the byte order (use UTF-16BE or UTF-16LE)");
}
else {
throw new UnsupportedEncodingException("Encoding " + charset + " is not supported yet (feel free to submit a patch)");
}
newLineSequences=new byte[][]{"\r\n".getBytes(charset),"\n".getBytes(charset),"\r".getBytes(charset)};
avoidNewlineSplitBufferSize=newLineSequences[0].length;
}
|
Creates a ReverseLineReader with the given block size and encoding.
|
public void stop(){
if (mRunning.compareAndSet(true,false)) {
mTargetDataLine.stop();
mTargetDataLine.close();
}
}
|
Stops the reader thread
|
static public Automaton intersection(Automaton a1,Automaton a2){
if (a1 == a2) {
return a1;
}
if (a1.getNumStates() == 0) {
return a1;
}
if (a2.getNumStates() == 0) {
return a2;
}
Transition[][] transitions1=a1.getSortedTransitions();
Transition[][] transitions2=a2.getSortedTransitions();
Automaton c=new Automaton();
c.createState();
LinkedList<StatePair> worklist=new LinkedList<>();
HashMap<StatePair,StatePair> newstates=new HashMap<>();
StatePair p=new StatePair(0,0,0);
worklist.add(p);
newstates.put(p,p);
while (worklist.size() > 0) {
p=worklist.removeFirst();
c.setAccept(p.s,a1.isAccept(p.s1) && a2.isAccept(p.s2));
Transition[] t1=transitions1[p.s1];
Transition[] t2=transitions2[p.s2];
for (int n1=0, b2=0; n1 < t1.length; n1++) {
while (b2 < t2.length && t2[b2].max < t1[n1].min) b2++;
for (int n2=b2; n2 < t2.length && t1[n1].max >= t2[n2].min; n2++) if (t2[n2].max >= t1[n1].min) {
StatePair q=new StatePair(t1[n1].dest,t2[n2].dest);
StatePair r=newstates.get(q);
if (r == null) {
q.s=c.createState();
worklist.add(q);
newstates.put(q,q);
r=q;
}
int min=t1[n1].min > t2[n2].min ? t1[n1].min : t2[n2].min;
int max=t1[n1].max < t2[n2].max ? t1[n1].max : t2[n2].max;
c.addTransition(p.s,r.s,min,max);
}
}
}
c.finishState();
return removeDeadStates(c);
}
|
Returns an automaton that accepts the intersection of the languages of the given automata. Never modifies the input automata languages. <p> Complexity: quadratic in number of states.
|
public int computeEdgePoints(List<Object> facevec,List<CoordFloatString> allLLPoints) throws FormatException {
int ring_ptr=((Number)facevec.get(ringIDColumn)).intValue();
List<Object> ring1=new ArrayList<Object>(rings.getColumnCount());
rings.getRow(ring1,ring_ptr);
int fac_id=((Number)ring1.get(faceIDColumn)).intValue();
int startedgeid=((Number)ring1.get(ringStartColumn)).intValue();
if (startedgeid <= 0) {
return 0;
}
int nextedgeid=startedgeid;
boolean firsttime=true;
allLLPoints.clear();
int polySize=0;
int prev_node=-1;
final List<Object> edge=new ArrayList<Object>(edges.getColumnCount());
do {
edges.getRow(edge,nextedgeid);
int start_node=edges.getStartNode(edge);
int end_node=edges.getEndNode(edge);
int rht_face=edgeRightFaceAdapter.getPrimId(edge);
int lft_face=edgeLeftFaceAdapter.getPrimId(edge);
int right_edge=edgeRightEdgeAdapter.getPrimId(edge);
int left_edge=edgeLeftEdgeAdapter.getPrimId(edge);
if (firsttime) {
prev_node=start_node;
firsttime=false;
}
CoordFloatString cfs=edges.getCoordinates(edge);
if ((fac_id == rht_face) && (fac_id == lft_face)) {
if (start_node == prev_node) {
nextedgeid=right_edge;
prev_node=end_node;
}
else if (end_node == prev_node) {
nextedgeid=left_edge;
prev_node=start_node;
}
else {
throw new FormatException(" node matching assertion failed ");
}
}
else if (fac_id == rht_face) {
nextedgeid=right_edge;
prev_node=end_node;
polySize+=cfs.tcount;
allLLPoints.add(cfs);
}
else if (fac_id == lft_face) {
nextedgeid=left_edge;
prev_node=start_node;
polySize+=cfs.tcount;
cfs.tcount*=-1;
allLLPoints.add(cfs);
}
else {
throw new FormatException("Node Assertion failed");
}
}
while (nextedgeid != startedgeid);
return polySize;
}
|
Computes the full set of points that determine the edge of the area.
|
public static boolean withinPackage(Tree.Declaration decl){
return container(decl) instanceof com.redhat.ceylon.model.typechecker.model.Package;
}
|
Determines whether the declaration's containing scope is a package
|
public void encodeSolution(final DataOutputBuffer out,final IBindingSet bset){
out.append(encodeSolution(bset));
}
|
Encode the solution on the stream.
|
public int exprGetNumChildren(){
return getLength();
}
|
Return the number of children the node has.
|
public void putElements(K key,Set<E> elements){
synchronized (this) {
removeKey(key);
if (!elements.isEmpty()) {
for ( E element : elements) {
addElement(key,element);
}
}
}
}
|
Sets the elements corresponding to a particular key. The existing set for that key (if it exists) is cleared.
|
protected void createSubsample(){
for (int i=0; i < m_SampleSize; i++) {
if (m_subSample[i] != null) {
Instance copy=(Instance)m_subSample[i].copy();
push(copy);
}
else {
break;
}
}
m_subSample=null;
}
|
Creates a subsample of the current set of input instances. The output instances are pushed onto the output queue for collection.
|
protected void parseArgs(String[] args) throws AdeUsageException {
if (args.length == 0) {
usageError("No arguments supplied");
}
m_myArgs=args;
}
|
Parse the input arguments
|
public void selectNavItem(int selectedId){
if (mRootView != null) {
final LinearLayout navMenu=(LinearLayout)mRootView.findViewById(R.id.library_nav_menu);
for (int i=0; i < navMenu.getChildCount(); i++) {
View v=navMenu.getChildAt(i);
if (v instanceof TextView) {
TextView tv=(TextView)v;
if (tv.getId() == selectedId) tv.setTextAppearance(getActivity(),R.style.SelectedNavigationMenuItem);
else tv.setTextAppearance(getActivity(),R.style.NavigationMenuItem);
}
}
}
}
|
Set the state of the selected nav item
|
private void createFullCopyForApplicationCGs(Workflow workflow,VolumeGroup volumeGroup,List<URI> fullCopyVolumes,Boolean createInactive,TaskCompleter taskCompleter){
boolean isCG=true;
taskCompleter.addVolumeGroupId(volumeGroup.getId());
List<Volume> allVolumes=ControllerUtils.getVolumeGroupVolumes(_dbClient,volumeGroup);
Map<String,List<Volume>> arrayGroupToVolumes=ControllerUtils.groupVolumesByArrayGroup(allVolumes,_dbClient);
for ( String arrayGroupName : arrayGroupToVolumes.keySet()) {
List<Volume> arrayGroupVolumes=arrayGroupToVolumes.get(arrayGroupName);
List<URI> fullCopyVolumesAG=getFullCopiesForVolumes(fullCopyVolumes,arrayGroupVolumes);
if (fullCopyVolumesAG.isEmpty()) {
_log.debug("Looks Full copy not requested for array group {}",arrayGroupName);
continue;
}
Volume sourceVolumeAG=arrayGroupVolumes.iterator().next();
if (!NullColumnValueGetter.isNullURI(sourceVolumeAG.getConsistencyGroup())) {
taskCompleter.addConsistencyGroupId(sourceVolumeAG.getConsistencyGroup());
}
URI storage=sourceVolumeAG.getStorageController();
StorageSystem storageSystem=_dbClient.queryObject(StorageSystem.class,storage);
_log.info("Creating full copy for group {}",arrayGroupName);
createCGFullCopy(storage,sourceVolumeAG.getId(),fullCopyVolumesAG,storageSystem,workflow,createInactive,isCG);
}
}
|
Create Full Copies for volumes in Volume Group (COPY type), Query all volumes belonging to that Volume Group, Group full-copies by Array Replication Group and create workflow step for each Array Group, these steps runs in parallel
|
public void onCombineSetup() throws IOException, InterruptedException {
}
|
Invoked on the named stage.
|
private static int binarySearch(int[] index,double[] vals,double target){
int lo=0, hi=index.length - 1;
while (hi - lo > 1) {
int mid=lo + (hi - lo) / 2;
double midval=vals[index[mid]];
if (target > midval) {
lo=mid;
}
else if (target < midval) {
hi=mid;
}
else {
while ((mid > 0) && (vals[index[mid - 1]] == target)) {
mid--;
}
return mid;
}
}
return lo;
}
|
performs a binary search
|
public VPAttribute(boolean mandatory,boolean isReadOnly,boolean isUpdateable,int WindowNo,MPAttributeLookup lookup,boolean searchOnly){
this(null,mandatory,isReadOnly,isUpdateable,WindowNo,lookup,searchOnly);
}
|
Create Product Attribute Set Instance Editor.
|
@ExceptionHandler(AccessDeniedException.class) @ResponseBody @ResponseStatus(HttpStatus.FORBIDDEN) public String handleException(final AccessDeniedException cause){
return convertErrorAsJson(cause.getMessage());
}
|
Handles an AccessDenied Exception thrown by a REST API web service endpoint, HTTP request handler method. <p/>
|
protected void init(Table table,Graph graph,int row){
m_table=table;
m_graph=graph;
m_row=m_table.isValidRow(row) ? row : -1;
}
|
Initialize a new Edge backed by an edge table. This method is used by the appropriate TupleManager instance, and should not be called directly by client code, unless by a client-supplied custom TupleManager.
|
public boolean aggregateOnly(){
if (this.hasAllCols()) return false;
for ( Column s : columns) if (s.getOp() == Operation.NONE && s.getCalculation() == null) return false;
return true;
}
|
Returns if this heading specifies just a count() in which case there is no need to fetch all the data
|
public CodedException withPrefix(String... prefixes){
String prefix=StringUtils.join(prefixes,".");
if (!faultCode.startsWith(prefix)) {
faultCode=prefix + "." + faultCode;
}
return this;
}
|
Returns the current exception with prefix appended in front of the fault code.
|
public void compute(Vertex<LongWritable,DoubleWritable,FloatWritable> vertex,Iterable<DoubleWritable> messages){
if (getSuperstep() == 0) {
vertex.setValue(new DoubleWritable(0d));
}
double count=0d;
for ( DoubleWritable message : messages) {
count+=1d;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Vertex " + vertex.getId() + " got a message. New total = "+ count);
}
vertex.setValue(new DoubleWritable(count));
for ( Edge<LongWritable,FloatWritable> edge : vertex.getEdges()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Vertex " + vertex.getId() + " sent a message to "+ edge.getTargetVertexId());
}
if (getSuperstep() < 2) {
sendMessage(edge.getTargetVertexId(),new DoubleWritable(1d));
}
}
vertex.voteToHalt();
}
|
Compute method
|
public void findAll(String sql,Object[] args,Result<Iterable<Cursor>> result){
QueryBuilderKraken builder=QueryParserKraken.parse(this,sql);
if (builder.isTableLoaded()) {
QueryKraken query=builder.build();
findAll(query,args,result);
}
else {
String tableName=builder.getTableName();
_tableService.loadTable(tableName,result.then(null));
return;
}
}
|
Select query returning multiple results.
|
protected final Object applyImplicitConversion(final ConversionType conversionType,final Class<?> dClass,final Class<?> sClass,final Object sourceContent){
if (!conversionType.isAbsent()) {
if (!conversionType.isUndefined()) return getConversion(conversionType,sourceContent);
if (isCastCase(dClass,sClass)) return write("(",dClass.getName(),")",sourceContent);
}
else {
if (isBoxing(dClass,sClass)) return write("new ",dClass.getName(),"(",sourceContent,")");
if (isUnBoxing(dClass,sClass)) return write(sourceContent,".",dClass.getName(),"Value()");
}
return sourceContent;
}
|
This method returns the source content modified, analyzing conversion type, destination and source classes.
|
public Builder negativeExamples(File negativeExamples){
this.negativeExamples=negativeExamples;
return this;
}
|
Sets the negative examples.
|
private boolean expressionMatch(){
ArrayList<String> values=new ArrayList<>(Arrays.asList(textField.getText().split("[ ,(,),+,-,/,*]")));
values.removeAll(Arrays.asList("+","-","/","*"," ","(",")",""));
return values.containsAll(cardNumbers);
}
|
Returns true if numbers in the expression match the numbers in the set
|
public boolean match(T value){
return match(value,blacklist);
}
|
Matches value against the set of rules using current white/black list mode.
|
public Object lookup(FacesContext facesContext,String name){
Object object=null;
try {
InitialContext context=new InitialContext();
object=context.lookup(name);
}
catch ( NamingException ne) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING,"Unable to lookup: " + name,ne);
}
if (facesContext.isProjectStage(ProjectStage.Development)) {
facesContext.addMessage(null,new FacesMessage("Unable to lookup: " + name,"Unable to lookup: " + name));
}
}
return object;
}
|
Look up the given object using its JNDI name.
|
private static String normalize(final String str){
char c;
StringBuffer buf=new StringBuffer();
for (int i=0; i < str.length(); i++) {
c=str.charAt(i);
if (Character.isLetter(c)) {
buf.append(Character.toLowerCase(c));
}
}
return buf.toString();
}
|
Normalizes String.
|
public void dropPcjTable(final Connector accumuloConn,final String pcjTableName) throws PCJStorageException {
checkNotNull(accumuloConn);
checkNotNull(pcjTableName);
try {
accumuloConn.tableOperations().delete(pcjTableName);
}
catch ( AccumuloException|AccumuloSecurityException|TableNotFoundException e) {
throw new PCJStorageException("Could not delete PCJ table named: " + pcjTableName,e);
}
}
|
Drops a PCJ index from Accumulo.
|
public CSSLangCondition(String lang){
this.lang=lang.toLowerCase();
this.langHyphen=lang + '-';
}
|
Creates a new LangCondition object.
|
private void renameReplay(){
Path targetFile;
try {
final TemplateEngine engine=new TemplateEngine(Env.APP_SETTINGS.get(Settings.RENAME_NEW_REPS_TEMPLATE));
targetFile=engine.apply(file);
}
catch ( final InvalidTemplateException ite) {
Env.LOGGER.error("Failed to rename new replay, template is invalid: " + Env.APP_SETTINGS.get(Settings.RENAME_NEW_REPS_TEMPLATE),ite);
return;
}
if (targetFile == null) {
return;
}
targetFile=Utils.uniqueFile(targetFile);
boolean ignore=true;
if (!file.getParent().equals(targetFile.getParent()) && !folderInfo.recursive) ignore=false;
if (ignore) Env.WATCHER.addIgnoredPath(targetFile);
if (!Files.exists(targetFile.getParent())) try {
Files.createDirectories(targetFile.getParent());
}
catch ( final IOException ie) {
Env.LOGGER.error("Failed to create subfolders, new replay renaming will probably fail: " + targetFile.getParent(),ie);
}
try {
Files.move(file,targetFile);
Env.LOGGER.info("Renamed new replay: \"" + file + "\" to \""+ targetFile+ "\"");
file=targetFile;
}
catch ( final IOException ie) {
Env.LOGGER.error("Failed to rename new replay: \"" + file + "\" to \""+ targetFile+ "\"",ie);
if (ignore) Env.WATCHER.removeIgnoredPath(targetFile);
}
}
|
Renames the new replay in its original folder.
|
static long toLong(String v){
String buildPart="1";
long buildType=700;
if (v.endsWith("-SNAPSHOT")) {
buildPart="";
v=v.substring(0,v.indexOf("-SNAPSHOT"));
buildType=0;
}
else if (v.contains("-alpha-")) {
buildPart=v.substring(v.lastIndexOf('-') + 1);
v=v.substring(0,v.indexOf("-alpha-"));
buildType=100;
}
else if (v.contains("-beta-")) {
buildPart=v.substring(v.lastIndexOf('-') + 1);
v=v.substring(0,v.indexOf("-beta-"));
buildType=300;
}
else if (v.contains("-rc-")) {
buildPart=v.substring(v.lastIndexOf('-') + 1);
v=v.substring(0,v.indexOf("-rc-"));
buildType=500;
}
String[] parts=v.split("\\.");
if (parts.length > 3) {
throw new IllegalArgumentException("Illegal version number: " + v);
}
long major=parts.length > 0 ? Long.parseLong(parts[0]) : 0;
long minor=parts.length > 1 ? Long.parseLong(parts[1]) : 0;
long rev=parts.length > 2 ? Long.parseLong(parts[2]) : 0;
long build=buildPart.isEmpty() ? 0 : Long.parseLong(buildPart);
long result=(((major * 1000 + minor) * 1000 + rev) * 1000) + build + buildType;
return result;
}
|
Converts a version string on the form x.y.z into an integer which can be compared to other versions converted into integers.
|
@SuppressWarnings("unchecked") public LiteralExtensionIV createIV(final Value value){
if (value instanceof Literal == false) throw new IllegalArgumentException();
final Literal lit=(Literal)value;
final AbstractLiteralIV delegate=new XSDNumericIV<BigdataLiteral>(XMLDatatypeUtil.parseFloat(lit.getLabel()));
return new LiteralExtensionIV(delegate,datatype.getIV());
}
|
Attempts to convert the supplied value into an internal representation using BigInteger.
|
public StaticNodeSettings build(){
checkNotNull(address,"address");
return new StaticNodeSettings(this);
}
|
Builds a static-node settings.
|
@Override protected EClass eStaticClass(){
return ImPackage.Literals.SYMBOL_TABLE_ENTRY_IM_ONLY;
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public void detachSprite(Sprite sprite){
Collection<AttachedSprite> sprites=attachedSprites;
if (sprites != null) {
Iterator<AttachedSprite> it=sprites.iterator();
while (it.hasNext()) {
AttachedSprite as=it.next();
if (as.sprite == sprite) {
it.remove();
break;
}
}
}
}
|
Detach a sprite that has been previously attached to the view.
|
public Date lastModified(){
return DateFormat.RESPONSE_DATE_FORMAT.parseDateTime(lastModified).toDate();
}
|
Returns last modified time of the object.
|
public List<ChallengeHandler> lookup(String location){
List<ChallengeHandler> result=Collections.emptyList();
if (location != null) {
Node<ChallengeHandler,UriElement> resultNode=findBestMatchingNode(location);
if (resultNode != null) {
return resultNode.getValues();
}
}
return result;
}
|
Locate all challenge handlers to serve the given location.
|
public static <E>List<E> singletonList(E object){
return new SingletonList<E>(object);
}
|
Returns a list containing the specified element. The list cannot be modified. The list is serializable.
|
public static void fill(int[] a,int val){
fill(a,0,a.length,val);
}
|
Assigns the specified int value to each element of the specified array of ints.
|
public static void main(String[] argv){
runClassifier(new DecisionStump(),argv);
}
|
Main method for testing this class.
|
public static void copyRemaining(ByteBuffer src,ByteBuffer dst){
int n=Math.min(src.remaining(),dst.remaining());
copy(src,dst,n);
}
|
Copies as much as possible
|
public CountProjectionExpression(boolean isDistinct){
this.distinct=isDistinct;
}
|
Ctor - for use to create an expression tree, without inner expression
|
public synchronized void remove(Aspect transientInstance){
try {
if (null != transientInstance.getId()) {
EntityManager entityManager=EntityManagerHelper.getEntityManager();
entityManager.getTransaction().begin();
Object aspect=entityManager.find(transientInstance.getClass(),transientInstance.getId());
if (null != aspect) {
entityManager.remove(aspect);
}
entityManager.getTransaction().commit();
}
}
catch ( Exception re) {
EntityManagerHelper.rollback();
throw re;
}
finally {
EntityManagerHelper.close();
}
}
|
Method remove.
|
public static Double[] toObject(final double[] array){
if (array == null) {
return null;
}
else if (array.length == 0) {
return ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY;
}
final Double[] result=new Double[array.length];
for (int i=0; i < array.length; i++) {
result[i]=new Double(array[i]);
}
return result;
}
|
<p>Converts an array of primitive doubles to objects.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>
|
public Boolean isRecordReplayEnabled(){
return recordReplayEnabled;
}
|
Gets the value of the recordReplayEnabled property.
|
public static int randomInt(int lowerThan){
return RANDOM.nextInt(lowerThan);
}
|
Get a pseudo random int value between 0 (including and the given value (excluding). The value is not cryptographically secure.
|
public void postIdle(final Runnable runnable){
postIdle(runnable,0);
}
|
Schedule runnable to run when the queue goes idle.
|
public static PortInfoBubble displayPrecheckInputPortDisconnectedWarning(final Port port){
return displayPrecheckInputPortDisconnectedWarning(port,true);
}
|
Displays a warning bubble that alerts the user that an input port of an operator expects input but is not connected. The bubble is located at the port and the process view will change to said port. This is a bubble which occurs during the check for errors before process execution so it contains a link button to run the process anyway.
|
@ExpectWarning("IL") private static void case1(){
case1();
}
|
Case1: FB doesn't report Infinite Loop in 'private' 'static' methods
|
protected OMGraphic drawFeature(int primitiveID,VPFFeatureWarehouse warehouse,LatLonPoint ll1,LatLonPoint ll2,double dpplat,double dpplon,String currentFeature,int featurePrimID) throws FormatException {
if (aft != null || tft != null || edg != null || ent != null || cnt != null) {
if ((aft != null) && aft.getRow(primitiveVector,primitiveID)) {
return aft.drawFeature(warehouse,dpplat,dpplon,ll1,ll2,primitiveVector,currentFeature,featurePrimID);
}
if ((tft != null) && tft.getRow(primitiveVector,primitiveID)) {
return tft.drawFeature(warehouse,dpplat,dpplon,ll1,ll2,primitiveVector,currentFeature,featurePrimID);
}
if ((ent != null) && ent.getRow(primitiveVector,primitiveID)) {
return ent.drawFeature(warehouse,dpplat,dpplon,ll1,ll2,primitiveVector,currentFeature,featurePrimID);
}
if ((cnt != null) && cnt.getRow(primitiveVector,primitiveID)) {
return cnt.drawFeature(warehouse,dpplat,dpplon,ll1,ll2,primitiveVector,currentFeature,featurePrimID);
}
if ((edg != null) && edg.getRow(primitiveVector,primitiveID)) {
return edg.drawFeature(warehouse,dpplat,dpplon,ll1,ll2,primitiveVector,currentFeature,featurePrimID);
}
}
return null;
}
|
Should be called once per feature, after the tables have been set (setTables()), and findYourself() has been called. The appropriate table will use the warehouse to create proper OMGraphic.
|
public byte[] reSample(byte[] sourceData,int bitsPerSample,int sourceRate,int targetRate){
int bytePerSample=bitsPerSample / 8;
int numSamples=sourceData.length / bytePerSample;
short[] amplitudes=new short[numSamples];
int pointer=0;
for (int i=0; i < numSamples; i++) {
short amplitude=0;
for (int byteNumber=0; byteNumber < bytePerSample; byteNumber++) {
amplitude|=(short)((sourceData[pointer++] & 0xFF) << (byteNumber * 8));
}
amplitudes[i]=amplitude;
}
LinearInterpolation reSample=new LinearInterpolation();
short[] targetSample=reSample.interpolate(sourceRate,targetRate,amplitudes);
int targetLength=targetSample.length;
byte[] bytes;
if (bytePerSample == 1) {
bytes=new byte[targetLength];
for (int i=0; i < targetLength; i++) {
bytes[i]=(byte)targetSample[i];
}
}
else {
bytes=new byte[targetLength * 2];
for (int i=0; i < targetSample.length; i++) {
bytes[i * 2]=(byte)(targetSample[i] & 0xff);
bytes[i * 2 + 1]=(byte)((targetSample[i] >> 8) & 0xff);
}
}
return bytes;
}
|
Do resampling. Currently the amplitude is stored by short such that maximum bitsPerSample is 16 (bytePerSample is 2)
|
public static String removeIllegalCharacter(final String text){
final StringBuilder rVal=new StringBuilder();
for (int i=0; i < text.length(); ++i) {
if (!isIllegalFileNameChar(text.charAt(i))) {
rVal.append(text.charAt(i));
}
}
return rVal.toString();
}
|
Designed to remove / \b \n \r \t \0 \f ` ? * \ < > | " ' : . , ^ [ ] = + ;
|
public Sheep retrieveSheep(){
if (player.hasSlot("#flock")) {
final RPSlot slot=player.getSlot("#flock");
if (slot.size() > 0) {
final RPObject object=slot.getFirst();
slot.remove(object.getID());
player.removeSlot("#flock");
object.put("x",player.getX());
object.put("y",player.getY());
return new Sheep(object,player);
}
}
return null;
}
|
Recreate a saved sheep.
|
public void sendChunk(ServerConnection servConn) throws IOException {
if (this.sc != servConn) throw new IllegalStateException("this.sc was not correctly set");
sendChunk();
}
|
Sends a chunk of this message.
|
public boolean isAutoRange(){
return this.autoRange;
}
|
Returns the current setting of the auto-range property.
|
public void testDeleteOneTracksInMyTracks() throws IOException {
if (!RunConfiguration.getInstance().getRunSyncTest()) {
return;
}
EndToEndTestUtils.createTrackIfEmpty(2,false);
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.trackListActivity.getString(R.string.menu_delete));
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.trackListActivity.getString(R.string.generic_yes));
EndToEndTestUtils.findMenuItem(EndToEndTestUtils.trackListActivity.getString(R.string.menu_sync_now),true);
SyncTestUtils.checkFile(EndToEndTestUtils.trackName,false,drive);
}
|
Deletes one track in MyTracks and checks it in Google Drive.
|
private void writeObject(final ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
}
|
Write the content of this URI.
|
public static void checkClusterWithCollectionCreations(final MiniSolrCloudCluster cluster,final SSLTestConfig sslConfig) throws Exception {
cluster.uploadConfigSet(SolrTestCaseJ4.TEST_PATH().resolve("collection1").resolve("conf"),CONF_NAME);
checkCreateCollection(cluster,"first_collection");
checkClusterJettys(cluster,sslConfig);
JettySolrRunner stoppedServer=cluster.stopJettySolrRunner(0);
assertTrue(stoppedServer.isStopped());
assertEquals(NUM_SERVERS - 1,cluster.getJettySolrRunners().size());
JettySolrRunner startedServer=cluster.startJettySolrRunner();
assertTrue(startedServer.isRunning());
assertEquals(NUM_SERVERS,cluster.getJettySolrRunners().size());
checkClusterJettys(cluster,sslConfig);
checkCreateCollection(cluster,"second_collection");
}
|
General purpose cluster sanity check... <ol> <li>Upload a config set</li> <li>verifies a collection can be created</li> <li>verifies many things that should succeed/fail when communicating with the cluster according to the specified sslConfig</li> <li>shutdown a server & startup a new one in it's place</li> <li>repeat the verifications of ssl / no-ssl communication</li> <li>create a second collection</li> </ol>
|
public static void pushNamespaces(BindingExpression be,Stack<PrefixMapping> namespaces){
for (int i=0, count=namespaces.size(); i < count; i++) {
PrefixMapping pm=namespaces.get(i);
be.addNamespace(pm.getUri(),pm.getNs());
}
}
|
Add all the namespaces to the binding expression.
|
private String prefix(){
return configClass.getSimpleName() + "$";
}
|
Adds a prefix to distinguish between methods with the same name but belonging to different classes.
|
public String optString(int index,String defaultValue){
Object object=this.opt(index);
return JSONObject.NULL.equals(object) ? defaultValue : object.toString();
}
|
Get the optional string associated with an index. The defaultValue is returned if the key is not found.
|
private static File GetFileFromPath(String path){
boolean ret;
boolean isExist;
boolean isWritable;
File file=null;
if (TextUtils.isEmpty(path)) {
Log.e("Error","The path of Log file is Null.");
return file;
}
file=new File(path);
isExist=file.exists();
isWritable=file.canWrite();
if (isExist) {
if (isWritable) {
}
else {
Log.e("Error","The Log file can not be written.");
}
}
else {
try {
ret=file.createNewFile();
if (ret) {
Log.i("Success","The Log file was successfully created! -" + file.getAbsolutePath());
}
else {
Log.i("Success","The Log file exist! -" + file.getAbsolutePath());
}
isWritable=file.canWrite();
if (!isWritable) {
Log.e("Error","The Log file can not be written.");
}
}
catch ( IOException e) {
Log.e("Error","Failed to create The Log file.");
e.printStackTrace();
}
}
return file;
}
|
Get File form the file path.<BR> if the file does not exist, create it and return it.
|
public int read(char cbuf[],int off,int len) throws IOException {
if ((off < 0) || (off > cbuf.length) || (len < 0)|| ((off + len) > cbuf.length)|| ((off + len) < 0)) throw new IndexOutOfBoundsException();
if (len == 0) return 0;
if (next >= length) return -1;
int n=Math.min(length - next,len);
text.getChars(next,next + n,cbuf,off);
next+=n;
return n;
}
|
Reads characters into a portion of an array.
|
public static ArrayList<Instruction> recompileHopsDag2Forced(Hop hops,long tid,ExecType et) throws DMLRuntimeException, HopsException, LopsException, IOException {
ArrayList<Instruction> newInst=null;
synchronized (hops) {
LOG.debug("\n**************** Optimizer (Recompile) *************\nMemory Budget = " + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
hops.resetVisitStatus();
rClearLops(hops);
hops.resetVisitStatus();
rSetExecType(hops,et);
hops.resetVisitStatus();
Dag<Lop> dag=new Dag<Lop>();
Lop lops=hops.constructLops();
lops.addToDag(dag);
newInst=dag.getJobs(null,ConfigurationManager.getDMLConfig());
}
if (tid != 0) newInst=ProgramConverter.createDeepCopyInstructionSet(newInst,tid,-1,null,null,null,false,false);
return newInst;
}
|
D) Recompile predicate hop DAG (single root), but forced to CP. This happens always 'inplace', without statistics updates, and without dynamic rewrites.
|
public void reset(){
super.reset();
this.V[0]=0x7380166F;
this.V[1]=0x4914B2B9;
this.V[2]=0x172442D7;
this.V[3]=0xDA8A0600;
this.V[4]=0xA96F30BC;
this.V[5]=0x163138AA;
this.V[6]=0xE38DEE4D;
this.V[7]=0xB0FB0E4E;
this.xOff=0;
}
|
reset the chaining variables
|
public GMLWriter(boolean emitNamespace){
this.setNamespace(emitNamespace);
}
|
Creates a writer which may emit the GML namespace prefix declaration in the geometry root element.
|
public RMIException(VM vm,String className,String methodName,Throwable cause){
super("While invoking " + className + "."+ methodName+ " in "+ vm,cause);
this.cause=cause;
this.className=className;
this.methodName=methodName;
this.vm=vm;
}
|
Creates a new <code>RMIException</code> that was caused by a given <code>Throwable</code> while invoking a given method.
|
protected static void checkRectangularShape(Object[][] array){
int columns=-1;
for (int row=array.length; --row >= 0; ) {
if (array[row] != null) {
if (columns == -1) columns=array[row].length;
if (array[row].length != columns) throw new IllegalArgumentException("All rows of array must have same number of columns.");
}
}
}
|
Checks whether the given array is rectangular, that is, whether all rows have the same number of columns.
|
public static SelectResults execute(ExecutablePool pool,String queryPredicate,Object[] queryParams){
AbstractOp op=null;
if (queryParams != null && queryParams.length > 0) {
op=new QueryOpImpl(queryPredicate,queryParams);
}
else {
op=new QueryOpImpl(queryPredicate);
}
return (SelectResults)pool.execute(op);
}
|
Does a region query on a server using connections from the given pool to communicate with the server.
|
static String determineSourceHome(){
try {
File file;
try {
file=new File("solr/conf");
if (!file.exists()) {
file=new File(Thread.currentThread().getContextClassLoader().getResource("solr/conf").toURI());
}
}
catch ( Exception e) {
file=new File(".");
}
File base=file.getAbsoluteFile();
while (!(new File(base,"solr/CHANGES.txt").exists()) && null != base) {
base=base.getParentFile();
}
return (null == base) ? null : new File(base,"solr/").getAbsolutePath();
}
catch ( RuntimeException e) {
return null;
}
}
|
Ugly, ugly hack to determine the example home without depending on the CWD this is needed for example/multicore tests which reside outside the classpath. if the source home can't be determined, this method returns null.
|
private static VirtualPoolChangeOperationEnum vplexCommonChecks(Volume volume,VirtualPool currentVpool,VirtualPool newVpool,DbClient dbClient,StringBuffer notSuppReasonBuff,String[] include){
s_logger.info(String.format("Checking vplexCommonChecks from [%s] to [%s]...",currentVpool.getLabel(),newVpool.getLabel()));
boolean isRPVPlex=VirtualPool.vPoolSpecifiesHighAvailability(currentVpool) && VirtualPool.vPoolSpecifiesRPVPlex(newVpool);
if ((!NullColumnValueGetter.isNullURI(volume.getConsistencyGroup())) && (!newVpool.getMultivolumeConsistency())) {
notSuppReasonBuff.append("The volume is in a consistency group but the target virtual pool does not specify multi-volume consistency");
return null;
}
include=new String[]{HIGH_AVAILABILITY};
if (!analyzeChanges(currentVpool,newVpool,include,null,null).isEmpty()) {
if (volume.isIngestedVolumeWithoutBackend(dbClient)) {
notSuppReasonBuff.append("The high availability of an ingested VPLEX volume cannot be modified.");
return null;
}
boolean isConvertToDistributed=isVPlexConvertToDistributed(currentVpool,newVpool,notSuppReasonBuff);
if (isConvertToDistributed && !VirtualPoolUtil.checkMatchingRemoteCopyVarraysettings(currentVpool,newVpool,dbClient)) {
isConvertToDistributed=false;
notSuppReasonBuff.append("Incompatible Remote Copy Varray Settings");
}
if (isConvertToDistributed) {
URI haVarrayURI=getHaVarrayURI(newVpool);
URI volumeVarray=volume.getVirtualArray();
URI cgURI=volume.getConsistencyGroup();
if (haVarrayURI.equals(volumeVarray)) {
notSuppReasonBuff.append("The High Availability Virtual Array in the target " + "Virtual Pool must be different than the Virtual Array for the volume.");
return null;
}
else if (!NullColumnValueGetter.isNullURI(cgURI)) {
notSuppReasonBuff.append("The volume is in a consistency group");
return null;
}
else {
if (!isRPVPlex) {
return VirtualPoolChangeOperationEnum.VPLEX_LOCAL_TO_DISTRIBUTED;
}
}
}
else {
return null;
}
}
VirtualPool newHaVpool=null;
VirtualPool currentHaVpool=getHaVpool(currentVpool,dbClient);
if (currentHaVpool != null) {
try {
newHaVpool=getNewHaVpool(currentVpool,newVpool,dbClient);
}
catch ( Exception e) {
s_logger.error(e.getMessage());
notSuppReasonBuff.append(String.format("Could not get new HA vpool from [%s]",newVpool.getLabel()));
return null;
}
if (!currentHaVpool.getId().toString().equals(newHaVpool.getId().toString())) {
s_logger.info("HA varray vpools are different");
if (isRPVPlex && newVpoolDoesNotSpecifyHaVpool) {
include=new String[]{TYPE,VARRAYS,REF_VPOOL,MIRROR_VPOOL,FAST_EXPANSION,ACLS,INACTIVE,NUM_PATHS};
}
else {
include=new String[]{TYPE,VARRAYS,PROTECTION_VARRAY_SETTINGS,REF_VPOOL,MIRROR_VPOOL,FAST_EXPANSION,ACLS,INACTIVE,NUM_PATHS};
}
Map<String,Change> changes=analyzeChanges(currentHaVpool,newHaVpool,include,null,null);
if (!changes.isEmpty()) {
notSuppReasonBuff.append("Changes in the following high availability virtual pool properties are not permitted: ");
fillInNotSupportedReasons(changes,notSuppReasonBuff);
return null;
}
}
}
boolean migrateHAVolume=false;
boolean migrateSourceVolume=VirtualPoolChangeAnalyzer.vpoolChangeRequiresMigration(currentVpool,newVpool);
if (currentHaVpool != null) {
migrateHAVolume=VirtualPoolChangeAnalyzer.vpoolChangeRequiresMigration(currentHaVpool,newHaVpool);
}
if (!migrateSourceVolume && !migrateHAVolume) {
notSuppReasonBuff.append("The virtual pool does not specify a change in any of the " + "following virtual pool properties: " + PROTOCOLS + ", "+ PROVISIONING_TYPE+ ", "+ USE_MATCHED_POOLS+ ", "+ ARRAY_INFO+ ", "+ DRIVE_TYPE+ ", "+ AUTO_TIER_POLICY_NAME+ ", "+ HOST_IO_LIMIT_IOPS+ ", "+ HOST_IO_LIMIT_BANDWIDTH+ ", "+ IS_THIN_VOLUME_PRE_ALLOCATION_ENABLED+ ", "+ ASSIGNED_STORAGE_POOLS+ ", "+ VMAX_COMPRESSION_ENABLED);
if (!isRPVPlex) {
return null;
}
}
if (!isRPVPlex) {
return VirtualPoolChangeOperationEnum.VPLEX_DATA_MIGRATION;
}
return VirtualPoolChangeOperationEnum.RP_PROTECTED;
}
|
Common checks for change vpool for all VPLEX volumes
|
public static String dateToString(Date date,Resolution resolution){
return timeToString(date.getTime(),resolution);
}
|
Converts a Date to a string suitable for indexing.
|
void doubleBufferingChanged(JRootPane rootPane){
getPaintManager().doubleBufferingChanged(rootPane);
}
|
Invoked when the doubleBuffered or useTrueDoubleBuffering properties of a JRootPane change. This may come in on any thread.
|
public MmsException(String message){
super(message);
}
|
Creates a new MmsException with the specified detail message.
|
public void searchDeclarationsOfAccessedFields(IJavaElement enclosingElement,SearchRequestor requestor,IProgressMonitor monitor) throws JavaModelException {
if (VERBOSE) {
Util.verbose("BasicSearchEngine.searchDeclarationsOfAccessedFields(IJavaElement, SearchRequestor, SearchPattern, IProgressMonitor)");
}
switch (enclosingElement.getElementType()) {
case IJavaElement.FIELD:
case IJavaElement.METHOD:
case IJavaElement.TYPE:
case IJavaElement.COMPILATION_UNIT:
break;
default :
throw new IllegalArgumentException();
}
SearchPattern pattern=new DeclarationOfAccessedFieldsPattern(enclosingElement);
searchDeclarations(enclosingElement,requestor,pattern,monitor);
}
|
Searches for all declarations of the fields accessed in the given element. The element can be a compilation unit or a source type/method/field. Reports the field declarations using the given requestor.
|
public final String sourceExpression(int index,Instances data){
return "true";
}
|
Returns a string containing java source code equivalent to the test made at this node. The instance being tested is called "i".
|
public double f1Measure(){
return fMeasure(1.0);
}
|
Get the pair-counting F1-Measure.
|
public boolean removeNode(Node node){
if (!nodes.contains(node)) {
return false;
}
boolean changed=false;
List<Edge> edgeList1=edgeLists.get(node);
for (Iterator<Edge> i=edgeList1.iterator(); i.hasNext(); ) {
Edge edge=(i.next());
Node node2=edge.getDistalNode(node);
if (node2 != node) {
List<Edge> edgeList2=edgeLists.get(node2);
edgeList2.remove(edge);
edgesSet.remove(edge);
changed=true;
}
i.remove();
getPcs().firePropertyChange("edgeRemoved",edge,null);
}
edgeLists.remove(node);
nodes.remove(node);
namesHash.remove(node.getName());
stuffRemovedSinceLastTripleAccess=true;
getPcs().firePropertyChange("nodeRemoved",node,null);
return changed;
}
|
Removes a node from the graph.
|
private static IdUrlPair bestSchedulerInfoMatchLikeValue(String value,String schedulerIdField){
String schedulerUrlField;
if (schedulerIdField.equals(AppResult.TABLE.FLOW_DEF_ID)) {
schedulerUrlField=AppResult.TABLE.FLOW_DEF_URL;
}
else if (schedulerIdField.equals(AppResult.TABLE.FLOW_EXEC_ID)) {
schedulerUrlField=AppResult.TABLE.FLOW_EXEC_URL;
}
else if (schedulerIdField.equals(AppResult.TABLE.JOB_DEF_ID)) {
schedulerUrlField=AppResult.TABLE.JOB_DEF_URL;
}
else if (schedulerIdField.equals(AppResult.TABLE.JOB_EXEC_ID)) {
schedulerUrlField=AppResult.TABLE.JOB_EXEC_URL;
}
else {
throw new RuntimeException(String.format("%s is not a valid scheduler info id field",schedulerIdField));
}
AppResult result=AppResult.find.select(String.format("%s, %s",schedulerIdField,schedulerUrlField)).where().like(schedulerIdField,value).order().desc(AppResult.TABLE.FINISH_TIME).setMaxRows(1).findUnique();
if (result != null) {
if (schedulerIdField.equals(AppResult.TABLE.FLOW_DEF_ID)) {
return new IdUrlPair(result.flowDefId,result.flowDefUrl);
}
else if (schedulerIdField.equals(AppResult.TABLE.FLOW_EXEC_ID)) {
return new IdUrlPair(result.flowExecId,result.flowExecUrl);
}
else if (schedulerIdField.equals(AppResult.TABLE.JOB_DEF_ID)) {
return new IdUrlPair(result.jobDefId,result.jobDefUrl);
}
else if (schedulerIdField.equals(AppResult.TABLE.JOB_EXEC_ID)) {
return new IdUrlPair(result.jobExecId,result.jobExecUrl);
}
}
return null;
}
|
Returns the scheduler info id/url pair for the most recent app result that has an id like value (which can use % and _ SQL wild cards) for the specified field. Note that this is a pair rather than merely an ID/URL because for some schedulers (e.g. Airflow) they are not equivalent and usually the UI wants to display the ID with a link to the URL. While it is true that the URL can probably be derived from the ID in most cases, we would need scheduler specific logic which would be a mess.
|
public static WritableIntegerDataStore makeIntegerStorage(DBIDs ids,int hints){
return DataStoreFactory.FACTORY.makeIntegerStorage(ids,hints);
}
|
Make a new storage, to associate the given ids with an object of class dataclass.
|
public static int toIntValue(Object o) throws PageException {
if (o instanceof Number) return ((Number)o).intValue();
else if (o instanceof Boolean) return ((Boolean)o).booleanValue() ? 1 : 0;
else if (o instanceof String) return toIntValue(o.toString().trim());
else if (o instanceof Castable) return (int)((Castable)o).castToDoubleValue();
else if (o instanceof Date) return (int)new DateTimeImpl((Date)o).castToDoubleValue();
if (o instanceof String) throw new ExpressionException("Can't cast String [" + o.toString() + "] to a number");
else if (o instanceof ObjectWrap) return toIntValue(((ObjectWrap)o).getEmbededObject());
throw new CasterException(o,"number");
}
|
cast a Object to a int value (primitive value type)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.