method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0c1375d6-e69a-4889-8cb3-cc3ff3f5b20e | 5 | public void Update(GameTime gameTime)
{
//HandleExplosions();
mMousePosition = new Vector2(mInput.GetMouseX(), GameProperties.WindowHeight() - mInput.GetMouseY()).DividedBy(GameProperties.Scale()).Minus(mCameraOffset);
GameEntity.UpdateList(gameTime, mEnemyList);
GameEntity.UpdateList(gameTime, mBulletLi... |
dc3d9d40-caea-4659-9202-4a1dda45120a | 4 | public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
BankAccount theAccou... |
d6bfd3a1-e2fe-43c8-9915-c093667dd9fd | 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://... |
e1fd947b-e258-4eea-a0b9-b253bad153c1 | 3 | public void actionPerformed(ActionEvent e)
{
// get the strings to be added to the database...
String dateStr = dateField.getText();
String startTimeStr = startTimeField.getText();
String endTimeStr = endTimeField.getText();
// Date to indicate the start day (00:00 o... |
14ebd1e0-7ff2-4196-8079-e7ab311110c1 | 6 | private void handleIOException( SelectionKey key, WebSocket conn, IOException ex ) {
onWebsocketError( conn, ex );// conn may be null here
if( conn != null ) {
conn.closeConnection( CloseFrame.ABNORMAL_CLOSE, ex.getMessage() );
} else if( key != null ) {
SelectableChannel channel = key.channel();
if( cha... |
ce5916d5-6800-4cb3-a6ef-93820053e5b3 | 2 | public static String implodeArray(final String[] inputArray, final String glueString) {
String output = "";
if (inputArray.length > 0) {
StringBuilder sb = new StringBuilder();
sb.append(inputArray[0]);
for (int i = 1; i < inputArray.length; i++) {
sb... |
202ec894-b508-4e79-b684-c480d3d91227 | 5 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int boards = in.nextInt();
v = new int[8][8];
allSol = new int[93][9];
nsol = 0;
board = new int[9];
queens(1);
for (int i = 0; i < boards; i++) {
for (int j = 0... |
30e65769-a475-4667-b823-e13766c777a5 | 4 | public List<List<Integer>> generate(int numRows) {
Integer[][] triangle = new Integer[numRows][];
// error List<List<Integer>> triangle = new
// ArrayList<ArrayList<Integer>>();
//o(n*n)
for (int i = 1; i <= numRows; i++) {
Integer[] row = new Integer[i];
if (i == 1) {
row[0] = 1;
triangle[i-1]... |
d4bf41fa-2102-41aa-8f1b-bbad674c9310 | 8 | public int agregarProspecto(String name, String surname1, String surname2, String mail, String DNI, String telefono, String contact_date) {
boolean Nocaracter = validarFormato(name);
boolean Nocaracter2 = validarFormato(surname1);
boolean Nocaracter3 = validarFormato(mail);
... |
8c23c3b1-6dec-413b-a36a-6685cec940c2 | 2 | public void readXMLInputString(String xmlString) {
try {
saxParser.parse(new InputSource(new StringReader(xmlString)), DPHreader.getInstance());
}
catch (final SAXException e) {
System.out.println("SAXException: " + e);
e.printStackTrace();
}
catch (final Throwable e... |
af3c6837-7124-4e69-9673-b556301059d3 | 2 | public Object clone() {
final StackExpr[] t = new StackExpr[target.length];
for (int i = 0; i < target.length; i++) {
t[i] = (StackExpr) target[i].clone();
}
final StackExpr[] s = new StackExpr[source.length];
for (int i = 0; i < source.length; i++) {
s[i] = (StackExpr) source[i].clone();
}
retu... |
3a518105-84bd-40b9-9765-370ff8ecc4d4 | 8 | public int findMaxScore(String[] grid){
int n = grid.length;
if(n==0) return 0;
int m = grid[0].length();
int N = n*m;
int E = 0;
Edge[] edges = new Edge[(n-1)*m+(m-1)*n];
for(int i=0; i<n; i++){
m = grid[i].length();
for(int j=0; j<m; j++)... |
8ef637d0-b6d8-489f-848a-ce4d213e1ae0 | 2 | @Test
@Ignore
public void test_AssociationListGet()
{
AssociationList laAssocList = laClient.getAssociationList(5,
"2012-01-25-12.36.43.023001", null);
System.out.println(laAssocList.getAssociationList().size());
if (laAssocList.getAssociationList().size() > 0)
{
for (Association laAssoc : laAssocList... |
fcba0475-55f3-445e-b483-97d3b1dd2c1e | 6 | public WebScraper(String[] args) throws IOException, BadLocationException {
ArrayList<URL> urls = new ArrayList<URL>();
//Is URL?
if(args[0].matches("^http\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)?$"))
urls.add(new URL(args[0]));
//Is file?
else if (args[0].match... |
e509580a-c9b8-4aff-be9c-9f2af42dede8 | 1 | private static TexturePaint getCheckerPaint() {
if (checkerPaint == null) {
int t = 8;
BufferedImage bi = new BufferedImage(t * 2, t * 2, BufferedImage.TYPE_INT_RGB);
Graphics g = bi.createGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, 2 * t, 2 ... |
0f949839-c752-4425-8228-47d1d7bf84d6 | 3 | public static boolean testContainment(double xin, double yin,
double[] pointsx, double[] pointsy) {
int i, j;
boolean result = false;
for (i = 0, j = pointsx.length - 1; i < pointsx.length; j = i++) {
if ((pointsy[i] > yin) != (pointsy[j] > yin)
&& (xin < (pointsx[j] - pointsx[i]) * (yin - pointsy[i])
... |
f28efe59-3b11-4638-99d9-7cc23ceaab54 | 7 | private void playnextsound()
{
// Only plays the next sound if the track is still playing
if (!isPlaying())
return;
// The sound is no longer delayed
this.delayed = false;
// Checks whether more loops are needed
// Loops the current sound if needed
if (this.currentloopcount > 0 ||
(this.cur... |
64aa0bc0-c900-4793-b0c3-58e4f6ac0deb | 9 | private void donebutton2MouseClicked(java.awt.event.ActionEvent evt) throws SQLException {//GEN-FIRST:event_donebutton2MouseClicked
// TODO add your handling code here:
//Check title
String bank = namefield.getText().toString();
String add = addressfield.getText().toString();
String accnum = a... |
8ab0ae70-bd9e-4144-aa95-74aa12a1cbe4 | 1 | public void clear() {
M = new byte[m];
if(intersectable) {
ts.clear();
}
} |
22ee4e6e-5761-435c-817d-3c607488d71d | 3 | void appendInstruction(Instruction newInstr, BytecodeInfo codeinfo) {
newInstr.addr = nextByAddr.addr;
newInstr.nextByAddr = nextByAddr;
nextByAddr.prevByAddr = newInstr;
newInstr.prevByAddr = this;
nextByAddr = newInstr;
/* adjust exception handlers end */
Handler[] handlers = codeinfo.getExceptionHand... |
38fc6d59-e4e1-453b-abb8-d957bd520059 | 0 | public void setVoornaam(String voornaam) {
this.voornaam = voornaam;
} |
5a331f12-b6ac-45a1-81e3-fb5fc5701ba0 | 5 | public static void sort(Comparable[] a) {
int N = a.length;
int h = 1;
while (h < N/3) {
h = 3*h + 1;
}
while (h >= 1) {
for (int i = h; i < N; i++) {
for (int j = i; j >= h && less(a[j], a[j-h]); j-= h) {
... |
e5c43485-864e-4318-bf12-624f370b48bd | 4 | public void tick(EnemyWave allEnemies) { // TODO Move to shootingaction so that we have only data in this class(?)
//send action to all objects
for (Placeable obj : getPlacablesWithinRangeOfThisTower()) {
if (!obj.equals(this)) {
for (GameAction currentAction : getGameAction... |
05d31e82-8ad3-4f3c-bc9d-579b4768bdc3 | 1 | public Tree(HuntField field) {
this.type = 'T';
synchronized (field) {
this.position = new Position(random.nextInt(field.getXLength()), random.nextInt(field.getYLength() + 1));
while (field.isOccupied(position)) {
this.position = new Position(random.nextInt(field.... |
cbfb2a8d-e727-4105-9001-f45cd1be14d5 | 1 | protected void checkInitiate() {
if (!isInitiate) {
throw new IllegalStateException("RemoteClientCall is not initiate. First execute Init().");
}
} |
5e0e6b58-928a-4ce6-9f5c-c1706a90de43 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
HttpSession sesionOk = request.getSession();
if (sesionOk.getAttribute("usuario") != null) {
String alert = "";
response.setCon... |
6e085c67-5a2b-4348-b228-50758c163c97 | 1 | @Override
public void close() throws XMLStreamException {
if (mWriter != null) {
try {
mWriter.close();
} finally {
mWriter = null;
}
}
} |
7456fc5f-0c46-4c1d-98ed-00014f0953a4 | 9 | public boolean contestCommand(CommandSender sender, String[] args) {
if (args.length != 0) {
return false;
} else if (sender instanceof Player) {
Player player = ((Player) sender).getPlayer();
MCWarClanPlayer mcPlayer = _tc.getPlayer(player.getUniqueId());
... |
099cc8f8-5a0c-439e-862d-826a39db93c3 | 6 | public int calcularAptitud(){
int aptitud = 1;
int cromFinX = 0;
int cromFinY = 0;
for(String mov : codificacion){
if(mov != null){
switch(mov){
case "up":
cromFinY -= 1;
break;
case "down":
... |
786f5df5-4e2f-4760-b12b-202a8d378700 | 1 | private static int countTokens(String template) {
int count = 0;
Matcher matcher = PATTERN.matcher(template);
while (matcher.find()) {
count++;
}
return count;
} |
307bc90d-56e0-494f-9589-209790fd9119 | 7 | private Vector enemyPixelMovement(Point goal) {
// Point goal = board.getCastle().getCenterOfObject();
Point enemyPos = this.getPixelPosition();
int deltaX = goal.getX()-enemyPos.getX();
int deltaY = goal.getY()-enemyPos.getY();
Vector newPos;
// kollar vilket håll som... |
2fc719f2-79de-4175-912a-db0cb0cfc7dc | 7 | public void paint(Graphics2D g,boolean draw,boolean fill){
if (calcularVar) {
calcular();
calcularVar = false;
}
if (draw && !fill) {
g.draw(path);
}else if(fill && !draw){
g.fill(path);
}else if(draw && fill){
... |
5fe460fc-ff72-4a47-a987-e10b83449ea0 | 0 | private StopForwarder() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Detener Forwarder");
putValue(SHORT_DESCRIPTION, "Detener Forwarder");
putValue(LONG_DESCRIPTION, "Detener Forwarder");
putValue(SMAL... |
34949896-3336-4a85-894d-b8c450ba99e0 | 4 | public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double ... |
b55e8aae-a4a1-4e41-9512-70257756cf97 | 2 | private String apply(String string) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < string.length(); ++i) {
if (rules.containsKey(string.charAt(i))) {
result.append(rules.get(string.charAt(i)));
} else {
result.append(string.charA... |
c6bfc939-74cd-4192-b019-c05cf63e09d9 | 9 | protected void paintLineHighlight(Graphics gfx, int line, int y)
{
int height = fm.getHeight();
y += fm.getLeading() + fm.getMaxDescent();
int selectionStart = textArea.getSelectionStart();
int selectionEnd = textArea.getSelectionEnd();
if(selectionStart == selectionEnd)
{
if(lineHighlight)
{
g... |
3b53ecb9-b8c1-4344-8b4d-00aabe87ea3c | 1 | public LinkOpener(String uri) {
try {
this.uri = new URI(uri);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
5927d833-c133-4f68-b53b-9871b90c5c81 | 8 | private static List<String> getIdListInsertStatement(SDNEntry sdne) {
List<String> rtn = new ArrayList<>();
for (Map<String, Object> map : sdne.getIdList()) {
String cols = SDNConstants.ELEMENT_SDNENTRYID;
String vals = sdne.getUid() + "";
for (String key : map.keySet()) ... |
c70a80b8-aac0-42d4-ab5f-32486bc0a964 | 1 | @Override
public Object getValueAt(int arg0, int arg1) {
if (arg1 == 0)
return (dfa.getStates().get(arg0).getState_Properties().getName()); else
return getEntry(arg0, arg1-1);
} |
0912548f-0e19-4be7-8535-42a546ab766f | 4 | public void testEqualSubsetIntersection() throws Exception {
for (int i = 0; i < 100; i++) {
int len = (int)(Math.random() * (10 - 1) + 1);
RBtree a = randomRB( len );
RBtree b = a;
if (!a.equal( b ) ) {
throw new Exception("FAILURE THE TWO SETS ARE NOT EQUAL");
}
if (!a.subset( a.intersect... |
638f8892-ede2-4ba2-ba81-5ef317c28600 | 5 | static void process_changesets_url_common ( URL passed_url, String passed_display_name, String passed_uid, String passed_id,
String passed_min_lat_string, String passed_min_lon_string, String passed_max_lat_string, String passed_max_lon_string,
String passed_download_changeset, String passed_building, boolean ... |
a3cf4ef2-09e3-48ff-8c26-3ee0699e77a0 | 4 | @GET
@Path("/{id}")
@Produces(MediaType.LIBROS_API_LIBRO)
public Libro getLibro(@PathParam("id") int id) {
Libro libro = new Libro();
Connection conn = null;
Statement stmt = null;
String sql;
try {
conn = ds.getConnection();
} catch (SQLException e) {
throw new ServiceUnavailableException(e.getMe... |
f14abdf8-b6cf-483d-acd0-b55e646f2c64 | 3 | public void readConfig() {
/* private boolean useDefaultUQuest = true;
*
* Database:
* private boolean useSQLite = false;
* protected boolean broadcastSaving = true;
* protected int SaveQuestersInfoIntervalInMinutes = 30;
*
* PluginSupport:
* private String MoneyPlugin = "none";
*... |
8be570f4-f1ed-43b9-b41f-861f1972c9a3 | 8 | @EventHandler
public void onRedstoneChange(BlockRedstoneEvent e) {
Block block = e.getBlock();
int startX = block.getX()-1;
int startY = block.getY()-1;
int startZ = block.getZ()-1;
int endX = block.getX()+1;
int endY = block.getY()+1;
int endZ = block.getZ()+1;
for(int x = startX; x <= endX; x++)
... |
14e2b706-c70f-4afb-82f0-3c242b39ec1a | 3 | @Override
public void messageReceived(MessageEvent arg0) {
final String msg = arg0.getMessage().toLowerCase();
if (msg.contains("you successfully chop away some ivy.")) {
chopped++;
}
if (msg.contains("a bird's nest falls out of the") && !Inventory.isFull()) {
... |
b73dee4c-f0f9-4aa2-a475-d91cfee2efa3 | 6 | public void moveBothServos(int pos1, int pos2)
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "moveBothServos");
return;
}
debug("Moving both servos to positions " + pos1 + " an... |
5ac00178-3aa6-4846-9144-40c1fdec4d4e | 2 | public int[] plusOne(int[] digits) {
int carry = 1;
for(int i = digits.length - 1; i >= 0; --i){
int tmp = digits[i] + carry;
digits[i] = tmp % 10;
carry = tmp / 10;
}
if(carry == 1){
int [] res = new int[digits.length+1];
res[0... |
5c89feab-c1bb-4dec-99b4-81a3c3a07903 | 3 | public void actionPerformed(ActionEvent e) {
log(e);
if(((JButton)e.getSource()).getText().equals(STARTMENU_BUTTON_START)){
} else if(((JButton)e.getSource()).getText().equals(STARTMENU_BUTTON_ABOUT)){
forwardAction("MyStyles.MyFrames.AboutMenuFrame");
} else if(((JButton)e.getSource()).getText().e... |
a43ea0af-c060-48fd-9101-3a3593fc892f | 3 | public void Architecture() throws IOException{
bins=new Bin[binNo];
for(int i=0; i<binNo; i++)
bins[i]=new Bin();
sortBins();
for(int i=0; i<archL; i++){
hiddenLayersNo=i+1;
updateArchNodes(hiddenLayersNo-1);
}
System.out.print("\nBest architecture:\n");
for(int l=0; l < bestArch.length; l++) ... |
53389911-e437-4cbf-bde5-a25dde4843ed | 2 | public void flipVertical() {
byte image[] = new byte[width * height];
int off = 0;
for (int j = height - 1; j >= 0; j--) {
for (int k = 0; k < width; k++) {
image[off++] = pixels[k + j * width];
}
}
pixels = image;
offsetY = trimHeight - height - offsetY;
} |
f91e4cb0-0fc6-4bc2-88f1-98582ecef67b | 1 | public Display(Alloy alloy, String[] hn, String message) {
super(message);
this.alloy = alloy;
this.hostNames = hn;
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(alloy.getWidth() + 5, alloy.getHeight() + 36);
this.setLocationRelativeTo(null);
t... |
091eb5e7-e5f1-485b-8c75-d2464e3b7e54 | 7 | private AVLNode balance()
{
switch( heightRightMinusLeft() )
{
case 1:
case 0:
case -1:
return this;
case -2:
if( left.heightRightMinusLeft() > 0 )
{
setLeft( left.rotateLeft(), null );
}
return rotateRight();
case 2:
if( right.heightRightMinusLeft() < 0 )... |
2f04a57c-12dc-462e-bfc5-2061942bfa3e | 4 | private void timeOut() {
boolean timedOutBeforeConnecting = false;
boolean timedOutAfterConnecting = false;
synchronized(CONNECTION_LOCK) {
if(isAttemptingToConnect) {
logger.fine("Connection to " + serverAddress + ":" + serverPort + " timed out");
closeConnection();
timedOutBeforeConnecting = true... |
ad31be05-8265-47bf-b3db-88fb39ceb1a8 | 3 | public static boolean isCollision(Circle c1, Circle c2) {
if (c1 == null || c2 == null) return false;
int xDist = c1.x - c2.x;
int yDist = c1.y - c2.y;
int rSum = c1.r + c2.r;
if (Math.pow(xDist, 2) + Math.pow(yDist, 2) <= Math.pow(rSum, 2)) {
return true;
}
return false;
} |
2d35794e-1ffb-402d-a5cd-f2dd212ea586 | 0 | public String allFits(){
return this.fitnessArr.toString();
} |
abcc0d56-0b8a-48f0-8a33-aefde1ec58e1 | 2 | public boolean temPermissao(String nome, String senha) {
if ((getNome().compareToIgnoreCase(nome) == 0) && (getSenha().compareToIgnoreCase(senha) == 0)) {
return true;
}
return false;
} |
a7d64164-f3a5-4879-a2e3-fa977af33e21 | 2 | public Integer getPrimaryGroup(Connection con, String user) {
/* Compose query. */
String SQL_QUERY = "SELECT user_group_id "
+ "FROM xf_user "
+ "WHERE username=?;";
/* Execute query. */
try {
PreparedStatement stmt = con.prepareStatement(SQL_QUERY);
stmt.setString(1, user);
ResultSet rs = st... |
a84cca4d-1b36-4f62-8801-9c156071129f | 0 | protected void onRemoveModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} |
3724a11e-d269-4189-956b-8f7ff66c833d | 6 | private static void configureDevelopmentLogging() {
// Configure console logger
devConsoleHandler = new ExtendedConsoleHandler();
devConsoleHandler.setFormatter(new DevLogFormatter());
// Configure file logger
try {
new File("./log").mkdir();
devFileHandler = getFileHandler(true);
if (DEV_MODE)... |
d17ba2c9-4a47-4666-ab22-45b060631318 | 8 | public static FileCache foruser() {
try {
String path = System.getProperty("user.home", null);
if(path == null)
return(null);
File home = new File(path);
if(!home.exists() || !home.isDirectory() || !home.canRead() || !home.canWrite())
return(null);
File base = new File(new File(home, ".hav... |
8271eadf-f288-45b5-8dc7-751f031bfe89 | 4 | public void update() {
up = keys[KeyEvent.VK_UP];
down = keys[KeyEvent.VK_DOWN];
right = keys[KeyEvent.VK_RIGHT];
left = keys[KeyEvent.VK_LEFT];
space = toggle(KeyEvent.VK_SPACE);
enter = toggle(KeyEvent.VK_ENTER);
escape = toggle(KeyEvent.VK_ESCAPE);
if(JudokaComponent.gameState == Judoka... |
c62ac90a-2a02-400f-b790-43f63affe174 | 6 | private void overwriteShapeDefault(Attributes attrs) {
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("color"))
shapeDef.setColor(new Color(Integer.valueOf(attrs.getValue(i),
16)));
else if (attrs.getQName(i).equa... |
a5b75e17-1b3c-4ee7-a229-24fe1a3fb8e9 | 9 | public HTML addClasses(final String...classtypes) {
if ( classtypes == null )
return this;
final String classesAsString = this.getOrCreateAttr("class");
final List<String> classesAsArray = new ArrayList<String>( );
for (final String s : classesAsString.split(" "))
classesAsArray.add(s);
for (fi... |
2d8b0534-2ab3-41c5-b26b-66a7c0f3fa59 | 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... |
69ac1df8-95f9-41a2-a54d-265acd93a613 | 6 | public void createScreenShot()
{
File screenshotFile = null;
JFileChooser chooser = new JFileChooser();
UIManager.put("FileChooser.saveDialogTitleText", "Save Michelizer Screenshot");
SwingUtilities.updateComponentTreeUI(chooser);
chooser.setSelectedFile(new File("Michelizer_Output.jpg"));
screenshotFile ... |
c530a7fe-8c3c-4552-addf-488bd6f46ed5 | 3 | private void cutButtonAction()
{
// No ads found
if (results.isEmpty())
{
text.append(String.format("No ads found.%s", newline));
setStateInitial();
return;
}
// Validate specified cut times
if (!validateCutTimes())
{
... |
8ed7fb67-e028-48d1-b587-1c8bf1dea114 | 0 | public double getRad(){
return rad;
} |
8c0cb09c-65aa-48f5-8cf6-928de9d6032b | 8 | private void moveComponents(
Container target, int x, int y, int width, int height, int columnStart, int columnEnd, boolean ttb)
{
switch (align)
{
case TOP:
y += ttb ? 0 : height;
break;
case CENTER:
y += height / 2;
... |
4b5372f6-d0e2-4dc3-bd6a-92b873620edd | 8 | private int countCompletelySolvedTopEdgeCubie() {
int count = 0;
RubiksCube rc = this.initialRcConfig;
// Get the four top layer edge cubies
Cubie frontTopFaceEdgeCubie = rc.getCubie(2, 3, 3);
Cubie rightTopFaceEdgeCubie = rc.getCubie(3, 3, 2);
Cubie backTopFaceEdgeCubie = rc.getCubie(2, 3, 1);
... |
6921f147-9f19-4000-b909-14505753a377 | 2 | public void gaFram ()
{
if (aktuell >= 0 && aktuell < Polylinje.this.horn.length - 1) aktuell++;
else aktuell = -1;
} |
1695888e-51b9-448e-aad2-a93e4b54ef3d | 8 | static private void parseVariables(DodsV parent, Enumeration children) {
while (children.hasMoreElements()) {
opendap.dap.BaseType bt = (opendap.dap.BaseType) children.nextElement();
if (bt instanceof DList){
String mess = "Variables of type "+bt.getClass().getName()+" are not supported.";
... |
de29d9fe-967d-4afe-9c44-def34a6c7f35 | 4 | public double[] marginalProbability(int x_i) {
int n = potentials.chainLength();
int k = potentials.numXValues();
double[] result = new double[k+1];
sum = 0;
result[0] = 0;
for (int v =1 ; v <= k ; v++) {
result[v] = messageFactor2Node(x_i, x_i, v);
if (x_i != 1) {
// not the first one
... |
97fa6c75-57ff-4b3e-8388-9b097e42d45d | 3 | public SingleTreeNode treePolicy() {
SingleTreeNode cur = this;
while (!cur.state.isGameOver() && cur.m_depth < ROLLOUT_DEPTH)
{
if (cur.notFullyExpanded()) {
return cur.expand();
} else {
SingleTreeNode next = cur.uct();
... |
0a32cec8-0e0f-40ef-b3b4-eee9b3f59fb5 | 4 | public Decifra(File arquivo){//construtor
try{ //tratamento de erro sobre a read do arquivo
arquivoR = new FileReader(arquivo); //abre o arquivo
buffer = new BufferedReader(arquivoR);
while(buffer.ready()){
code[read]=buffer.readLine();//code recebe o que esta na buffer a cada linha, assim cad... |
7d1ced4e-92b4-49dd-b3e3-70a1804fa810 | 7 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
Boolean result = (Boolean) resultFututre.get();
if (wasInsert == true) {
if (result == true) {
request.setAttribute("er... |
f7077feb-ace5-496e-ad77-e418a4c19182 | 7 | public void mouseDragged(MouseEvent e) {
if(this.laf.bh.ccol.getState()==false)
{
Graphics g;
Color c=Color.BLACK;
g=this.getGraphics();
g.clearRect(0,0,this.getWidth(),this.getHeight());
this.paint(g);
xf=e.getX();
yf=e.getY();
switch(th... |
21b43a6d-2cda-4dcd-9ad6-138046dc93cc | 2 | private void setTrafficNodes(InterfaceRequiredMethods n, double duration,
Distribution dist) {
if (dist instanceof UniformDistribution) {
int rate = (int) dist.nextSample();
double interval = duration / rate;
// uniforme distribuição para escolher um tempo de 0 a 10 minutos para iniciar a sequencia de... |
ff70f9a3-8c8a-4b03-a208-8b2f6203f1f5 | 8 | public Matrix solve(Matrix B) {
if (B.getRowDimension() != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
double[][] X = B.getArrayCopy... |
7f866078-e91a-4848-a87c-17a024d93c07 | 6 | final void method546(int i, int i_40_, int i_41_) {
if (i_41_ == -2) {
if (i_40_ == 0) {
anInt5280 = -(i >= 0 ? i : -i) + anInt5278;
anInt5289 = 4096;
anInt5280 = anInt5280 * anInt5280 >> -1109421716;
anInt5290 = anInt5280;
} else {
anInt5289 = anInt5280 * anInt5298 >> -640192180;
if ((anInt5289 ... |
d1f49844-cc51-4d93-9431-abe9d5f16baa | 1 | @Override
protected void logBindInfo(Method method) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功");
}
} |
8a77244d-32b0-440c-a3cc-b9fa22d89ec0 | 9 | public void generateDataforCassandraHector(int uID, int noOfReplicas, int minute, int rate) {
int tsID = 0;
long executedTime = 0;
String timeStampOutput = "";
int noOfSamples = minute * rate * 60;
try {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
uconn.cse.cass... |
1f980432-353a-4216-b99e-d733a9699c41 | 8 | public static MaplePacket charInfo(final MapleCharacter chr) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.CHAR_INFO);
// mplew.writeShort(0x31);
mplew.writeInt(chr.getId());
mplew.write(chr.getLevel());
mpl... |
45c3249a-9d48-4953-950b-4f7df80cd6f9 | 5 | public void read() {
if (db.exists()) {
if (hasRead)
return;
try {
FileReader f = new FileReader(db);
BufferedReader in = new BufferedReader(f);
String line;
while ((line = in.readLine()) != null) {
lines.add(line);
}
} catch (Exception ex) {
ex.printStackTrace();
}
has... |
3169b03b-048e-4ece-b57b-b495b6e1236f | 1 | public void SetSolenoidValue(int channel, boolean value){
solenoid[channel - 1] = (byte) (value ? 1:0);
} |
508ef49b-1f95-40ba-8ee0-87cc8195c7fc | 0 | @BeforeClass
public static void setUpClass() throws Exception {
System.out.println("start");
MyUnit.getDriver().get("http://www.google.com");
} |
67fc92a8-c141-4b78-a429-8a7d6bee7809 | 0 | public BST() {
this.count = 0;
root = null;
} |
a2247dee-48a0-4428-ac74-9976930497e7 | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String nombre =request.getParameter("usuario");
String clave =request.getParameter("clave");
List<Usuario> lista = usuarioFacade.findByLogin(nombre,... |
df4241d8-9ec9-4990-b656-8d5c4c9d87bb | 1 | private void newtonAlg(double point) {
int count = 1;
double step = point;
double nextStep = point - calcValue(point)/calcDerivative(point);
double epsilon = Math.pow(10, -7);
while (Math.abs(nextStep - step) > epsilon) {
count++;
step = nextStep;
... |
0d071c63-a82e-4cfa-92d6-427604454713 | 6 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number of lines for the characters to be printed: ");
int num = scan.nextInt();
for (int i = 1; i <= num; i++) {
for (int j = 1; j <= num; j++)
if (i == 1 || i == num || j == 1 || j == num)
Sy... |
6c288a0f-c261-495c-8310-4a7e191747fb | 0 | public static String substring(String s, int beginIndex, int endIndex) throws IndexOutOfBoundsException {
// Discovered somthing new. String.substring is basically a
// memory leak. See: http://developer.java.sun.com/developer/bugParade/bugs/4637640.html for more details.
// Use string.getChars to avoid this whe... |
0019ce16-455e-4539-ae80-1fc619581170 | 0 | public AdjacencyList getAdjacencyList() {
return adjacencyList;
} |
48ca17eb-2792-4620-a5f2-ea50ac9a38f6 | 5 | public CellHandle[] getCells()
{
List<? extends BiffRec> mycells;
try
{
Boundsheet boundsheet = mySheet.getBoundsheet();
int colFirst = getColFirst();
mycells = boundsheet.getCellsByCol( colFirst );
}
catch( CellNotFoundException e )
{
return new CellHandle[0];
}
CellHandle[] ch = new Cell... |
3413397b-f900-4798-8ef2-2e381cb18f77 | 0 | public int getBlue(){
return _blue.get();
} |
be15a5c2-4573-4e6e-bcc1-395c8ab8e8c7 | 0 | public PumpingLemma getCurrent()
{
return get(myCurrent);
} |
7b50826f-c362-4b1b-bea7-66a97663c87d | 2 | public void set_order_to_idx( String idxFileName )
{
if(canIfNoCdx())
{
order = "[idx]";
Idx = new idx();
try { Idx.fidx = new RandomAccessFile( new File( g_idxname(idxFileName) ), fmode()); }
catch (FileNotFoundException e1) { e1.printStackTrace(); }
Idx.read_header();
Idx.recno = recno;
updateseek... |
0fc41acd-4df7-4806-924b-06455cb0d827 | 6 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
BufferedImage originalImage = new BufferedImage(85, 85,
BufferedImage.TYPE_INT_RGB);
try {
originalImage = ImageIO.read(getClass().getResource(
"/imgs/menu/background.jpg"));
} catch (IOException e1) {
System.out.pri... |
d6b2a997-ffa0-4501-940f-895f9c03ce66 | 4 | private void makeSit(Chair chair){
pDir = chair.getPlayerSitDir();
setCharLoc(chair.getPlayerX(),chair.getPlayerY());
stopMoveChar();
sitting = true;
sittingHigh = chair.isHigh();
sittingLow = chair.isLow();
if(chair.getChairDir() == 0){
sittingDown = true;
}else{
sittingDown = false;
}
if(cha... |
ef9a46d0-c5c7-4e6e-84fb-d93a4af9d13e | 2 | @Override
public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
Cinema otherCinema = (Cinema) other;
return this.name.equals(otherCinema.name);
} |
b3e12b69-a152-49b1-ac73-a7c26e959949 | 2 | @Override
public Cible putCible(Cible c) throws JSONException, BadResponseException {
Representation r = new JsonRepresentation(c.toJSON());
r = serv.putResource("intervention/" + interId + "/cible", null, r);
Cible cible = null;
try {
JSONObject jobj = new JsonRepresentation(r).getJsonObject();
cible =... |
b1a27f53-55ef-4401-90b0-8cc9b65ece76 | 5 | @Override
protected boolean canRun(ClassNode node) {
if (!node.superName.endsWith("Object") || classNodes.containsKey("NodeHashTable"))
return false;
if (node.fields.size() >= 2) {
for (int fni=0; fni < node.fields.size(); fni++) {
FieldNode fn = (FieldNode) n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.