method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d8c0b043-0d2b-43e5-bc92-2384d3381e77 | 7 | static final public void Block() throws ParseException {
jj_consume_token(LBRACE);
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case IF:
case WHILE:
case PRINT:
case IDENTIFIER:
;
break;
default:
jj_la1[12] = j... |
29f7af6d-cbc8-4874-9971-58d34ffae24a | 9 | @Test
public void testSourceRequirements() {
// check data access class
try {
Class<?> clazz = Class.forName("suncertify.db.Data");
Assert.assertTrue("DBMain is not assignable from " + clazz,
DBMain.class.isAssignableFrom(clazz));
} catch (ClassNotFoundException e1) {
Assert.fail("data access class... |
989dc3b1-f3ee-49ee-a16a-4acc142ef75d | 8 | public LinkedList<int[]> emptyBoardMoves() {
LinkedList<int[]> positions = new LinkedList<int[]>();
// Add in the southwest-northeast diagonal
int positionRow = row;
int positionCol = col;
while (Engine.onBoard(positionRow + 1, positionCol - 1)) {
positionRow += 1;
positionCol -= 1;
}
while (Engi... |
fd9f74de-e373-4d30-a552-3d89b0cec805 | 3 | private boolean jj_3R_40() {
if (jj_scan_token(IF)) return true;
if (jj_3R_50()) return true;
if (jj_scan_token(THEN)) return true;
return false;
} |
0ba8f3d7-e0e2-4dd0-98a9-ca734dab5783 | 2 | private void export() {
Production[] p = editingGrammarModel.getProductions();
/* System.out.println("PRINTTITTING");
for (int i=0; i<p.length; i++)
{
System.out.println(p[i]);
}*/
try {
p = CNFConverter.convert(p);
} catch (UnsupportedOperationException e) {
JOptionPane.showMessageDialog(this, e.... |
48388b53-8ea2-4cdf-9c76-d21500c7d017 | 3 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int start = input.nextInt();
int end = input.nextInt();
boolean isAny = false;
for (int i = start; i <= end; i++) {
if(isSymetric(Integer.toString(i))){
System.out.println(i);
isAny = true;
}
}
if (!isAny) {
... |
54fecc46-18d5-4e5b-b0cd-65c7888692a6 | 2 | public void visitStoreExpr(final StoreExpr expr) {
if (expr.target == from) {
expr.target = (MemExpr) to;
((MemExpr) to).setParent(expr);
} else if (expr.expr == from) {
expr.expr = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
3953ecb1-0406-482f-92ed-70bbc3c7d791 | 9 | private void doRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
List<String> messages = new ArrayList<String>();
List<String> errors = new ArrayList<String>();
boolean help = false;
String command = request.getParameter(P... |
5b1b1e1a-9255-499e-ae41-591b0c0ff707 | 7 | private void illegalDrunkerSearch(Cell inpStartPosition, Set<Cell> visitedCells) {
visitedCells.add(inpStartPosition);
if (inpStartPosition.getObject() instanceof Drunker && ((Drunker) inpStartPosition.getObject()).isIllegal() && inpStartPosition.isIlluminated()) {
this.illegalDrunkers.add((... |
d222b940-4e89-4da0-b4d3-b3e0676ad2b3 | 7 | public int readB(int bits){
//System.err.println(this+" read: bits="+bits+", storage="+storage+", endbyte="+endbyte+
// ", ptr="+ptr+", endbit="+endbit+", buf[ptr]="+buffer[ptr]);
int ret;
int m=32-bits;
bits+=endbit;
if(endbyte+4>=storage){
/* not the main path */... |
d72ac11f-572d-4f33-ab1b-009c743f3fd1 | 0 | protected void end() {} |
55a3d37a-dac2-4e46-9ed2-c611f6449bc7 | 9 | static void lsp_to_curve(float[] curve, int[] map, int n, int ln,
float[] lsp, int m, float amp, float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0; i<m; i++)
lsp[i]=Lookup.coslook(lsp[i]);
int m2=(m/2)*2;
i=0;
while(i<n){
int k=map[i];
float p=.7071067812f;
floa... |
a3bf4dc7-c575-498e-874c-f4af4e0984c6 | 3 | public static LabelProvider getJavaParameter(Method method, int index)
{
if (PARAMETERS == null || PARAMETER_NAME == null)
{
return new LabelProvider()
{
@Override
public String getLabel()
{
return null;
... |
2636e433-86e6-4c39-b11b-b240f53df881 | 8 | public boolean equals(PixImage image) {
int width = getWidth();
int height = getHeight();
if (image == null ||
width != image.getWidth() || height != image.getHeight()) {
return false;
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (! (getRed(... |
54bc1135-3665-4657-a80e-a386b60a028b | 8 | @Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
/**
* ScheduleElementViewWrapper verarbeiten
*/
if (value instanceof ScheduleElementViewWrapper) {
... |
9dd604dd-7b0c-442e-bfa8-6a303c2b9f26 | 9 | public int handlePeerData (Blob data) throws IOException {
switch (wrState) {
//---------------------------------------------------------
// initial state:
//---------------------------------------------------------
case STATE_INITIAL:
if (isServer) {
if (skVersion == 1)
// server: extra... |
7fca5fd2-71e7-4a76-9349-8c35bc450f3c | 1 | public void updateRow(int index, Object[] array) {
// data[rowIndex][columnIndex] = (String) aValue;
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
Files updateRecord = fileService.updateFiles((String) array[0],
(String) array[1], (String) array[2], (String) array[3],... |
4bd6c06d-0fdb-4247-88c3-b76cf733104a | 8 | @Override
public double convertTo(int type) {
switch (type) {
case UnitConstants.FEET_SECOND:
return getValue() * 88;
case UnitConstants.FEET_MINUTE:
return getValue() * 5280;
case UnitConstants.MILES_MINUTE:
return getValue... |
f7c8b765-bff4-4cf0-b896-d364cd437679 | 0 | @Test
public void testSetAnthill() {
System.out.println("setAnthill");
Cell instance = new Cell(0,0);
String expResult = "none";
String result = instance.getAnthill();
assertEquals(expResult, result);
instance.setAnthill("red");
expResult = "red";
... |
839d2e0c-62f2-48db-9ba8-94218a29d458 | 6 | public void OMMItemParse(OMMItemEvent ie)
{
OMMItemEvent event = ie;
Handle _handle = event.getHandle();
OMMMsg respMsg = event.getMsg();
OMMData data = respMsg.getPayload();
int fid = 0;
boolean isLINK_A = false, isLONGLINK = false;
// Iterate the FieldEnt... |
7de15b76-aaef-43d1-a0c5-18835f88780d | 6 | public static String trimSectionBegin(String text) {
if (isBlank(text)) {
return text;
}
boolean isBlank = false;
int firstIndex = 0;
if (text.length() >= 1) {
if (text.charAt(0) == ' ') {
isBlank = true;
firstIndex++;
}
}
for (int i = 1; i < text.length(); i++) {
if (!(text.charA... |
f0eabb42-7e0f-4c79-ab37-1840e26ef7f6 | 4 | public void updatePlat3(int k, Character plat) {
// manages brown platforms, continues the animation by changing images
Platform brownPlat = (Platform) plat;
if (brownPlat.getBrownAnimation() == true) {
if (brownPlat.getId() == 8) {
myPlatforms.remove(k);
}
if (brownPlat.getId() < 8) {
offScree... |
b1e5008c-1b3b-4550-a10d-cea80bb56438 | 7 | private boolean undo() {
boolean isSuccessful = false;
if (actionList.isEmpty()) {
messageToUser = MSG_CANNOT_UNDO;
return isSuccessful;
}
ActionEntry x = actionList.pop();
Action done = x.getAction();
Command command = done.getCommand();
switch (command) {
case ADD:
isSuccessful = undoAdd(done... |
ae7f7353-da5b-4c98-98b7-a2e844eb8653 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c == 0) {
reader.reset();
this.index = startIndex... |
10f63a4f-143e-4104-baee-2c1cf89ad956 | 3 | @Override
public void checkRequirements() throws WrongConfigurationException {
// Devo utilizar as estratégias indicadas
// pelo arquivo xml de conf.
this.statistic = new Statistics(this.ID);
if (!(reliabilityModel instanceof ReliableDelivery)) {
// os nodos devem iniciar com entrega confiável
this.re... |
d14901c8-808c-4500-b095-c082b4508433 | 8 | public void update()
{
TextBoxGame.button1.setToolTipText(TextBoxGame.button1.getText());
TextBoxGame.button2.setToolTipText(TextBoxGame.button2.getText());
TextBoxGame.button3.setToolTipText(TextBoxGame.button3.getText());
TextBoxGame.button4.setToolTipText(TextBoxGame.button4.getText());
TextBoxGame.b... |
0751dc10-8e04-4754-b655-2acbc900f05e | 9 | public static void main(String[] args) throws Exception
{
SocketListeningConnector socketListeningConnector = new SocketListeningConnector();
Map<String, Connector.Argument> argumentMap = socketListeningConnector.defaultArguments();
argumentMap.get(SocketListeningConnector.ARG_LOCALADDR).setValue("127.0.0.1");... |
2961191e-7c83-42b4-ab23-e5c7f372f085 | 9 | public String toStringSummary() {
int resultsetLength;
String result;
String titles;
int i;
int j;
if (m_NonSigWins == null)
return "-summary data not set-";
resultsetLength = 1 + Math.max((int)(Math.log(getColCount())/Math.log(10)),
... |
43f885f3-8379-425b-b068-b147b8f492a7 | 6 | public List<List<Point>> solve()
{
List<List<Point>> paths = new ArrayList<List<Point>>();
open.add(new SearchNode(start, null));
currentNode = null;
while(!open.isEmpty())
{
List<Point> path = new ArrayList<Point>();
currentNode = pop(open);
nodesVisited++;
if(board.isAccessible(currentNode.getL... |
e3609f9f-848e-4f9e-922e-ab87f795f93b | 2 | public boolean isNearer(int x, int y, double distance){
if(distance < this.depthBuffer[x][y] || this.depthBuffer[x][y] < 0){
return true;
}
return false;
} |
3709a022-0985-4ae7-8083-e2881da9b95f | 7 | protected boolean posValid(double newX, double newY) {
boolean returnBool = true;
int startX = (int) (newX / MainGameState.TILE_SIZE);
int startY = (int) (newY / MainGameState.TILE_SIZE);
int endX = (int) ((newX + width - 5) / MainGameState.TILE_SIZE);
int endY = (int) ((newY + height) / MainGameState.... |
865f62d5-728b-4dce-95bc-b14b2291f62c | 2 | public synchronized void close() throws SQLException {
lock.lock();
for (Connection conn : idleConnections)
conn.close();
for (Connection conn : busyConnections)
conn.close();
busyConnections.clear();
idleConnections.clear();
lock.unlock();
} |
48cef3b5-0162-4454-bbbe-e6f8544931dd | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
19a8c53f-6f10-425b-a2f4-3ffc933e8fc9 | 7 | public static List<String> getWithNewlines(String s) {
if (s == null) {
throw new IllegalArgumentException();
}
final List<String> result = new ArrayList<String>();
final StringBuilder current = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(i);
if (c == '\\' && i... |
d1149b73-63fc-4b66-ba41-04ed661b55c1 | 9 | private void startNG() {
int numIter = 100;
double eps = 0.01;
// quantisation error - break condition
double quantE = Double.MAX_VALUE;
// training values
double lambda_i = numNeurons * 0.5; // initial decay constant
double lambda_f = 0.01; // lambda update coefficient
// resize the number of neuron... |
c1a6080a-1da6-4d47-808a-9f75c1e90232 | 6 | public void addElement(AbstractElement element) {
if (element == null)
throw new NullPointerException("The ElementSystem is null.");
RETW(defaultEngineLock, () -> {
if (!elements.containsKey(element.getID())) {
elements.values().parallelStream().forEach(e -> {
... |
c8957ef3-5a1f-416f-9af0-5cd1b637bf9c | 8 | public int getDistance(String from, String to)
throws EmptyGraphException, UnreachableVertexException, OutOfGraphException {
int n = vertices.size();
if (n == 0){
throw new EmptyGraphException();
}
else{
Vertex source = null;
Vertex target = null;
... |
8e9e0e24-8872-490e-9f5a-9de38dee65ca | 9 | public Item evaluateItem(XPathContext context) throws XPathException {
if (isLazyConstruction() && (
!context.getController().getExecutable().isSchemaAware() ||
(validation == Validation.PRESERVE && getSchemaType() == null))) {
return context.getConfiguration(... |
440d6b82-a98d-4201-8ca7-14ab0298b9a0 | 4 | public synchronized void unregister(Listener listener) {
boolean changed = false;
for (List<RegisteredListener> list : muffinbag.values()) {
for (ListIterator<RegisteredListener> i = list.listIterator(); i.hasNext();) {
if (i.next().getListen().equals(listener)) {
... |
779e64cf-1b9c-4dff-8cf2-3ea5a819b917 | 7 | public boolean setState( String state ){
if( state.length() < 34){
return false;
}
if( backendBoard.setState( state.substring( 0, 32) ) ){
if( state.charAt( 32 ) != '0' && state.charAt( 32 ) != '1'){
return false;
}
for(int i = 33; i < state.length(); i++){
if( !Characte... |
95f6a107-a6b8-4354-ba05-fdd5d57b395c | 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... |
fbb65f40-d5c4-4420-9d47-b08be018cb91 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Visible other = (Visible) obj;
if (list_id != other.list_id)
return false;
if (type != other.type)
return false;
return true;
} |
e17a0e4b-251d-4104-9c1c-063b209e39c5 | 7 | private Object process(final RedisInputStream is, boolean stringsOnly) {
try {
byte b = is.readByte();
if (b == MINUS_BYTE) {
processError(is);
} else if (b == ASTERISK_BYTE) {
return processMultiBulkReply(is, stringsOnly);
} else i... |
1ea2a71a-ebfb-4492-b37f-9a2961cf3c2d | 3 | public void repaint(){
super.repaint();
//display the MP
if (mpLabel!=null)
mpLabel.setText("MAGICPOWER: " + MagicPower.getMP());
//display the gem
if (gemLabel!=null){
Gem gem=game.getMap().getGem();
String gemstring="---";
//if it's not null display the first 3 letters of the class name
... |
4007a27c-ee14-4c55-8b71-2c7448b75470 | 4 | public static Bookmark getUserData(List<Bookmark> lines, int userID, int resID) {
Bookmark returnData = null;
for (Bookmark data : lines) {
if (data.userID == userID) {
returnData = data; // old
if (resID != -1 && data.resID == resID) {
returnData = data;
return returnData;
}
}
}
ret... |
f19ec8ce-cc05-45f3-b7f2-68e522a29972 | 2 | @Override
public void revalidate() {
for (DockLayoutNode child : mChildren) {
if (child != null) {
child.revalidate();
}
}
} |
5b901afe-a41d-422f-a710-7652276e7ec0 | 7 | public static DenseMatrix64F[] createSpan( int dimen, int numVectors , Random rand ) {
if( dimen < numVectors )
throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension");
DenseMatrix64F u[] = new DenseMatrix64F[numVectors];
u[0] = Rando... |
8a13a641-afe5-4019-bec2-8226449f6bbb | 4 | @Override
public void setBackground(Color back) {
if (this.leafMap == null) {
return;
}
for (AccordionRootItem menu : leafMap.keySet()) {
menu.setBackground(back);
menu.getBranchPanel().setBackground(back);
if (selectionColor == null) {
... |
b63223c8-5e9a-4dd0-afcd-dda2184dd4ee | 8 | protected PointDouble findBest() throws Exception {
PointInt center;
Grid neighborGrid;
boolean finished;
PointDouble result;
PointDouble resultOld;
int iteration;
Instances sample;
Resample resample;
log("Step 1:\n");
// generate sample?
if (getSampleSizePercent()... |
da165052-f6b7-44a4-a401-01acd95d05c5 | 3 | Chip[] getCurrChips(int col){
Chip[] currChips = new Chip[500];
int counter = 0;
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
if(board[i][j].returnColor() == col){
currChips[counter] = board[i][j];
++counter;
}
}
}
return currChips;
} |
71a82019-55cc-47ec-8c5b-ebb7b5f33516 | 1 | public static void main(String[] args) {
List<Double> numbers = new ArrayList<>();
int size = 300;
for (int i = 1; i <= size; i++) {
numbers.add((double)i);
}
long before = System.nanoTime();
square(numbers);
long after = System.nanoTime();
Sy... |
25b05e1a-214c-4bde-9534-55666837add8 | 6 | private static int priority(char c){
switch(c){
case '*':
return 3;
case '/':
return 3;
case '+':
return 2;
case '-':
return 2;
case '(':
return 1;
case ')':
return -1;
default:
return 0;
}
} |
7ac619d0-ccda-44b3-80d2-551e9b433253 | 0 | @Override
public String toString() {
return "bomb at " + tile.x + "," + tile.y + " (owned by " +
owner.getBomberNumber() + ")";
} |
657556fc-baa5-4995-a98d-2f8888d31d97 | 9 | static void run(boolean[] bits) {
int falseCount = 0;
int start = 0;
// for(int i = 0; i < bits.length; i ++) {
// if(bits[i]) {
// start ++;
// } else {
// break;
// }
// ... |
b7eb2224-49b8-4209-8350-a2a5ae67c6a9 | 4 | private Object wrapNative(Object nms) {
if (nms == null)
return null;
if (BASE_CLASS.isAssignableFrom(nms.getClass())) {
final NbtType type = getNbtType(nms);
// Handle the different types
switch (type) {
case TAG_COMPOUND:
... |
e617c26e-d35e-4839-bd3b-193cc096b1c2 | 7 | protected boolean hasJumpMove(Board jumpBoard, boolean myTurn) {
Board board = jumpBoard.copy();
Checker checker = jumpBoard.pop();
while(checker != null) {
if (isMyColor(checker) && myTurn && !checker.getJumpMoves(board, false).isEmpty())
return true;
else if (!isMyColor(checker) && !myTurn && !chec... |
78a221f3-a5c1-4d80-8dae-50e1ce6abb52 | 0 | public static void main(String[] args) {
new _10_NonStaticInstanceInitialization();
} |
52d952e5-ca4c-4526-8bc2-72a116114e29 | 9 | public Command createCommand(final String[] args, final int index, final GlobalOptions gopt, String workDir) {
final CommitCommand command = new CommitCommand();
command.setBuilder(null);
final String getOptString = command.getOptString();
final GetOpt go = new GetOpt(args, getOptString)... |
cdd9bbe4-05ca-45a2-b199-095188f5ab7c | 7 | public MainForm() {
super("Simple Java based player");
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
pack();
setVisible(true);
setSize( 600, 600 );
list1.setModel( listModel );
setContentPane( panel1 );
final Core core = new Core();
Updat... |
922f5d04-f85a-40a5-b732-06b7d678ca62 | 7 | public static Feedback startController(String inputCommandString) {
assert inputCommandString != null;
LOGGER.info("==============\n" +
"User Input: \n" +
" " + inputCommandString + "\n" +
"====================\n");
inputCommandObje... |
5a8dc5a0-4b4b-497c-a897-133ac3467e3e | 0 | public void setPeopleAmount(PeopleAmount peopleAmount) {
this.peopleAmount = peopleAmount;
} |
8c2400da-5321-4997-9ccd-6eadf37bb9cc | 5 | public static <TT> TypeAdapterFactory newFactoryForMultipleTypes(final Class<TT> base,
final Class<? extends TT> sub, final TypeAdapter<? super TT> typeAdapter) {
return new TypeAdapterFactory() {
@SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal
public <T> TypeA... |
45f89025-9d18-4626-90d3-12cf253816fa | 7 | public static Torrent parseTorrentFile(String filePath) throws IOException, NoSuchAlgorithmException{
//get file
File file = new File(filePath);
int len =(int) file.length();
byte[] data = new byte[len];
Files.newInputStream(file.toPath()).read(data);
Bencoding encoding = new Bencoding(data);
Bencoding... |
f567d4b5-9528-4687-8441-8f8d1e3d2379 | 1 | private int[] transform(int[] bowl)
{
int plate[] = new int[length];
for(int i = 0; i < length; i++)
plate[i] = bowl[transform[i]];
return plate;
} |
c986ac5e-ce72-46eb-8fbe-d39b7c45a259 | 4 | @Override
public void pause()
{
switch( channelType )
{
case SoundSystemConfig.TYPE_NORMAL:
if( clip != null )
clip.stop();
break;
case SoundSystemConfig.TYPE_STREAMING:
if( sourceDataLine != null )
... |
7eaeb31a-741b-4e2b-878c-037286aee1b1 | 0 | public SpawnLevel(Game game) {
super(game, Tileset.OVERWORLD_LEVEL);
loadLevel(path);
} |
99842d24-ea2f-4173-b503-b65f15a7eb9e | 1 | public void m1_transactionnee() {
// copie de la valeur modifiée spéculativement.
int ancien_i = this.i;
try {
this.i = 10 ;
System.out.println("dans m1_transactionnee : i = " + this.i);
this.m2(this.i);
} catch (Exception e) {
// remise en place de la valeur initiale après erreur.
this.i = ancie... |
fde39d25-c034-43ae-a471-8fccabfa1bce | 7 | public boolean isExecutable() {
boolean result = isTag("object") || isTag("void") && hasAttr("class") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
&& hasAttr("method") || isTag("array") || isPrimitive() //$NON-NLS-1$ //$NON-NLS-2$
|| isTag("class") || isTag("null"); //$NON-NLS-1$ //... |
df596bee-d1a5-4ba2-a97e-5164def13a41 | 4 | private boolean willCollide(int nextPlayerPositionX, int nextPlayerPositionY, int playerWidth){
Iterable<Obstacle> brickEnemies = theModel.getBrickEnemies();
int nextPlayerXWidth = nextPlayerPositionX + BRICK_SIZE;
for (Obstacle obstacle : brickEnemies){
int nextObstacleXWidth = obstacle.getPositionX() + BRICK_... |
36c1bb5f-fbdf-426f-a1da-68d1fe163c48 | 7 | public boolean containsCurve(BezierCurve curve) {
Point[] line = new Point[2];
for (int i = 0; i < points.size(); i++) {
line[0] = points.get(i);
line[1] = points.get((i + 1) % points.size());
List<Double> roots = curve.getLineIntersectionRoots(line[0], line[1]);
if (roots == null) {
continue;
}... |
b6291e2a-9227-4751-87fc-6876dd310c3f | 2 | public int getPictureValue(String picture) {
List<String> tenTypes = new ArrayList<String>();
tenTypes.add("jack");
tenTypes.add("queen");
tenTypes.add("king");
if (tenTypes.contains(picture)) {
return TEN;
} else if (getValidPictures().contains(picture)) {
... |
53d5949b-4197-434c-8155-2a86f83f5299 | 7 | public void testRegression() throws Exception {
PMMLClassifier classifier = null;
Instances testData = null;
EvaluationUtils evalUtils = null;
weka.test.Regression reg = new weka.test.Regression(this.getClass());
FastVector predictions = null;
boolean success = false;
for (int i = 0; i < ... |
29d14d01-34a0-4285-a131-3f75ed8286d4 | 4 | public static void setDirection(EventHandler<ActionEvent> handler, MovingType direction) {
if (handler != null && StepDirection.class.isInstance(handler)) {
((StepDirection) handler).setDirection(direction);
}
if (handler != null && TransitionControl.AnimationEndHandler.class.isInsta... |
71c47a4a-4d87-4cb5-b8ec-2b83d831a71a | 3 | public void update(long currentTime) {
if (animations.isEmpty()) {
return;
}
if (!animations.peek().isStarted()) {
startAnimation(currentTime);
}
else if (animations.peek().isFinished()) {
doFinishAction();
animations.pop();
... |
2cbfb195-9208-4e7e-acdd-e70147cf5a57 | 1 | public static double[] getPaperMargins(PrintService service, PrintRequestAttributeSet set, LengthUnits units) {
double[] size = getPaperSize(service, set, LengthUnits.IN);
MediaPrintableArea current = (MediaPrintableArea) getSetting(service, set, MediaPrintableArea.class, true);
double x;
double y;
if (curre... |
4ed04089-e6fe-4972-9a37-b164094fe76d | 5 | public void paint(Graphics g) {
double x, y;
Point2D p1, p2, p3, p4;
updateLocation();
Graphics2D g2d = (Graphics2D) g;
// Les 2 extremites du lien
// Attention p1=(x2,y2), et p2=(x1,x2) !
p1 = new Point2D.Double(x2, y2);
p2 = new Point2D.Double(x1, y1);
int hauteur = x1 - x2;
int largeur = y1... |
d8be79ac-9362-4fe7-a1c6-e7532ccecfed | 3 | public void createLink() {
try {
Path file1 = Paths.get("test1");
System.out.println(file1.toRealPath());
Path hLink = Paths.get("test1.hLink");
Path sLink = Paths.get("test1.symLink");
try {
//only works on supporting OSs.
... |
860c1daf-ca7b-416a-aa60-3d78ac4d4d19 | 8 | private void internalReflection(Atom a) {
double radius = a.sigma * 0.5;
byte hit = 0;
if (a.rx + radius > getX() + getWidth()) // hit east side
hit |= 1;
else if (a.rx - radius < getX()) // hit west side
hit |= 2;
if (a.ry + radius > getY() + getHeight()) // hit south side
hit |= 4;
else if (a.ry ... |
98a324fc-addf-478b-88f4-cc07bd86c306 | 3 | public static String maxWordedEtc( String string, int maxLength )
{
if ( string == null ) {
return EMPTY;
}
if ( maxLength < 0 ) {
maxLength = 0;
}
if ( string.length() <= maxLength ) {
return EMPTY + string;
}
return string... |
7dda6ec1-cf95-4318-ae5b-f91f4b1557e3 | 1 | public static TreeMap<Integer, Integer> stringToTree(String s)
{
TreeMap<Integer, Integer> tree = new TreeMap<Integer, Integer>();
StringTokenizer tokenizer = new StringTokenizer(s);
while (tokenizer.hasMoreTokens()) {
Integer token = Integer.parseInt(tokenizer.nextToken());
Integer token1 =... |
ceed12d1-d819-4246-a8f8-a05a716b8c5b | 9 | public String convert(String s, int numRows) {
if (s == null || s.isEmpty() || numRows <= 0 || numRows == 1) {
return s;
}
StringBuilder sb = new StringBuilder(s.length());
for (int i = 0; i < numRows; i++) {
boolean isVertical = true;
boolean isBotto... |
ff632b49-60e8-4d89-9bd9-85a4f38a8576 | 6 | private void queue(String className, long timestamp) {
log("Processing "+className,Project.MSG_VERBOSE);
Class ann;
try {
ann = userLoader.loadClass(className);
} catch (ClassNotFoundException e) {
throw new BuildException(e);
}
if(!Annotation.cla... |
73079876-03e8-4019-a73e-16596bcb1e6f | 1 | private void sendConnectionInfo() {
try {
outputBuffer.put((byte) 6);
putMedInt(outputBuffer, 3);
outputBuffer.putShort((short) 0);
output.write(outputBuffer.array());
output.flush();
outputBuffer.clear();
outputBuffer.put((byte) 3);
putMedInt(outputBuffer, 0);
outputBuffer.putShort((short... |
c7649bec-0243-4d32-ba36-38c456fc528a | 3 | public static boolean isUniqueChars2(String s){
if(s == null)
return false;
int flag = 0;
for(int i = 0; i< s.length(); i++) {
int offset = s.charAt(i) - 'a';
if((flag & (1<<offset)) != 0)
return false;
else
flag = flag | (1<<offset);
}
return true;
} |
d631aeee-e95b-46fd-b49b-4ed6da88cb78 | 1 | public double simulateBlockedOvershootCosts(AbstractStochasticLotSizingProblem problem,
AbstractStochasticLotSizingSolution solution)
throws ConvolutionNotDefinedException, SolvingInitialisiationException {
AbstractLotSizingPeriod[] periods = problem.getPeriods();
double[] periodOvershoot = simulateBlocked... |
87226689-6235-445c-bdf7-1eab5151b5ff | 1 | @Override
public void showSourcecode(ArrayList<String> sourceLine, Integer fokus) {
DefaultTableModel model = new DefaultTableModel();
Object[][] zeilen = new Object[sourceLine.size()][sourceLine.size()];
for(int i=0; i<sourceLine.size(); i++){
zeilen[i][0] = i+1;
zeilen[i][1] = sourceLine.get(i);
... |
9adda4a9-f81f-4bfd-aad0-aee949f5d120 | 1 | public void setCollectionName(String input) {
if (editingCollection) {
selectedCollection.setCollectionName(input);
} else {
newCollection.setCollectionName(input);
}
} |
0df17efc-8a6a-4e05-aab2-95483af0081f | 4 | public static void call(final String mapping, final String data) throws Exception {
String[] colNames = null;
FileInputStream pzmap = null;
FileInputStream fileToParse = null;
BuffReaderDelimParser pzparse = null;
try {
pzmap = new FileInputStream(new File(mapping));
... |
eaf06061-f307-49d5-a447-b98a87423a0a | 0 | public static TwitterModel readConf(String confFilename)
throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readValue(new File(confFilename), JsonNode.class);
TwitterModel twitterModel = new TwitterModel();
twitterModel.setAcc... |
d46a077c-e63d-46f9-bfdb-76d09d5b3a12 | 4 | @Override
public void run() {
super.run();
try {
while (true) {
currentJob = (JobImpl1) qMananager.pull("Queue1");
if (currentJob!=null) {
currentJob.startWork(this);
System.out.println("1-"+id+" start "+currentJob.id);
Thread.sleep(500);
currentJob.endWork(this);
System.out.println("1-... |
9b564f28-ce5c-4037-9f29-0a4e0dc85199 | 1 | public void pushbackToken(int token) {
if (pushback != NO_TOKEN)
throw new IllegalStateException("Can only handle one pushback");
pushback = token;
} |
95cb9bad-731e-42fd-ba06-f2af58dec050 | 7 | @Override
protected void writeEventStream(GameEvent g, OutputStream outputStream)
throws IOException {
ERGameEvent e = (ERGameEvent)g;
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
oos.writeInt(e.eventType);
switch(e.eventType){
case (ERGameEvent.EVENT_MESSAGE_C):
oos.writeUTF(... |
837bd402-52f6-4ea4-b209-96e5535d0282 | 0 | public Person(int id,String name, int age){
this.id = id;
this.name = name;
this.age = age;
} |
b776d5ee-9e8c-49ea-a4b8-1667ea720e4b | 3 | @Override
public boolean notifyRead(int address) { //Absence of data indicates requested memory read as opposed to write (as in reality)
Data dataRead;
if (address < 100 && address >=0) {
if (MEMORY[address] == null) {
dataRead = new OperandImpl(0); //If the contents of address is null, read as 0 (as in rea... |
5506572a-90ee-497d-814e-1166377699a9 | 2 | private static void test_setNibble(TestCase t) {
// Print the name of the function to the log
pw.printf("\nTesting %s:\n", t.name);
// Run each test for this test case
int score = 0;
for (int i = 0; i < t.tests.length; i += 4) {
int exp = (Integer) t.tests[i];
int arg1 = (Integer) t.tests[i + 1];
i... |
019af289-1997-436f-ac17-67a28cf28b07 | 2 | public static void main(String[] args) {
// Working with Text Files
File file = new File("/Users/madalin/git/introtocs/IntroToCs/src/introtocs/io/text.txt");
try {
// Code that will cause an exception
PrintWriter out = new PrintWriter(file);
Scanner in = new Scanner(file);
try {
o... |
e0cc3496-b843-4061-8fee-614bac4d6af4 | 4 | public boolean check_write ()
{
if (!out_active || state != State.active)
return false;
boolean full = hwm > 0 && msgs_written - peers_msgs_read == (long) (hwm);
if (full) {
out_active = false;
return false;
}
return true;
} |
e7a4ee85-4bf8-4352-8890-13fccf4bf43b | 2 | public void setType (int type)
{
// System.err.println ("setting type to "+types[type]);
this.type = type;
switch (type)
{
case ARRAY:
value = array = new Vector ();
break;
case STRUCT:
value ... |
85426cd5-07df-4f93-a6e4-ec953c7dd10d | 3 | public boolean isExempt(String infile) {
if (infile.toLowerCase().endsWith(".class")) {
String inclass = infile.substring(0, infile.length() - 6);
for (String exempt : exemptions) {
if (inclass.startsWith(exempt + "/")) {
return true;
... |
ae0fc15d-ef49-469d-9720-ed12ec1ab015 | 2 | public static Quiz getQuizByQuizName(String quizName) {
quizName = quizName.trim();
String statement = new String("SELECT * FROM " + DBTable + " WHERE name = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setString(1, quizName);
ResultSet rs = stmt.executeQ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.