public String toString() { String tmp = new String(); ArrayList<Expression> args; if (this.op == null) { if (this instanceof Variable) { tmp = ((Variable) this).getValue().toString(); if (this.flag != null && this.flag.equals(Flag.UMINUS)) tmp = "-" + tmp; } else if (this instanceof FunctionCall) { tmp = ((FunctionCall) this).getTag() + "("; args = ((FunctionCall) this).getArgs(); for (int i = args.size() - 1; i >= 0; i--) tmp = tmp + args.get(i).toString() + ","; tmp = tmp.substring(0, tmp.length() - 1) + ")"; } } else { String l = this.left.toString(); String r = this.right.toString(); if (this.priority) tmp = "( " + l + " " + op.getString() + " " + r + " )"; else tmp = l + " " + op.getString() + " " + r; if (this.flag != null && this.flag.equals(Flag.UMINUS)) tmp = "-( " + tmp + " )"; } return tmp; }
/** * 获取枚举对象 * * @param code 来源码 * @return */ public static OperationType get(int code) { OperationType[] sources = OperationType.values(); for (OperationType source : sources) { if (source.code() == code) { return source; } } return null; }
public TransactionCommand(Mod pMod, DOM pCmdDOM) throws ExInternal, ExDoSyntax { super(pCmdDOM); // Determine transaction type String lTypeAttr = getAttribute("operation", "UNDEFINED").toUpperCase(); mOperationType = OperationType.valueOf(lTypeAttr); if (mOperationType == null) { throw new ExDoSyntax("Unrecognised transaction operation type: " + lTypeAttr); } switch (mOperationType) { case JOIN: Track.info( "TransactionCommand", "Transaction JOIN deprecated - use fm:post-dom", TrackFlag.BAD_MARKUP); mTransactionOperation = new JoinOperation(pMod, pCmdDOM); break; case SPLIT: mTransactionOperation = new SplitOperation(pMod, pCmdDOM); break; case AUTONOMOUS: mTransactionOperation = new AutonomousOperation(pMod, pCmdDOM); break; case COMMIT: case ROLLBACK: mTransactionOperation = new ControlOperation(); break; default: throw new ExDoSyntax( "Unrecognised transaction operation type: " + mOperationType); // Shouldn't happen } }
/** * Creates and adds a new operation to the operation queue. * * @param opType the type of the operation. * @param waveId the wave id in which the operation should be applied to. * @param waveletId the wavelet id of the given wave in which the operation should be applied to. * @param blipId the optional blip id of the given wave in which the operation should be applied * to. Not all operations require blip id. * @param index the index where this new operation should be added to in the queue. * @param parameters the parameters that should be added as a property of the operation. * @return an instance of {@link OperationRequest} that represents the queued operation. */ OperationRequest addOperation( OperationType opType, WaveId waveId, WaveletId waveletId, String blipId, int index, Parameter... parameters) { String waveIdString = null; if (waveId != null) { waveIdString = ApiIdSerializer.instance().serialiseWaveId(waveId); } String waveletIdString = null; if (waveletId != null) { waveletIdString = ApiIdSerializer.instance().serialiseWaveletId(waveletId); } OperationRequest operation = new OperationRequest( opType.method(), String.format(OP_ID_FORMAT, nextOpId++), waveIdString, waveletIdString, blipId, parameters); // Set the proxying for parameter, if necessary. if (proxyForId != null && !proxyForId.isEmpty()) { operation.addParameter(Parameter.of(ParamsProperty.PROXYING_FOR, proxyForId)); } pendingOperations.add(index, operation); return operation; }
/** * Gets the parameters of the GetCapabilities capability answer. * * @return The operation type representing the GetCapabilities operation. */ private OperationType getCapOperation(WMSResponse wmsResponse) { OperationType opCap = new OperationType(); opCap.getFormat().add("text/xml"); Get getCap = new Get(); getCap.setOnlineResource( buildOnlineResource(wmsResponse, WMSProperties.CAP_GET, "GetCapabilities")); Post postCap = new Post(); postCap.setOnlineResource( buildOnlineResource(wmsResponse, WMSProperties.CAP_POST, "GetCapabilities")); HTTP httpCap = new HTTP(); httpCap.setGet(getCap); httpCap.setPost(postCap); DCPType dcpTypeCap = new DCPType(); dcpTypeCap.setHTTP(httpCap); opCap.getDCPType().add(dcpTypeCap); return opCap; }
/** * Gets the parameters of the GetMap capability answer. * * @return The operation type representing the getMap operation. */ private OperationType getMapOperation(WMSResponse wmsResponse) { OperationType opMap = new OperationType(); for (ImageFormats im : ImageFormats.values()) { opMap.getFormat().add(im.toString()); } Get get = new Get(); get.setOnlineResource(buildOnlineResource(wmsResponse, WMSProperties.MAP_GET, "GetMap")); Post post = new Post(); post.setOnlineResource(buildOnlineResource(wmsResponse, WMSProperties.MAP_POST, "GetMap")); // We feed the http object HTTP http = new HTTP(); http.setGet(get); http.setPost(post); DCPType dcpType = new DCPType(); dcpType.setHTTP(http); opMap.getDCPType().add(dcpType); return opMap; }
private OperationType getFeatureOperation(WMSResponse wmsResponse) { OperationType opFeature = new OperationType(); opFeature.getFormat().add("text/xml"); // GET Get getFeature = new Get(); getFeature.setOnlineResource( buildOnlineResource(wmsResponse, WMSProperties.FEATURE_GET, "GetFeatureInfo")); // POST Post postFeature = new Post(); postFeature.setOnlineResource( buildOnlineResource(wmsResponse, WMSProperties.FEATURE_POST, "GetFeatureInfo")); // Both in HTTP HTTP httpFeature = new HTTP(); httpFeature.setGet(getFeature); httpFeature.setPost(postFeature); DCPType dcpTypeFeature = new DCPType(); dcpTypeFeature.setHTTP(httpFeature); opFeature.getDCPType().add(dcpTypeFeature); return opFeature; }
public Operation( OperationType operationType, FailoverPolicy failoverPolicy, String keyspaceName, Map<String, String> credentials) { this.failCounter = (operationType == OperationType.READ) ? Counter.READ_FAIL : Counter.WRITE_FAIL; this.operationType = operationType; this.stopWatchTagName = operationType.name(); this.failoverPolicy = failoverPolicy; this.keyspaceName = keyspaceName; this.credentials = Collections.unmodifiableMap(credentials); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { struct.kind = OperationType.findByValue(iprot.readI32()); struct.setKindIsSet(true); } if (incoming.get(1)) { struct.dbname = iprot.readString(); struct.setDbnameIsSet(true); } if (incoming.get(2)) { { org.apache.thrift.protocol.TList _list10 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.keys = new ArrayList<String>(_list10.size); for (int _i11 = 0; _i11 < _list10.size; ++_i11) { String _elem12; // required _elem12 = iprot.readString(); struct.keys.add(_elem12); } } struct.setKeysIsSet(true); } if (incoming.get(3)) { { org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.values = new ArrayList<String>(_list13.size); for (int _i14 = 0; _i14 < _list13.size; ++_i14) { String _elem15; // required _elem15 = iprot.readString(); struct.values.add(_elem15); } } struct.setValuesIsSet(true); } }
@Nullable public GutterIconRenderer createRenderer() { if (mySide == ThreeSide.BASE) return null; Side versionSide = mySide.select(Side.LEFT, null, Side.RIGHT); assert versionSide != null; myCtrlPressed = myViewer.getModifierProvider().isCtrlPressed(); myShiftPressed = myViewer.getModifierProvider().isShiftPressed(); if (!isChange(versionSide)) return null; switch (myType) { case APPLY: return createApplyRenderer(versionSide, myCtrlPressed); case IGNORE: return createIgnoreRenderer(versionSide, myCtrlPressed); default: throw new IllegalArgumentException(myType.name()); } }
/** * The operation type. * * @param operationType The operation type. * @see OperationType */ public void setOperationType(OperationType operationType) { this.operationType = operationType.toString(); }
@Override public int hashCode() { int result = type != null ? type.hashCode() : 0; result = 31 * result + (wrapped != null ? wrapped.hashCode() : 0); return result; }
@Override public void writeMarshallable(WireOut wireOut) { wireOut.write(() -> "type").text(type.toString()); wireOut.write(() -> "wrapped").object(wrapped); }
@Override public void readMarshallable(WireIn wireIn) throws IllegalStateException { this.type = OperationType.valueOf(wireIn.read(() -> "type").text()); this.wrapped = wireIn.read(() -> "wrapped").object(Object.class); }
public OperationType findValueByNumber(int number) { return OperationType.forNumber(number); }
public void read(org.apache.thrift.protocol.TProtocol iprot, Message struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // KIND if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.kind = OperationType.findByValue(iprot.readI32()); struct.setKindIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // DBNAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.dbname = iprot.readString(); struct.setDbnameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // KEYS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); struct.keys = new ArrayList<String>(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { String _elem2; // required _elem2 = iprot.readString(); struct.keys.add(_elem2); } iprot.readListEnd(); } struct.setKeysIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // VALUES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list3 = iprot.readListBegin(); struct.values = new ArrayList<String>(_list3.size); for (int _i4 = 0; _i4 < _list3.size; ++_i4) { String _elem5; // required _elem5 = iprot.readString(); struct.values.add(_elem5); } iprot.readListEnd(); } struct.setValuesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); }
public Operation(OperationType operationType) { this.failCounter = (operationType == OperationType.READ) ? Counter.READ_FAIL : Counter.WRITE_FAIL; this.operationType = operationType; this.stopWatchTagName = operationType.name(); }
@Override public void write(Writer writer) throws IOException { left.write(writer); writer.append(" ").append(operation.toString()).append(" "); right.write(writer); }