method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3dc207ab-c73d-4b4c-b8dc-66598c1e1d2a | 0 | public Iterator<Path> getPathIterator(){
return pathList.iterator();
} |
e8ec0b7d-b71b-4172-9610-ea5e00a0ad84 | 0 | public void setK (double k) {
this.k = k;
} |
0ffb1b61-2f84-4fb1-b15b-1a0f6ca30c4a | 6 | public boolean chargeForDevCard() {
if (! resForDevCard()) return false;
for (int i = 0; i < BRICK_DEV; i++) _hand.remove(Resource.Brick);
for (int i = 0; i < ORE_DEV; i++) _hand.remove(Resource.Ore);
for (int i = 0; i < SHEEP_DEV; i++) _hand.remove(Resource.Sheep);
for (int i = 0; i < TIMBER_DEV; i++) _hand.... |
09dd8f4c-1c75-4e3d-9745-8de2f611b513 | 4 | public NoiseMenu() {
super("Noise");
setEnabled(true);
JMenuItem saltAndPepper = new JMenuItem("Salt and Pepper");
saltAndPepper.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
if (pa... |
9279184e-7476-459c-83b4-82852d523710 | 3 | int NNIRetestEdge( heap p, heap q, edge e, double[][] avgDistArray,
double[] weights, direction[] location, int possibleSwaps )
{
direction tloc = location[e.head.index+1];
location[e.head.index+1] =
NNIEdgeTest( e,avgDistArray,weights,e.head.index+1 );
if ( direction.NONE == location[e.head.index+1] )
... |
27422f20-f091-4b26-bf31-180c18768621 | 6 | public int[] countSort(int[] A){
int c0= 0;
int c1 =0;
int c2 = 0;
for(int i=0 ;i<A.length;i++){
if(A[i] == 0)
c0++;
else if(A[i]== 1)
c1++;
else c2++;
}
for(int i=0;i< c0;i++){
A[i] = 0;
... |
190e5faa-cb04-4dd8-9d20-0a26e4c3d259 | 0 | public int getRowCount() {
return variables.length;
} |
0fa03c57-18e1-4739-b6e5-545c2f512737 | 5 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y))
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
for (Player p:apples.playerList)
{
if (apples.pointDis(X, Y, p.x, p.y)<radius&... |
1ef1e374-3d74-40c6-a1e8-0116d43ecd56 | 3 | public void desalocarProfessorTurma(String codDisciplina, int numTurma,
String matriculaProf) {
try {
sistemaFrontEnd.desalocaProfessorDeTurma(codDisciplina, numTurma,
matriculaProf);
front.exibirMsg("Professor desalocado com sucesso");
} catch (DisciplinaInexistenteException e) {
front.exibirMsg("... |
eeecbf74-4a32-430c-ae39-de07894f9b0c | 1 | private boolean isYCoordInsideWindow(int yCoord) {
return (yCoord >= Math.abs(yOffset))
&& (yCoord <= (windowDimension.height + Math.abs(yOffset)));
} |
b7d0f6e5-e538-4879-8c8d-9c4b5a188b30 | 4 | private void markForDamage(Element e, Batch <Element> inRange) {
if (e == null || e.flaggedWith() != null) return ;
e.flagWith(inRange) ;
inRange.add(e) ;
if (e instanceof Boardable) for (Mobile m : ((Boardable) e).inside()) {
markForDamage(m, inRange) ;
}
} |
c71559ee-dd5c-40d9-ba3c-504cfe4749c1 | 0 | public void showError(String message)
{
messageLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
showBasicDialogs(message);
} |
a46443ec-d950-447f-9c82-53eb32f7e186 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
82f7fd58-58c6-4a01-a9f7-56ec33ae15c7 | 2 | public static void createScoreboard(Player player) {
//Scoreboard
Scoreboard board = manager.getNewScoreboard();
Team team = board.registerNewTeam("teamname");
team.addPlayer(player);
//Sidebar
Objective sidebar = board.registerNewObjective(player.getName().substring(0, (player.getName().length()-play... |
49d8c01d-cc4c-4aad-8ae6-f20faff0d4e9 | 5 | public static boolean readUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Input");
int option = fileDialog.showOpenDialog(null);
if (option != JFileChooser.APPROVE_OPTION)
return false;
... |
39c67d64-525f-4e2d-920e-94e1ef0169f9 | 4 | void Parse () throws FileNotFoundException {
Scanner in = new Scanner(new FileReader("save.txt"));
time = in.nextInt();
difficulty = in.nextInt();
hints = in.nextInt();
for (int row = 8; row >=0; row--) {
for (int col = 0; col < 9; col++) {
boardArray[col][row] = in.nextInt();
}
}
for (int row =... |
b5bae66d-e68a-4414-a579-7e87f6970f48 | 4 | @Override
public void onKeyUp(int key)
{
if (currentScreen == null)
return;
if (currentScreen instanceof IReceiveKeyUpEvent)
((IReceiveKeyUpEvent) currentScreen).onKeyUp(key);
for (IRenderable renderable : currentScreen.getComponents())
if (renderable instanceof IReceiveKeyUpEvent)
((IReceiveKeyU... |
d44f9d39-d05b-4791-92c3-07122ff7e62f | 4 | @Override
public void close() throws IOException
{
synchronized(this)
{
CoderResult result;
if( null == decoder )
{
return;
}
// flush the input buffer
inputBuffer.flip();
do
{
outputBuffer.clear();
result = decoder.decode( inputBuffer, outputBuffer, true );
outputBuffer.... |
81150911-c756-4428-9e1e-2699abdf1f13 | 9 | @Override
public String traverse() {
StackBST stack = new StackBST();
StringBuilder l = new StringBuilder();
// induction basis:
StackBSTelem elem = new StackBSTelem(0, root);
stack.push(elem);
// induction step:
BinarySearchTreeItem<K> node;
while (true) {
elem = stack.top();
node = elem.node;... |
b3105a06-d2cd-4426-9db5-15cd4a2810a5 | 0 | public boolean checkHeroAvailable(){
return isHeroAvailable;
} |
f90e38f2-152e-4c40-8e0f-8e84609b5954 | 6 | public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
try {
final Method method = version.getClass().getMethod(methodName);
return new Adapter.Getter<V>() {
public V call() {
try {
Transaction me = Thread.getTransaction();
Transaction o... |
8eda621e-064d-426e-92cb-135002158643 | 0 | @Override
public void execute(DebuggerVirtualMachine dvm) {
} |
cdf582ca-8c2a-4ac4-8abf-25742572a93c | 3 | private void convert(BufferedImage image) {
int imageWidth = image.getWidth();
int imageHight = image.getHeight();
int size = imageWidth * imageHight;
Integer imagePixel[] = new Integer[size];
int i = 0;
for (int y = 0; y < imageHight; y++) {
for (int x = 0; x... |
49807416-1b90-4f5b-a5d1-4117bcaff8fb | 0 | public void highlightMove() {
this.setBorder(BorderFactory.createLineBorder(this.BACKGROUND_HIGHLIGHT_MOVE));
} |
fbf533b9-1e6c-46a9-a6e8-6e90d97ad981 | 7 | public ByteBuffer unpredict(ByteBuffer imageData)
throws IOException
{
List<byte[]> rows = new ArrayList<byte[]>();
byte[] curLine = null;
byte[] prevLine = null;
// get the number of bytes per row
int rowSize = getColumns() * getColors() * getBitsPe... |
409f8d54-9b4b-48a6-8085-77bb5adf1974 | 3 | private int jjMoveStringLiteralDfa18_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 17);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 17);
}
switch(curChar)
{
case 45:
return jjMoveStringLiter... |
fe9025ce-a5df-4ab9-9574-ebb1d6450b45 | 3 | public String toFullString() {
String wString = "";
switch (this) {
case ROCK:
wString = "Rock";
break;
case PAPER:
wString = "Paper";
break;
case SCISSORS:
wString = "Scissors";
... |
971579f6-0dd6-4972-aa37-8d5031874315 | 3 | public void invoke(List<String> commands, StreamWriter streamWriter, OutputStream output)
throws IOException
{
ProcessBuilder pb = new ProcessBuilder(commands);
Process proc = pb.start();
ByteArrayOutputStream procError = new ByteArrayOutputStream();
try {
T... |
7c7cdb5d-0660-4142-a3ff-f29d09d12b98 | 0 | public int get(int index) {
RangeCheck(index);
return data[index];
} |
177fcb1e-63c8-471c-8293-5b58f76e9559 | 1 | public VolumeAdjustTool(List<VideoSection> sections) {
this.randomSections = sections;
if (sections.size() > 0)
currentSection = sections.get(0);
} |
840b12ed-266c-4df1-905f-8f3d533bf903 | 9 | public void createGelIterator( GenKbAuthorization Authorization,
GenKbGelIteratorBuff Buff )
{
GenKbGelInstructionPKey pkey = schema.getFactoryGelInstruction().newPKey();
pkey.setClassCode( Buff.getClassCode() );
pkey.setRequiredCartridgeId( Buff.getRequiredCartridgeId() );
pkey.setRequiredGelInstId( Buff.... |
4cf6d3d3-8c1f-40b4-9b35-f3d6a1bf6195 | 9 | private <T> MethodsStringConverter<T> findFromStringMethod(Class<T> cls, Method toString, boolean searchSuperclasses) {
// find in superclass hierarchy
Class<?> loopCls = cls;
while (loopCls != null) {
Method fromString = findFromString(loopCls);
if (fromString != null) {... |
3591cd2e-904f-45cd-8236-95d755455b38 | 8 | static void makeGraphRandom() throws Exception {
NUM_AGENTS = 12;
NUM_TASKS = 16;
graph = new double[NUM_AGENTS][NUM_TASKS][3]; // use innermost array as holding <cost, capacity, pheromone>
for (int i = 0; i < NUM_AGENTS; i++) { // go through agents
for (int j = 0; j < NUM_TASKS; j++) { // go through tasks
... |
0ca2c23d-0a70-4602-8e90-a84810b4741d | 4 | public void operationsTest() throws IOException {
for (int i = 0; i < 100; ++i){
assertEquals(manager.addValue(i + "key", i + "value"), 0);
}
for (int i = 0; i < 100; ++i){
assertEquals(manager.editValue(i + "key", (i + 100) + "value"), 0);
}
for (int i ... |
28f47ec2-5065-4100-9f73-de6adbb41f99 | 0 | @EventHandler
public void onBlockBreak(BlockBreakEvent event) {
} |
f2720db5-95ef-4cbf-868e-db059b143d0b | 6 | public Tileset(String name, int tileWidth, int tileHeight, int spacing,
int margin, int tileOffsetX, int tileOffsetY,
Map<String, String> properties, BufferedImage image,
RGBColor imageTransparentColor, boolean imageUseTransparentColor,
int imageWidth, int imageHeight,
Map<Integer, TilesetTile> tiles) {
... |
c6fc184d-d349-452a-9b07-ecc3842a6cc9 | 8 | public static void main(String [] args) throws FileNotFoundException {
Scanner scan = new Scanner(System.in);
System.out.printf("Data input file (blank for System.in): ");
String inputFile = scan.nextLine();
if (inputFile.length() > 0) {
scan.close();
scan = new Scanner(new File(inputFile));
}
System.... |
34980b06-94cd-4b37-bfbe-6ffb3e3595bc | 8 | private void loadImages(){
try{
File directory = new File(CHARACTER_IMAGE_PATH);
File[] characterList = directory.listFiles();
for(File file : characterList){
File charFolder = new File(CHARACTER_IMAGE_PATH+file.getName()+"/");
File[] imageList = charFolder.listFiles();
for(File image : ... |
a983b1ca-bd6f-48ab-b1a7-d03f93c67ae8 | 3 | private void jbtnFtx_ActionPerformed()
{
List<EzimContact> lTmp = this.jlstContacts.getSelectedValuesList();
if (lTmp.size() == 1)
{
EzimContact ecTmp
= (EzimContact) this.jlstContacts.getSelectedValue();
InetAddress iaTmp = ecTmp.getAddress();
JFileChooser jfcTmp = new JFileChooser
(
EzimC... |
b28986e2-208b-4b10-b868-604b205848b7 | 3 | public DAO_Parametre() {
SAXBuilder sxb = new SAXBuilder();
try {
//On crée un nouveau document JDOM avec en argument le fichier XML
File f = new File(path);
File dossier = new File("stockage");
if (!dossier.exists()) {
... |
7dabade5-133e-4711-813c-74fc6b29f49c | 0 | public int getX() {
return this.x;
} |
d2a97c7d-4ddb-4c29-9722-5411e048d670 | 2 | private boolean isValidEndEffectEvent(Event event) {
if (event.getOriginator() instanceof PrimaryPowerFailure) {
PrimaryPowerFailure powerFailure = (PrimaryPowerFailure) event.getOriginator();
if (powerFailure.equals(parentPowerFailure))
return true;
}
return false;
} |
82925a0e-9fc1-4ee5-afec-79d10ec2d072 | 0 | public MarkTest() {
} |
1135ba37-9f4e-444c-9132-ba2de724c05b | 1 | public void setTexture(Texture t) {
if (t != null) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t.getTextureID());
}
} |
7aee8d07-120a-4cb1-ae26-9a070ca42a5d | 9 | public SeedingStrategy getSeedingStrategy() {
SeedingStrategy seedStrat = null;
if(this.randomIndexRadioButton.isSelected()) {
//use a random index SeedingStrategy
int numCases = -1;
try {
numCases = Integer.parseInt(this.numInitialCasesTextField.getText());
} catch (NumberFormatException nfe) {
... |
46a048bf-6a3a-4f18-8853-9407d4c0de25 | 4 | private JMenuBar creatingMenu() {
JMenu menu = new JMenu("Menu");
add(menu);
JMenuItem newGameButton = new JMenuItem("New Game");
JMenuItem saveGameButton = new JMenuItem("Save Game");
JMenuItem loadGameButton = new JMenuItem("Load Game");
menu.add(newGameButton);
menu.add(saveGameButton);
menu.add(load... |
334a30a3-6ca3-48fb-af90-054559b6af1f | 0 | public SaveAsSubMenuItem() {
super();
setEnabled(false);
Outliner.documents.addDocumentRepositoryListener(this);
} |
f8436d22-9095-4785-afa5-576f2935b726 | 3 | protected double currentRobotWeight()
{
if (this.RobotOnRamp != null)
{
RobotPart[] arrayOfRobotPart = this.RobotOnRamp.getRobotParts();
double d = 0.0D;
for (int i = 0; i < arrayOfRobotPart.length; i++) {
if (!(arrayOfRobotPart[i] instanceof Chassis))
d += arrayOfRobotPart... |
5d3a4a9f-8024-405b-b468-508c4fb3f2a4 | 5 | @Override
public final void display(final JPanel panel,
@SuppressWarnings("hiding") final KeyEventHandler key) {
this.textField = new JTextField();
final JScrollPane scrollPane = new JScrollPane(this.textField);
final JPanel mainPanel = new JPanel();
final String value = value();
final StringBuilder sb =... |
c6735112-0de1-4717-8307-69e556e23dd2 | 7 | private static ServiceDescriptor getServiceDescriptor(Element descElement) throws ServiceParseException {
ServiceDescriptor desc = new ServiceDescriptor();
NodeList childNodes = descElement.getChildNodes();
for(int i=0;i<childNodes.getLength();i++) {
Node node = childNodes.item(... |
265685a0-d5e6-4231-bbfc-68f602d089cd | 0 | @Basic
@Column(name = "category")
public String getCategory() {
return category;
} |
a336f35d-7ce5-4be0-9d91-9c7d45f2a971 | 1 | public StartupController(JPanel v)
{
startupControllerInstance=this;
startupModel = new StartupModel();
if(v instanceof LoginView){
loginView =(LoginView) v;
}else{
createOwner = (CreateOwnerView) v;
}
loginV... |
5865bada-a11d-4e3e-8098-d81efdb1128c | 9 | private static final ArrayList<String> getRowColAndGapsTrimmed(String s) {
if (s.indexOf('|') != -1) {
s = s.replaceAll("\\|", "][");
}
ArrayList<String> retList =
new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Aprox return length.
int s0 = 0;
... |
a675b143-a078-44e7-abf4-6afb4ec6ab5e | 4 | @Override
public void onEnable() {
// Setup plugin information
name = this.getDescription().getName();
version = this.getDescription().getVersion();
// Text
getServer().getConsoleSender().sendMessage(
ChatColor.RESET
+ "*********** Enabling MineAuction ***********");
// Setting current instanc... |
9de39834-e027-4ee5-bb42-a211ad0c8e02 | 8 | public boolean tryMove(ArrayList<Square> arraySquares, Piece piece, MovePiece mPiece)
{
System.out.println("u");
this.arraySquares=arraySquares;
this.mPiece=mPiece;
this.piece=piece;
canDo=false;
String type=piece.getType();
//I try the possible moves
if(type.equals("pawn"))
canDo=p.tryMove(array... |
4b1d4f74-cd4a-4e12-ba85-09a66c85ec03 | 5 | public static int importGraph(Path graph) throws Exception {
Configuration conf = HBaseConfiguration.create();
HBaseAdmin hbase = new HBaseAdmin(conf);
if(hbase.tableExists(TABLE_NAME)) {
hbase.disableTable(TABLE_NAME);
hbase.deleteTable(TABLE_NAME);
}
if(hbase.tableExists(SYNC_TABLE_NAME)) {
... |
cbc9cc90-95b3-4379-930e-f3d01d4104ac | 8 | public void setToInverseL( double a[] ) {
// TODO reorder these operations to avoid cache misses
// inverts the lower triangular system and saves the result
// in the upper triangle to minimize cache misses
for( int i =0; i < n; i++ ) {
double el_ii = t[i*n+i];
... |
56542775-6747-4243-a5c8-4c519e118c3b | 4 | private boolean check() {
// check that hash table is at most 50% full
if (M < 2*N) {
System.err.println("Hash table size M = " + M + "; array size N = " + N);
return false;
}
// check that each key in table can be found by get()
for (int i = 0; i < M; i... |
69cf8077-afa2-4392-bbc7-3c5e37de0eb4 | 1 | private void reload_buildPropButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reload_buildPropButtonActionPerformed
try {
jTextArea1.setText(selectedDevice.getBuildProp().getProp());
} catch (IOException ex) {
logger.log(Level.ERROR, "An error occurred whi... |
b4e33b8d-6931-4b11-adc5-3855c0816015 | 4 | public void checkInvvariants() {
contratPere.checkInvariants();
if(!(super.getForceVitale() >= 3 && super.getForceVitale() <=11))
throw new InvariantError("3 <= getForceVitale(P) <= 11");
if(!(super.getNbBombes()>=0))
throw new InvariantError("getNbBombes(P)>=0");
if(!(super.getCompteurFireSuit()>=0))
... |
cdc22387-d61a-440c-91e7-52ab1a06a72c | 9 | public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst...
// harga = 444;
int ribuan[] = new int[10];
int counter=0;
String temphasil="";
while(harga/1000!=0){
ribuan[counter] = harga%1000;
counter++;
//temphasil = temphasil + ribuan+".";
harga = harga /1000... |
b1e64b5c-3bf4-46d2-ae2f-655b0824eb36 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
7a9b0939-4dce-40f1-8a20-13756ea09e4d | 5 | public animation(){
for (int i = 0; i < pokemons.length; i++) {
pokemon monster = new pokemon();
monster.displacementX = ((Math.random() * (box.resolution().width-210)))+15;
monster.displacementY = ((Math.random() * (box.resolution().height-210)))+15;
monster.constantAcc = playSpeed;
monster.xIncremen... |
84d5596a-7332-4b35-80a8-23f108fca2f2 | 7 | public Set<Location> getEmptyLocations(int row, int col, int dist) {
Set<Location> locations = new HashSet<>();
for (int x = row - dist; x <= row + dist; x++) {
if (isInBounds(x)) {
for (int y = col - dist; y <= col + dist; y++) {
if (isInBounds(y) && this... |
d7f55d07-459d-425d-84c2-b64a001dde5e | 0 | public List findByContestId(Object contestId) {
return findByProperty(CONTEST_ID, contestId);
} |
4c9c844d-fb74-4533-85aa-010ca4e3a059 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
4e8bca89-3f69-4d41-bd5f-e2da31bc4d9c | 5 | public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... |
44e04e0e-e3b9-4831-a80c-c82ae0bbbb25 | 9 | public synchronized BufferedImage getScaled( Getter<BufferedImage> populator, int width, int height ) throws ResourceNotFound {
int firstAvailableSlot = -1;
int hash = (width ^ (height << 16)) & Integer.MAX_VALUE;
if( scaled == null ) {
@SuppressWarnings("unchecked")
SoftReference<BufferedImageWithFlipBi... |
48aed447-b5e7-455f-b0dd-7507c57cdc3a | 2 | private boolean testaaVaakarivi(Piste p0) {
Piste p1 = new Piste(p0.getX(), p0.getY());
for (int i = 0; i < 24; i++) {
if (testaaPiste(p1)) {
return true;
}
p1.siirra(1, 0);
}
return false;
} |
34390bee-a642-4bb4-a98d-ba695e9c88ea | 4 | public String generate() {
String error = "No errors.";
if (details)
System.out.println("Humidity flags: PRODUCE="+ioflags.PRODUCE+", SAVE="+ioflags.SAVE+", LOAD="+ioflags.LOAD);
if (Utils.flagsCheck(ioflags) != 0) {
System.out.println("ERROR: IOFlags object is corrupted, error: "+Utils.flagsCheck(iof... |
12ec89c7-d12d-4ab4-82ce-16c35e9e3ee6 | 5 | private byte[] readInputStreamBurstMode(InputStream is, int length) {
try {
byte[] data = new byte[length];
// changes per alaz
int off = 0;
int toRead = length - off;
while (toRead > 0) {
int readLength = is.read(data, off, toRead);
if (readLength == -1) {
throw new BeanstalkException(St... |
76f61860-28b2-48b3-a1a2-8133f555c2b9 | 3 | private static void solve(int []width, String []entexits) {
// iterate of the ent exits
for (String str: entexits){
int ent = Integer.parseInt((str.split(" ")[0]));
int exit = Integer.parseInt((str.split(" ")[1]));
int min_width = Integer.MAX_VALUE;
for (int i = ent;i<=exit;i++){
if(width[i]<min_... |
1091c5e3-2acd-42e9-93be-28a08a022c77 | 7 | public Point mousePosToTile(int mousex, int mousey)
{
final int w = map.getWidth();
final int h = map.getHeight();
int best = 99999999;
int bestRow = 0;
mousex -= tileLocator.getCursorX() / 2;
mousey -= tileLocator.getRasterY() / 2;
// Find best row... |
48dd1ccb-4607-42ad-9d4d-dd53c1dd2bb5 | 4 | public void startMoving(Direction dir) {
move(dir);
int last = queuedMoveDirectionPreferences.length - 1;
int dirIndex = last;
for(int i = 0; i < last && dirIndex == last; i++)
if(queuedMoveDirectionPreferences[i] == dir)
dirIndex = i;
for(int i = dirIndex; i >= 1; i--)
queuedMoveDirectionPreference... |
9a2e35be-0cd6-4197-857b-2a0834099e09 | 0 | public MessageImplXml() throws DaoException {
super("/xml/Message.xml", Message.class);
} |
a20faea4-be97-4d8b-a5f4-66b5a3a199df | 3 | private ModelAndView getModelAndView(Method handlerMethod,
ServletWebRequest webRequest, MapEntry exceptionProcessor,
Exception ex) throws Exception {
HttpStatus responseStatus = exceptionProcessor.httpStatus();
webReques... |
f7ac1c94-d9c2-41ef-9c61-ef61f95b5e2f | 6 | @Override
public void run() {
while (true) {
try {
int connection = selector.select(250);
if (connection > 0) {
for (SelectionKey newKey : selector.selectedKeys()) {
if (newKey.isReadable()) {
... |
7685b84a-a60b-4c19-a887-6141a5f6a8e5 | 0 | public void setGraphX(int x) {
this.graphX = x;
} |
ae3851cd-19c7-4025-b49c-f4fabd216f57 | 3 | public static void draw(String[] header, int[] layout, String[][] data) {
int innerWidth = 0;
for (int i : layout) {
innerWidth += i;
}
System.out.println(" ├──┬" + multiString("─", h(header, layout).length()) + "┐");
System.out.println(" │ │ " + h(header, layout));... |
a4ec294c-ad5f-415c-8455-4cb771324cb4 | 9 | @Override
public List<T> findAll(
HolderReader<? extends Locator, ? extends LocatorHolder<? extends Locator>> locatorReader,
String applicationHomeDir) throws JAXBException {
LocatorHolder<? extends Locator> holder = locatorReader.getHolder(locatorReader.getFilePath(applicationHomeDir));
if (holder == null ... |
2fe597b7-61aa-442c-8059-2174633c111c | 1 | public void draw() {
for(int x = 0; x<nodes.size() - 1; x++) {
GL11.glPushMatrix();
GL11.glTranslated(nodes.get(x).getX() - Theater.get().getScreen().camera.getX(), nodes.get(x).getY() - Theater.get().getScreen().camera.getY(), 0);
GL11.glColor3d(0, 1.0, 1.0);
GL11.glLineWidth(1.0f);
GL11.glBegin(G... |
767b297a-3aeb-49b2-88ae-f2f79bac1173 | 8 | public void addLogs(ArrayList<WorkLog> logs, boolean testMode) throws ClassNotFoundException, SQLException, Exception {
String insertString =
"INSERT INTO task_log "
+ "(task_log_task, task_log_description, task_log_creator, task_log_hours, task_log_date, task_log_name)"
... |
c8e2ddf6-23e7-495d-b566-36826f72eb9a | 8 | private final static long from64(byte[] encoded, int idx, int size) {
long res=0;
int f=0;
while(size>0) {
size--;
long r=0;
// convert encoded[idx] back into a 6-bit value.
byte d=encoded[idx++];
if(d=='/') {
r=1;
}
if(d>='0' && d<='9') {
r=2+d-'0';
}
if(d>='A' && d<='Z') {
... |
e94905c9-64bd-4be1-9bb5-14f8d2c8833c | 4 | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String login = req.getParameter("login");
String pass = req.getParameter("password");
User user = userDao.getUserByLogin(login);
if (pass.equals(user.getPass()) && (user.getAccess() =... |
ee2f337a-6252-49cb-b11b-b2a912396010 | 9 | static double[] dataLightSubprocessor(String datain) {
// possibly add # replacement value
String[] dataInSplit = datain.replaceAll("@", " ").replaceAll("_", " ")
.split(" ");
//
if (dataInSplit.length != 175)
System.out.println(dataInSplit.length);
double[] processed = new double[dataInSplit.length];
... |
fb8d326d-7241-40fd-beaf-e5f3c3a5bbb3 | 7 | public void findUnique() throws IOException {
BufferedReader br = new BufferedReader(new FileReader(filename));
String line;
int i;
while ((line = br.readLine()) != null) {
int[] counts = new int[10];
int lowestUnique = 0;
String[] nums = line.split("\\s");
for (i = 0; i < nums.length; i++) {... |
e8fea4a9-0bae-4e37-bbd8-8c797a9f9a86 | 2 | private void buttonListening(){
loadFileButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt) {
// TODO Auto-generated method stub
JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(null);
if(returnVal == JFileChooser.APPROVE... |
a81dbce6-8288-470c-94d4-49387cae28a9 | 2 | public Boolean initialize() {
try {
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:" + SQLFile.getAbsolutePath());
return true;
} catch (SQLException ex) {
core.writeError("SQLite exception on initialize " + ex, true);
} catch (ClassNotFou... |
f89771b5-ba11-4ebb-a615-1ee6349df790 | 4 | public void show(String person) {
try {
ArrayList<User> users = DataBase.getInstance().getUsers();
for (Iterator it = users.iterator(); it.hasNext();) {
User user = (User) it.next();
if (user.getLogin().equals(person)) {
ArrayList<Signa... |
cc6a935a-0b62-40ac-9f24-d5b63a91d85f | 9 | private Status locateTrack() {
int x = tile.xCoord;
int y = tile.yCoord;
int z = tile.zCoord;
Status status = testForTrack(x, y, z);
if (status != Status.INVALID)
return status;
status = testForTrack(x - 1, y, z);
if (status != Status.INVALID)
... |
6ebea5dd-50ed-43c9-95ba-8c60368d053f | 9 | protected void updateMessageLabel() {
if (fMessageLabel != null && !fMessageLabel.isDisposed()) {
Display display = fMessageLabel.getDisplay();
if ((fErrorText != null && fErrorText.length() > 0)
|| fErrorImage != null) {
fMessageLabel.setForeground(JFaceColors.getErrorText(display));
fMessageLabel... |
0beed46a-85cc-48f4-8df1-f6f1d3191f44 | 9 | public Object solution (JSONArray args) {
// input / output
long maxRank = (Long) args.get(0);
long maxFile = (Long) args.get(1);
List<Long> rank = (List<Long>) args.get(2);
List<Long> file = (List<Long>) args.get(3);
// create Set of all re... |
d889c111-b17d-4a4e-9b78-e9ce16854f81 | 3 | public static void main( String[] args ) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
GraphPanel panel = new GraphPanel();
frame.add( panel );
frame.setBounds( 20, 20, 1000, 900 );
Graph graph = new Graph();
panel.setGraph( graph );
for( int i = 0; i < 8; i++... |
c274c660-e53b-42e5-8424-51e61ac94fdf | 3 | @Override
public int calculateWriteSize()
{
if (_isStaticSize)
{
return _writeSize;
}
_writeSize = 0;
IDeserializer currentDesirealizer;
for (int i = 0; i < deserializersCount; i++)
{
currentDesirealizer = deserializers.get(i);
currentDesirealizer.setValue(input.get(i));
if(currentDesireal... |
fbdbc8ae-81ea-4f23-8d19-521a4bcf7bb4 | 8 | public QueryString check(AuthParameters auth, QueryString queryString)
throws MalformedURLException, IOException, NoSuchAlgorithmException {
if (auth.getAuthWithApiId() && auth.getApiId() != null) {
queryString.add("api_id", auth.getApiId());
} else if (auth.getAuthWithoutToken() && auth.getLogin() != null
... |
9c729c9b-4a3e-4898-9d53-c15edbbf22bb | 2 | public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... |
a0fa6092-9b87-4d70-a2d0-831ea2711084 | 9 | public ErrorData(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "errorId") ) {
this.errorId = Integer.valueOf(map.get(prefix + "errorId"));
}
if( map.containsKey(prefix + "domain") ) {
this.domain = map.get(prefix + "domain");
}
if( map.containsKey(prefix + "subdomain") ) {
t... |
2d24ade0-685e-4f5d-9dde-350719dfeeec | 0 | public String getTwitter_user_name() {
return twitter_user_name;
} |
3415be33-1b41-4419-a459-3dbbc2afef03 | 7 | private Map<Vehicle, Node> getNodes(Position position, Set<Vehicle> set) throws IllegalArgumentException {
if (position == null || set == null) {
throw new IllegalArgumentException();
}
// Create a HashMap if it doesn't exist.
if (nodes.get(position) == null) {
nodes.put(position, new HashMap<Vehicle, ... |
b50a0a81-baa7-49a3-aefe-8c4dd06bdce9 | 2 | public int getPlayerUnits(PlayerColor owner){
int count = 0;
Iterator<Integer> iter = keySet().iterator();
while(iter.hasNext()){
Integer key = iter.next();
if(m_territories.get(key).getOwner() == owner){
count += m_territories.get(key).getUnitNumber();
}
}
return count;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.