method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2f579f7a-3435-4c0a-9629-42455d1df7c9 | 9 | public void decode( ByteBuffer socketBuffer ) {
assert ( socketBuffer.hasRemaining() );
if( DEBUG )
System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(), socketBuffer.remaining() ... |
649dd01a-c385-4a78-819f-d4ccff89c374 | 5 | @Override
public void zoneChanged(PointEvent event) {
if (event.isInZone(Zone.BACK)) {
dispatchMouseEvent(event, MouseEvent.MOUSE_PRESSED,
MouseEvent.BUTTON1_DOWN_MASK, MouseEvent.BUTTON1);
} else if ((event.leftViewPort() && event.wasInClickZone()) ||
(event.wasInClickZone() && !event.isInClickZone())... |
8f307fd3-7907-41a1-9855-62cb9eb3549d | 2 | public List<Client> ListerClients() {
try {
String sql = "SELECT * FROM User WHERE role='Client'";
ResultSet rs = crud.exeRead(sql);
List<Client> liste = new ArrayList<Client>();
while (rs.next()) {
Client c = new Client();
c.setLog... |
0cfdd19e-3e4d-4665-af61-e097c7738b8c | 7 | @SuppressWarnings("unchecked")
private static HashMap<String,Object> theBaseLoop(LoadedQuest q, String what){
//Set this up so we can check for the cool uQuest.levelplugin.exp.class.amount etc etc.
//You can't split at a "." for a reason I don't know, so we convert it first! This way we can keep to bukkit's '.' st... |
065e469e-36c5-4071-9e25-2c0fb4c50b37 | 5 | @Override
public int doEndTag() throws JspException {
try {
final HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
final JspWriter out = pageContext.getOut();
final String whereFrom = request.getHeader("referer");
if (whereFrom == null) {
System.out.println("Warning: BackRef... |
5aab54c8-05cd-4827-bbdb-8a407d34b19c | 0 | private void doStart() throws Exception {
//..start server socket and listener
listener = new ServerSocket(getEndPoint().getPort(), 0);
doSetActive(true);
//..notify start server event
fireServerStarEvent(new ServerStartEvent(this));
//..start listener connections
Thread thread = new Threa... |
8b07c58f-6db2-43bb-904b-70bfb8cf6704 | 5 | @Override
public void pursue() {
if (!checkArmyStatus()) {return;}
if (root != null) { // root == null means this is FormOwnArmy
Set<FormArmyQuest> army = getRoot().getArmy();
if (army != null) {
Clan recruiter = getRoot().getDoer();
if (Me.currentShire() == recruiter.currentShire()) {army.add(this);... |
9efa20cd-ecd3-4992-9293-be203a7ac0e2 | 1 | private void compute_pcm_samples14(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[14 ... |
522ac728-a255-4216-a468-4dc5a56d285a | 4 | private static void checkAndDeleteFile(FileSystem fileSystem, String file) throws TestFailedException {
try {
if (fileSystem.pathExists(file))
fileSystem.deleteFile(file);
if (fileSystem.pathExists(file))
throw new TestFailedException("I have closed all handles, therefore I should be able to delete ... |
a7c7c3b1-54a5-48eb-98b4-dd027cbc77f0 | 5 | public static MapleJob getBy5ByteEncoding(int encoded) {
switch (encoded) {
case 2:
return WARRIOR;
case 4:
return MAGICIAN;
case 8:
return BOWMAN;
case 16:
return THIEF;
case 32:
return PIRATE;
default:
return BEGINNER;
}
} |
eb58d174-d022-46c6-b852-32d44e45b002 | 9 | @Override
public String generatePassword() {
String password="";
Random random=new Random(new Date().getTime());
switch(random.nextInt(6)){
case 0: //sqrt
{
int rand=random.nextInt(99);
if(random.nextBoolean()){
password="sqrt+("+Double.toString(Math.pow(rand,2))+")=="+Integer.toString(rand);
} ... |
cc173360-4d9d-4dd9-8223-012936ea2036 | 7 | public void rescueSettlement(Place p, Settlement s)
{
s.setFreed();
if(this.isLiving)
{
move(p,s);
}
if((this.isLiving) || (this.getXPosition() >= s.getXPosition()-1 && this.getXPosition() <= s.getXPosition()+1 && this.getYPosition() >= s.getYPosition()-1 && this.getYPosition() <= s.getYPosition()+1))
... |
5a15cdc4-9226-4458-84dc-994ee07bb782 | 4 | public Object getProperty(Object object, String name) throws Exception {
Object result = null;
try {
Class<?> c = object.getClass();
Field field = c.getDeclaredField(name);
if (!Modifier.isPublic(field.getModifiers())) {
throw new Exception(
"Property " + object.toString() + ... |
cf318bb0-8996-4509-ab3e-f2655bab2236 | 0 | public void setPiece(Piece piece) {
this.placedPiece = piece;
} |
8aae5def-fc04-4858-9d74-476dcd72a955 | 2 | public boolean creationDossier(ObjectInputStream input, ObjectOutputStream output) throws IOException
{
String dir = input.readUTF();
String[] tab = dir.split("/\\\\");
File parent = root;
for (String child : tab)
parent = new File(parent,child);
... |
6fadb5fa-b1ee-49db-b4f9-ab1dc88ee5a1 | 6 | private boolean solvePlusInGroup(int l, int r)
throws ContradictionException {
boolean tableModified = false;
int pluses = 0;
for (int i = l; i < r; ++i) {
if (table[i][ENV_COL] == Resolution.Plus) {
++pluses;
}
... |
a5fccec2-2193-4e27-9480-6216b62a704f | 6 | @Override
public void update(float tpf) {
super.update(tpf);
if(enabled){
timer+=tpf;
if(timer>maxTime){
if(spatial.getParent()!=null){
space.removeCollisionListener(this);
space.remove(this);
spatial... |
1622b36d-96e8-49ff-9ffc-cf9565a95007 | 8 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("PromoteDemoteAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c... |
391577e6-3b8c-4457-9966-1fc498901aef | 0 | public String getSource(){
return this.source;
} |
3ad6a6e0-d9c7-42e4-a3cf-6c11c1ba0081 | 3 | @EventHandler
public void onBlockBurn(BlockBurnEvent event){
if(event.getBlock().getTypeId() != 0){
plates = plugin.getPlates();
for(int i = 0; i< plates.size(); i++){
Location loc = new Location(event.getBlock().getWorld(),event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlock... |
6ba62592-465a-4e03-8055-f6a34feaca60 | 4 | public LinkedHashMap<Integer, ?> leer(String rutaFichero, Dato dato) {
LinkedHashMap<Integer, ?> map = new LinkedHashMap<>();
switch (dato) {
case PERSONA:
map = leerPersonaXStream(rutaFichero);
break;
case COMPRA:
map = leerCompras... |
0515ba30-3de5-4c39-bfb4-19efa3a6361c | 9 | @Override
public void paintHandlers(final Graphics2D g) {
final ElementHandlers handlers = getComponent().getHandlers();
if (handlers == null)
return;
final AffineTransform oldTransform = g.getTransform();
g.translate(handlers.getX(), handlers.getY());
g.setPai... |
2e5e0f47-0ef3-40b8-9738-910c690a4673 | 1 | private void goForward() {
try {
myCurrentPosition++;
String url = (String) myURLHistory.get(myCurrentPosition);
setDisplay(url);
} catch (Throwable e) {
myCurrentPosition--;
}
} |
d67772a8-f4f9-4991-a41e-6e4a0eab5a69 | 0 | public Document getMostRecentDocumentTouched() {
return this.mostRecentDocumentTouched;
} |
abc8b2c5-e2fa-49a9-b00d-579898b0c984 | 8 | public int getAnotherDirection(Case position){
List<Integer> voisines = new ArrayList<Integer>();
if((position.getCaseNumber()-16) > 0){
if(!path.contains(field.casefield[position.getCaseNumber()-16])){
voisines.add(0);
}
}
if((position.getCaseNumber()%16) != 15){
if(!path.contains(fie... |
fa88d7f8-a470-4d09-ab66-873ac63d1c2b | 4 | public boolean getStatus() {
boolean flag = true;
int i, j;
for (i = 0; i < 9; i++) {
for (j = 0; j < 9; j++) {
if (m_grid[i][j] == 0) {
isSolved = false ;
flag = false;
break;
}
}
}
if(flag == true)
isSolved = true;
return flag;
} |
36fa56cf-e0d0-4955-a5e1-48605c82a0c1 | 2 | public static void createKnownPlagiarismList(File filepath) {
knownPlagiarism.clear();
try {
Scanner s = new Scanner(filepath);
while (s.hasNext()) {
knownPlagiarism.add(s.next());
}
s.close();
} catch (FileNotFoundException fnf) {... |
f0f59920-0b72-4483-844e-bced57f6c926 | 0 | public void setRight(boolean right) {
this.right = right;
} |
7a7e895f-b86c-403c-947c-5e5d0bca5932 | 2 | @SuppressWarnings("resource")
private static void printCnt() throws IOException {
FileWriter writer = new FileWriter(new File("./Counters/counters" + System.currentTimeMillis() + ".txt"));
int min = 0;
while (true) {
System.out.println("\n\nmin: " + min + " written to database, " + database_cnt + " ,fetched:... |
18c8411a-eb82-4697-9cf2-7a3bb138d5cc | 2 | public Forme() {
this.setTitle("Jeu du Taquin");
this.setSize((getNbCarreaux() + 2) * getTaille() + 4, (getNbCarreaux() + 2) * getTaille() + 50);
this.setLocationRelativeTo(null);
//this.setResizable(false);
temp = this;
//cr�er un objet Panneau sans image
pan = ... |
a83bf0d4-dcae-4e0a-b8f5-bf877b15a77b | 5 | @Override
public void mouseReleased(MouseEvent e)
{
if (!e.isConsumed() && first != null)
{
if (preview != null && preview.isVisible())
{
if (isLabel(index))
{
moveLabel(e);
}
else
{
resizeCell(e);
}
}
e.consume();
}
super.mouseReleased(e);
} |
8f12e2c3-06d0-48df-8f0f-32eb84c1eb58 | 0 | @FXML
private void handleBtnPrevAction(ActionEvent event) {
move(-1);
} |
e92dbbe7-2b15-43d4-9f1e-1077cba2044f | 3 | public synchronized void agregarProceso(Proceso p)
{
while(disponible==true)
{
try
{
wait();
}catch(InterruptedException ex)
{
JOptionPane.showMessageDialog(null, "Error de ejecución, respuesta del sistema: "+ex.getMessa... |
3404b796-a29e-4cae-bf08-9beffd3fdd43 | 2 | private int getLastColumnIndex(String modelingTime) {
int result = 0;
for (int j = 0; j < parsedLines[0].length; j++) {
if (modelingTime.equals(parsedLines[0][j])) {
result = j;
break;
}
}
return result;
} |
b4c8fb86-4ced-43f5-8be4-1f87fc442680 | 8 | public static int Eval(int[][] board, int playerID)
{
singlePointGiven = new int[board.length][board[0].length];
int eH = EvalHorizontal(board, playerID);
if (eH == maxValue || eH == -maxValue) return eH;
int eV = EvalVertical(board, playerID);
if (eV == maxValue || eV == -maxValue) return eV;
int eDL =... |
faac3667-63cd-4013-acc2-07b1f4766fdc | 1 | private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
if(this.jFrame1.isVisible())
this.jFrame1.setVisible(false);
else
this.jFrame1.setVisible(true);
this.jFrame1.setLocation(450,230);
this.jSlider1.addChan... |
04095907-035f-4db9-9156-1c657daf3cd7 | 7 | @Override public <T extends Comparable<? super T>> void merge(final T[] a,
final int start, final int middle, final int end)
{
assert start >= 0;
assert start < middle;
assert middle < end;
assert end <= a.length;
/** I don't know a better way to create a generic array. */
final T[] b = (T[])new Compara... |
3094a2be-0685-4ff9-8042-2464ed8aa72f | 4 | private void processInsert(int idOrdinal) throws SQLException {
RowsIEventData data = (RowsIEventData)rowEvent.getData();
Set<ToiValue> vValueList = ToiContext.getToiValue(new ToiEntry(schema, table));
for(RowsIEventData.Row row: data.getRows()) {
for(ToiValue toiValue : vValueList) ... |
1bb07afb-cc4e-418d-ac76-4227b1adf16d | 4 | @Override
public String getAxisWithMeaning(long axisWithoutMeaning[])
throws AxisWithoutMeaningErrorException {
for (long axis : axisWithoutMeaning) {
System.err.print(axis);
}
System.err.println();
if (axisWithoutMeaning.length == 1) {
valid((int)... |
102d20e1-c7cd-44cc-9947-e10474e41168 | 5 | @Override
public void keyReleased(int keyCode, char keyChar) {
// Display FPS toggle
if (keyCode == Input.KEY_F) {
gc.setShowFPS(!gc.isShowingFPS());
}
// Reset game
if (keyCode == Input.KEY_R) {
reset();
}
// Performing tile set move... |
adbbad08-dd55-4814-9ed8-7bd47e4dc393 | 1 | @Override
public int create(Recipe recipe){
Map<Ingredient,Quantity> ingredients = new HashMap<Ingredient,Quantity>();
for(Ingredient i : recipe.getIngredients().keySet()){
Ingredient ingredient = ingredientService.create(i);
ingredients.put(ingredient, recipe.getIngredients().get(i));
}
recipe.setIngred... |
e858c7a2-c24d-42be-8153-6795858fa503 | 6 | public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length <... |
53021df4-f5a7-4ac7-851f-a9a8d419ec98 | 9 | protected Iterable<? extends Assigner<? super Item, ? super Item>> assigners(final Assignment<? extends Item> assignment) {
final Type<?> thisType = this.type(), thatType = assignment.value().type();
return Iterables.filteredIterable(Filters.nullFilter(), Iterables.convertedIterable(BaseItem.FIELD_ASSIGNER_CONVERTE... |
05ac05fe-7b98-4f09-acf1-9b52965700b0 | 2 | public int getAllele(int index){
int allele = 0;
int firstBitIndex = index*environment.bitsPerAllele;
int bitsToGo = environment.bitsPerAllele;
int byteIndexInGene = firstBitIndex/Byte.SIZE;
int inBitsFromRight = Byte.SIZE-firstBitIndex%Byte.SIZE;
allele |= geneData[byteIndexInGene];
//remo... |
34981661-ebfa-4cbe-aaaf-b3b4104265bb | 1 | @EventHandler
public void onInventoryPickupItemEvent(InventoryPickupItemEvent event) {
if (event.getInventory().getHolder() instanceof Hopper) {
Hopper hopper = (Hopper) event.getInventory().getHolder();
hopperHandler(hopper, event.getItem().getItemStack(), event);
}
} |
c29de16c-f2c3-4b6a-bb49-023d3407ce8e | 5 | private int checkFrameLimit()
{
int currentFrame = 1;
for (int i = 0; i < rollCount; i++)
{
int pinsKnockedDown = pinsKnockedDownArray[i];
if (currentFrame == 10)
{
return 10;
}
if (pinsKnockedDown == 10)
{
currentFrame++;
}
else if (pinsKnockedDown > 0)
{
int j = i + 1;
... |
4941b789-0c46-4afc-89ab-cce3e33db93e | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TestUser)) return false;
TestUser that = (TestUser) o;
if (years != that.years) return false;
if (!name.equals(that.name)) return false;
return true;
} |
3721eade-8df8-4dd7-a8f5-8d0146cbc70c | 8 | public static void main( String[] args )
{
System.out.println( "NanoHTTPD 1.0 (c) 2001 Jarno Elonen\n" +
"(Command line options: [port] [--licence])\n" );
// Show licence if requested
int lopt = -1;
for ( int i=0; i<args.length; ++i )
if ( args[i].toLowerCase().endsWith( "licence" ))
{
lopt = i;... |
8cbbbc17-0f04-41ff-95de-9a0bd06c67e8 | 7 | private int search(int[] A, int b, int e, int target, boolean front) {
if (b >= e)
return -1;
if (b + 1 == e) {
if (A[b] == target)
return b;
return -1;
}
int mid = (b + e) / 2;
if (A[mid] == target) {
int k;
if (front) {
k = search(A, b, mid, target, front);
} else {
k = search(... |
7d0b5d04-a966-436e-8bb9-11e764515f2c | 3 | public void layoutContainer(Container paramContainer) {
Component[] arrayOfComponent = paramContainer.getComponents();
this.counter = 0;
for (int i = 0; i < arrayOfComponent.length; i++)
{
Component localComponent = paramContainer.getComponent(i);
if (this.horizontal)
localComponen... |
35e52dc9-c29c-4652-ac4e-28c845c8faec | 6 | private static CLICache getCache(boolean createCache) throws IOException {
String cwd = (new File(".")).getCanonicalPath();
File cacheDir = new File(cwd, ".wormarc");
if (!(cacheDir.exists() && cacheDir.isDirectory())) {
if (!createCache) {
throw new IOException("No ... |
991e3404-8979-443e-88d2-dd33ea57f393 | 9 | public void generateNetherTerrain(int par1, int par2, byte[] par3ArrayOfByte) {
byte b0 = 4;
int k = b0 + 1;
byte b2 = 17;
int l = b0 + 1;
this.noiseField = this.initializeNoiseField(this.noiseField, par1 * b0,
0, par2 * b0, k, b2, l);
for (int i1 = 0; i... |
e42d57a9-504c-4e19-833d-44b94c09b51c | 1 | public void write7bytes(long n) throws IOException {
long b0 = n & 0xff;
long b1 = (n & 0xff00) >> 8;
long b2 = (n & 0xff0000) >> 16;
long b3 = (n & 0xff000000) >>> 24;
long b4 = (n & 0xff00000000L) >> 32;
long b5 = (n & 0xff0000000000L) >> 40;
long b6 = (n & 0xff000000000000L) >> 48;
if (le) {
write... |
71361312-cb95-43f5-96b6-cd91a660fafb | 8 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int N = in.nextInt();
in.nextLine();
boolean[][][] space = new boolean[N][N][N];
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
{
String nextLine = in.nextLine();
for (int k = 0; k < N; k++)
if (nextLine... |
65638058-6515-4a4d-bb3f-de81b30e9bcf | 8 | protected Dimension calculateSize(boolean minimum) {
int tabPlacement = tabPane.getTabPlacement();
Insets insets = tabPane.getInsets();
Insets contentInsets = getContentBorderInsets(tabPlacement);
Insets tabAreaInsets = getTabAreaInsets(tabPlacement);
Dimensi... |
79626148-e8d6-436a-9691-55d62f0c1101 | 9 | public static void main(String[] args) throws Exception {
FileWriter result = new FileWriter(".desktop");
result.append("[Desktop Entry]\n");
result.append("Version=1.0\n");
result.append("Type=Application\n");
result.append("Name=FreeCol\n");
result.append("Exec=freeco... |
6ce6443f-aec3-4534-bc64-4114e53728ab | 3 | @Override
public ResultSet fillData(String command) {
try {
if (connection.isClosed())
Connect(server);
} catch (SQLException e) {
Connect(server);
}
try {
return connection.prepareStatement(command).executeQuery();
} catch (SQLException e) {
e.printStackTrace();
return null;
}
} |
78b5a3f6-5f16-4c7a-978d-c6d014f7c501 | 9 | @SuppressWarnings("static-access")
private void manejarDiscovery() throws UnknownHostException, IOException {
PaqueteDHCP data = new PaqueteDHCP();
data.setOP((byte) 0x02);
data.setHTYPE(pack.getHTYPE());
data.setHLEN(pack.getHLEN());
data.setHOPS((byte) 0x00);
data.setXID(pack.getXID());
byte[] a = { h... |
0004f7cf-54f8-47c5-9eaa-9f874b40357f | 0 | public Rule(String source, String dest, String kind, Integer seqNum,
Boolean duplicate, String action) {
this.source = source;
this.dest = dest;
this.kind = kind;
this.seqNum = seqNum;
this.duplicate = duplicate;
this.action = Action.valueOf(action);
} |
e0a64c94-f8fc-4ed9-b7c8-920a8be5c106 | 2 | public Map<String, Object> getPlayerInfo(String playerId) {
for (Map<String, Object> playerInfo : getPlayersInfo()) {
if (playerId.equals(playerInfo.get(PLAYER_ID))) {
return playerInfo;
}
}
return null;
} |
51068ec2-4b54-4bea-81bc-cb360db02a92 | 7 | public void readFile() {
int x = 0;
if (scanner.hasNext()) {
totalElements = Integer.parseInt(scanner.next());
elementStringArray = new String[totalElements];
elementListArray = new String[totalElements][totalElements];
}
if (scanner.hasNext()) {
totalStartingElements = Integer.parseInt(scanner.next... |
46db68f1-e71e-4d78-aade-8844972a9ea1 | 0 | @Override
public double getHig() {
return hight;
} |
5d78cd29-a731-49d3-9fff-d656c1bdab6f | 1 | private static String trim(String s, int width) {
if (s.length() > width)
return s.substring(0, width-1) + ".";
else
return s;
} |
3783e676-3aa7-49ac-b0af-650a5bb72242 | 2 | @Override
public boolean equals(Object obj) {
VariableAppearance appearance = (VariableAppearance) obj;
return (appearancePattern.equals(appearance.getAppearancePattern())
&& filePath.equals(appearance.getFilePath()) && parsingContext
.equals(appearance.getParsingContext()));
} |
61de65c5-5285-4608-aedc-0d362e596980 | 4 | public void generateDirectoryListing( UUID sid,
OutputStream out )
throws IOException {
FileHandler phpHandler = this.getHTTPHandler().getFileHandlerByExtension( ".php" );
try {
// Create some dummy values
HTTPHeaders dummyHeaders = new HTTPHeaders();
//URI dummyURI = new URI(... |
bbf8dfd9-d1eb-4698-ace6-938a2b3a963d | 9 | final public void Term() throws ParseException {
/*@bgen(jjtree) Term */
ASTTerm jjtn000 = new ASTTerm(JJTTERM);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Factor();
if (jj_2_36(2)) {
MultOp();
Term();
... |
26c954ea-d2a4-4127-b8aa-08638b9260f4 | 1 | public Class<?> getColumnClass(int columnIndex) {
return String.class;
} |
0d2cf55a-8b23-4184-8ee8-b9d95f967a90 | 8 | public boolean[] getCalibrateFlags(int length) throws IOException {
parseRange pr = new parseRange();
if (calibParam == null) { // determine calibFlags based on range matching param index
boolean[] calibrationFlags = pr.getArray(range, length);
return calibrationFl... |
1f6f5ea9-54eb-470c-87f8-e2c8fd5d45b4 | 7 | @Override
public List<IEntityObject> ExecuteQuery(Class<? extends EntityObject> c, NamedQuery query) {
Connection conn = null;
List<IEntityObject> res = new ArrayList<IEntityObject>();
try {
if ((conn = this.getConnection()) != null) {
Statement statement = conn.... |
caa8a4b1-5885-4909-a8f2-e90dbbd17ab2 | 3 | public byte[] _readValue(int key, String valueName) throws RegistryErrorException
{
try
{
byte ret[] = (byte[])queryValue.invoke(null, new Object[] {new Integer(key), getString(valueName)});
return ret;
}
catch (InvocationTargetException ex)
{
throw new RegistryErrorException(ex.... |
6ad9fd2b-6e1d-4526-b0cb-9508dc96b535 | 4 | private void handleShortOptionCluster( String candidate, ArgumentList arguments, OptionSet detected ) {
char[] options = extractShortOptionsFrom( candidate );
validateOptionCharacters( options );
for ( int i = 0; i < options.length; i++ ) {
AbstractOptionSpec<?> optionSpec = specFor... |
23f60438-a5aa-43b6-8025-9ce8a38cf092 | 3 | public void connect() throws ConnectionException {
if(clientConnection == null || clientConnection.isClosed()) {
try {
clientConnection = new ServerSocket(port);
}
catch(IOException e) {
throw new ConnectionException(e);
}
}
engine.start();
} |
9c00d167-3c46-45b4-989e-953b636ccfd1 | 8 | public void start() {
if (applet != null) {
applet.start();
return;
}
if (gameUpdaterStarted) return;
Thread t = new Thread() {
public void run() {
gameUpdater.run();
try {
if (!gameUpdater.fatalError)
replace(gameUpdater.createApplet());
... |
17198c3c-f6bf-472c-88e2-510c1ba0a9a1 | 3 | public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
if (opcode == INVOKEINTERFACE || opcode == INVOKEDYNAMIC) {
minSize += 5;
maxSize += 5;
} else {
minSize += 3;
maxSize += 3;
}
if (mv != null) {
mv.visitMethodInsn(opcode, owner, name, des... |
25ccf1b1-3801-44e0-8c4d-d147defe018f | 9 | private static boolean isExpandingValuable(BotState state, Region region) {
boolean isValuable = true;
// If there is an opponent in the SuperRegion where we want to expand
// then don't expand
SuperRegion desiredSuperRegion = getMostDesirableSuperRegionFromRegion(state, region);
if (desiredSuperRegion.hasEne... |
35fca553-f0b8-4f66-940d-1b70a8397bb0 | 3 | protected void selectionChanged() {
int index = list.getSelectionIndex();
int size = list.getItemCount();
removeButton.setEnabled(index >= 0);
upButton.setEnabled(size > 1 && index > 0);
downButton.setEnabled(size > 1 && index >= 0 && index < size - 1);
} |
1cf9b44a-022c-49aa-939b-e9b98a3c8c08 | 2 | public void Display()
{
this.DisplayColIndex();
this.DrawHorizontalLine();
for(int i = rows-1; i >=0; i--)
{
this.DisplayRowIndex(i);
this.DrawVerticalLine();
for(int j = 0; j< cols; j++)
{
... |
1b01df47-dc86-4975-b58a-8dc73b769ebb | 2 | public int update(Funcionario f) {
Connection con = null;
PreparedStatement pstm = null;
int retorno = -1;
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(UPDATE);
pstm.setString(1, f.getNome());
pstm.setInt(2, f... |
bb9142b9-0a0a-48dc-bdde-26732d25f564 | 2 | private void visit(EdgeWeightedGraph G, int v)
{
marked[v] = true;
for (WeightedEdge e : G.adj(v))
{
int w = e.other(v);
if (!marked[w])
pq.add(e);
}
} |
63b56a45-7679-43b5-92b5-e17cd81f1ee5 | 7 | @EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event){
player = event.getPlayer();
playerName = player.getName().toLowerCase();
String playerMessage = event.getMessage();
if (ghettoflaggedPlayers.contains(playerName)) {
ghettoClass.makeGhetto(player, playerMessage, event);
} else ... |
67e6c1b7-7f7a-4454-8552-fe703752d31d | 6 | public boolean wallCollision(){
int owlIsMovingX = 0;
int owlIsMovingY = 0;
if (owl.getMoveDirection().getWhere() == 0){
owlIsMovingX = 10;
} else if (owl.getMoveDirection().getWhere() == 1){
owlIsMovingX = -10;
} else if (owl.getMoveDirection().getWhere()... |
cf825637-323b-415f-867a-f158296eab49 | 1 | private static void creaInstancia() {
if (INSTANCE == null) {
INSTANCE = new ctrlTaller();
}
} |
2dcbd391-8a4d-4150-a9f8-75497dac44b5 | 3 | @SuppressWarnings("nls")
private static final boolean hasThousandsSuffix(String buffer) {
return buffer.endsWith("t") || buffer.endsWith("T") || buffer.endsWith("k") || buffer.endsWith("K");
} |
7a3e106a-6c1b-4e8b-b94d-a44c8cd9bb2f | 8 | private void exit(boolean b) {
if(b){
frame.setAlwaysOnTop(false);
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new MapFilter());
fc.setCurrentDirectory(RessourcesCreator.MAP_FOLDER);
fc.setAcceptAllFileFilterUsed(false);
if(current.getPath()!=null)
fc.setCurrentDirectory(current.getPa... |
a3b2c05b-393d-4c8f-9d49-e7aa570a0a0c | 8 | private void createHoverHelp(final Control control) {
if (control == null) {
return;
}
// If a control was provided, create the tipLabel -- if the text in the
// header is
// truncated, it will display it as a tooltip.
tipLabel = new Label() {
/**
* @see org.eclipse.draw2d.Figure#getToolTip()
... |
7cd6f945-bcb2-4758-95da-172b9e051bae | 5 | private void initializeReplicationAwareMappings() throws IOException {
Properties props = new Properties();
slaveAddresses = new HashSet<String>();
props.load(new FileInputStream(filePath));
this.masterAddress = props.getProperty(BookStoreConstants.KEY_MASTER);
if (!this.masterAddress.toLowerCase().startsWi... |
005523fa-f7ea-426e-a5f0-effa81f39c70 | 6 | public static void main(String args[]) {
//<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://download.oracle.com/javas... |
601730d5-d67e-4265-b20b-5131693e2dbd | 8 | public Value naryOperation(final AbstractInsnNode insn, final List values)
throws AnalyzerException {
int opcode = insn.getOpcode();
if (opcode == Opcodes.MULTIANEWARRAY) {
for (int i = 0; i < values.size(); ++i) {
if (!BasicValue.INT_VALUE.equals(values.get(i))) {
throw new AnalyzerException(insn, n... |
2f39a544-7523-467b-a0a3-5186ee98c882 | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
TreeNode<Integer> root = TestSwapTree.createTreeNode(1);
Map<Integer, TreeNode<Integer>> treeNodes = new HashMap<>();
treeNodes.put(1, root);
for (int i = 1; i <= n; ++i) ... |
2cdd6b59-6602-4377-b96c-efadd1d96ba5 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
594b2db6-375f-4850-b85d-6199da4601fb | 1 | public KeyStroke getKey() {
return false ? KeyStroke.getKeyStroke('a') : null;
} |
6167e009-659b-4b1b-9755-fd0445694d2a | 8 | @Override
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
// If we submit an answer
if (source == submit)
{
selectShowing = false;
WordFinder.kill();
this.submitAnswer();
this.conditionalClearInput();
... |
d2d35663-d3da-4a2d-b6a3-753e344a984c | 5 | @Test
public void testEquals()
{
System.out.println("equals");
Genotipo g1 = new Genotipo(5);
Genotipo g2 = new Genotipo(5);
Genotipo g3 = new Genotipo(5);
assertEquals(false, g1.equals(null)); //base
assertEquals(false, g1.equals("hola")); //base
... |
f6a75105-90c6-4b7c-baa0-715f4fa10da2 | 8 | @Override
public List<V_Es_Requerimiento> LIST_DGP_PROCESO(String id_dep, String id_dir, Boolean procAcad) {
this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "select * from RHVD_ES_REQUERIMIENTO where ES_PORCENT IS NOT NULL ";
sql += (id_dep.trim().equals(""))... |
fb4188c5-b746-4846-98cc-f422a285fa69 | 0 | private void redirect(String uri,HttpServletResponse response) throws IOException{
response.sendRedirect(uri);
} |
30130e42-efc9-48d8-b072-a609eb5ef6ae | 2 | public static OurList computeIntersection(OurList A, OurList B)
{
OurList duplicates = new OurList();
for(int i = 0; i<A.size(); i++)
{
String s = A.get(i);
if(B.contains(s))
{
duplicates.add(s);
}
}
ret... |
960f2a88-4373-4f88-acba-00b73d73aeb5 | 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... |
aaacad33-8c52-48f6-b09a-8e4d78c6b223 | 2 | static void read() {
while (!Thread.currentThread().isInterrupted()) {
Lock readLock = rw.readLock();
long val;
readLock.lock();
try {
val = counter;
} finally {
readLock.unlock();
}
System.out.println(Thread.currentThread().getName() + ": " + val);
try {
Thread.sleep(200);
} ca... |
0b940349-2069-4830-a57e-8bb1c3e6416c | 9 | private Object readArgument(char type) {
switch (type) {
case 'i' :
return readInteger();
case 'h' :
return readBigInteger();
case 'f' :
return readFloat();
case 'd' :
return readDouble();
case 's' :
return readString();
case 'c' :
return readChar();
case 'T' :
return ... |
1a6a7f16-195c-46c6-b182-c09bf577bfce | 2 | public static Point2D.Double randomPointInCircle(double radius, Point2D.Double origin, double theta, double offset) {
Random randomGen = new Random();
if (origin == null) {
origin = new Point2D.Double();
}
double u = (randomGen.nextDouble() * radius) + (rand... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.