method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b4115ae5-32ce-42f6-9a5e-0433fe251820 | 7 | public void loadVisOp(String visOpName)
{
Department visOp = DataBase.departments[DataBase.findDeptPos(visOpName)];
if (visOp != null)
{
for (int index = 0; index<visOpsPanel.getComponentCount(); index++)
{
try
{
((JSpinner) visOpsPanel.getComponent(index)).setValue("1");
((JSpinner) visO... |
33c8194c-7129-460a-bee0-519e1c87ef12 | 0 | public void setExpiryDate(XMLGregorianCalendar value) {
this.expiryDate = value;
} |
db29ecb6-a363-4f80-b3bd-c13604fb1486 | 8 | public void testSet(Set<Object> set) {
// first test add and contains
set.clear();
assertTrue("Clear should make it empty", set.isEmpty());
Object[] items=new Object[itemCount];
for (int i =0; i < itemCount; i++) {
Integer o =Integer.valueOf(i);
items[i]=o;
set.add(o);
assertTrue("add/contains", s... |
88be1ff4-43ca-40bc-827f-476882f26e76 | 5 | synchronized boolean frameCorrectionFirstCodingExon() {
List<Exon> exons = sortedStrand();
// No exons? Nothing to do
if ((exons == null) || exons.isEmpty()) return false;
Exon exonFirst = getFirstCodingExon(); // Get first exon
// Exon exonFirst = exons.get(0); // Get first exon
if (exonFirst.getF... |
e0a818de-2082-48c9-9dcc-d2c49989d604 | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
ArrayList<CompRequest> comp = new ArrayList<CompRequest>();
... |
8ef5c940-cafb-4e2b-8f0b-af10248c9ba6 | 4 | private boolean follows(Gob g1, Gob g2) {
Following flw;
if ((flw = g1.getattr(Following.class)) != null) {
if (flw.tgt() == g2)
return (true);
}
if ((flw = g2.getattr(Following.class)) != null) {
if (flw.tgt() == g1)
return (true);
}
return (false);
} |
8b350b8f-8173-45c6-9617-eec2bd9cb997 | 7 | public int read(final int[] docs, final int[] freqs) throws IOException {
while (true) {
while (current == null) {
if (pointer < readers.length) { // try next segment
if (tenum != null) {
smi = tenum.matchingSegments[matchingSegmentPos++];
if (smi==nu... |
f16aa27e-4a11-48ea-8968-36ae0ac85830 | 3 | public void replaceTile(Tile find, Tile replace) {
for (int y = bounds.y; y < bounds.y + bounds.height; y++) {
for (int x = bounds.x; x < bounds.x + bounds.width; x++) {
if(getTileAt(x,y) == find) {
setTileAt(x, y, replace);
}
}
... |
617a401e-505b-4bcd-8d07-7dd1a3d583df | 1 | public Object getValueAt(int row, int col) {
try {
return audienceResultList.get(row).getColumnData(col);
} catch (Exception e) {
e.getMessage();
return null;
}
} |
053e26e3-159a-42d5-85c8-935588d28aa2 | 9 | public static void openURL(String url)
{
try
{ // attempt to use Desktop library from JDK 1.6+
Class<?> d = Class.forName("java.awt.Desktop");
d.getDeclaredMethod("browse", new Class[] { java.net.URI.class }).invoke(
d.getDeclaredMethod("getDesktop").invok... |
6b3dd500-2a21-42d4-89ca-06bc0b34c6e3 | 0 | public PDAToCFGConverter() {
initializeConverter();
} |
0ef057ee-a726-48de-a4e8-4b5edee8a010 | 2 | public void addProduction(Production production) {
if (myProductions.size() == 0
&& !ProductionChecker.isRestrictedOnLHS(production))
throw new IllegalArgumentException(
"The first production must be restricted.");
super.addProduction(production);
} |
54b9f60f-fa19-41b9-8348-166522b67f41 | 5 | private static UnitTypes defineUnitToBuild(int freeMinerals, int freeGas) {
// boolean arbiterAllowed =
// UnitCounter.weHaveBuilding(UnitTypes.Protoss_Arbiter_Tribunal);
boolean valkyrieAllowed = UnitCounter.weHaveBuilding(UnitTypes.Terran_Control_Tower);
boolean scienceVesselAllowed = UnitCounter
.weHaveB... |
965133f5-478e-4c59-a1cb-50e32d390562 | 0 | @Override
public int hashCode() {
return Objects.hash(terminalID);
} |
26c05d64-b848-4b57-acc2-74ad69ec4271 | 1 | public Sprite(String texture) {
try {
this.texture = load(texture);
} catch (IOException e) {
loadError();
}
} |
1d048713-dd27-4ca4-a4a2-064974202111 | 1 | private void genPostponed(final Node node) {
final Instruction inst = (Instruction) postponedInstructions.get(node);
if (inst != null) {
method.addInstruction(inst);
// Luckily, the rc and aupdate don't change the stack!
postponedInstructions.remove(node);
}
} |
9aaccf1f-b9ac-4eaa-8bc9-e8c02fec5d92 | 2 | public void addResidualFlowTo(int v, double delta)
{
if (v == from) // backward edge
flow -= delta;
else if (v == to) // forward edge
flow += delta;
throw new IllegalArgumentException();
} |
70f72548-0d51-4ee7-abf6-b77e734ef13b | 1 | public void checkGroups(boolean includeManual, CommandSender sender)
{
CheckReport report = new CheckReport(sender);
for(GroupSettings settings : getGroups(includeManual))
checkGroup(settings, report);
} |
31be4d9e-536f-452d-9c9d-3c117093ead7 | 6 | public final boolean completeTask()
{
if (this.complete)
{
return true;
}
if (this.triesLeft == 0)
{
return true;
}
boolean finish = false;
try
{
finish = this.finishTask();
}
catch (Throwable e)
{
Logger.err(e);
}
if (finish)
{
synchronized (this)
{
... |
17c7832a-da48-48dc-b7cb-80bb52d5a9c7 | 9 | private void initContentNumber() {
contentNumber = 0;
if (content.length() == 0)
return;
// check to already get exception during parsing rather than during
// checking (later). we keep these
// values already in long form rather than executing Long.parseLong(...)
// many times (during check).
switch ... |
feac98cf-6cd5-4596-8d04-a72b9e466141 | 1 | private static void showAllUser() throws Exception {
System.out.println("Users...");
UserDAO dao = new UserDAO();
ArrayList users = (ArrayList) dao.findAll();
User o;
for (int i = 0; i < users.size(); i++) {
o = (User) users.get(i);
Syste... |
ac8c7009-2fd6-49d9-866b-4f2828659371 | 4 | private List<QCProjectSet> getProjectSetList(File dir, int negDepth) {
List<QCProjectSet> result = new ArrayList<>();
if (negDepth > 0) {
List<File> folder = dirFolderlist(dir);
for (File f : folder) {
if (isProjectSetDirectory(f)) {
result.add(new QCProjectSet(f, getProjectList(f, MAX_SET_SCAN_DEP... |
11ae4cc1-8d97-4a68-bd33-47816019e42d | 0 | public void load(ProBotGame game){
this.setPosition
(
new Point
(
(int)Math.floor(this.getCurrentWorld().getWidth()/2*POSITION_MULTIPLYER),
(int)Math.floor(this.getCurrentWorld().getHeight()/2*POSITION_MULTIPLYER-60)
)
);
this.setHead(game.getUpgradeManager().getHeadByName("Head 2"));
... |
92ace4b7-777c-4372-a4ab-5c3e66fb4480 | 2 | public int getInboxNumber(){
int number=0;
String requete= "select count(*) from message";
try {
Statement statement = MyConnection.getInstance().createStatement();
ResultSet resultat = statement.executeQuery(requete);
while(resultat.next()){
n... |
ab00d31c-a17b-4a56-b14f-70ff07cf9c92 | 3 | @Test
public void testStringArrays() throws Exception
{
PersistenceManager pm1 = new PersistenceManager(driver,database,login,password);
StringArrayContainer sac = new StringArrayContainer();
sac.setValues(new String[]{"Foo","bar","BAZ"});
pm1.saveObject(sac);
//get the object from another PersistenceMan... |
4334d247-50ec-4bb8-ab23-9083b037e767 | 8 | public List<Clan> load() {
List<Clan> list = new ArrayList<Clan>();
// Check if folder exists
if (plugin.clanClassFolder == null) {
plugin.logger.warning("No clans found in the classes folder. This plugin will only use the default clans.");
return list;
}
// Create Class Loader Instance
ClassLoader... |
864f1948-704c-44d3-b65b-047ec064445c | 2 | public static String replaceExtension(String filename, String newExtention)
{
int i = filename.lastIndexOf('.');
return (i > 0 && i < filename.length() - 1) ? filename.substring(0,
i + 1)
+ newExtention : filename;
} |
3a7cb58c-5258-4275-978f-34779b7caeca | 8 | public static String periodToFormat(long period) {
long elapsedYears = getYears(period);
period = period % yearInMillis;
long elapsedDays = getDays(period);
period = period % dayInMillis;
long elapsedHours = getHours(period);
period = period % hourInMillis;
long e... |
fef10cca-13cb-4d9d-b737-6db87d10d216 | 9 | public void drawarrows(GOut g) {
Coord oc = viewoffset(sz, mc);
Coord hsz = sz.div(2); //half size
double ca = -Coord.z.angle(hsz);
for (Party.Member partyMember : glob.party.memb.values()) {
// Gob gob = glob.oc.getgob(id);
Coord memberCoords = partyMember.getc()... |
799ac5e0-b846-4aac-bbed-e43cc1f7eb6b | 3 | public static void printAll()
{
try
{
PreparedStatement stmt = Main.EMART_CONNECTION.prepareStatement("select * " +
"from ReplenishmentOrder");
ResultSet rs = stmt.executeQuery();
System.out.println("Replenishment Order:");
while (rs.next())
{
System.out.println(rs.getInt("order_id") + "|" ... |
8103f164-eaae-4960-a48c-0e93b85007bc | 7 | @SuppressWarnings("unchecked")
public static <T extends Number> T[][] array2DArraySorter(T[][] tab,
int sortColumn) {
int tabLength = tab.length;
if (tabLength == 0)
return tab;
for (int i = 0; i < tabLength; ++i) {
if (sortColumn > tab[i].length - 1)
throw new ArrayIndexOutOfBoundsException(
... |
43f5065f-9e5a-41fd-8a32-ebffa3e577c0 | 9 | public static Cons buildOneTableAssertion(NamedDescription tableRelation, Cons tuple, Module dbModule) {
{ Cons assertion = Stella.NIL;
int colno = -1;
{ int i = Stella.NULL_INTEGER;
int iter000 = 0;
int upperBound000 = tableRelation.arity();
boolean unboundedP000 = upperBound00... |
e2ec8ec3-542a-4829-aa16-f8fb512e37b7 | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject) other).keySet())) {
return false;
}
Iterator<S... |
6ff40e32-8a79-4751-96da-3e66ce85e355 | 3 | @SuppressWarnings({ "unchecked", "rawtypes" })
public void initializeComponents() {
regionCombobox = new JComboBox<String>();
progressBar = new JProgressBar();
contentPane = new JPanel();
coverLabel = new JLabel("");
lolPath = new JTextField();
openButton = new JButton("Open");
ButtonPatch = new JButton(... |
101ebf0c-5ea1-4a59-ab52-93ac343bfb5e | 5 | public Segment getIntersection(GeometricModel model) {
/*if (centre.getBrutalLength(model.centre) > this.maxLength + model.maxLength)
return null;*/
float maxLength = this.maxLength + model.maxLength;
maxLength *= maxLength;
if (centre.getLengthSquared(model.centre) > maxL... |
334947e9-c7b3-4d56-884c-552fcbb445aa | 8 | public void run() {
try {
while (running) {
if(IsConnectedToServer == true){
String message = null;
try{
message = din.readUTF();
LatestServerReply = message;
GetServerMessages.CheckServerMessages(message);
waitingforreply = false;
}catch(Exception e){
IsConnectedTo... |
7b5397a1-96a9-42c0-84e1-cb2521fc1b57 | 4 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
out.println("Please enter the maze you would like to run:");
String input = "src/MazeReadIn/trickysearch2";//console().readLine();
String output = input+"Solution";
Maze myMaze = ReadMaze.parseMaze(input); // classN... |
ba860b61-ba04-4a36-8f90-dcd562683d6c | 6 | public void drawWorldMap(){
worldMap[1] = super.mouseX >= 522 && super.mouseX <= 558 && super.mouseY >= 124 && super.mouseY < 161;
if (worldMap[0] && worldMap[1]) {
WorldOrb[1].drawSprite(10, 123);
} else if (worldMap[1]) {
WorldOrb[1].drawSprite(10, 123);
} else {
WorldOrb[0].drawSprite(10, 123);
}
... |
42823c74-58bf-4808-bd76-e3863eff32b8 | 3 | public static boolean getBooleanValue(String value) {
if(value != null)
if(value.equals("true"))
return true;
else if(value.equals("false"))
return false;
throw new IllegalArgumentException("Invalid value");
} |
94722d17-50a4-4d23-86bf-39aa8d9192ca | 6 | public void judge() {
int d = dealer.score();
int p = player.score();
if ((d > 21 && p > 21) || d == p) {
System.out.println(EVEN);
} else if (p <= 21 && (d > 21 || d < p)) {
System.out.println(WIN);
} else {
System.out.println(LOST);
... |
48688cfd-fcba-4290-9b48-1242a6b295c5 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
eec38716-c581-4b2e-b219-8cc41d92e011 | 3 | public void provideFontChar(char chr, RSFontChar fontChar)
{
if (disposed)
return;
if (fontChar == null)
fontChar = DUMMY_FONT_CHAR;
int sector = chr >>> 8;
int index = chr & 0xff;
RSFontChar[][] charCache = this.charCache;
RSFontChar[] cacheSector = charCache[sector];
if (cacheSector != null)
... |
5622582f-f504-4445-bb73-469e4878864d | 8 | public static int maxProfit2(int[] prices) {
BestTimetoBuyandSellStockIII main = new BestTimetoBuyandSellStockIII();
Queue<Integer> profitQueue = new PriorityQueue<Integer>(1000,
main.new OwnComparator());
Stack<Integer> stack = new Stack<Integer>();
int lowPos = 0;
int tempLowPos = 0;
int highPos = 0;
... |
2ccd058d-84bf-4b61-a472-a5ac63ee4403 | 9 | private void listaDeclaraciones() {
if(aux.getTipo()!=Nodo.tipoToken.EOF){
Nodo tem = this.declaracion();
if (tem != null) {
tip.add(tem);
if (aux.getTipo()==Nodo.tipoToken.PuntoyComa) {
aux=(Tokens2)tok.next();
this... |
9c74ea42-393a-420b-96b2-6a91dcc4ee82 | 5 | public void visitInRange(int id, AABB range, IEntityVisitor visitor) {
Set<Entity> entities = structure.queryRange(new HashSet<Entity>(),
range);
Iterator<Entity> it = entities.iterator();
while (it.hasNext()) {
Entity entity = it.next();
if (entity.isRemoved) {
continue;
}
EntityComponent com... |
585ba0a7-cd21-484f-8146-4ac21ecd0d17 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Servidor)) {
return false;
}
Servidor other = (Servidor) object;
if ((this.idServidor == null && other.idServid... |
891422d4-f90c-4562-848e-db591b4d182f | 2 | private static String readResponse(URLConnection connection, String encoding) throws IOException {
if ( !isValidContentType(connection) )
throw new IOException("Invalid content type for " + connection.getURL());
BufferedReader reader = new BufferedReader( new InputStreamReader(connection.ge... |
d2aac7df-cebd-4dce-bbca-684e8efbeab1 | 4 | public void Update() {
for (int i = 0; i < yPositions.length; i++) {
// Move image
yPositions[i] += speed;
// If image moving left
if (speed < 0) {
// If image is out of the screen, it moves it to the end of line of images.
if (yPo... |
3223a13e-4b1a-4ff7-9b36-d894b7029f56 | 6 | public static int[] rotate(int[] pix, float beta, int iw, int ih, int owh) {
int[] opix = new int[owh * owh];
double t = beta / 180;
float cos_beta = (float) Math.cos(t * Math.PI);
float sin_beta = (float) Math.sin(t * Math.PI);
for (int i = 0; i < owh; i++) {
for (int j = 0; j < owh; j++) {
float u = ... |
82773e93-2058-4590-8cff-29656521eaa7 | 8 | public Object getParameterValue(Object parameter)
{
if (parameter == null || parameter instanceof Number
|| parameter instanceof String
|| parameter instanceof Character
|| parameter instanceof Boolean || parameter instanceof Date
|| parameter ... |
5e4260f8-1612-4314-81cd-164e5da4d875 | 3 | public static void main(String[] args) {
Factual factual = factual();
// Get all entities that are possibly a match
ReadResponse resp = factual.resolves(new ResolveQuery()
.add("name", "Buena Vista")
.add("latitude", 34.06)
.add("longitude", -118.40));
for(Map<?, ?> rec : resp.getData()) {... |
09919852-4a5f-4267-9996-718e12a2ba3d | 1 | public void test_toPrinter() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder();
try {
bld.toPrinter();
fail();
} catch (UnsupportedOperationException ex) {}
bld.appendLiteral('X');
assertNotNull(bld.toPrinter());
} |
85e4905e-4a38-4145-b602-f9ea1d34cd9f | 8 | public List getModelChildren() {
List modelChildren;
if (getModel() instanceof PaletteContainer)
modelChildren = new ArrayList(
((PaletteContainer) getModel()).getChildren());
else
return Collections.EMPTY_LIST;
PaletteEntry prevVisibleEntry = null;
for (Iterator iter = modelChildren.iterator(); i... |
00722daa-5f9b-4a42-91d4-2132dafd4cd4 | 5 | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
final PrintWriter out = response.getWriter();
long startTime = System.currentTimeMillis();
out.println("Checking WEB-INF/classes...");
out.println();
WebScanner scanner = new WebScanner... |
003f59ae-8cb6-4671-acca-8927f99e7244 | 3 | public void testGetSetNextSegment() {
VehicleAcceptor[] roads = new VehicleAcceptor[10];
for (int i = 0; i < 10; i++) {
VehicleAcceptor r = VehicleAcceptorFactory.newRoad();
roads[i] = r;
if (i > 0) {
roads[i-1].setNextSeg(r);
}
}
for (int i =0; i < 9; i++) {
Assert.assertTrue(roads[... |
1fccbbfe-8ca4-439b-b814-a32e9a5eab21 | 9 | @Override
public void loadFromFile(String trainFile, String testFile, String quizFile, String featureFile)
{
System.out.print("Loading dataset... ");
try
{
if(trainFile != null && trainFile.length() > 0);
loadDataFromFile(trainFile, InstanceType.Train);
if(testFile != null && testFile.length() > 0)
... |
efd1668a-21b4-4148-b148-550915782a02 | 7 | public boolean detectAmbiguities() {
iteration = 0;
int maxpairs = 0;
int prevSize;
int size = nfa.items.size() + 2 + nfa.transitions.size();
do {
++iteration;
monitor.println("\nBuilding pair graph:");
if (!traverse()) {
// aborted by user
return false;
}
monitor.println(done... |
db4d6262-d1df-4950-b114-64997e75d5ee | 1 | public static String getNoteName(int i)
{
if(i<0)
return "Paus";
return NOTE_NAMES[i % 12];
} |
982496c7-1a84-41d2-ac5c-91a4c4231c7d | 3 | public ShellLinkHeader setShowCommand(int n) throws ShellLinkException {
if (n == SW_SHOWNORMAL || n == SW_SHOWMAXIMIZED || n == SW_SHOWMINNOACTIVE) {
showCommand = n;
return this;
} else
throw new ShellLinkException();
} |
b5fefead-d779-439d-bfa3-6bd083563260 | 7 | @Override
public void reactToChanges(ObservationEvent ev) {
if (ev instanceof CheckBoxEvent) {
CheckBoxEvent event = (CheckBoxEvent) ev;
this.setThoricity(event.isChecked());
this.notifyObserver();
} else if (ev instanceof OptionLineEvent) {
OptionLi... |
5befd405-830a-40e1-9f5d-7d31c38e382b | 2 | private void updateGame() {
handler.updateObjects();
for (int i = 0; i < handler.objects.size(); i++) {
if (handler.objects.get(i).getID() == ObjectID.Player) {
cam.updateCam(handler.objects.get(i));
}
}
} |
1db76a31-9519-4a9f-85d6-adc58ddd6698 | 9 | public void handleNonGeometricAttributes(SimpleFeatureImpl feature) throws UnsupportedEncodingException, FileNotFoundException {
try
{
String featureAttribute = "featureWithoutID";
String featureName = "featureWithoutName";
String featureClass = "featureWithoutClass";
//... |
349c9406-1398-492d-ae74-1001fa02884c | 2 | public Type getHint() {
Type bottomHint = bottomType.getHint();
Type topHint = topType.getHint();
if (topType == tNull && bottomType.equals(bottomHint))
return bottomHint;
return topHint;
} |
39485fbb-355e-48de-8911-0beea5bb92a7 | 5 | public int compare(ByteBuffer o1, ByteBuffer o2) {
byte[] byteString1 = o1.array();
byte[] byteString2 = o2.array();
int minLength = byteString1.length > byteString2.length ? byteString2.length : byteString1.length;
for (int i = 0; i < minLength; i++) {
int bitCompare = bitCo... |
a41e5c29-c734-41b2-a9e1-07bfb290b354 | 5 | private Builder setStackTrace(Throwable t) {
// view button
stage.viewStacktraceButton = new ToggleButton("View stacktrace");
// copy button
stage.copyStacktraceButton = new Button("Copy to clipboard");
HBox.setMargin(stage.copyStacktraceButton, n... |
03b358b5-314f-4587-8fa1-6c709c46ee8b | 1 | public static float[][] convertToFloatArray2D(String string) {
float[][] theData = null;
String[] segments = string.split(" ");
theData = new float[segments.length][];
for (int i = 0; i < theData.length; i++) {
theData[i] = convertToFloatArray1D(segments[i], i);
}
return theData;
} |
cfa3a922-c50f-4b71-be02-667110b29711 | 2 | public static long fatorial(long number) {
if (number == 0 || number ==1) {
return 1;
}
return number * fatorial(number - 1);
} |
b43f3bda-edd9-41d1-a489-4e09368e1335 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
c701cacc-4d20-410d-bfdc-f89e65ba2286 | 8 | public void setOptions(String[] options) throws Exception {
setDebug(Utils.getFlag('D', options));
String classIndex = Utils.getOption('c', options);
if (classIndex.length() != 0) {
if (classIndex.toLowerCase().equals("last")) {
setClassIndex(0);
} else if (classIndex.toLowerCase().eq... |
cf3ca985-019a-4337-95e8-e18680d05a07 | 6 | private static void
writeTable(PdfWriter __writer)
throws BadElementException, DocumentException, IOException
{
PdfContentByte canvas = __writer.getDirectContent();
canvas.saveState();
canvas.setLineWidth(0.1f);
float origin_x = 50f;
float origin_y = 70... |
1eb9883d-742b-488b-b950-a69d752041c6 | 1 | public static void flush()
{
if(mStream != null)
mStream.flush();
} |
a6f89666-06a6-4156-9dae-733ed043473e | 5 | public void enterQueue(Vehicle v) throws SimulationException, VehicleException {
if(v.isParked() || v.isQueued() || v.wasParked() || v.wasQueued()){
throw new VehicleException("Vehicle not in correct state");
}
if(queueFull()){
throw new SimulationException("Queue is full");
}
status += setVehicleMsg(v... |
578fb303-5fe1-421c-bf0a-f07b3ae9d2ba | 5 | public void hitEnemy(String name, int damage) {
// vind de juiste enemy in de array
for (Enemy E : myEnemies) {
String[] namesplit = E.getName().split(" ");
if (namesplit[0].toLowerCase().equals(name) || E.getName().toLowerCase().equals(name)) {
// Als de enemy levend is
if (E.isAlive()) {
System... |
7bf84a6f-ec79-496f-acaa-c97b34a825c9 | 9 | private int valueValidator(int value, JTextField field) {
if (!field.equals(minesField) && value < 8) {
value = 8;
} else if (field.equals(heightField) && value > 16) {
value = 16;
} else if (field.equals(widthField) && value > 30) {
value = 30;
} else... |
271c0f9b-4d01-49bc-a5a1-f1fe48dfb8e3 | 4 | public void escape(KeyEvent e)
{
if (selectionCellsHandler != null)
{
selectionCellsHandler.reset();
}
if (connectionHandler != null)
{
connectionHandler.reset();
}
if (graphHandler != null)
{
graphHandler.reset();
}
if (cellEditor != null)
{
cellEditor.stopEditing(true);
}
} |
906c97c8-73d9-4be5-bd14-59b1b90cea89 | 4 | @RequestMapping(value = "/buildQuestion", method = RequestMethod.POST)
public @ResponseBody
String buildQuestion(@RequestParam int count) {
ObjectWriter mapper = new ObjectMapper().writer().withDefaultPrettyPrinter();
List<Question> listQuestions = questionService.getQuestions();
String json = "";
try {
if... |
9389bf36-d79c-455f-9ba5-753e5d301085 | 0 | public static void deleteByAppt(long apptId) throws SQLException {
PreparedStatement statement = connect.prepareStatement(
"delete from Reminder where appointmentId = ? ");
statement.setLong(1, apptId);
statement.executeUpdate();
} |
04f60a64-6402-4f29-b2cd-c7e79c361586 | 8 | private void doTheDamnThing(RandomAccessFile fp) throws IOException
{
byte[] b = new byte[26];
// Load IMPM header
fp.read(b, 0, 4);
if(b[0] == 'I' && b[1] == 'M' && b[2] == 'P' && b[3] == 'M')
{
loadDataIT(fp);
return;
}
// Attempt to load XM
fp.seek(0);
if(Util.readStringNoNul(fp,b,17).... |
65069d27-3106-4fbb-a21b-a168e70d04e8 | 7 | private List<HantoCell> getContiguousCells(List<HantoCell> board, HantoCell aCell){
List<HantoCell> contigCells = new ArrayList<HantoCell>();
if (aCell != null){
int x = aCell.getX();
int y = aCell.getY();
if (isCellOccupied(x, y + 1)){
contigCells.add(findCell(x, y + 1, board));
} if (isCellOcc... |
31a23c7e-ae30-4aa5-adad-23025e14145b | 4 | public static ArrayList<Integer> numerosPrimos(int n) {
if (n < 2)
return new ArrayList<Integer>();
char[] is_composite = new char[(n - 2 >> 5) + 1];
final int limit_i = n - 2 >> 1, limit_j = 2 * limit_i + 3;
ArrayList<Integer> results = new ArrayList<>((int) Math.ceil(1.25506
* n / Math.log(n)));
resu... |
41e1e90a-894f-4236-a9d1-ed9876f2d8a0 | 8 | public int getParameter(String paramname){
if(paramname == "HoodSize"){return 0;}
if(paramname == "NextX"){return -1;}
if(paramname == "NextY"){return -1;}
if(paramname == "Age"){ return age;}
if(paramname == "Mat"){ return mat;}
if(paramname == "Matcount"){ return matcount;}
if(paramname == "... |
ea079018-ae0c-4709-85b1-7f2658beeaad | 2 | public String toInfoString() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < total; i++) {
sb.append("LinkedList[" + i + "] = " + findElement(i).toInfoString());
if (i < total - 1) {
sb.append("\n");
}
}
return sb.toString();
} |
74c5d325-0fae-428b-b3e2-d61a4242a120 | 6 | public static void main(String[] args) throws InterruptedException, IOException {
TCounter messagesReceived = new DropwizardTCounter();
messagesReceived.register("DEBUG.ClientPusb.MessagesReceiced");
ClientTurtleEnvironment nioClientMT = new ClientTurtleEnvironment();
nioClientMT.open()... |
068d51f6-0919-4df7-8d98-6005f4af8642 | 0 | protected boolean isFinished() {
return false;
} |
c3f9d2ba-6c05-4d62-995c-3a845d644cd4 | 5 | CtField getField2(String name) {
CtField df = getDeclaredField2(name);
if (df != null)
return df;
try {
CtClass[] ifs = getInterfaces();
int num = ifs.length;
for (int i = 0; i < num; ++i) {
CtField f = ifs[i].getField2(name);
... |
3a6a9946-0af3-4a86-8f47-2d9c591e0264 | 6 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("CutAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c instanceo... |
70dae7ed-f297-4103-8c2e-d5fffbb69c08 | 8 | @Test
public void testGetFileContentHash_CalculatesHashCorrectly_Succeeds() {
Path tempFile = null;
try {
try {
tempFile = Files.createTempFile("Photons_test_CalculatesHashCorrectly", ".txt");
} catch (IOException e) {
e.printStackTrace();
fail("Could not create temp file.");
}
// Write... |
37e76458-9b49-42db-a2d2-4aaa70d70958 | 0 | public void testCsvTools() {
String filePath = "C:\\Users\\tdhuang\\Desktop\\功夫baby数据表格1(未加数值)\\关卡对应图片\\high_level_picture.csv";
CsvFile csvFile = new CsvFile(filePath, 0, 4, 1);
List<CsvDataLine> data = CsvTools.parse(csvFile);
System.out.println(data);
assertNotNull(data);
} |
c8b0e19d-a82e-4e7e-8e44-52aa5a113165 | 4 | public void query(String query, boolean instant) {
if (!instant) {
m_thread.query(query);
} else {
final Connection connection = getConnection();
try {
if (connection == null) {
Utilities.outputError("Could not connect to database '" + m_databaseName + "'");
return;
}
m_st... |
3fdac357-7cf4-496c-9017-0fa10e705823 | 4 | public String toString(){
String tmp = "";
for (int r = 1; r <= 17; r++) { // for every row
int c = ((r % 2 == 0) ? 2 : 1); // what col to start?
for (; c <= 9; c += 2) {
Hexpos h = new Hexpos(r, c);
if (h.onBoard()){
tmp += "[ " + h.hashCode() + " : " + owner(h ) + "] " ;
}
}
}
... |
5a0d2df7-22b1-4cb9-9aed-16f5a948f2b9 | 0 | @Override
public void sayToBomberman(String message) throws IOException {
writer.append(message).append("\n");
writer.flush(); //possibly not needed as the writer may autoflush after linebreak
} |
a3ae747a-f981-4a7f-adc5-29eaaf736575 | 1 | public void save(XMLWriter out, LengthUnits units) {
double[] size = getPaperSize(units);
double[] margins = getPaperMargins(units);
PrintService service = getPrintService();
out.startTag(TAG_ROOT);
if (service != null) {
out.writeAttribute(ATTRIBUTE_PRINTER, service.getName());
}
out.writeAttribute(A... |
11ad4806-1cd4-43c2-86a6-45dc772fd846 | 3 | public static boolean nameIsOnlyUpperCase(Variable variable) {
String name = variable.getName();
for (int i = 0; i < name.length(); i++) {
if (!Character.isUpperCase(name.charAt(i)) && name.charAt(i) != '_') {
return false;
}
}
return true;
} |
9ce34b41-ec62-45a5-b8c7-d1b11ca7c488 | 7 | public static final long extractLong(String buffer, long def, boolean localized) {
buffer = normalizeNumber(buffer, localized);
if (hasDecimalSeparator(buffer, localized)) {
return (int) extractDouble(buffer, def, localized);
}
long multiplier = 1;
if (hasBillionsSuffix(buffer)) {
multiplier = 100000000... |
2bb4ee6b-deb6-4731-ba9f-9c2ce5f67f8f | 5 | public void run () {
running = true;
while (running) {
try {
Thread.sleep (timeInterval);
} catch (Exception e) {
break;
}
if (paused) {
running=MoveOn();
if (running) {
s... |
d03d664d-a598-4cba-b8f8-80a882f14091 | 8 | @SuppressWarnings("unchecked")
public void saveTabData(ArrayList<Section> list) {
for (Section s : list) {
for (Object o : s.getQuestions()) {
if (o != null) {
for (Object tab : (ArrayList<Object>) o) {
if (tab != null) {
... |
c0a77a3d-e421-4fd0-ae15-c8eee393ee2e | 3 | public ArrayList<Collidable[]> checkCollisions() {
ArrayList<Collidable[]> collisions = new ArrayList<Collidable[]>();
for(int a = 0; a < entities.size() - 1; a++) {
for(int b = a + 1; b < entities.size(); b++) {
Collidable[] current = new Collidable[2];
current[0] = entities.get(a);
current[1] = ... |
077fb6b1-485d-47ef-818c-70e54b6e70bb | 3 | public DownloadXML(String weburl) {
HttpClient client = HttpClients.createDefault();
HttpGet get = new HttpGet(weburl);
get.setHeader("Content-Type", "application/xml");
HttpResponse response;
try {
response = client.execute(get);
HttpEntity entity = response.getEntity();
if (entity != null) {
In... |
8fe17110-15d7-4a05-acb3-c526d3385492 | 4 | @Test
public void testPersonenEnRelaties() {
assertNotNull(pietEnTeuntje);
assertSame(pietEnTeuntje, adm.getGezin(pietEnTeuntje.getNr()));
Iterator<Gezin> it = teuntje.getGezinnen();
Gezin teuntjeEnPiet = it.next();
assertFalse(it.hasNext());
assertSame(pietEnTeuntje, teunt... |
fc3081c2-617b-4ac7-b736-e0da10707f75 | 7 | public void removeElement (klasse o)
{ int i=indexOf(o);
if (i<0) return;
O[i]=null; ON--;
if (Gap<0 || Gap>i) Gap=i;
if (i==OLast-1) OLast--;
while (OLast>0 && O[OLast-1]==null) OLast--;
if (Gap>=OLast) Gap=-1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.