method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
27774370-d5d3-427d-9d0e-e683e642caa5 | 7 | public static ByteBuffer decode(PDFObject dict, ByteBuffer buf,
PDFObject params) throws IOException {
Inflater inf = new Inflater(false);
int bufSize = buf.remaining();
// copy the data, since the array() method is not supported
// on raf-based ByteBuffers
byte[] d... |
9cbd0df5-5780-4064-a0cd-01a3f6b3affe | 9 | protected String readString(InputStream in) throws IOException {
int length = readInt(in);
// Avoid allocating a rediculous array size.
// But InputStreams don't universally track position/size.
// And available() might only mean blocking, not the end.
// So try some special cases...
if ( in instanceof ... |
c2d71879-f72c-4677-a461-2bce1998d02d | 4 | public final void loadAssetDetailsFromXml(String... xmlFilePaths) {
XStream xstream = new XStream(new DomDriver());
for (String xmlFilePath : xmlFilePaths) {
String xmlContents = FileManager.getFileContents(xmlFilePath);
// Cast the xml contents to the same as our data field
Map<String, Map<String, String>... |
4c454195-8797-4b72-bae4-e74f1ffc4c2d | 2 | public GraphicsMain() {
setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
setIgnoreRepaint(true);
frame = new JFrame(Main.NAME);
frame.setDefaultCloseOperation(JFra... |
dc2fcdf3-ce7c-4914-aa8a-6310d9a4d191 | 9 | public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
String line;
String viewName = null;
EditorHelper editor = EditorHelper.getCurrent(event);
int lineNo = editor.getCurrentLineNo();
line = editor.getLine(line... |
48775d56-d24f-4fe4-a1c2-9e0b6367c78c | 3 | void attackBot(BattleBot bot) {
//Check what bot is attacking, subtract health accordingly. Set victor if a bot dies.
if (bot == bot1) {
this.hpBot2--;
if (this.hpBot2 <= 0) {
this.victor = 1;
}
}
else
{
this.hpBot1--;
... |
068bd1d6-3911-4921-93a0-3f651d5567e3 | 9 | int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
82b73ff0-e11f-4e31-86d7-6a9e59278732 | 0 | public JButton getjButtonSuiv() {
return jButtonSuiv;
} |
ccde6b9a-6b9a-472a-875b-01fc63294854 | 0 | public User getUser() {
return m_user;
} |
99a0deb2-85d9-4ddf-8a72-e7b77e29dd45 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PII other = (PII) obj;
if (a != other.a)
return false;
if (b != other.b)
return false;
return true;
} |
f89913b4-ef42-441b-afe5-e7d0052a8b3c | 2 | public AnnotationVisitor visitArray(final String name) {
buf.setLength(0);
appendComa(valueNumber++);
if (name != null) {
buf.append(name).append('=');
}
buf.append('{');
text.add(buf.toString());
TraceAnnotationVisitor tav = createTraceAnnotationVisit... |
17e92a80-87f6-4d07-bafd-dc67399eb567 | 6 | final String _readKey_(int symbol) throws IOException, IllegalArgumentException {
final Reader source = this._reader_;
final StringBuilder result = this._builder_;
result.setLength(0);
while (true) {
switch (symbol) {
case -1:
case '\r':
case '\n':
throw new IllegalArgumentException();
c... |
0e99f084-3159-47dc-86f9-95b4905255a7 | 7 | Space[][] openSets(Space sp) {
Space[][] sets = new Space[numOpenSets(sp)][5];
int index = 0;
if (numOpenSets(sp) != 0) {
if (isOpen(board[sp.pos[0]], sp.piece, 1)) {
sets[index] = board[sp.pos[0]];
index++;
}
if (isOpen(getColumn(sp.pos[1]), sp.piece, 1)) {
sets[index] = getColumn(sp.pos[1])... |
b5a2468d-fd5c-43b4-a2ff-9ca79d6e3576 | 8 | private boolean isConnectableInternal(Neighborhood n1, Neighborhood n2) {
if (n1.getCenter().equals(n2.getCenter())) {
return false;
}
final LineSegmentInt seg1 = new LineSegmentInt(n1.getCenter(), n2.getCenter());
if (hasIntersectionStrict(seg1)) {
return false;
}
final double angle1 = Singularity.co... |
79926d30-7a06-4708-b54c-28c335c1a482 | 0 | public void setIterationCount(BigInteger value) {
this.iterationCount = value;
} |
f0a3f1d7-3533-463b-b916-7ff27ea63e48 | 9 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof IndexItem<?,?>)) {
return false;
}
IndexItem<? extends Annotation,?> o = (IndexItem<?,?>) obj;
return structure.equals(o.structure) && annotationType == o.annotationType && loader == o.loader;
} |
44646545-889c-4a10-82fc-9eb7d47a401f | 2 | private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
Pays paysVide = new Pays(-1,"");
this.jComboBoxPays.addItem(paysVide);
try {
List<Pays> pp1 = RequetesPays.selectPays();
for (Pays pays : pp1) {
... |
83621d5e-9bfa-4b92-8eed-2a62395d5c5e | 7 | public ArrayList<FirstMove> makeFirstMoves(SearchPiece[] board) {
ArrayList<String> history = new ArrayList<String>();
ArrayList<FirstMove> firstmoves = new ArrayList<FirstMove>();
for (int i = 0; i < board.length; i++) {
SearchBoard move1 = new SearchBoard(board, 1, 1, i);
SearchBoard move2 = new Searc... |
0b996e70-ae1a-4e37-b52f-c1d71f18a0cf | 8 | public static int getAuctionTime( int auctionID ) throws DatabaseException {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
int uid, bids;
String qGetAuctionTime = "SELECT endingTime FROM auctiontime WHERE auctionID = ?";
try {
conn = DBPool.getInstance().getConnection();
//... |
bee6ccd2-ddf3-4a37-ba5a-ed0ed11dfa86 | 8 | public List<Pixel> neighbours(int width, int height)
{
List<Pixel> result = new ArrayList<Pixel>(8);
for(int i = -1; i <= 1; i++)
{
for(int j = -1; j <= 1; j++)
{
if(i != 0 || j != 0)
{
int newX = x + i;
... |
f0881c9f-77ce-4631-a7bf-a02796274276 | 5 | private void listar_Impresoras (){
String [] separada;
separada = jComboBox1.getSelectedItem().toString().split("-");
int modulo = Integer.parseInt(separada[0].trim());
r_con.Connection();
Vector<Vector<String>>v = r_con.getContenidoTabla("SELECT * FROM impresoras WHERE imp_id_modulo = "+modulo);
... |
5e9322bc-dce8-4e2a-9186-2ca4a7c4374f | 2 | public Result execute(Command command) {
LabelDTO labelDTOren = (LabelDTO) ((Object[]) command.getCommandSource())[0];
Account accountren;
accountren = accountDAO.getAccountByname(labelDTOren.getAccount());
Set<Label> labelsren = new HashSet<Label>();
labelsren = accountren.getL... |
1ef3fb40-ac34-4b73-b84d-98063753c0c6 | 2 | private
List<Element> queryXPathList(String query) {
if (query == null) return new ArrayList<Element>(0);
try {
Element root = doc.getRootElement();
XPathBuilder<Element> xpb = new XPathBuilder<Element>(query,Filters.element());
XPathExpression<Element> xpe = xpb.compileWith(XPathFactory.instance()); // ... |
9de9e9fb-742a-4b69-bd9e-1a4172df342f | 9 | public Matrix solve (Matrix B) {
if (B.getRowDimension() != m) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!this.isNonsingular()) {
throw new RuntimeException("Matrix is singular.");
}
// Copy right hand side with pivoting
int n... |
c321b883-9409-4d16-b6d7-5eaed6a3d27b | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
aa5926db-354e-4f40-bcf3-ca7bb86fb2a2 | 7 | public boolean isLegalMovement(HantoCell from, HantoCell to, HantoBasePiece piece)throws HantoException{
boolean isLegal = true;
int cellDistance = getDistance(from, to);
if (!isAdjacent(to.getX(), to.getY())){
throw new HantoException("Cell is not adjacent");
}
if (breaksContinuity(from, to)){
thro... |
7e8f9290-1df0-4862-8491-16c64f432c06 | 3 | @Override
public boolean performFinish() {
final String containerName = page.getContainerName();
final String fileName = page.getFileName();
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationT... |
480f9e72-53cb-4875-b8d7-c5686e5797ae | 4 | private void downloadNewTables() {
List<Integer> changes = findTableChanges();
Queue<FileRequest> requests = new LinkedList<FileRequest>();
tables = new ReferenceTable[versionTable.getEntryCount()];
for (int i = 0; i < changes.size(); i++) {
requests.offer(requester.request(255, changes.get(i)));
}
whil... |
17bd3dc4-5605-420e-a9c1-7b11ff1abd0c | 3 | public Image getImage(String s, Color fill) {
// check xobjects for stream
Stream st = (Stream) library.getObject(xobjects, s);
if (st == null) {
return null;
}
// return null if the xobject is not an image
if (!st.isImageSubtype()) {
return null;... |
c329f2bb-7170-4cc1-aeab-de0a06e8f180 | 5 | final void a(int i) {
if ((mask & 0x5) != 5)
throw new IllegalStateException();
if (i == 4096)
method644();
else if (i == 8192)
method651();
else if (i == 12288)
method639();
else {
int i_578_ = Class70.sineTable[i];
int i_579_ = Class70.cosineTable[i];
synchronized (this) {
fo... |
95c061b3-67c9-415d-ba79-ff70a9b6689d | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
30b60c02-b9f9-4641-b120-3f4bf7752311 | 0 | @Override
public void mouseReleased(MouseEvent e) {
mouseKeyStatus(e, false);
} |
53825bd0-8868-44cc-93a6-ea92f5497e3a | 1 | public void m1() {
try {
this.i = 10;
System.out.println("dans m1 : i = "+this.i);
this.m2(this.i);
} catch(Exception e) {
// code palliant l’erreur ayant provoqué l’exception.
}
System.out.println("catch de m1 : i = " + this.i);
} |
1411a291-2d92-4e0d-af17-b098549bd871 | 0 | public Unit(double conversionFactor, String name) {
this.conversionFactor = conversionFactor;
this.name = name;
} |
c2c62311-0bb1-459c-abd8-361815d5784c | 3 | public void run(){
byte[] b = new byte[8192];
MessageEvent me = new MessageEvent(b);
while(true){
try{
Connection.getInputStream().read(b);
Main.getDefaultEventSystem().listen(me.setBytes(b));
if(me.isCanceled())break;
}catch(Exception e){e.printStackTrace(); break;}
}
System.out.println("Re... |
fcdf6f95-6b35-4695-86d6-e024571ade9e | 4 | public void lisaaHoitoOhjeet(HttpServletRequest request, HttpServletResponse response) throws NamingException, SQLException, ServletException, IOException {
Kayttaja a = haeAsiakkaanTiedotAsiakasIdlla(request);
try {
List<HoitoOhje> h = new ArrayList<HoitoOhje>();
List<Oirekuvaus... |
9126ef56-29cf-48a9-82eb-1a68aa6b3016 | 3 | public int executeUpdate(String sql,List params) {
int result = -1;
try {
//执行SQL语句
PreparedStatement ps = connection.prepareStatement(sql);
if(params != null)
for(int i = 0 ;i < params.size();i++){
ps.setObject(i+1,params.get(i));
}
result = ps.exe... |
af6ba2c0-a757-4331-b81c-773e4ff234f2 | 3 | public static void sort(long[]arr){
long tmp = 0;
for(int i=1;i<arr.length;i++){
tmp = arr[i];
int j=i;
while(j>0 && arr[j] >= tmp){
arr[j] = arr[j - 1];
j--;
}
arr[j] = tmp;
}
} |
0d93f329-cc16-4642-82f7-6cce6b98cf97 | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
0fc7680b-2cb5-474b-9b68-f3d193634ccf | 7 | public void merge(int a[], int m, int b[], int n) {
int aIndex = m - 1, bIndex = n - 1;
for (int i = m + n - 1; i >= 0; i --) {
Integer aItem = aIndex >= 0 ? a[aIndex] : null;
Integer bItem = bIndex >= 0 ? b[bIndex] : null;
boolean fromB = false;
if (aIn... |
850f0641-0fd5-43db-95cd-ee8cea3740df | 3 | public static void Initialize(int width, int height){
if(GRASS == null)
GRASS = new Tile(width, height, true, 0xff45ef45);
if(WALL == null)
WALL = new Tile(width, height, false, 0xff121212);
if(HERO == null)
HERO = new Tile(width - 4, height - 4, false, 0xffef... |
b07567ca-67fa-44b7-8209-983aae8cdced | 1 | @Override
public void visitConstantExpr(ClassNode c, MethodNode m, final ConstantExpr expr) {
if (expr.value() instanceof Type) {
Type typeValue = (Type) expr.value();
String name = typeValue.toString().replaceAll("/", ".").replaceFirst("L", "").replace(";", "");
CallStaticExpr forName = new CallStaticExp... |
f4369883-48b6-4c4a-ae2b-a57c7d8d735b | 8 | @Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = IntCache.getIntCache(par3 * par4);
for (in... |
5106f0bf-3c34-42bd-b616-23641149a194 | 1 | @Override
public void scoreRound(boolean won, int score) {
//If we won the round, update the weights for reinforcement learning
if (won) updateWeights();
} |
8a8c5919-fa3a-409c-922e-2ff7c4de2ac7 | 4 | public static void putOnStack(Node[] state, char player){
double[] ourState = new double[state.length * 2];
//put in the x's
for(int i = 0; i < 48; i++){
if(state[i].getChar() == 'x'){
ourState[i] = 1;
}
else{
ourState[i] = 0;
}
}
//put in the o's
for(int i = 48; i < input.length-1; i++... |
e3eeb613-5aa7-4470-a9ec-8e1b9eef9043 | 0 | public InetAddress getAddress() {
return this.address;
} |
98e0ed6c-2f41-488b-a0ec-730ac4b9c8ad | 6 | public void testSafeAddLong() {
assertEquals(0L, FieldUtils.safeAdd(0L, 0L));
assertEquals(5L, FieldUtils.safeAdd(2L, 3L));
assertEquals(-1L, FieldUtils.safeAdd(2L, -3L));
assertEquals(1L, FieldUtils.safeAdd(-2L, 3L));
assertEquals(-5L, FieldUtils.safeAdd(-2L, -3L));
as... |
17e037a1-c91b-4f09-a64e-b145f63633c7 | 7 | public boolean interact(Widget w, Coord c) {
for (Widget wdg = w.lchild; wdg != null; wdg = wdg.prev) {
if (wdg == this)
continue;
Coord cc = w.xlate(wdg.c, true);
if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) {
if (interact(wdg, c.add... |
50a5092c-282f-471a-b55f-f73c37789d8f | 7 | 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... |
27c3dee8-47b7-4c17-a6b9-a798fb6a118d | 7 | private boolean agregarALista(NodoTablaHashing<K,V>[] aP, K k, V v) {
int llave=hash(k);
boolean bool=false;
if(aP[hash(k)]!=null){
int i=llave;
while(i<aP.length&&!bool){
if(aP[i]==null){
aP[i]=new NodoTablaHashing<K, V>(k, v); bool=true;
}
i++;
}
for(int j=0;j<llave&&!bool;j++){
... |
b62b3628-983f-4abe-a232-a8f8a9cacea9 | 8 | private int gameValue() {
// Calculate the base value for the game
int baseVal = 24; // start off with grand game value.
// Grab our gametype, and if it's not grand, calculate the values.
GameTypeOptions.GameType actualGameType = this.gameType.getGameType();
if(actualGameType != GameTypeOptions.GameType.Gr... |
bc70a742-97d4-499e-a510-4a6b8180b365 | 0 | public DotMessageShower(String message,IOnStringInput onStringInput) {
super(message,SYMBOL,onStringInput);
} |
6d6653a3-a34c-4ac5-9531-2a34068333cc | 6 | public Item(GameWindow w, int x, int y, int type){
window = w;
panel = w.panel;
energy =100;
posX =x;
posY =y;
bounds = new Rectangle(posX,posY,32,32);
itemType = type;
switch(itemType){
case(0): //Waffe
damage = 1;
name = "Magnum";
break;
case(1): //medikit, nahrung
h... |
9d99c5dd-28ff-4ba6-9a88-5e380265d377 | 6 | public void drawCell(int x, int y){
/* Cell Drawing Option
* 0 = Regular drawing
* 1 = Checker Board pattern
* 2 = Randomized
* 3 = Randomized/Checker Board
*/
if(rcflag){if(cdo == 1){ cellCheckDraw(x,y, true);}else{cellAltDraw(x,y);}}
else{
switch(cdo){
c... |
f84d2323-dc51-4021-be77-67e5d890c39f | 0 | public int value() {
return i;
} |
73b574f6-03ef-4001-9c32-d0195cdfd2b3 | 1 | public double value(double x) {
if (Double.isNaN(this.Demand.density(x))) System.out.println(
"NaN Density at "+x+" of "+Demand+" with mean "+Demand.getNumericalMean()+
" and sd "+Math.sqrt(Demand.getNumericalVariance()));
return (this.y-x)*this.Demand.density(x);
} |
3a488b65-3b95-46ab-834c-9c834f073fec | 3 | public static List<Block> getBlocks(Cuboid cuboid, World world){
List<Block> blocks = new ArrayList<Block>();
for(int x = cuboid.getVectorMin().getBlockX(); x <= cuboid.getVectorMax().getBlockX(); x++){
for(int y = cuboid.getVectorMin().getBlockY(); y <= cuboid.getVectorMax().getBlockY(); ... |
75c9765e-4516-4656-ab3c-45daefbeae38 | 8 | public int getNeighbourIndex(final Direction direction, final Cell cell, final Player player) {
switch (direction) {
case TOP:
return verticalMoveChecker.getTopNeighbourIndex(cell, player);
case BOTTOM:
return verticalMoveChecker.getBottomNeighbourIndex(cell, player);
case LEFT:
return horizontalMoveCh... |
8d9ba6e4-ce52-4534-9060-72e2dfdca2d1 | 6 | @Override
public boolean removeLetterTiles(List<Location> tilesPlayed) {
if(tilesPlayed == null) return true;
List<Tile> removedTiles = new ArrayList<Tile>();
for(Location loc : tilesPlayed){
Tile t = loc.getTile();
if(t==null){
throw new NullPointerException("Can't remove null tile from player");
}... |
a081ee0b-ebac-4076-aa96-89420062171e | 2 | public static void changeSetting(String key, String newValue) {
//Check if the key exists, if so; remove it
if (configuration.containsKey(key) && !configuration.get(key).equals(newValue)) {
Logger.log("Removed: " + key);
configuration.remove(key);
}
//Put in the new value
configuration.put(key, newVa... |
024b8011-d755-43a6-a6c0-187c4c2e325d | 8 | public DonkeyRegion(File hardFile) {
this.hardFile = hardFile;
try {
if (hardFile.exists()) {
lastModification = hardFile.lastModified();
}
file = new RandomAccessFile(hardFile, "rw");
if (file.length() < 5) {
// Write the... |
658f3afa-5b4a-4861-9ee8-6084d92da225 | 9 | @Override
public boolean process(Player player) {
if (ingredients == Ingredients.TORSTOL && otherItem.getId() != VIAL) {
if (!player.getInventory().containsOneItem(15309)
|| !player.getInventory().containsOneItem(15313)
|| !player.getInventory().containsOneItem(15317)
|| !player.getInventory().cont... |
33885bd8-1d68-4b6f-9eae-a46b6822681b | 1 | @Override
public void handleResult() throws InvalidRpcDataException {
String result = getStringResult();
if (result.equalsIgnoreCase(STATUS_STRING_OK)) {
EventBusFactory.getDefault().fire(new DownloadRemovedEvent(downloadGid));
} else {
// TODO: handle
... |
4f10e5c8-ff08-49b5-9dbb-830353d49cfe | 7 | public boolean isValid(String s) {
if (s == null || s.length() <= 1) {
return false;
}
Map<Character, Character> map = new HashMap<Character, Character>();
map.put('(', ')');
map.put('[', ']');
map.put('{', '}');
Stack<Character> stack = new Stack<Character>();
for (char c : s.toCharArray())... |
21c46564-3a9b-4f48-807a-a9c815d3af72 | 9 | public static BufferedImage detectVerticalEdges(BufferedImage image, int amount) {
int width = image.getWidth();
int height = image.getHeight();
BufferedImage edgeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
for(int x = 0; x < width; x++)
for(int y = 0;... |
50a442c4-4ed4-4d7f-83e7-ecd68d795085 | 2 | public double getEtxToMeFromNode(int nodeID) {
Iterator<Edge> it2 = this.outgoingConnections.iterator();
EdgeOldBetEtx e;
while (it2.hasNext()) {
e = (EdgeOldBetEtx) it2.next();
if (e.endNode.ID == nodeID){
e = (EdgeOldBetEtx) e.getOppositeEdge();
return e.getEtx();
}
}
return 0.0;
} |
39d6549a-ccce-47ed-91ec-05d976b06595 | 9 | public InputStream pcmstream() {
return(new InputStream() {
private byte[] buf;
private int bufp;
private boolean convert() throws IOException {
float[][] inb = decode();
if(inb == null) {
buf = new byte[0];
return(false);
}
buf = new byte[2 * chn * inb[0].length];
int p = ... |
1f1d8c9e-8c26-4769-8fff-fc6a1d9fc578 | 1 | @Override
public void terminateMachine(IMachine machine) throws InvalidObjectException, ConnectorException
{
try
{
CloudStackClient client = ClientLocator.getInstance().getClient(machine.getComputeCenter().getProperties(),
controllerServices);
client.terminateVirtualMachine(machine.getName());
... |
40d3c9ab-d021-41ff-b04f-2068a684dd34 | 5 | public void load(Vehicle vehicle, File file){
// Load the Vehicle in Territory.
addVehicle(vehicle);
BufferedReader reader = null;
String line = "";
String splitBy = ",";
try {
reader = new BufferedReader(new FileReader(file));
while ((line = reader.readLine()) != null) {
String[] data = lin... |
c831324f-7a69-4eca-be66-fd9f4c17e528 | 0 | public int getRobotState() {
return robotState;
} |
22c5b56a-429f-455b-905a-c592ff3faa00 | 7 | static public Spell getEarthSpell(int i)
{
switch (i)
{
default:
case 0:
return new Earthbending();
case 1:
return new EarthbendingSpike();
case 2:
return new EarthbendingShard();
case 3:
... |
f1c16724-12c2-46d9-a657-3c193db49124 | 9 | private boolean evaluateTcfClause(String clause) {
if (model instanceof MesoModel)
return false;
if (clause == null || clause.equals(""))
return false;
String[] sub = clause.split(REGEX_AND);
Tcf.Parameter[] par = new Tcf.Parameter[sub.length];
String funx, funy;
byte id;
short length;
for (int n ... |
37481b57-a9c8-4d44-8d3f-12d7742935c1 | 2 | public boolean removeLift(int LiftID){
for(int i=0;i<lifts.size();i++){
if(lifts.get(i).getLiftID()==LiftID){
lifts.get(i).delete();
lifts.remove(i);
return true;
}
}
return false;
} |
4c28a560-1183-4789-836c-76e1eef1445b | 3 | @Override
public void paintComponent(Graphics g) {
Graphics2D graphics = (Graphics2D) g;
super.paintComponent(graphics);
/*
* Berechnung der Groesse der Blockelemente. Die Groesse ist abhaengig
* von der Anzahl der Spalten und Zeilen und der jeweils verfuegbaren
*... |
858df2e4-ea5f-4172-adf3-0813d2701ea0 | 9 | private int getNextDir(int[] from,int to,boolean closer,Game.DM measure)
{
int dir=-1;
double min=Integer.MAX_VALUE;
double max=-Integer.MAX_VALUE;
for(int i=0;i<from.length;i++)
{
if(from[i]!=-1)
{
double dist=0;
switch(measure)
{
case PATH: dist=getPathDistance(from[i],to)... |
f3594d7d-8d95-40a8-adbc-90b6139a8466 | 7 | public synchronized void setFrame(final CEMILData frame)
{
if (!frame.getDestination().equals(getKey()))
throw new KNXIllegalArgumentException("frame key differs from this key");
if (!max)
ensureCapacity();
else if (!overwrite && size == timestamps.length)
return;
final CEMILData[] c = (CEMILData[]) v... |
7499d1c5-356e-411d-9626-2cd188034654 | 8 | public static List<CategoryNode> buildCategoryByUrl(String url) throws IOException {
System.out.println("Trying to get url: " + url);
Document document;
try {
document = Jsoup.connect(url).get();
} catch(IOException e) {
throw new IOException("Error when get " + url, e);
}
Elements elements = document... |
3484596c-0fd8-42fe-b65c-96582bacc1aa | 9 | public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
PrintWriter cout = new PrintWriter(System.out);
while(sc.hasNext()!=false){
String[] originals = sc.nextLine().split(" ");
if(originals.length==1&&ori... |
68867186-bbb6-4ee8-af53-f0fae5db0430 | 1 | public boolean PointerMoveListener(int mX, int mY, int mDX, int mDY) {
if(mainLogic.currentState == GameLogic.GameState.PLAYING) {
currentMouseAction.onPointerMove(mX, mY, mDX, mDY);
}
/*
for(long a : selectedWeapons) {
GameActor act = mainLogic.getActor(... |
010fcce1-760b-4c12-8346-e853401c00dd | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
0c6ed547-f60e-4580-b66a-3c37c12f6bd4 | 3 | public static int getRotatedMapChunkY(int y, int rotation, int x) {
rotation &= 3;
if (rotation == 0) {
return y;
}
if (rotation == 1) {
return 7 - x;
}
if (rotation == 2) {
return 7 - y;
} else {
return x;
}
} |
700b5721-d400-4242-82e2-869e69d037a1 | 5 | public void run() {
ServerSocket s = null;
try{
this.frame.setDB();
s = new ServerSocket(this.PORT);
try {
this.frame.serverOutput.setText("---- Server Avviato Correttamente! ---- \n Server in attesa di richieste...");
while(true) {
Socket socket = s.accept();
try{
new ... |
5da269f2-04a7-4f4e-b181-b0a6dd3eacc6 | 6 | public static String getJavaTypeFor( String type )
{
String tocheck = Util.sanitize( type, false ).toLowerCase();
if ( tocheck.equals( "null" ) )
{
return "null";
}
if ( tocheck.equals( "integer" ) )
{
return "int";
}
if ( tocheck.equals( "real" ) )
{
return "double";
}
if ( tocheck.equa... |
ed5ba37c-fc17-46f6-a846-74c841566187 | 0 | public void setjComboBoxLabo(JComboBox jComboBoxLabo) {
this.jComboBoxLabo = jComboBoxLabo;
} |
89e0414a-c8bb-42eb-a2b5-a675f8c9dca5 | 7 | public String toString() {
StringBuffer sb = new StringBuffer("<class>" + getClass().getName() + "</class>\n");
if (uid != null)
sb.append("<uid>" + uid + "</uid>\n");
sb.append("<width>" + (widthIsRelative ? (widthRatio > 1.0f ? 1 : widthRatio) : getWidth()) + "</width>\n");
sb.append("<height>" + (heightIs... |
9332cb64-d1c9-4a6a-879e-e30f53770532 | 9 | private void addNewBook(){
int choice;
boolean quit;
quit = false;
try
{
con.setAutoCommit(false);
while(!quit)
{
System.out.print("\n\nPlease choose one of the following: \n");
System.out.print("1. Add Standard\n");
System.out.print("2... |
f1967b4f-f1f9-427d-b212-dcf3b862aa2b | 8 | private static String suit(Card card) {
switch(card.getSuit()) {
case HEARTS:
return !UNICODE ? "H" : "\u2661"; // 2665 on windows
case DIAMONDS:
return !UNICODE ? "D" : "\u2662"; // 2666 on windows
case SPADES:
return !UNICODE ? "S" : "\u2660";
case CLUBS:
return !UNICODE ? "C" : "\u2663";
... |
4492ddff-83c8-41a1-8bec-880ca97e5ce8 | 5 | public JComboBoxUnit() {
super();
final ListCellRenderer r = getRenderer();
setRenderer(new ListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Component c;
if(disabl... |
7cb218a5-71cf-4976-8ad1-87f92fb34ed4 | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line;
Queue<Character> q = new LinkedList<>();
boolean hyphen = false;
while ((line = in.readLine()) != null) {
if ((line =... |
55891763-750f-4ea3-b8ea-890364d36c46 | 4 | private Type mergeClasses(Type type) throws NotFoundException {
CtClass superClass = findCommonSuperClass(this.clazz, type.clazz);
// If its Object, then try and find a common interface(s)
if (superClass.getSuperclass() == null) {
Map interfaces = findCommonInterfaces(type);
... |
02ff1336-98d7-41d2-adbb-1f70ceb195e2 | 4 | public boolean tarkistaSarakkeet(int kuka) {
int vierekkaiset = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (poyta[j][i] == kuka) {
vierekkaiset++;
}
}
if (vierekkaiset == 3) {
... |
424cbafd-dce0-427e-ab74-7efec0f76fad | 4 | private boolean fileIsVideo(String string) {
if(string.endsWith(".mov") || string.endsWith(".MOV") || string.endsWith(".mp4") || string.endsWith(".MP4"))
return true;
return false;
} |
01ee3b9e-57f3-48c1-b8b5-76c85c6dd14a | 9 | public int get_END_IF(int INDEX, String code)
{
log.log(4, log_key, "call get_END_IF, INDEX = ", new Integer(INDEX).toString(), "\n");
for(;;INDEX++) {
if ( (code.charAt(INDEX) == 'E') &&
(code.charAt(INDEX + 1) == 'N') &&
(code.charAt(INDEX + 2... |
514f8a3c-a3a2-4211-aba7-0c7e32f1e5df | 3 | @Override
protected boolean check() {
return (method.getParameterTypes()[0] == Updates.class && (method
.getParameterTypes()[1] == String.class || (method
.getParameterTypes()[1] == String[].class && method
.getParameterTypes()[2] == String.class)));
} |
902c80b6-1db4-45b1-a845-1b505e518def | 7 | public static BPInt from(byte[] bytes) {
// note - all negative numbers are represented by 8 bytes.
int size = bytes.length;
boolean highestBitIsSet = ((0x80 & bytes[0]) == 128);
if (size == 1) {
return new BPInt(0xff & bytes[0]);
} else if (size == 2) {
r... |
beb6a440-faa7-4da4-b3c4-584cedd4a64e | 0 | public List<Blog> getBlogs(){
return blogModelBS.getBlogs();
} |
8371276d-17d8-4461-8c41-774fb0aea8a5 | 1 | public static boolean isNegativeSentiment ( String str ) {
if ( negativeHashMap.containsKey(str) ) return true;
else return false;
} |
10fbb753-4b54-4b3c-a3ad-670612103bfb | 1 | private void nextToken()
{
try
{
current = scanner.next();
}
catch (IOException e)
{
}
} |
27975403-0de0-4b2a-85a1-7b6c93004cb9 | 1 | public void visit_dup_x2(final Instruction inst) {
// Top value on stack must be category 1.
final Set top1 = atDepth(0);
checkCategory(top1, 1);
final Set top2 = atDepth(1);
final int category = checkCategory(top2);
if (category == 1) {
final Set top3 = atDepth(2);
checkCategory(top3, 1);
// ... |
d504cbf8-2ab7-4c5c-9bfb-708595cc451c | 9 | static boolean isSameType(Type t1, Type t2, Types types) {
if (t1 == null) { return t2 == null; }
if (t2 == null) { return false; }
if (isInt(t1) && isInt(t2)) { return true; }
if (t1.tag == UNINITIALIZED_THIS) {
return t2.tag == UNINITIALIZED_THIS;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.