method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a8ff5c62-1144-4826-aaec-0acee370a97b | 6 | public void loadFormationFiles() {
try {
Scanner scn = new Scanner(new FileReader(formationFile));
int i = 0;
int j = 0;
int columnCount = 0;
int rowCount = 0;
int tempLoc;
while(scn.hasNextLine()) {
String line[] = scn.nextLine().split(",");
columnCount = 0;
tempLoc = 0;
for(... |
fe1f890e-cd1c-4b60-9df8-31cf8aa06061 | 2 | public byte[] i2c_read(short address, int length) throws IOException {
if (length<=0) {
throw new IOException("no data");
}
if (length==1) {
return this.read_single(address);
} else {
return this.read_multiple(address, length);
}
} |
146e1946-ff09-4fe0-ae02-c811503f9079 | 9 | @Override
public void run() {
initializeLogger();
Thread currentThread = Thread.currentThread();
this.log.fine("Get current Thread");
File file = new File(this.fileName);
this.log.fine("Create new file: " + file.toString());
InputStream fileReader = getFileReader(file);
if (fileReader == null) return;
... |
4e014fd1-8e06-416a-bf94-3defd29451e5 | 9 | private void modifyFactors(int firstFactorIndicator, int secondFactorIndicator) {
//TODO: (3 marca 2013) zrob tak by faktoy nie modyfikowaly sie o dodanie 1dynki, tylko o dodanie elementu z tableOfP1
BigDecimal factor1 = factorList1.get(0);
BigDecimal factor2 = factorList2.get(0);
factorList1.remove(0);
factorList... |
d77a4ca5-5790-4d29-94b0-d83a9aca2965 | 0 | @Override
public String toString() {
return "\nMessage [user=" + user.getEmail() + ", date=" + date + ", text=" + text
+ "]";
} |
b9e042e4-bde5-454c-b37c-aaeb6ef2ca54 | 0 | public int pushRunTimeStack(int item) {
return runStack.push(item);
} |
95e92773-3e7e-4e6e-a405-3a2997983503 | 4 | public void analyze()
{
final int width = mField.getWidth(), height = mField.getHeight();
mAreas.clear();
HashSet<Integer> emptyTiles = new HashSet<>();
for (int tile = 0; tile < width * height; tile++ )
if (mField.getTileValue(tile).isEmpty()) emptyTiles.add(tile);
for (int tile : emptyTiles)
{
i... |
b7a7cceb-0715-4eba-80eb-f93b0d5edd63 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PrintNode other = (PrintNode) obj;
if (expr == null) {
if (other.expr != ... |
042e7943-cadd-4831-8dae-e69dc146467e | 9 | private MITMAdminClient( String [] args ) {
int remotePort = 8002;
String remoteHost = "localhost";
if( args.length < 3 )
throw printUsage();
try {
for (int i=0; i<args.length; i++)
{
if (args[i].equals("-remoteHost")) {
remoteHost = args[++i];
} else if (args[i].equals("-remotePort"))... |
22742ac5-18b1-4727-9324-f7d4116d1c0d | 1 | public void remove(){
if(threadCount.decrementAndGet() == 0){
semaphore.release();
}
} |
f89c8de1-eeba-43dc-a3c3-95240adb9559 | 9 | @Override
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
final Set<EntityPortion> portion = getEntityPortion(arg.get("PORTION").get(0));
EntityGender gender = null;
final String arg1 = arg.get("GENDER").get(0);
if (arg1 == null) {
gender = EntityGenderUtils.all();
} e... |
5fd4f004-9933-437c-9b76-88f035ad6bca | 9 | @Test
public void testGetBooks() {
Integer testISBN = 400;
Set<StockBook> booksToAdd = new HashSet<StockBook>();
booksToAdd.add(new ImmutableStockBook(testISBN, "Book Name",
"Book Author", (float) 100, 5, 0, 0, 0, false));
try {
storeManager.addBooks(booksToAdd);
} catch (BookStoreException e) {
e.... |
84486782-cae2-44ac-a429-f04038bd982d | 5 | public Rectangle getTextBounds (int columnIndex) {
checkWidget ();
if (!parent.checkData (this, true)) SWT.error (SWT.ERROR_WIDGET_DISPOSED);
CTableColumn[] columns = parent.columns;
int columnCount = columns.length;
int validColumnCount = Math.max (1, columnCount);
if (!(0 <= columnIndex && columnIndex < validCo... |
351979ef-8956-4efb-a57e-dd41876f04e3 | 3 | private boolean check(Point point, List<Point> arrayList){
if (point == null){
return true;
}
for (Point point1: arrayList){
if (point1.equals(point)){
return true;
}
}
return false;
} |
ad9bd720-dc97-4b1f-9895-204f644a5190 | 6 | @Override
protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) {
super.dataAttributeChanged(keyWord, value);
if (value != null) {
if (keyWord == BPKeyWords.ACTOR) {
this.actorTa.setText((String) value);
} else if (keyWord == BPKeyW... |
f21e37b2-c05c-4987-98b7-aad29261319c | 4 | public static void removeRental(int rentalId, int prodId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
... |
6ccd17d6-2e37-41da-b190-ee27e58bf14e | 4 | public HoughLineDialog(final Panel panel) {
setTitle("Hough Line");
setBounds(1, 1, 300, 200);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
pan = new JPanel();
pan... |
aa9d747d-f558-426b-b693-049f090fe598 | 1 | private void setLine(int idx, Tile[] re) {
for (int i : _0123) {
tiles[i + idx * ROW] = re[i];
}
} |
d9b9d022-ac3f-4aab-9c3d-414f24bb3a9d | 1 | @Override
public void actionPerformed(ActionEvent arg0) {
String data = messageToSend.getText();
if ( data.isEmpty() )
return;
messagelog.append(messanger.getMyUsername()+": "+data+"\n");
messanger.sendMessage(data);
messageToSend.setText("");
} |
4edf0c72-066f-4ae2-9b59-00b07f5892b1 | 8 | private ArrayList<Cell> calculateCustomSeatingOrder() {
// Find the maximum number from the given order
int maximumNumber = 0;
for (int[] array : this.customMethod) {
for (int y = 0; y < array.length; y++) {
if (array[y] > maximumNumber) {
maximumN... |
3929096c-6594-42a9-bf86-5a11dd183ba7 | 4 | public boolean GetFlip() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: GetFlip() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: GetFlip() END");
}
return m_w < PIECE_SIZE;
} |
cd1ca2a4-fcbf-41d2-b7af-398a953a233c | 8 | @Override
public String getStat(String code)
{
switch (getCodeNum(code))
{
case 0:
return CMClass.classID(this);
case 1:
return displayText();
case 2:
return description();
case 3:
return text();
case 4:
return CMLib.coffeeMaker().getExtraEnvPropertiesStr(this);
case 5:
return rawIma... |
5ebac48f-69c2-45a6-adca-d9c856d3346a | 1 | static public MenuPrincipal instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new MenuPrincipal();
}
return UnicaInstancia;
} |
6282916f-00c8-45ae-b01f-b33b2a9f18bb | 7 | private double getLevel(Hand hand) {
FingerList figs = null;
// if we get here, there is no level hand in the frame
if (hand == null || (figs = hand.fingers()) == null || figs.isEmpty()){
deadLevelFrames++;
// if we get here, there is no pitch hand in the frame
if (... |
4a1d798e-6711-4a91-89b8-d26143dbefd6 | 3 | private void bindPlayerInventory(InventoryPlayer inventory)
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
{
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
for (int i = 0; i < 9; i++)
addS... |
8b0a3dc4-b9b4-4445-82ad-558bea52283b | 9 | private String getMonospacedFontName() {
if (monospacedFontName==null) {
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
String[] familyNames = ge.getAvailableFontFamilyNames();
Arrays.sort(familyNames);
boolean windows = System.getProperty("os.name").toLowerCase().... |
33466fa0-92ea-41aa-aea0-3f095b3dcf2c | 1 | public void quicksave() throws IOException {
File saveFolder = new File(SAVE_FILE_FOLDER);
if (!saveFolder.isDirectory()) { //If the save folder doesn't exist, create it when quicksaving.
saveFolder.mkdir(); //mkdir = make directory
}
//EXTRA: Allow multiple, maybe time-stamped, quicksaves.
save(SAVE_FILE_... |
47a882d5-711f-440e-a2c1-94aa0279624f | 1 | public int getInt(String key, int _default)
{
return containsKey(key) ? get(key).intValue() : _default;
} |
74f67471-4f42-42ae-9b5f-d81410f96517 | 7 | private void drawHeadTailU(UGraphic ug, Page page, double positionTail) {
for (Map.Entry<Participant, LivingParticipantBox> ent : participants.entrySet()) {
final Participant p = ent.getKey();
final LivingParticipantBox box = ent.getValue();
final double create = box.getCreate();
boolean showHead = true;
... |
3cab2521-21cc-4b59-b0b7-aba237a5ae3c | 8 | private void adjustLocation() {
double newX = currentLocation.x;
double newY = currentLocation.y;
if (newX < Environment.getMinX() || newX > Environment.getMaxX() ||
newY < Environment.getMinY() || newY > Environment.getMaxY())
{
// flags that determine whether o... |
e7ad619e-5d6f-43dd-bd71-e3ab92e0a3a6 | 2 | public void testToStandardHours_months() {
Period test = Period.months(1);
try {
test.toStandardHours();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.months(-1);
try {
test.toStandardHours();
fail();
... |
c507162b-8b8d-447a-b7ac-6f86ba4e83c4 | 5 | public static void main(String[] args) {
Set<Schema.Player> conflicts = Sets.newHashSet();
PlayerRepository<Schema.Player> repository = JacksonPlayerRepository.create("/master.player.json");
Map<String,Map<String,Schema.Player>> idMap = Maps.newHashMap();
for(Schema.Player p : reposit... |
fa69fb56-e44c-46ab-b297-c26d5c3dc9ae | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(target.charStats().getMyRace().bodyMask()[Race.BODY_MOUTH]<=0)
{
if(!auto)
mob.tell(L("Ther... |
9d61f959-279b-4221-b62b-8711e3dedb65 | 5 | public static String[] separateString(String string) {
LinkedList list = new LinkedList();
for (int i = string.length() - 1; i >= 0; i--) {
int start = i;
if (string.charAt(i) != ')') {
list.addFirst(string.substring(i, i + 1));
continue;
}
while (i > 0 && string.charAt(i) != '(')
i--;
if... |
b219146a-150f-490b-ba6e-98b4702b0130 | 8 | public JPanel setButtons(int time) {
JPanel buttons = new JPanel();
buttons.setLayout(new GridBagLayout());
buttons.setBackground(new Color(255, 231, 186));
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5,5,5,5);
//Display the current time
c... |
2db01201-0404-4c13-8cf2-3016447d99c4 | 1 | public void open(File file) {
try {
model.openAudioInputStream(file);
view.setPlayEnabled(true);
view.setStopEnabled(false);
view.setPauseEnabled(false);
} catch (Exception e) {
view.showStatus(e.getMessage());
view.setPlayEnabled(false);
view.setStopEnabled(false);
view.setPauseEnabled(fals... |
f6a76559-5542-400c-8bd4-171a1fe3e26c | 3 | private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... |
ed600cc2-9772-4abf-bdb4-87e2b20541d9 | 2 | public void setY(int y)
{
for(int i=0;i<markers;i++)
{
if(marker[i].isSelectedDrag())
{
marker[i].setY(y);
// break;
}
}
} |
8e448bce-ac7d-42f2-8d58-c43fbc2962a7 | 1 | public String getTrackOnAlbumStr() {
if (TrackOnAlbum <= 0) {
return "";
}
return String.valueOf(TrackOnAlbum);
} |
565158dc-a897-4850-9038-95bec6d82be2 | 6 | private static String convertNumber(String number) {
if (number.length() > 3)
throw new NumberFormatException(
"La longitud maxima debe ser 3 digitos");
// Caso especial con el 100
if (number.equals("100")) {
return "CIEN";
}
StringB... |
c961f294-6a5b-40bb-9d29-47c2ca7e4c8f | 0 | @Override
public void run() {
System.out.println(bank.getMoney(800));
} |
80b0d738-c87c-431a-b83d-5fa8bb42a247 | 0 | public void setName(String name) {
clientName = name;
} |
5b5e8a23-a430-4bf0-83c2-68d56395dcc3 | 6 | private void sell(String[] commandString, Player player) throws CommandException {
if (commandString.length >= 3) {
CargoEnum cargoEnum = CargoEnum.toCargoEnum(commandString[2]);
if (cargoEnum != null) {
Station station = player.getCurrentStar().getStation();
... |
de57e84c-24b6-4d51-936e-a26b6a063ca6 | 6 | public boolean userExists(Transaction trans, String table, String username) throws DatabaseException{
try {
if(!validString(username)) {
throw new SQLException("Trying to use invalid characters at username:'"+username+"'");
}
String query = "";
Connection connection = ((JDBCTransac... |
3cfac781-5640-473b-9549-d94bc3c04cff | 7 | public final void dotted_as_names() throws RecognitionException {
try {
// Python.g:233:17: ( dotted_as_name ( COMMA dotted_as_name )* )
// Python.g:233:19: dotted_as_name ( COMMA dotted_as_name )*
{
pushFollow(FOLLOW_dotted_as_name_in_dotted_as_names1686);
dotted_as_name();
state._fsp--;
if (sta... |
fe822fe4-33ed-45e1-81d7-a62d7c176ce7 | 6 | public void resetGame(boolean message, boolean keepKits) {
debug("Resetting game " + getGameId());
reset = true;
lastKeepKits = keepKits;
time = 0;
resetScores();
lastKits.clear();
for (Entry<String, PlayerData> en : pd.entrySet()) {
lastKits.put(en.ge... |
cc1ec60b-3be0-4048-9ed5-210de35d4085 | 4 | public static int findMaxDepth(int[][] maze){
int max = Integer.MIN_VALUE;
for(int i=0; i<maze.length; i++){
for(int j=0; j<maze[0].length; j++){
if(maze[i][j]<Integer.MAX_VALUE && max<maze[i][j])
max = maze[i][j];
}
}
return max;
} |
534c3711-43ae-41a3-af5f-83bca47ef02a | 5 | public static RequestCommand valueOf(String command) {
command = command.toUpperCase();
if ("LOG_FILE".equals(command)) {
return new RequestCommand(LOG_FILE);
}
if ("GZ_FILE".equals(command)) {
return new RequestCommand(GZ_FILE);
}
if ("SEARCH_FILE_CONTENT".equals(command)) {
return new RequestComm... |
f7b22bd0-f93a-44bd-927f-9af4cfd88c4c | 7 | private void method91(Stream stream, int i)
{
while(stream.bitPosition + 10 < i * 8)
{
int j = stream.readBits(11);
if(j == 2047)
break;
if(playerArray[j] == null)
{
playerArray[j] = new Player();
if(aStreamArray895s[j] != null)
playerArray[j].updatePlayer(aStreamArray895s[j]);
}
... |
ca38efbe-996d-408b-a23a-3a22f699c6de | 6 | public static void main(String[] args) {
System.out.println("program Seaching bubblesort");
System.out.println("==========================");
System.out.println("");
Scanner in=new Scanner(System.in);
System.out.print("masukan jumlah data=");
int jumlah=in.nextIn... |
55129abc-049c-4226-a6a3-c928a147743d | 4 | public ArrayList<String> wordBreakRec(String s, Trie trie) {
ArrayList<String> res = new ArrayList<String>();
ArrayList<Integer> ends = trie.seach(s);
if (!ends.isEmpty()) {
for (Integer end : ends) {
// res.add(s.substring(0, end));
String strBegin = s.substring(0, end);
String sTmp = s.substring... |
f311b1d4-b98d-4e65-9c8f-04875eb9ba59 | 7 | public int applySeason()
{
int ambientTemp = 60;
int randomizer = (rnd.nextInt(30) - 15); // plus or minus up to 15 degrees
switch (getSeasonState()){
case SPRING:
ambientTemp = 65 + randomizer;
break;
case SUMMER:
ambientTemp = 75 + randomizer;
isHeatwave = rnd.nextInt(5) == 1;
if (... |
16aa7e21-8fb4-4091-99c3-32d5928900fb | 5 | private void addLayoutObjects(Level l){
//Add the tiles and edges to the map
if (l != null){
for (int i = 0; i < l.getTiles().length; i++){
for (int j = 0; j < l.getTiles()[i].length; j++){
if(l.getTiles()[i][j] !=null) {
addTile(l.getTiles()[i][j]);
}
... |
e0a9c113-c01d-4767-91a4-2cdda96a05cd | 3 | public boolean jumpMayBeChanged() {
for (int i = 0; i < subBlocks.length; i++) {
if (subBlocks[i].jump == null && !subBlocks[i].jumpMayBeChanged())
return false;
}
return true;
} |
44bdb6ff-0b27-4d60-aa7e-e9c2d08ef6ac | 7 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
{
super.unInvoke();
return;
}
final MOB mob=(MOB)affected;
super.unInvoke();
if(canBeUninvoked())
if((mob.location()!=null)&&(!mob.amDead()))
mob.location().show(mob,null,CMMsg.MSG_OK_VISUA... |
ae1289d6-26d3-4367-b964-9c6c88004db4 | 3 | public void InsertToHashMap() {
int curKey;
for (int i = 0; i < arrayLen; i++) {
curKey = originalArray[i];
// if originalArray[i] is duplicate, then the LinkedList for its
// hash key should already exist;
if (mappedArray.containsKey(curKey)) {
LinkedList<Integer> existElements = mappedArray.get(cu... |
7b722a70-7092-418f-af2f-bd6f6f1e1590 | 3 | public void insertionSort()
{
int temp = 0;
int pos = 0;
// loop from second element on
for (int i = 1; i < a.length; i++)
{
// save current value at i and set position to i
temp = a[i];
pos = i;
// shift right any larger elements
while (0 < pos && temp <... |
87c960a6-b893-4ff3-91d2-30c2a52f39a0 | 6 | static public double get(int itemLevel, QualityT quality, int randPropIndex) {
if (itemLevel < 1 || itemLevel > M.length) {
throw new IllegalArgumentException("Illegal ItemLevel: " + itemLevel);
}
if (randPropIndex < 0 || randPropIndex >= N) {
throw new IllegalArgumentExc... |
6059233a-f5bd-4bd1-a126-589e8c3c7012 | 3 | @Override
public boolean retainAll(Collection<?> c) {
boolean b = false;
for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) {
T t = iterator.next();
if (!c.contains(t)) {
iterator.remove();
b = true;
}
}
return b;
} |
8a499a18-52f9-4c53-9b46-2bf244b91ca8 | 6 | @Override
public int print(Graphics g, PageFormat pf, int ind)throws PrinterException{
//g.setPaint(Color.black);
if(ind > printer.kol_chek-1)
return NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D)g;
try {
Buf... |
c9a5ebab-09f1-482a-ba47-f4fd0f34fd54 | 8 | public static TobiiEventMap loadTobiiEvent2(File file) throws IOException {
CSVReader reader = new CSVReader(new FileReader(file), '\t');
String[] line;
// Get header data for this file
TobiiHeader header = readHeader(reader);
TobiiEventMap eventMap = new TobiiEventMap(header);
// Work our way dow... |
ee2d91b9-238b-4a97-90bc-03e35704d85e | 1 | @Override
public int getWidth() {
int width = 0;
if (this.fontmetrics != null) {
width = this.fontmetrics.stringWidth(this.str);
}
return width;
} |
a7e859df-01e5-4e7c-a703-6054500cb2b0 | 6 | public static int generateTrainingExamples(Vector instances, Surrogate concept) {
{ int numInstances = instances.length();
Cons consQuery = Stella.NIL;
int numExamples = 0;
TrainingExample example = null;
Proposition prop = null;
QueryIterator query = null;
Symbol conceptName = S... |
58738023-bfb9-4d73-8d47-465451e668a4 | 0 | public void setCode(String code) {
this.code = code;
} |
1d2bc26b-c5ee-4a46-9d23-de41b62dfdae | 2 | public int compareTo(Money o) {
if ((o == null) || (!isSameCurrencyAs(o)))
throw new ClassCastException();
return getQuantity().compareTo(o.getQuantity());
} |
a454801e-a83e-4629-a580-33915bcbb68e | 7 | public String convert(String s, int numRows) {
if (numRows == 1) {
return s;
}
StringBuilder sb = new StringBuilder();
int step = 2 * numRows - 2; // P->A->Y->P->A, step = 4
for (int i = 0; i < numRows; i++) {
if (i == 0 || i == numRows - 1) {
... |
2a2b7bdd-34bf-4f28-9ad5-f8f2a79ef31d | 8 | private void slider_moved(final ChangeEvent e) {
final JSlider slider = (JSlider) e.getSource();
if (slider == slider_userHTTP)
{
setSliderTitle(slider, ControllerGUI.SLIDER_TITLE_USER_HTTP + ": "
+ slider.getValue());
} else if (slider == slider_userWebSocket)
{
setSliderTitle(slider, ControllerG... |
2e5f7323-15f3-40bc-b06f-c46c84f30aba | 9 | public static String getFilePassword(File file) throws FileException, FileNotFoundException
{
FileInputStream fstream;
fstream = new FileInputStream(file);
final DataInputStream in = new DataInputStream(fstream);
final BufferedReader br = new BufferedReader(new InputStreamReader(in)... |
80e77ffb-a4e8-43b0-8ffb-318e23a7f6a6 | 7 | public Node makeNode(char representation)
{
Node node = masterNode.makeCopy();
if (node != null)
{
node .setHeuristic(new ManhattanHeuristic());
if (representation == TerrainInfo.Start.REPRESENTATION)
{
FlatlandsTerrain start = new FlatlandsTerrain();
start.setRepresentation(TerrainInfo.Star... |
a20b0ea1-9f9d-4276-b2bb-d26cc9acae36 | 8 | public static int indexOfDifference(CharSequence cs1, CharSequence cs2) {
if (cs1 == cs2) {
return INDEX_NOT_FOUND;
}
if (cs1 == null || cs2 == null) {
return 0;
}
int i;
for (i = 0; i < cs1.length() && i < cs2.length(); ++i) {
if (cs1.charAt(i) != cs2.charAt(i)) {
break;
}
}
if (i < cs2... |
10b7c35e-186e-4f20-afbd-ff602fdee050 | 3 | @Override
public ByteBuffer getMessage() {
for (int i = 16; i < 20; i++) {
uiMode[i] = (short) 0xffff;
}
uiSetVoltage[1] = (short) 0x1999;
ByteBuffer buffer = ByteBuffer.allocate(86);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 0xaaa0); // sig
buffer.putShort((short) 86); ... |
8cf801b4-bad6-4347-8c30-038aaf6ea9e8 | 7 | @Test
public void testStudentPersistence() {
// Tests that every student who enters the algorithm, leaves the
// algorithm
if(DEBUG){ System.out.println("testStudentPersistence() in BossSortJUnitSuite\n"); }
BossSort bs = new BossSort(labs, tutorials, students);
AlgorithmOutput out = bs.start();
for (Stud... |
229fc2d4-ade8-439a-9e58-ac497e7a85fe | 6 | public static void commit() {
try {
CoordinatorGUI.textArea.append("Commenizing completion phase with succses..." + "\n" + "\n");
CoordinatorGUI.textArea.append("Signaling nodes to commit to task..." + "\n" + "\n");
String goForIt = "commit";
buf = goForIt.getByt... |
dcb06163-4621-4796-ac2a-a0a7e7955bb7 | 6 | public void updateAlteredImage()
{
Image i = original_image.getImage();
Image new_image = i;
// Check for prefilter
if(meanPrefilterRadio.isSelected())
{
//System.out.println("Mean prefilter selected");
String windowSizeString = windowSizes[windowCombo... |
4fecd628-6652-4012-bfdf-c9a74b5bf4c4 | 0 | public EbonyWarAxe() {
this.name = Constants.EBONY_WAR_AXE;
this.attackScore = 15;
this.attackSpeed = 17;
this.money = 2100;
} |
1ea74024-b769-40fb-a8fa-9420617d95bc | 1 | private void checkIfWon() {
if (checkAllPlayerFlagsCaptured())
this.setPlayerStatus(PlayerStatus.WON);
} |
fa0162ff-1acf-45ed-80cd-2eeb06ccec96 | 5 | public Double getAccBinary(long timestamp, List<AccMagn> magns) {
long minTimestamp = magns.get(0).getTimestamp();
long maxTimestamp = magns.get(magns.size() - 1).getTimestamp();
int low = 0;
int high = magns.size() - 1;
if ((magns.size() == 0) || (timestamp < minTimestamp || timestamp > maxTimestamp)) {
... |
61100a30-d889-4d5b-9ee3-4b4bc53785d3 | 5 | protected boolean checkLandingArea(World world, Box2D area) {
if (dropPoint instanceof Venue) {
return dropPoint.inWorld() ;
}
else for (Tile t : world.tilesIn(area, false)) {
if (t == null) return false ;
if (t.owner() == this) continue ;
if (t.owningType() > Element.ELEMENT_OWNS) r... |
4ae2fd16-797d-47cb-b6b0-a3fa6626dd90 | 5 | public void commit() {
Connection conn = getConnection();
try{
conn.setAutoCommit(false);
for(EntityBase ent : added.keySet() )
{
switch(ent.getOperation())
{
case insert:
{
added.get(ent).persistAdd(ent);
}
case delete:
{
added.get(ent).persistDelete(ent)... |
67a52940-d490-4f41-b257-0317ea219980 | 0 | public byte[] getBytes() {
return bytes;
} |
b03745d8-f1ed-4ea9-ba2d-b8a277b83efc | 2 | @Override
public void run(){
while(running){
now = System.currentTimeMillis();
if((now-start)%20==0){
tick();
}
}
} |
3b2f92d2-ced7-4fe9-ac61-fa3ace3a8a6e | 0 | public String getQuery() {return query;} |
19f2b105-c6f2-4c6a-8d35-24256cde7ab1 | 5 | private void btnVoegToeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVoegToeActionPerformed
Gezin gezin = (Gezin)CboxGezin.getSelectedItem();
if(this.persoonPanel2.getPersoonsnummer() != 0 && this.persoonPanel2.getVoornamen() != null && this.persoonPanel2.getAchternaam() != null ... |
24ac1938-97b3-45ec-b8b8-b4083a5c231f | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof OHLCDataItem)) {
return false;
}
OHLCDataItem that = (OHLCDataItem) obj;
if (!this.date.equals(that.date)) {
return false;
}
... |
96a3e1e6-536c-4249-a774-458f7eecaadb | 2 | private static int readContinuationByte() throws UTF8Exception {
if (byteIndex >= byteCount) {
throw new UTF8Exception("Invalid byte index");
}
int continuationByte = byteArray[byteIndex] & 0xFF;
byteIndex++;
if ((continuationByte & 0xC0) == 0x80) {
retu... |
c0512ecc-413a-4b07-b315-9bb53e14c67a | 4 | public void setSeV(List<?> list)
{
for(PComando e : this._seV_)
{
e.parent(null);
}
this._seV_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.parent().remov... |
3efba0f3-c925-4ac3-9b5d-8be92151b677 | 2 | @Override
public void run() {
try {
System.out.println("考试开始……");
while (!Thread.interrupted()) {
students.take().run();
}
System.out.println("考试结束……");
} catch (InterruptedException e) {
e.printStackTrace();
}
... |
48c4941b-879b-414d-86c1-85649ac446c4 | 4 | public GameMatter isOn(int x, int y){
if (x < boundX || x > boundX + width || y < boundY || y > boundY + height){
return null;
}
return gameObject;
} |
c8ea4c3c-fc7b-4ac8-8cfa-f7be2e404006 | 7 | public void addEntry() {
if (isOnline) {
System.out.println("Input date");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String date = null;
try {
date = br.readLine();
} catch (IOException e) {
... |
3d380428-76a6-43ef-bb99-04540f4a8fbc | 2 | @SuppressWarnings("static-access")
public SecondaryButtonListener() {
super();
{
whisperArea = new JTextArea();
whisperArea.setLineWrap(true);
whisperFrame = new JFrame("Whispers");
whisperFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
whisperFrame.setSize(400, 400);
genNoteArea = new JTex... |
aeaf0d67-6625-461c-842d-d118982c089f | 2 | @Test
public void testVragen() throws DataException {
List<Onderwerp> onderwerpen = content.getOnderwerpen();
for (Onderwerp onderwerp : onderwerpen) {
List<Vraag> vragen = content.getVragen(onderwerp.getNaam());
assertTrue("Er moeten vragen zijn bij onderwerp \"" + onderwerp.getNaam() + "\".", vragen.size(... |
818f3371-3483-4eec-958a-a54617e52779 | 0 | public void log(final String txt) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
synchronized (txtLog) {
txtLog.append(txt);
}
}
});
} |
e565a6db-188d-4218-8888-87aa3c9558e9 | 1 | public void drawGraphForm(FrameBuffer buffer) {
for(GraphicForm gForm : graphForms)
gForm.draw(buffer);
} |
d2ab928b-5e4a-4855-8b1f-657ac3141a66 | 1 | @Test(expected = InvalidActionException.class)
public void testPickUpActionTestInventoryFull()
throws InvalidActionException {
Player player = new Player(new Position(1, 1));
// Max size of inventory is 6
for (int i = 0; i < 6; i++) {
player.addItemToInventory(new LightGrenade(new Position(1, 1)));
}
p... |
ff511738-3b0e-41c9-a494-b8371e7cb49c | 1 | public String arbitrary(Random random, long size)
{
int length = (int)Arbitrary.random(random, 0,
Math.min(Integer.MAX_VALUE, size));
StringBuffer buffer = new StringBuffer(length);
for (int i = 0; i < length; ++i) {
buffer.append(charG... |
837d1250-eec1-4263-a550-8ddbaa4283e2 | 4 | @Override
public void run()
{
try
{
while (!isInterrupted() && run)
{
final String message = reader.readLine();
Log.d("ClientReceiver", "run() + message = " + message);
if (message == null)
{
break;
}
notifyObservers(message);
}
}
catch (final IOException e)
{
System... |
692eefc3-ffc7-440f-9d6d-5b66fec72b2b | 0 | public static void addToUsefulVariableSet(String variable, Set set) {
set.add(variable);
} |
3bfa8c8d-38e0-4437-80c0-1e428fc87355 | 5 | private int sink(int i)
{
Key t = pq[i]; // Save key for later restoring
while (2 * i + 1 <= N) // while pq[i] has both the children
{
int j = 2 * i + 1; // rightmost child
// 1st comparision: Making j point to the greatest of the two
// children as pq[i] should sink to j
if (less(pq[j - 1], pq[j])... |
7623c32a-9f1a-448e-86b2-679f52101d69 | 7 | public static String getStatusName(int code){
switch (code) {
case 1:
return Status.PENDING.toString();
case 2:
return Status.UNDER_PREPARATION.toString();
case 3:
return Status.PENDING_DELIVERY.toString();
case 4:
... |
38ea5699-4661-4aee-b8f6-1144c0118a0e | 5 | void showErrorDialog(String operation, String filename, Throwable e) {
MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
String errorMessage = "";
if (e != null) {
if (e instanceof SWTException) {
SWTExceptio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.