public new void WriteExternal(IDataOutput output) { if (_message != null) _message.WriteExternal(output); else base.WriteExternal(output); }
public new void WriteExternal(IDataOutput output) { if (_message != null) ((AbstractMessage) _message).WriteExternal(output); else ((AbstractMessage) this).WriteExternal(output); }
public void WriteExternal(IDataOutput output) { var bytes = Encoding.UTF8.GetBytes(Json); output.WriteInt32(bytes.Length); output.WriteBytes(bytes); }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); int flags = 0; if (Operation != 0) flags |= OPERATION_FLAG; output.WriteByte((byte)flags); if (Operation != 0) output.WriteObject(Operation); }
public void WriteExternal(IDataOutput output) { Dictionary<string, object> dict = new Dictionary<string, object>(); foreach (var x in this) dict[x.Key] = x.Value; string json = Serializer.Serialize(dict); byte[] b = Encoding.UTF8.GetBytes(json); output.WriteByte((byte)(b.Length >> 24)); output.WriteByte((byte)(b.Length >> 16)); output.WriteByte((byte)(b.Length >> 8)); output.WriteByte((byte)(b.Length)); output.WriteBytes(b); }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (CorrelationIdBytes == null) CorrelationIdBytes = RtmpUtil.ToByteArray(CorrelationId); int flag = 0; if (CorrelationId != null && CorrelationIdBytes == null) flag |= CORRELATION_ID_FLAG; if (CorrelationIdBytes != null) flag |= CORRELATION_ID_BYTES_FLAG; output.WriteByte((byte)flag); if (CorrelationId != null && CorrelationIdBytes == null) output.WriteObject(CorrelationId); if (CorrelationIdBytes != null) output.WriteObject(CorrelationIdBytes); }
protected void method_9(IDataOutput param1) { param1.WriteShort(-21903); param1.WriteShort(-31435); }
protected void method_9(IDataOutput param1) { param1.WriteShort(32651); }
public void Write(IDataOutput param1) { param1.WriteShort(ID); this.method_9(param1); }
public void writeData(IDataOutput dout) { dout.writeUTF(ElementSetId); dout.writeInt(DataLength); dout.write(DataBytes); }
public void WriteExternal(IDataOutput output) { throw new NotImplementedException(); }
protected void method_9(IDataOutput param1) { param1.WriteShort(-16098); param1.WriteShort(this.var_5008); param1.WriteShort(22964); }
public void WriteExternal(IDataOutput output) { output.WriteInt(Json.Length); output.WriteUTFBytes(Json); }
private void ProcessWriteAsyncMessage(IDataOutput output) { ProcessWriteAbstractMessage(output); if (!String.IsNullOrEmpty(CorrelationId) || correlationIdBytes != null) { // write correlation id bytes if (correlationIdBytes == null) { byte[] corBytes = AmfMessageUtils.UIDStringToBytes(CorrelationId); correlationIdBytes.WriteBytes(corBytes); } // CORRELATION_ID_BYTES_FLAG output.WriteByte(0x2); output.WriteObject(correlationIdBytes); } }
protected void method_9(IDataOutput param1) { param1.WriteInt(param1.Shift(this.x, 10)); param1.WriteInt(param1.Shift(this.y, 9)); }
public virtual void WriteExternal(IDataOutput output) { byte f1 = 0; if (Body != null) f1 |= 0x01; if (ClientId != null && ClientIdBytes == null) f1 |= 0x02; if (Destination != null) f1 |= 0x04; if (Headers != null) f1 |= 0x08; if (MessageId != null && MessageIdBytes == null) f1 |= 0x10; if (Timestamp != 0) f1 |= 0x20; if (TimeToLive != 0) f1 |= 0x40; byte f2 = 0; if (ClientIdBytes != null) f2 |= 0x01; if (MessageIdBytes != null) f2 |= 0x02; if (f2 != 0) f1 |= 0x80; output.WriteByte(f1); if ((f1&0x80) != 0) output.WriteByte(f2); if (Body != null) output.WriteObject(Body); if (ClientId != null && ClientIdBytes == null) output.WriteObject(ClientId); if (Destination != null) output.WriteObject(Destination); if (Headers != null) output.WriteObject(Headers); if (MessageId != null && MessageIdBytes == null) output.WriteObject(MessageId); if (Timestamp != 0) output.WriteObject(Timestamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (ClientIdBytes != null) output.WriteObject(ClientIdBytes); if (MessageIdBytes != null) output.WriteObject(MessageIdBytes); byte f3 = 0; if (CorrelationId != null && CorrelationIdBytes == null) f3 |= 0x01; if (CorrelationIdBytes != null) f3 |= 0x02; output.WriteByte(f3); if (CorrelationId != null && CorrelationIdBytes == null) output.WriteObject(CorrelationId); if (CorrelationIdBytes != null) output.WriteObject(CorrelationIdBytes); }
//IntVar x; //IntVar y;//Reduntant public void SolveVrpProblem(Day day, ConfigParams cfg, VrpProblem vrpProblem, IDataOutput dataOutput, int[] VCMinMax) { this.day = day; this.cfg = cfg; //Google Distance Matrix API (Duration matrix) // Create Routing Index Manager manager = new RoutingIndexManager( day.TimeMatrix.GetLength(0), day.Vehicles.Count, day.Depot); // Create Routing Model. routing = new RoutingModel(manager); // Create and register a transit callback. int transitCallbackIndex = routing.RegisterTransitCallback( (long fromIndex, long toIndex) => { // Convert from routing variable Index to distance matrix NodeIndex. var fromNode = manager.IndexToNode(fromIndex); var toNode = manager.IndexToNode(toIndex); return(day.TimeMatrix[fromNode, toNode]); } ); // Define cost of each arc. routing.SetArcCostEvaluatorOfAllVehicles(transitCallbackIndex); // Add Distance constraint. if (day.TimeWindowsActive != true) { routing.AddDimension(transitCallbackIndex, 0, 700000, true, // start cumul to zero "Distance"); RoutingDimension distanceDimension = routing.GetMutableDimension("Distance"); distanceDimension.SetGlobalSpanCostCoefficient(100); } else { routing.AddDimension( transitCallbackIndex, // transit callback 1000, // allow waiting time 600, // vehicle maximum capacities false, // start cumul to zero "Time"); TimeWindowInit(day, routing, manager);//Set Time Window Constraints } if (day.MaxVisitsActive != 0) { int demandCallbackIndex = routing.RegisterUnaryTransitCallback( (long fromIndex) => { // Convert from routing variable Index to demand NodeIndex. var fromNode = manager.IndexToNode(fromIndex); return(day.Demands[fromNode]); } ); routing.AddDimensionWithVehicleCapacity( demandCallbackIndex, 0, // null capacity slack day.VehicleCapacities, // vehicle maximum capacities true, // start cumul to zero "Capacity"); } // Allow to drop nodes. for (int i = 1; i < day.TimeMatrix.GetLength(0); ++i) { routing.AddDisjunction( new long[] { manager.NodeToIndex(i) }, day.Locations.ElementAt(i).Penalty); } // Setting first solution heuristic. RoutingSearchParameters searchParameters = operations_research_constraint_solver.DefaultRoutingSearchParameters(); searchParameters.FirstSolutionStrategy = FirstSolutionStrategy.Types.Value.PathMostConstrainedArc; //metaheuristic searchParameters.LocalSearchMetaheuristic = LocalSearchMetaheuristic.Types.Value.GuidedLocalSearch; searchParameters.TimeLimit = new Duration { Seconds = cfg.SolutionDuration }; searchParameters.LogSearch = true; solver = routing.solver(); //TODO //Some location must be on same route. //solver.Add(routing.VehicleVar(manager.NodeToIndex(2)) == routing.VehicleVar(manager.NodeToIndex(5))); //One node takes precedence over the another. //routing.AddPickupAndDelivery(manager.NodeToIndex(2), manager.NodeToIndex(5)); //Constraint variable //x = solver.MakeIntVar(day.Vehicles.Count, day.Vehicles.Count, "x"); //Number of vehicle restriction - old version //solver.Add(x < 7); //Number of vehicle restriction -new version //y = solver.MakeIntVar(routing.Vehicles(), routing.Vehicles(), "y"); //solver.Add(y <= VCMinMax[1]);//Reduntant // Solve the problem. solution = routing.SolveWithParameters(searchParameters); day.LocationDropped = false; // Display dropped nodes. List <int> droppedNodes = new List <int>(); for (int index = 0; index < routing.Size(); ++index) { if (routing.IsStart(index) || routing.IsEnd(index)) { continue; } if (solution.Value(routing.NextVar(index)) == index) { droppedNodes.Add(manager.IndexToNode((int)index)); day.LocationDropped = true; } } day.DroppedLocations.Clear(); Console.WriteLine(day.Locations.ElementAt(0).Name); if (droppedNodes != null) { foreach (var item in droppedNodes) { Location location = LocationDB.Locations.Where(x => x.Position.strPos_ == day.Addresses[item]).ToList().ElementAt(0); if (location != null) { Console.WriteLine(location.Name); day.DroppedLocations.Add(location); } } } List <int> AssignedNodes = new List <int>(); Console.WriteLine(manager.GetNumberOfNodes()); //Inspect Infeasable Nodes for (int i = 0; i < day.Vehicles.Count; i++) { var index = routing.Start(i); int j = 0; while (routing.IsEnd(index) == false) { j++; index = solution.Value(routing.NextVar(index)); } if (j == 1) { day.InfeasibleNodes = true; foreach (var item in day.DroppedLocations) { LocationDB.Locations.Where(x => x.ClientRef == item.ClientRef).ToList().ElementAt(0).Infeasible = true; } if (day.Vehicles.Count - 1 >= 1) { day.SetVehicleNumber(day.Vehicles.Count - 1); day.ResetResults(); vrpProblem.SolveVrpProblem(day, cfg, vrpProblem, dataOutput, VCMinMax); } return; } } // Inspect solution. day.TotalDur = 0; day.MinDur = 100000; for (int i = 0; i < day.Vehicles.Count; i++) { long routeDuration = 0; var index = routing.Start(i); while (routing.IsEnd(index) == false) { var previousIndex = index; index = solution.Value(routing.NextVar(index)); routeDuration += routing.GetArcCostForVehicle(previousIndex, index, 0); } day.TotalDur += routeDuration; day.MaxDur = Math.Max(routeDuration, day.MaxDur); day.MinDur = Math.Min(routeDuration, day.MinDur); } day.AvgDur = day.TotalDur / day.Vehicles.Count; }
protected void method_9(IDataOutput param1) { param1.WriteShort(2067); param1.WriteShort(10958); param1.WriteShort(this.petRequestType); }
protected void method_9(IDataOutput param1) { param1.WriteShort(this.notificationType); param1.WriteInt(param1.Shift(this.eventId, 13)); }
public void Write <R>(IDataOutput <R> o, int proj = 0x00ff) where R : IDataOutput <R> { o.Put(nameof(name), name); o.Put(nameof(text), text); }
public void WriteExternal(IDataOutput output) { output.WriteObject(this.ToArray()); }
/// <summary> /// Encode the ArrayCollection for a data stream. /// </summary> /// <param name="output">IDataOutput interface.</param> public void WriteExternal(IDataOutput output) { output.WriteObject(ToArray()); }
protected override void method_9(IDataOutput param1) { base.method_9(param1); param1.WriteInt(param1.Shift(this.number, 17)); param1.WriteShort(this.type); }
private void ProcessWriteAbstractMessage(IDataOutput output) { byte flag = 0; if (Body != null) flag |= (int)PartFlags.BODY_FLAG; if (!String.IsNullOrEmpty(Destination)) flag |= (int)PartFlags.DESTINATION_FLAG; if (Headers != null && Headers.Any()) flag |= (int)PartFlags.HEADERS_FLAG; if (Timestamp != 0) flag |= (int)PartFlags.TIMESTAMP_FLAG; if (TimeToLive != 0) flag |= (int)PartFlags.TIME_TO_LIVE_FLAG; if (ClientId != null || !String.IsNullOrEmpty(MessageId)) flag |= (int)PartFlags.HAS_NEXT_FLAG; output.WriteByte(flag); byte flag2 = 0; if (ClientId != null || clientIdBytes != null) { // write correlation id bytes if (clientIdBytes == null) { byte[] cBytes = AmfMessageUtils.UIDStringToBytes((string)ClientId); clientIdBytes = new ByteArray(); clientIdBytes.WriteBytes(cBytes); } flag2 |= 0x1; } if (MessageId != null || messageIdBytes != null) { // write correlation id bytes if (messageIdBytes == null) { byte[] cBytes = AmfMessageUtils.UIDStringToBytes((string)MessageId); messageIdBytes = new ByteArray(); messageIdBytes.WriteBytes(cBytes); } flag2 |= 0x2; } if (flag2 != 0) output.WriteByte(flag2); if (Body != null) output.WriteObject(Body); if (!String.IsNullOrEmpty(Destination)) output.WriteObject(Destination); if (Headers != null && Headers.Any()) output.WriteObject(Headers); if (Timestamp != 0) output.WriteObject(Timestamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (clientIdBytes != null) output.WriteObject(clientIdBytes); if (messageIdBytes != null) output.WriteObject(messageIdBytes); }
protected void method_9(IDataOutput param1) { param1.WriteBoolean(this.hasFuel); param1.WriteBoolean(this.hasPet); param1.WriteBoolean(this.petIsAlive); }
protected void method_9(IDataOutput param1) { param1.WriteUTF(this.poiId); this.visualModifier.Write(param1); }
protected void method_9(IDataOutput param1) { param1.WriteShort(-23400); param1.WriteShort(-25518); }
public void writeData(IDataOutput dout) { dout.writeUTF(Id); dout.writeUTF(Type); dout.writeUTF(Description); dout.writeUTF(Url); dout.writeUTF(ProcessingTime); dout.writeUTF(MaxRequests); dout.writeUTF(Quantities); }
protected void method_9(IDataOutput param1) { param1.WriteShort(2748); param1.WriteShort(this.var_2249); }
protected void method_9(IDataOutput param1) { this.type.Write(param1); this.status.Write(param1); param1.WriteUTF(this.var_909); }
public void writeData(IDataOutput dout) { dout.writeUTF(WebServiceId); dout.writeUTF(QuantityId); dout.writeUTF(TimeStamp); dout.writeUTF(ElementSetId); dout.writeUTF(ScenarioId); dout.writeBoolean(NeedsUpload); dout.writeInt(DataLength); dout.write(DataBytes); }
public virtual void WriteExternal(IDataOutput output) { if (ClientIdBytes == null) ClientIdBytes = RtmpUtil.ToByteArray(ClientId); if (MessageIdBytes == null) MessageIdBytes = RtmpUtil.ToByteArray(MessageId); int firstflags = 0; if (Body != null) firstflags |= BODY_FLAG; if (ClientId != null && ClientIdBytes == null) firstflags |= CLIENT_ID_FLAG; if (Destination != null) firstflags |= DESTINATION_FLAG; if (Headers != null) firstflags |= HEADERS_FLAG; if (MessageId != null && MessageIdBytes == null) firstflags |= MESSAGE_ID_FLAG; if (TimeStamp != 0) firstflags |= TIMESTAMP_FLAG; if (TimeToLive != 0) firstflags |= TIME_TO_LIVE_FLAG; int secondflags = 0; if (ClientIdBytes != null) secondflags |= CLIENT_ID_BYTES_FLAG; if (MessageIdBytes != null) secondflags |= MESSAGE_ID_BYTES_FLAG; if (secondflags != 0) firstflags |= HAS_NEXT_FLAG; output.WriteByte((byte)firstflags); if (secondflags != 0) output.WriteByte((byte)secondflags); if (Body != null) output.WriteObject(Body); if (ClientId != null && ClientIdBytes == null) output.WriteObject(ClientId); if (Destination != null) output.WriteObject(Destination); if (Headers != null) output.WriteObject(Headers); if (MessageId != null && MessageIdBytes == null) output.WriteObject(MessageId); if (TimeStamp != 0) output.WriteObject(TimeStamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (ClientIdBytes != null) output.WriteObject(ClientIdBytes); if (MessageIdBytes != null) output.WriteObject(MessageIdBytes); }
protected override void method_9(IDataOutput param1) { base.method_9(param1); param1.WriteFloat(this.var_2824); param1.WriteShort(-7762); }
protected void method_9(IDataOutput param1) { param1.WriteShort(-11574); param1.WriteUTF(this.var_4114); }
protected virtual void method_9(IDataOutput param1) { param1.WriteShort(-10530); param1.WriteShort(-12223); param1.WriteUTF(this.key); }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); byte flags = 0; if (operation != 0) flags |= OPERATION_FLAG; output.WriteByte(flags); if (operation != 0) output.WriteObject(operation); }
protected void method_9(IDataOutput param1) { param1.WriteInt(param1.Shift(this.totalAmountOfNpcOnMap, 29)); param1.WriteInt(param1.Shift(this.mapId, 1)); param1.WriteInt(param1.Shift(this.npcId, 12)); }
/// <summary> /// Write this data structure to the given output stream. /// </summary> /// <param name="os">the output stream</param> /// <exception cref="IOException">if an I/O error occurs</exception> public override void Store(IDataOutput os) { base.Store(os); }
protected void method_9(IDataOutput param1) { param1.WriteShort(1313); this.var_2563.Write(param1); param1.WriteShort(21392); }
/// <summary> /// Write the contents of this <see cref="Row"/> to the given output stream. /// </summary> /// <param name="os">the output stream</param> /// <exception cref="IOException">if an I/O error occurs</exception> public virtual void Store(IDataOutput os) { os.WriteInt(cells.Count); IEnumerator<char> i = cells.Keys.GetEnumerator(); for (; i.MoveNext();) { char c = i.Current; Cell e = At(c); if (e.cmd < 0 && e.@ref < 0) { continue; } os.WriteChar(c); os.WriteInt(e.cmd); os.WriteInt(e.cnt); os.WriteInt(e.@ref); os.WriteInt(e.skip); } }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); output.WriteByte(0); }
internal static int WriteUTF(string str, IDataOutput @out) { int strlen = str.Length; int utflen = 0; int c, count = 0; /* use charAt instead of copying String to char array */ for (int i = 0; i < strlen; i++) { c = str[i]; if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { utflen += 3; } else { utflen += 2; } } if (utflen > 65535) throw new FormatException( "encoded string too long: " + utflen + " bytes"); byte[] bytearr = null; if (@out is DataOutputStream) { DataOutputStream dos = (DataOutputStream)@out; if (dos.bytearr == null || (dos.bytearr.Length < (utflen + 2))) dos.bytearr = new byte[(utflen * 2) + 2]; bytearr = dos.bytearr; } else { bytearr = new byte[utflen + 2]; } bytearr[count++] = (byte)(int)(((uint)utflen >> 8) & 0xFF); bytearr[count++] = (byte)(int)(((uint)utflen >> 0) & 0xFF); int i2 = 0; for (i2 = 0; i2 < strlen; i2++) { c = str[i2]; if (!((c >= 0x0001) && (c <= 0x007F))) break; bytearr[count++] = (byte)c; } for (; i2 < strlen; i2++) { c = str[i2]; if ((c >= 0x0001) && (c <= 0x007F)) { bytearr[count++] = (byte)c; } else if (c > 0x07FF) { bytearr[count++] = (byte)(0xE0 | ((c >> 12) & 0x0F)); bytearr[count++] = (byte)(0x80 | ((c >> 6) & 0x3F)); bytearr[count++] = (byte)(0x80 | ((c >> 0) & 0x3F)); } else { bytearr[count++] = (byte)(0xC0 | ((c >> 6) & 0x1F)); bytearr[count++] = (byte)(0x80 | ((c >> 0) & 0x3F)); } } @out.Write(bytearr, 0, utflen + 2); return utflen + 2; }
protected void method_9(IDataOutput param1) { this.var_2932.Write(param1); }
/// <summary> /// Write this data structure to the given output stream. /// </summary> /// <param name="os">the output stream</param> /// <exception cref="IOException">if an I/O error occurs</exception> public override void Store(IDataOutput os) { os.WriteBoolean(forward); os.WriteInt(BY); os.WriteInt(tries.Count); foreach (Trie trie in tries) trie.Store(os); }
protected void method_9(IDataOutput param1) { param1.WriteBoolean(this.name_23); }
public void writeData(IDataOutput dout) { dout.writeUTF(WebServiceId); dout.writeUTF(QuantityId); dout.writeUTF(ElementSetId); dout.writeUTF(TimeStamp); dout.writeUTF(ScenarioId); }
protected void method_9(IDataOutput param1) { param1.WriteShort(this.typeValue); }
public void WriteExternal(IDataOutput output) { ProcessWriteAcknowledgeMessage(output); }
protected override void method_9(IDataOutput param1) { base.method_9(param1); param1.WriteDouble(this.name_140); }
private void ProcessWriteAcknowledgeMessage(IDataOutput output) { ProcessWriteAsyncMessage(output); output.WriteByte(0); }
protected void method_9(IDataOutput param1) { param1.WriteShort(577); this.var_4838.Write(param1); }
/// <summary> /// Write this <see cref="Trie"/> to the given output stream. /// </summary> /// <param name="os">the output stream</param> /// <exception cref="IOException">if an I/O error occurs</exception> public virtual void Store(IDataOutput os) { os.WriteBoolean(forward); os.WriteInt(root); os.WriteInt(cmds.Count); foreach (string cmd in cmds) os.WriteUTF(cmd); os.WriteInt(rows.Count); foreach (Row row in rows) row.Store(os); }
protected void method_9(IDataOutput param1) { param1.WriteInt(param1.Shift(this.var_4820, 23)); param1.WriteShort(-15828); }
protected void method_9(IDataOutput param1) { param1.WriteShort(this.var_3599); this.var_210.Write(param1); param1.WriteShort(this.var_4722); }
protected void method_9(IDataOutput param1) { param1.WriteShort(this.name_87); }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (correlationIdBytes == null && correlationId != null) correlationIdBytes = new Guid(correlationId).ToByteArray(); byte flags = 0; if (correlationId != null && correlationIdBytes == null) flags |= CORRELATION_ID_FLAG; if (correlationIdBytes != null) flags |= CORRELATION_ID_BYTES_FLAG; output.WriteByte(flags); if (correlationId != null && correlationIdBytes == null) output.WriteObject(correlationId); if (correlationIdBytes != null) output.WriteObject(correlationIdBytes); }