method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cb904dc0-ed1d-426f-a7df-923cbeefc75c | 5 | static byte[] discardWhitespace(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
case (byte) ' ' :
case (byte) '\n' :
case (byte) '\r' :
case (by... |
70e5fa18-5387-4d69-b74a-3e161a40c2a2 | 2 | public static boolean WillCapture(Planet s,Planet d) { // Tested
// Planet d = destination
// Planet c = source
if (s!=null&&d!=null)
return s.NumShips()/2 > d.NumShips();
return false;
} |
eaa12dd5-ff47-4ae7-bb46-2a03ab6f475c | 1 | @Override
public void onDisable() {
PluginDescriptionFile pdfFile = this.getDescription();
log.info( pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled." );
// cancel all tasks (and clear list)
Collection<Integer> woolGrowingTaskIDs = this.woolGrowingSheep.values();
... |
87f50357-8c91-4c3a-8246-3fc1eff653af | 5 | private Node getRootNode(File configFile) throws ParsingException {
DocumentBuilderFactory dbFactory =
DocumentBuilderFactory.newInstance();
dbFactory.setIgnoringComments(true);
dbFactory.setNamespaceAware(false);
dbFactory.setValidating(false);
DocumentBuilder db =... |
cd08f1e0-0ef6-436f-9a5b-5f6a0bb0e53d | 7 | @Override
protected void readMessage(InputStream in, int msgLength)
throws IOException {
if (msgLength != MESSAGE_LENGTH) {
throw new IllegalStateException(
"Message Length must be 2 for CONNACK. Current value: "
+ msgLength);
}
// Ignore first byte
in.read();
int result = in.read();
swit... |
a00e35b6-87e6-41f0-93a1-a952ffff3427 | 3 | public void setLessthan(TLessthan node)
{
if(this._lessthan_ != null)
{
this._lessthan_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(... |
ae8256bb-25ee-45ae-80e6-c8798a23e32b | 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... |
ffe18d24-f3cb-4011-b5dd-08c303b4ad11 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
77a9daab-23e9-417d-9b04-c3223980e763 | 1 | public void commitOnly(final Set methods, final Set fields) {
classInfo.setClassIndex(constants.addConstant(Constant.CLASS, type));
classInfo.setSuperclassIndex(constants.addConstant(Constant.CLASS,
superclass));
final int ifs[] = new int[interfaces.length];
for (int i = 0; i < ifs.length; i++) {
ifs[i... |
85f30fbc-b447-4480-9749-81eaa2f0da2a | 0 | public static List<Medicament> selectAll(EntityManager em) throws PersistenceException {
List<Medicament> lesMedicaments = null;
Query query= em.createQuery("select m from Medicament m");
lesMedicaments = query.getResultList();
return lesMedicaments;
} |
9fe5df6a-fe9c-454c-8719-4600bfbc5193 | 0 | public boolean isSportKit() {
return sportKit;
} |
63b6b13f-c231-4285-b270-eccaf6c4023b | 4 | @Override
public void paint(Graphics g) {
//super.paint(g); //To change body of generated methods, choose Tools | Templates.
if (isDirty) {
try {
graph(lastPlot);
g.drawImage(img, 0, 25, this);
} catch (InterruptedException ex) {
... |
fc365afc-9843-4a5f-9f1c-abe509e8a34e | 4 | public final WaiprParser.trigger_return trigger() throws RecognitionException {
WaiprParser.trigger_return retval = new WaiprParser.trigger_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token sh=null;
CommonTree sh_tree=null;
RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(a... |
e9f87201-ede3-4390-8b94-259860be7fcc | 5 | public boolean isEqual(Collider c)
{
if(c == null)
return false;
c.updateVerts();
updateVerts();
if(c.verts.length != verts.length)
return false;
for(int x=0;x<verts.length;x++)
{
if(verts[x].x != c.verts[x].x || verts[x].y != c.verts[x].y)
return false;
}
return true;
} |
0d7f0fed-a373-463f-8af1-e6ab54fa8cee | 8 | public static void updateMapModel(BotState state) {
// mal schauen...
// possibleOpponentSuperRegionsLastTurnBegin =
// possibleOpponentSuperRegionsLastTurn;
List<Region> opponentRegions = state.getVisibleMap().getEnemyRegions(state);
for (Region enemyRegion : opponentRegions) {
if (!regionsOpponentHold.c... |
c3b3be77-406c-4e2e-adec-b5e6dc64ee84 | 7 | @Test
public void testDoorDirection() {
int sumUp = 0;
int sumDown = 0;
int sumLeft = 0;
int sumRight = 0;
int sumNone = 0;
for (BoardCell b : board.getCells()) {
if (b.isRoom()){
//b = new RoomCell(b);
RoomCell.DoorDirection d = ((RoomCell) b).getDoorDirection();
// System.out.println(d)... |
329af91c-3c23-4e85-906c-93c361905165 | 6 | public boolean checklogin() {
boolean loginflag = false;
System.out.println("ATTEMPTING TO CONNECT TO DB!!");
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
//con =... |
6bdc3c12-a5ca-4bfd-b421-feefaa5e6c25 | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[] a = readArray(in, n);
long s = 0;
for (int i : a) s += i;
if (n < 3 || s % 3 != 0) {
... |
e7434374-6e0c-404a-abf0-6852d8cef925 | 3 | public String toString() throws JSONException {
if (this.string == null) {
int c;
int length = 0;
char chars[] = new char[this.length];
for (int at = 0; at < this.length; at += characterSize(c)) {
c = this.characterAt(at);
if (c < 0... |
ea2c8f0b-b31c-4ad3-aa14-fb902809bd16 | 7 | @Test
public void invalidBillingAddrCreateProfile() {
Address billing = getTestBillingAddress();
Card card = getTestCard();
ProfileResponse createdProfile = null;
try {
createdProfile = beanstream.profiles().createProfile(card, null);
Assert.fail("Fail test because the billing address was empty");
} c... |
95e5a4c9-ad32-4fa1-9e0d-5fb5b9e58308 | 5 | public void weibullStandardProbabilityPlot(){
this.lastMethod = 13;
// Check for negative x values
if(this.sortedData[0]<0){
System.out.println("Method weibullStandardProbabilityPlot: negative x value found - weibullThreeParProbabilityPlot called");
t... |
5909356a-0ca1-404a-a0c2-901ffee9e3c6 | 6 | public static Collection<String> generateBindings(String s,
Collection<Integer> xVals, Collection<Integer> yVals) {
ArrayList<String> strings = new ArrayList<String>();
if (s.contains("!1") && s.contains("!2")) {
for (int x : xVals)
for (int y : yVals)
strings.add(s.replace("!1", "" + x).replace("!2"... |
099d6258-6e5f-418b-bee8-8a468c395370 | 4 | public static void unMuteBackground(){
// Used for loops
int i;
// Used so that the methods associated with a midi player can be accessed.
MidiPlayer currentMidiPlayer;
//Checks the slide for slide for content
if (null != entityPlayers)
{
for(i =0;i <entityPlayers.size(); i++)
{
// test whe... |
ef8ef71b-d9c3-4cd2-8bbf-5af09605515b | 6 | @Override
public int read () throws IOException
{
int character = super.read();
if (this.first)
{
while (character != '\n')
character = super.read();
character = super.read();
this.first = false;
}
if (character == -1)
return -1;
if (character == '.')
return '-';
i... |
7d63aa47-84a9-4b67-ab41-0f22852d7e44 | 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<St... |
060612d5-bcab-4760-b359-67d02ad2ebc8 | 5 | public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
try {
final Method method = version.getClass().getMethod(methodName, _class);
return new Adapter.Setter<V>() {
public void call(V value) {
try{
lock.lock();
if (firstTime) {
... |
53f91deb-26ff-423d-bfce-26e15af2b286 | 4 | public void load() throws ContainerDatabaseException {
try {
this.database.load();
} catch (IOException ex) {
throw new ContainerDatabaseException(ex);
}
// get dispensers
Map<String, YAMLNode> containers = this.database.getNodes("containers"); // XXX: This is already named containers as we plan to m... |
7061fc77-c95e-4857-bee5-edbda66386a2 | 0 | public void blockade()
{
} |
8bcb8340-3415-48cc-85f8-3292c4bdad20 | 4 | public void setComando(List<?> list)
{
for(PComando e : this._comando_)
{
e.parent(null);
}
this._comando_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.pa... |
fa275e7b-9ab0-429f-b5df-d6f56160b6f7 | 1 | public void testSetStart_RI2() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setStart(new Instant(TEST_TIME2 + 1));
fail();
} catch (IllegalArgumentException ex) {}
} |
9d45846c-fbe5-4b60-bc80-45f89b78c5b6 | 6 | public ArrayList<String> getPost(String ID) throws SQLException {
ArrayList<String> messages = new ArrayList<String>();
PreparedStatement ps = null;
ResultSet rs = null;
Connection con = null;
try {
con = dbConnect.getDBConnection();
String querypostID = ... |
f2e0b810-abfe-404f-af58-03c998865788 | 2 | @Override
public int compare(CommandEntity e1, CommandEntity e2)
{
if(e1.getCalendar().getTime().getTime() < e2.getCalendar().getTime().getTime())
return -1;
else if(e1.getCalendar().getTime() == e2.getCalendar().getTime())
return 0;
else
return 1;
... |
949ba82f-816f-4b2c-995c-05f9740b3aa6 | 6 | int decode(Buffer b){
int ptr=0;
DecodeAux t=decode_tree;
int lok=b.look(t.tabn);
if(lok>=0){
ptr=t.tab[lok];
b.adv(t.tabl[lok]);
if(ptr<=0){
return -ptr;
}
}
do{
switch(b.read1()){
case 0:
ptr=t.ptr0[ptr];
break;
case 1:... |
7bdbb4e1-42ee-4cda-a81f-510ac05b9d12 | 3 | public ArrayList<Spot> getEmptySpots() {
ArrayList<Spot> eSpots = new ArrayList<Spot>();
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
if (grid[i][j] == 0) {
Spot sp = new Spot(i,j);
eSpots.add(sp);
}
}
}
return eSpots;
} |
7c29d115-0295-451a-86eb-78c1866653e7 | 3 | private static Production[] createRules(Node node) {
Map e2t = elementsToText(node);
String left = (String) e2t.get(RULE_LEFT_NAME);
if (left == null)
left = "";
NodeList list = ((Element) node).getElementsByTagName(RULE_RIGHT_NAME);
Production[] p = new Production[list.getLength()];
for (int i = 0; i < ... |
049096ab-d3ad-41e5-98b4-d90aae05eae5 | 7 | public static void main(String[] args) {
final int MAX_BALL = 50;
final int MAX_FLOOR = 1000;
Scanner scanner = new Scanner(System.in);
int p = scanner.nextInt();
int[][] dp = new int[MAX_BALL + 1][MAX_FLOOR + 1];
for (int i = 0; i < p; i++) {
int setNumber = scanner.nextInt();
int b = scanner.nextInt... |
d7b02e6a-aba4-4131-9070-f31b16b5982e | 6 | private final void method1341(Object object, Interface14 interface14,
int i, int i_0_) {
try {
if (i < -84) {
anInt2314++;
if ((i_0_ ^ 0xffffffff) < (anInt2324 ^ 0xffffffff))
throw new IllegalStateException("s>cs");
method1338(7, interface14);
anInt2311 -= i_0_;
while (anInt2311 < 0) {
... |
f9e8613f-af15-467a-99cc-a38853c399bf | 4 | public static BlackBox rippleAdder(int amount) {
BlackBox[] fullAdders = new BlackBox[amount];
BlackBox rippleAdder = new BlackBox();
for (int i=0; i<amount; i++) {
if (amount==1) {
fullAdders[i] = CreateBlackBox.fullAdder();
rippleAdder.addElement(fu... |
2adcb950-ed37-44f3-afc1-5599eb63de6b | 0 | public String getText() {
return text;
} |
c63652c7-0613-4190-be83-6b85a772f600 | 3 | public void setClickTarget(URL paramURL, String paramString)
{
if (paramURL != null)
{
if (!this.imListening) {
addMouseListener(this.mouseHandler);
}
}
else if (this.imListening)
removeMouseListener(this.mouseHandler);
this.url_target = paramURL;
this.frame = paramSt... |
493628f2-cfc1-44ce-a2b1-046c424c9ad5 | 8 | private static void assertFiles(final File expected,
final File actual) {
String actualLine, expectedLine, trimmedLine;
BufferedReader expectedR = null, actualR = null;
try {
expectedR = new BufferedReader(new FileReader(expected));
actualR = new BufferedReade... |
f4118d70-1190-4b6e-802f-86903f4cd10f | 8 | @SuppressWarnings("unused")
public Debate getSpecificDebate(String id) {
Element root = document.getRootElement();
Element debateElement;
Debate debate = null;
Element debateE = (Element) document
.selectSingleNode("//debate[@id='" + id + "']");
if (debateE != null) {
String topic = debateE.element... |
6e951287-be14-40b1-8918-d85eccf9409c | 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... |
a064790d-d1d5-465d-8045-a28bca0e45c6 | 2 | public static void showMarkStderr(int i, int showEvery) {
if (i % showEvery == 0) {
if (i % (100 * showEvery) == 0) System.err.print(".\n" + i + "\t");
else System.err.print('.');
}
} |
38d3497a-6b1c-437f-908d-3ac9e03aa143 | 5 | private void ejecuta() {
int contador = 0; // Contara los segundos de ejecucion del programa
int limite = Constantes.LIMITETIEMPO; // Se establecera el limite en SEGUNDOS de la
// ejecucion del programa
/*PRUEBAS BUILDER
ArrayList<InterfazDeTiposCiclista> listaejecutatipo = new ArrayList<InterfazDeTiposCiclista... |
8c92bb63-d657-49ed-a77c-d5660d46ff55 | 8 | @Override
public void computeNormalisingConstant() throws InternalErrorException {
totalTimer.start();
PopulationVector N = qnm.N.copy();
int r = 0, Nr;
int R = qnm.R, M = qnm.M;
BigRational[] curG = new BigRational[matrixSize], G_1 = null;
for (int i = 0; i < matrixS... |
2845db42-a665-4ca7-b6ba-d46487ffbb77 | 4 | public void update() {
int i;
plateau.eraseCourante();
boolean colision = plateau.descendre(vitesse);
if (colision) {
plateau.drawCourante();
plateau.nouvellePiece();
int[] lines = plateau.checkLines();
plateau.deleteLines(lines);
... |
032e6d0b-49c4-4c91-b02b-09d38058f4bf | 1 | public String getLabelCode(){
if(falsePart == null){
return condition.getLabelCode() +
this.printLineNumber(true) +
"goto := " + this.labelFalse +
" if " + condition.place + " == false \n" +
truePart.getLabelCode() +
this.printLineNumber(true) +
"label := " + this.labelFalse;
}
... |
e9d897bc-d96e-4f80-b1bd-6215ab911567 | 6 | @Override
public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias can... |
3f81e9d6-6417-46b9-8ab0-89b24eead231 | 7 | void splitCycle(){ //cycles[activeCycle] jest "przycinany" !!!!!!???????!!!!!
Cycle oldC = cycles[activeCyc.get(0)];
int cut1 = oldC.vxList.indexOf(tempCycle.vxList.get(0)); //indeks w activeCyc.vxList punktu tempCycle.vxList[0]
int cut2 = oldC.vxList.indexOf(tempCycle.vxList.get(tempCycle.vxList.size()-1));
Ar... |
d654e0f5-a29a-420e-8d92-1d0fc8e74a6e | 1 | public void testWithChronologyRetainFields_invalidInNewChrono() {
YearMonth base = new YearMonth(2005, 13, COPTIC_UTC);
try {
base.withChronologyRetainFields(ISO_UTC);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
129cb662-5aef-4427-824e-fb2c4638647f | 3 | public static String getSuffix(String str, String out)
{
if (str == null || str.length() == 0)
{
return null;
}
int i = str.lastIndexOf(out);
if (i == -1)
{
return null;
}
return str.substring(i + out.length());
} |
95900cd4-b188-4206-b90f-2f9eb5fb3cfa | 4 | private int getOffsetY(int rowStartOffset, FontMetrics fontMetrics)
throws BadLocationException
{
// Get the bounding rectangle of the row
Rectangle r = component.modelToView( rowStartOffset );
int lineHeight = fontMetrics.getHeight();
int y = r.y + r.height;
int descent = 0;
// The text needs to be ... |
5a79f6c9-0c6f-49f9-8af9-4abe10b5402e | 4 | @Test
public void enqueuesAndDequeues()
{
assertTrue(queue.dequeue().equals("apples") &&
queue.dequeue().equals("oranges") &&
queue.dequeue().equals("pickles") &&
queue.dequeue().equals("tommytoes") &&
queue.dequeue() == null);
} |
561cc6c2-c08a-49eb-b2c9-30c177c9ea27 | 8 | public void getNextURLs(int max, List<WebURL> result) {
while (true) {
synchronized (mutex) {
if (isFinished) {
return;
}
try {
List<WebURL> curResults = workQueues.get(max);
workQueues.delete(curResults.size());
if (inProcessPages != null) {
for (WebURL curPage : curResults) ... |
a0ce1826-39d5-4368-b410-66d369b298a1 | 4 | public ArrayList<Prestamos> getAll(){
PreparedStatement ps;
ArrayList<Prestamos> rows = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Prestamos");
ResultSet rs = ps.executeQuery();
if(rs!=null){
try {
w... |
d269e708-95c8-466f-bc53-00760fae93bb | 3 | private void add(core.Hero hero, WidgetStackGrid list, core.Position2Object<GroupOfUnits> p2u)
{
if (hero.getUnits().size() >= 6 ) {
QMessageBox.warning(this, "Nie można dodać", "W garnizonie jest już 6 jednostek");
} else {
core.UnitType type = (core.UnitType)this.unit.itemData(this.unit.currentIndex());
... |
d94319c0-fc96-4a20-880b-76eb6235bbde | 3 | public static CompoundTag objectToCompoundTag(Object object)
{
CompoundTag tag = new CompoundTag(new HashMap<String, Tag>());
for (Field field : object.getClass().getFields())
{
try
{
if (field.get(object) == null)
continue;
Tag t = null;
t = Tag.fromValue(field.get(object));
... |
1226b8eb-4066-4302-a166-a9c68e832dca | 5 | public final void mLETTER() throws RecognitionException {
try {
int _type = LETTER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// C:\\Users\\Florian\\Dropbox\\Git\\CI_WiSe2013-2014\\CI_Aufgabe3\\teil1\\symbolraetsel_AST_Normalisiert\\SymbolraetselAST.g:36:7: ( ( 'A' .. 'Z' )+ )
... |
dadbc393-8f66-4cc9-b563-a3eb8cfe356a | 4 | @Test
public void testEditPromotion() {
BlockingQueue<Promotion> promotionAux = null;
Product book = new Product("Book", 1234, 2.30, 100);
Promotion promotion = new Promotion(book, 1.00, 1245);
facade.addProduct(book);
facade.addPromotion(promotion);
try {
Thread.sleep(4000);
} catch (InterruptedE... |
06e0e0b5-1b32-42e7-a902-c22323f74171 | 7 | @Before
public void setUp() {
calendarUsers = new CalendarUser[numInitialNumUsers];
events = new Event[numInitialNumEvents];
eventAttentees = new EventAttendee[numInitialNumEvents];
this.calendarService.deleteAllUsers();
this.calendarService.deleteAllEvents();
this.calendarService.deleteAllEventAttendee... |
01e27680-7c85-46ae-984e-5d87dc066ef4 | 7 | static final public void opRel() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EGAL:
jj_consume_token(EGAL);
expression.empileOpera(YakaConstants.EGAL);
break;
case DIFF:
jj_consume_token(DIFF);
expression.empileOpera(YakaConstants.DIFF);
br... |
002b021e-708b-4d71-b0ea-fd6b0942e720 | 4 | @Override
public int hashCode() {
int result = minimumValue != null ? minimumValue.hashCode() : 0;
result = 31 * result + (maximumValue != null ? maximumValue.hashCode() : 0);
result = 31 * result + (averageValue != null ? averageValue.hashCode() : 0);
result = 31 * result + (singleV... |
329eb074-d6e0-4850-a5ea-9e6a6a5651fe | 2 | public static void setFlag(BoardModel boardModel, Point point) {
Cell currentCell = boardModel.getBoard()[point.getPosX()][point.getPosY()];
if (boardModel.getNumberOfFlags() > 0 && !currentCell.isFlagged()) {
currentCell.setFlagged(true);
boardModel.setNumberOfFlags(boardModel.... |
515bda45-4fbe-44a6-a65a-9b05ecce0730 | 3 | public void print(final PrintStream out) {
out.println(name + "." + type + (isDirty ? " (dirty) " : "") + ":");
Iterator iter;
iter = code.iterator();
while (iter.hasNext()) {
out.println(" " + iter.next());
}
iter = tryCatches.iterator();
while (iter.hasNext()) {
out.println(" " + iter.n... |
9e6fd7e6-ccb4-4c62-a88c-0f38128033e2 | 0 | public String location() {
return "Acceptable at all locations.";
} |
9cfaeef2-0466-4eed-9b27-3b088aaabeb9 | 7 | void expandNodes(List<String> a) {
long startTime = System.currentTimeMillis();
AnyAction aa = new AnyAction(this);
int index = 1;
while (index < a.size()) {
final String s = a.subList(0, index + 1).toString();
for (int i = 0, n = getRowCount(); i < n; i++) {
... |
f66a70bb-a624-47b6-8239-72f3686773ab | 9 | public void buildSound(int column) {
int count = -1;
sou.clear();
for (int j = 0; j < buttons[1].length; j++) {
if (buttons[column][j].getState()) {
try {
sou.addClip("samples/sam2/" + sampleLines[j]);
// System.out.println("sample: " + sampleLines[j] +
// " added");
count++;
} c... |
8cc47d69-4e84-4277-be95-91e0a501a930 | 9 | public static void main(String[] args) throws IOException{
if ((args.length < 2) || (args.length < 4 && !args[0].equals("-chisquareALL"))) {
System.out.println("Wrong arguments: -chisquare modelFileName featureA featureB");
System.out.println(" -chisquareALL modelFileName");
} else {
Map<St... |
b923d602-6e63-4caf-ab15-23ea5c48fdbe | 5 | public String[] getPathBinLinux() {
//
// This method looks for the path where all executable program
// are linked on a Linux system.
//
String pathBin = System.getenv("PATH");
int countDoublePoint = 0;
int i = 0;
while(i<pathBin.length()) {
if ((pathBin.charAt(i)) == ':')
countDoublePoint++;
i... |
92c97bc2-a30c-42a1-974e-1db8d72a8e0d | 6 | public void compareMsg(String msg, BufferedReader br) throws Exception{
String adyacentIp;
if (msg.contains(":")){
System.out.println("<SERVER>RECIEVING FROM CLIENT:" + msg);
String[] firstPick = msg.split(":");
adyacentIp = firstPick[1];
if ((!adyacentIp... |
265e1a47-3958-45bc-82a7-17b8b11ac096 | 2 | public List<PecaFornecida> listarPecasFornecedores() {
List<PecaFornecida> lista = new ArrayList<>();
for (Fornecedor f : fornecedores) {
for (PecaFornecida p : f.getFornecimentos()) {
lista.add(p);
}
}
return lista;
} |
c579ab07-897c-4b9e-948a-7db50ccd0941 | 0 | public void setImagen(String imagen) {
this.imagen = imagen;
} |
aba4027c-7fa8-400a-8e60-5c83d893c64c | 7 | public Command parse(String[] args) throws ParseException {
// if no args are given, do defaultAction
if (args.length == 0) {
args = new String[] {defaultAction.toString()};
}
// determine action and get syntax for it
CommandSyntax syntax = parseAction(args);
Command.ActionType action = syntax.getAct... |
9bdcabd8-8aec-47ae-9b17-79c16ff11d35 | 3 | public void buildDatabase() {
this.lineCount = 0;
try {
while (this.bufrReader.ready()) {
this.process(this.bufrReader.readLine() + '\n');
this.lineCount++;
}
this.bufrReader.close();
} // print the error
catch (IOExcept... |
b794f09a-a433-4c92-8590-6b0ae899a100 | 7 | public void loadFile() {
File inputFile = new File( EXTERNAL_FILE );
if(!inputFile.exists()){
try {
JAXBContext context = JAXBContext.newInstance( Contacts.class );
File outputFile = new File( EXTERNAL_FILE );
Marshaller marshaller = context.createMarshaller();
Contacts contacts = new Contacts()... |
d7483c6c-7777-44db-97c2-cd2c6d68605f | 9 | public String toString() {
// only ZeroR model?
if (m_ZeroR != null) {
StringBuffer buf = new StringBuffer();
buf.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
buf.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n\n");
buf.append("War... |
014692e7-9400-4dee-95ad-bc8598aaa1d6 | 3 | public static boolean isEnglishLetter(char c) {
return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
} |
f569d958-cd49-4b68-8fec-f5e7f9e3e02c | 6 | @Override
public boolean insert(final char character, final int level) {
if (level == 1) { // Char should be one of sons
// We checked isFull at the previous level so one of them is null
if (left == null) {
left = new Leaf(character);
} else { // right == null
right = new Leaf(character);
isFull... |
cd5438fa-ef8c-47db-9961-2e16a3c54fba | 2 | @EventHandler
public void onBlockDamage(BlockDamageEvent event) {
Player player = event.getPlayer();
if (!plugin.canBuild(player)) {
event.setCancelled(true);
if (message != null)
message.sendMessage(player);
}
} |
ebeaa0d0-e947-4e92-b1c3-78589722e78d | 0 | public RockTile(Sprite sprite, String id){
super(sprite, id);
} |
582176a5-ac59-4f0f-8b76-06eb3306f8df | 3 | public boolean matchString(String s) {
int k = idx;
for (int i = 0; i < s.length(); i++) {
if (k >= len || s.charAt(i) != buf[k++]) { return false; }
}
idx = k;
return true;
} |
55c7e2d2-6caa-4be8-89b0-5a412b624b42 | 7 | public void paint(Graphics g)
{
switch (gameState)
{
case GAMESTART:
g.setColor(Color.yellow);
g.fillRect(0,0,VWIDTH,VHEIGHT);
g.setColor(Color.blue);
g.setFont(font);
g.drawString("Welcome to Catamaran!", VWIDTH/2 - 180, 100);
g.drawString("Click to Start", VWIDTH/2 - 100, ... |
1db64026-a846-488e-ac71-88d031ac8c62 | 6 | private void addPossibleTakingMove(final List<Move> moveList,
final int targetFile, final boolean isPromoting) {
if (ChessRules.fileWithinBounds(targetFile)) {
final ChessCoord tarCoord = Coords.coord(targetFile, this
.getCoord().getRank() + this.rankStep);
... |
c7abe362-3679-4ad8-9c3f-f166dfd57019 | 8 | public String longestPalindrome(String s) {
if(s==null || s.length()<2)
return s;
int l = s.length();
char[] arr = s.toCharArray();
boolean[][] mat = new boolean[l + 1][l + 1];
int aj=0,ai=1;
for(int i=0;i<=l;i++){
for(int j=0;j<=l-i;j++){
... |
1bfdb03f-80c9-42a7-a9e4-5400864875a5 | 4 | @SuppressWarnings("unchecked")
public static void read(String fileName) throws FileNotFoundException {
// prepare to read file
FileInputStream fin = new FileInputStream("plugins/" + Main.pluginName + "/" + fileName);
ObjectInputStream ois;
try {
// attempt to read file
ois = new ObjectInputStream(fin);... |
6eea54eb-a61b-436f-bf5d-c5bd4ad4eddc | 6 | @Override
public Node<T> getParent(Node<T> n) {
if (safety && !contains(n)) {
throw new NodeNotFoundException();
} else if (n == null) {
return null;
}
for (Node<T> tn : this) {
Iterator<Node<T>> children = children(tn);
while (children.hasNext()) {
Node<T> child = children.next();
if (chil... |
f952652e-c270-4e69-977d-dc801a36d5b7 | 3 | public Class<?> getConfigurableAnnotation(ArrayList<Class<?>> classes)
{
if(configurableAnnotation == null)
findConfigurableAnnotation(classes);
return configurableAnnotation;
} |
ed68d035-5d4f-4a90-8b36-f332a982ae22 | 5 | public void setSimObjects(Garden[] g, Player[] c){
//setting language-specific strings
if(Locale.getDefault() == Locale.GERMAN || Locale.getDefault() == Locale.GERMANY){
nameOld = Lang_GER.nameOld;
title = Lang_GER.pitchWindow;
restartL = Lang_GER.setUpWindow;
} else if(Locale.getDefault() == Locale.FREN... |
a50d64a0-af2e-4bf9-9972-c96c97bc004c | 4 | public void reset() throws InterruptedException {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: reset() BEGIN");
}
int x = getGrid().getGridWidth();
int y = getGrid().getGridHeight();
setGrid(new Grid(x, y));
setPlayer1Score(0);
setPlayer2Sco... |
4fecc962-d033-4486-9890-63333309ecda | 1 | public void epoch(){
EPOCH_allmoves = STAT_allmoves / (double) STAT_rounds;
EPOCH_badmoves = STAT_badmoves / (double) STAT_allmoves;
EPOCH_wins = STAT_wins / (double) STAT_rounds;
resetStats();
//Running average of this model's stats
if (first_epoch){
first_epoch = false;
MODEL_badmoves = EPOCH_bad... |
6699230b-7444-4bde-8194-31c97f3708b7 | 2 | public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
Input input = gc.getInput();
if(input.isKeyPressed(Input.KEY_SPACE)){
Sounds.bleep.play();
sbg.enterState(Game.menu);
}
counter+=delta;
if(counter > 2000){
bgcolor = (bgcolor+1) %5;
counter = 0;
}
... |
5d2370c1-486f-4f66-9e35-bf1e5d4c21f4 | 3 | public float getLineThickness() {
// check for border style
if (borderStyle != null) {
return borderStyle.getStrokeWidth();
}
// check the border entry, will be solid or dashed
else if (border != null) {
if (border.size() >= 3) {
return bor... |
719ebc66-f718-4ad4-aa8f-2ff1007ed580 | 1 | public void run () {
try {
setVendedor(getLocal().asignarVendedor());
local.getCompradores().remove(this);
local.getCompradoresSiendoAtendidos().add(this);
comprar();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
de1edbbf-bf41-4dd3-848d-ce3cf562a704 | 3 | public BufferedImage[] draw(String msg) {
BufferedImage[] result = new BufferedImage[msg.length()];
msg = msg.toUpperCase();
for (int i = 0; i < msg.length(); i++) {
for(int l = 0; l < characters.size(); l++){
if(Character.toString(msg.charAt(i)).contains(CorrectText(characters.get(l).getName(),true... |
0fd34c10-f210-4a98-b9f6-43f0c3717667 | 4 | @Override
public void render(GameContainer container, Graphics graphics) throws SlickException {
gameMapRenderer.render();
gameMap.getItemsOnMap().forEach(i -> i.render());
players.forEach(Player::renderGlass);
players.forEach(Player::render);
int position = 10;
final int offset = 30;
int... |
f613d7ed-cb19-43e0-b5dd-dd7446514fab | 5 | public void waitForPageToLoad() {
// Logger.getInstance().info("waitForPageToLoad started");
WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(getTimeoutForPageLoad()));
try {
wait.until((ExpectedCondition<Boolean>) new ExpectedCondition<Boolean>() {
public Boolean apply(final WebDriver d) {
... |
8a8599ff-7445-4640-9656-922e9593c84a | 0 | public int getRemainingSize() {
return 0;
} |
869c5817-2549-4c09-8ed3-20f4312039cf | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
a1f9d3db-dc03-401a-bc70-2a8b574d4fd3 | 9 | public void setOptions(String[] options) throws Exception {
String tmpStr;
super.setOptions(options);
tmpStr = Utils.getOption('N', options);
if (tmpStr.length() != 0)
setNumInstances(Integer.parseInt(tmpStr));
else
setNumInstances(20);
tmpStr = Utils.getOption("n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.