2 * Copyright 2006-2012. The SimGrid Team. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package.
9 import org.simgrid.msg.Task;
11 * Tasks sent between peers
13 public class MessageTask extends Task {
26 public String issuerHostname;
27 public String mailbox;
29 public char bitfield[];
31 public int blockIndex;
32 public int blockLength;
33 public boolean stalled;
35 * Constructor, builds a value-less message
37 * @param issuerHostname
41 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId) {
42 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
45 * Constructor, builds a new "have/request/piece" message
47 * @param issuerHostname
52 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index) {
53 this(type,issuerHostname,mailbox,peerId,index,false,-1,-1);
56 * Constructor, builds a new bitfield message
58 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, char bitfield[]) {
59 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
60 this.bitfield = bitfield;
63 * Constructor, build a new "request" message
65 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, int blockIndex, int blockLength) {
66 this(type,issuerHostname,mailbox,peerId,index,false,blockIndex,blockLength);
69 * Constructor, build a new "piece" message
71 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, boolean stalled, int blockIndex, int blockLength) {
73 this.issuerHostname = issuerHostname;
74 this.mailbox = mailbox;
77 this.stalled = stalled;
78 this.blockIndex = blockIndex;
79 this.blockLength = blockLength;