2 * Copyright (c) 2006-2013. The SimGrid Team.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package.
10 import org.simgrid.msg.Task;
12 * Tasks sent between peers
14 public class MessageTask extends Task {
27 public String issuerHostname;
28 public String mailbox;
30 public char bitfield[];
32 public int blockIndex;
33 public int blockLength;
34 public boolean stalled;
36 * Constructor, builds a value-less message
38 * @param issuerHostname
42 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId) {
43 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
46 * Constructor, builds a new "have/request/piece" message
48 * @param issuerHostname
53 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index) {
54 this(type,issuerHostname,mailbox,peerId,index,false,-1,-1);
57 * Constructor, builds a new bitfield message
59 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, char bitfield[]) {
60 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
61 this.bitfield = bitfield;
64 * Constructor, build a new "request" message
66 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, int blockIndex, int blockLength) {
67 this(type,issuerHostname,mailbox,peerId,index,false,blockIndex,blockLength);
70 * Constructor, build a new "piece" message
72 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, boolean stalled, int blockIndex, int blockLength) {
74 this.issuerHostname = issuerHostname;
75 this.mailbox = mailbox;
78 this.stalled = stalled;
79 this.blockIndex = blockIndex;
80 this.blockLength = blockLength;