method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
692b8deb-6ceb-410c-9e10-b8bd7100f483 | 4 | @Override
public boolean equals(Object o) {
if(o instanceof TreasureLocation){
TreasureLocation location = (TreasureLocation) o;
if(location.getX() == getX()){
if(location.getY() == getY()){
if(location.getZ() == getZ()){
return true;
}
}
}
}
return false;
} |
1c1dc444-8dbe-4a2a-b753-b48be2dc108b | 5 | public Card[][] getSets()
{
int count = cards.size();
if (count < 3)
return new Card[0][];
ArrayList<Card[]> sets = new ArrayList<Card[]>();
for (int i = 0; i < count; i++)
{
for (int j = i + 1; j < count; j++)
{
for (int k = j + 1; k < count; k++)
{
Card[] set = {cards.get(i), cards... |
c1119a39-5450-423b-ac93-b37b818a0d6d | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg.... |
0fb3f1e3-8ccb-4ae1-a2c0-bf155c0d911c | 4 | public void jump(boolean forceJump) {
if (onGround || forceJump) {
onGround = false;
setVelocityY(JUMP_SPEED);
if(anim == left)
anim = animJumpLeft;
else if (anim == right)
anim =animJumpRight;
anim.update(JUMP_TIME);
... |
6fcf1f73-ae33-438f-a992-694030bb4a3b | 0 | public ExitMessage(){
int len = 12;
buf = new byte[len];
TypeConvert.int2byte(len, buf, 0);
TypeConvert.int2byte(RequestId.Exit, buf, 4);
} |
33305107-4459-4f92-b548-add5f3b63da1 | 3 | public static String byte2hex2(byte[] source) {
if (source == null || source.length <= 0) {
return "";
}
final int size = source.length;
final char str[] = new char[size * 2];
int index = 0;
byte b;
for (int i = 0; i < size; i++) {
b = source[i];
str[index++] = sHexDigits[b >>> 4 & 0xf];
str[... |
645ef54f-0b21-468c-aa52-8fdba556ffe4 | 9 | @Override
public void startEvent(){
try{
for(int i = 0 ; i < 5; i++){
if(inputs[0].getText().isEmpty() &&
inputs[1].getText().isEmpty()
&& inputs[2].getText().isEmpty()){
voltage = DEFAULT_VOLTAGE;
... |
b60b3c4d-ccdb-4860-9525-ffa4e58d7baa | 0 | public AnnotatedWith( Annotation annotation )
{
this.annotation = annotation;
} |
9534ac99-e848-4c22-941e-69785c433438 | 1 | private synchronized void setState(ClientState state) {
if (this.state != state) {
this.setChanged();
}
this.state = state;
this.notifyObservers(this.state);
} |
6eeb6284-1f9e-44b0-9e49-ae7a2465c662 | 3 | @Test
public void edgeIsToggled()
{
Vertex v1 = vc.addVertex(3, 5);
Vertex v2 = vc.addVertex(5, 3);
vc.toggleEdge(v1, v2);
boolean b1 = v1.getAdjacents().contains(v2) && v2.getAdjacents().contains(v1);
vc.toggleEdge(v2, v1);
boolean b2 = v1.getAdjacents().isEmpty(... |
ed107881-a340-4b55-ae87-af5473de48cb | 7 | public void filter(FileFilter customFilter) {
FileFilter filter = makeFilter();
//Adds custom filter if exists
if (filter != null && customFilter != null) {
filter = new AndFilter(filter, customFilter);
} else if (filter == null && customFilter != null) {
filter ... |
92ae68dd-3f01-43d2-86f6-78f04435e402 | 4 | public String getClipboardContents()
{
String result = "" ;
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() ;
//odd: the Object param of getContents is not currently used
Transferable contents = clipboard.getContents( null ) ;
boolean hasTransferableText = ( contents != null... |
be5b54d0-26c9-4f32-9625-c6ad33717590 | 5 | private void readObject(ObjectInputStream in) throws IOException {
setLevel(Level.parse(in.readUTF()));
setLoggerName(in.readUTF());
setMessage(in.readUTF());
setMillis(in.readLong());
final Object[] params = new Object[in.readInt()];
for (int i = 0; i < params.length; i+... |
8725cb60-ffea-47f5-a0ca-f133403da9e7 | 7 | @Override
public boolean put( String key, Long value )
{
if ( key == null )
{
throw new IllegalArgumentException( "key was null" );
}
if ( value == null )
{
throw new IllegalArgumentException( "value was null" );
}
int iteration = ... |
499e1503-f1f9-4044-85db-2d3e2fdff1d4 | 3 | void verificarObstaculos(){
int cabeza = inicioSnake +longSnake -1;
cabeza = cabeza %(ancho *alto);
for(int i = inicioSnake;i< inicioSnake +longSnake -1 ;i++){
int pos = i %(alto*ancho);
if(snakeX[cabeza] == snakeX[pos]&&
snakeY[cabeza] ==snakeX[pos]){... |
14d26130-5e8c-46a6-8c52-3f00b5c08a8f | 3 | public void ConsultarAdmin(String user, String clave) throws SQLException {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
try{
Conexion.GetInstancia().Conectar();
ResultSet consulta=Conexion.GetInstan... |
ddeb4892-2fba-46fb-a724-33b50bdc446f | 8 | public static String convertFileToString(File file) {
if (file != null && file.exists() && file.canRead() && !file.isDirectory()) {
Writer writer = new StringWriter();
InputStream is = null;
char[] buffer = new char[1024];
try {
is = new FileInputStream(file);
Reader reader = new BufferedReader(... |
0a42afec-e38c-41b2-a898-bfcb11afefc3 | 1 | static public CycSymbol getCycSymbolForBoolean(boolean val) {
return (val == false) ? CycObjectFactory.nil : CycObjectFactory.t;
} |
40a31a29-47d6-483c-b624-d45ba989dd7e | 0 | public static void main(String[] args) {
System.out.println("Backspace = <\b>");
System.out.println("New line = <\n>");
System.out.println("Return = <\r>");
System.out.println("Formfeed = <\f>");
System.out.println("Tab = <\t>");
System.out.println("Backslash = <\\>");
System.out.println("Single quote = <\'>");
... |
716c63d6-0208-48ce-af2a-68cf86da7bd6 | 2 | public static void scrollBothPaneV(String str, int delta) {
if (str == "inc") {
scrollPane1.getVerticalScrollBar().setValue(scrollPane1.getVerticalScrollBar().getValue() - delta);
scrollPane2.getVerticalScrollBar().setValue(scrollPane2.getVerticalScrollBar().getValue() - delta);
... |
de457e75-ca08-4e38-9283-172f822890e1 | 4 | @Override
protected Integer doInBackground() throws Exception {
/* Try to connect to the server on localhost, port 5556 */
jLabel3.setText("Sending transfer command");
ChatBox.MultiThreadChatClient.os.println("/send");
Socket sk = new Socket("188.26.255.139", 5557... |
c3693645-0c4c-47f2-80e2-5f52b218d709 | 4 | private final void loadProps() {
if (props == null) {
props = new Properties();
}
InputStream in;
try {
File propsFile = new File(StaticString.PROPS_NAME);
if (propsFile.exists()) {
in = new FileInputStream(propsFile);
} else {
in = ClassLoader.getSystemClassLoader().getResourceAsStream(
... |
f3003f98-6a6c-4cb1-850a-9febdd381745 | 1 | public void beforeFirst() throws SQLException {
if (first == 1) {rs.beforeFirst();}
else {rs.absolute(first - 1);}
} |
21a4faae-41bc-4868-b12a-e39c3299c900 | 5 | private void copierFichier(String source, String destination) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
byte buffer[] = new byte[1024];
int taille = 0;
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
... |
1707082d-7cf0-49b9-bfed-ad7b5931cfcf | 3 | public void zoom(int amount) {
int direction = amount / Math.abs(amount);
for (int i=1; i<=Math.abs(amount); i++) {
if (radius > originalRadius || direction > 0) {
radius = radius + 30*direction;
}
}
this.windowCoordsUpdated = false;
updateCenterCoordinates();
} |
0fead528-26dc-4da3-9eba-ff7744c65565 | 0 | public String getCode() {
return code;
} |
8af04176-a096-414e-b5fb-0e1a24c94bb2 | 2 | public Entity(EntityType type, Point world_position) {
this.type = type;
is_opaque = EntityType.isOpaque(type);
is_passable = EntityType.isPassable(type);
name = EntityType.getName(type);
needs_update = EntityType.needsUpdate(type);
default_interact = EntityType.defaultIn... |
3923e3f3-cb14-434f-8cf0-e53a8a7ddef6 | 5 | private IMode getMode(byte[] key, byte[] iv, int state) {
IBlockCipher cipher = CipherFactory.getInstance(properties.get("cipher"));
if (cipher == null) {
throw new IllegalArgumentException("no such cipher: " + properties.get("cipher"));
}
int blockSize = cipher.defaultBlockSize();
... |
749582ba-b479-4951-a6b1-d415d7ac0595 | 3 | private static int determineWinner(FutureTask<Integer> task1, FutureTask<Integer> task2)
throws InterruptedException,
ExecutionException
{
boolean isDone = false;
int winnerTime = 0;
while (!isDone)
{
if (task1.isDone())
{
... |
b3743ab3-1d5c-403f-b4e5-238ee4c8b765 | 7 | public static Keyword interpretIterativeForallScores(ControlFrame frame, Keyword lastmove) {
if (lastmove == Logic.KWD_DOWN) {
if (frame.partialMatchFrame == null) {
ControlFrame.createAndLinkPartialMatchFrame(frame, Logic.KWD_ITERATIVE_FORALL);
}
else {
while (frame.partialMatchFr... |
7feac648-7e52-4fcb-ad6b-e9401afaee77 | 7 | @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(target==mob)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return f... |
af7477fc-ed21-4fb3-9fb5-b32654afe48b | 1 | public void move(boolean forward) {
_motor.set((forward ? 1 : -1)*MOTOR_SPEED);
} |
95ac2e38-c192-4d31-ae66-4394ce8cb44a | 5 | public RarHandler(File album) {
Logger.getLogger(RarHandler.class.getName()).entering(RarHandler.class.getName(), "RarHandler", album);
try {
archive = new Archive(album);
} catch (RarException | IOException ex) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVE... |
6d8de203-80f3-431a-ab08-d2d1e1511b5c | 4 | public void saveState(Session s) throws Exception {
s.saveInt(homeworld == null ? -1 : homeworld.ID) ;
s.saveInt(partners.size()) ;
for (System p : partners) s.saveInt(p.ID) ;
for (int i = NUM_J ; i-- > 0 ;) {
s.saveFloat(jobSupply[i]) ;
s.saveFloat(jobDemand[i]) ;
}
s... |
33c071f9-e7b3-4fa7-aec5-bb1e6407d6b4 | 2 | public static String formatArray(String[] arr, char sep) {
if (arr.length == 0)
return "";
StringBuffer sb = new StringBuffer();
int sepcount = arr.length - 1;
for (int i = 0; i < sepcount; i++)
sb.append(arr[i] + sep);
sb.append(arr[sepcount]);
return sb.toString();
} |
10eed13d-6661-43f1-ad02-c59333084910 | 7 | private void setPreparedStatementValues(PreparedStatement preparedStatement,
Field field,
int index,
Product product) {
try {
Class<?> type = field.getType();
String typeName = type.getSimpleName();
if (typeName.equals("String")) {
preparedStatement.setString(ind... |
f8843411-77d8-4a6b-9d18-7e7f315c8970 | 6 | @EventHandler
public void onMessageEvent(MessageEvent event){
try{
Object o = Utils.fromByteArray(event.b);
if(o instanceof String){//assume its json //****************************
GSONListener.listen((String)o, event.sc);// Gson/Json *
return; // Listener ... |
6f97b397-e0e5-4bea-9c11-273d87e2f6d3 | 2 | boolean handleWrite() throws IOException {
synchronized (this.bufferQueueMutex) {
ByteBuffer buffer = this.bufferQueue.peek();
while (buffer != null) {
channelWrite(buffer);
if (buffer.remaining() > 0) {
return false; // Didn't finish this buffer. There's more to
// send.
} else {
... |
3f8e1bd7-f217-407b-8bbc-56f011f3278a | 4 | public boolean intersects(KDPoint q, double distActual) {
return isInside(q, distActual) || intersectHorizontal(q, distActual, true) || intersectHorizontal(q, distActual, false) ||
intersectVertical(q, distActual, true) || intersectVertical(q, distActual, false);
} |
73a69d25-31db-43c8-b375-dadbcb534b16 | 7 | public boolean readFAT() {
//System.out.println("Reading FAT from disk");
int entries= 0;
File file = new File(cacheDir, "FAT");
if(!file.isFile()) {
return false;
}
FileInputStream fileIn;
try {
fileIn = new FileInputStream(file);
} catch (IOException e) {
return false;
}
DataInputSt... |
8cf3a094-ee50-472f-af95-e8e99ce17126 | 9 | public MethodCollector visitMethod(int access, String name, String desc) {
// already found the method, skip any processing
if (collector != null)
return null;
// not the same name
if (!name.equals(methodName))
return null;
Ty... |
956aa172-f9b6-41b0-98e8-0711d2e23bff | 1 | private void updateParts() {
entireView.removeAll();
for (JComponent jp : parts) {
entireView.add(jp);
}
} |
a7ddab9c-30ae-4479-b1c8-ae84c420a7a2 | 8 | public void toggleKey(int keyCode,boolean isPressed){
if(keyCode == KeyEvent.VK_W || keyCode == KeyEvent.VK_UP){
up.toggle(isPressed);
}
if(keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_DOWN){
down.toggle(isPressed);
}
if(keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_LEFT){
left.toggle(isPr... |
18bc65dc-8290-4440-b8e6-706612a069e8 | 2 | public void resolve(String name_, boolean ip4only_) {
name = name_;
int hash = name_.hashCode();
if (hash < 0)
hash = -hash;
hash = hash % 55536;
hash += 10000;
try {
address = new InetSocketAddress(InetAddress.g... |
4bcc767b-38ae-45c6-8481-2a79f3cae662 | 1 | public static node Huffman(ArrayList<node> list){//Creates tree and returns root
int n = list.size();
node x = eMin(list);
node y = eMin(list);
node no = new node();
no.l = x;
no.r = y;
no.val = x.val + y.val;
no.frequency = x.frequency+y.frequency;
list.add(no);
... |
946b0de8-2bd5-4c4a-8039-51309372caa5 | 3 | private void sendToAll(ChatMsg input) {
byte[] data = new byte[UTF_CHAT_MSG_BYTESIZE];
try {
data = input.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
data = input.toString().getBytes();
}
for (User u... |
7421b755-169d-4fe2-8d27-b86c507ecdef | 4 | public void initiateRemoval() {
if(this.isRemoving()) return;
try
{
List<Appointment> aAppt = Appointment.findByVenue(this.getId());
// if no user is concerned, finalize it
if(aAppt.size() <= 0) {
this.finalizeRemovalWithoutChecking();
return;
}
this.aWaitingId.clear();
for(Appointment a... |
1cbd425c-966a-4bad-9d78-1c1f90611fc9 | 2 | @Override
public void onCompleted( EntityConcentrationMap data )
{
for(EntityGroup group : data.getAllGroups())
{
if(!mSettings.matchesWarn(group))
continue;
mReporter.reportGroup(mSettings, group.getEntities().size(), group.getLocation());
}
mReporter.groupDone(mSettings);
} |
6c0b7cc8-4221-4fe5-98cc-9caaa4dee82c | 8 | final public void Function_name() throws ParseException {
/*@bgen(jjtree) Function_name */
SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_NAME);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Identifier();
} catch (Throwab... |
74198ce6-6eee-4ed2-b1b0-dcd912624838 | 3 | public Object getValue (HashMap<String,HashMap<String,Object>> map, String mainKey, String nodeKey) {
// do mainKey exist?
if(!map.containsKey(mainKey)) {
return false;
}
HashMap<String,Object> obj = map.get(mainKey);
if(!obj.containsKey(nodeKey)) {
return false;
... |
ab54bb9f-e66c-488b-a35c-61a5dcf072f1 | 0 | @Override
public void loadOp() throws DataLoadFailedException {
ConfigurationSection sec = getData(specialYamlConfiguration, "op");
YamlPermissionBase permBase = new YamlPermissionOp(sec);
load(PermissionType.OP, permBase);
} |
f800f160-097c-4d4f-b982-95d5aff2e0c1 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
f46090b9-8a6c-4ec6-aeec-fe2a6884263c | 5 | public static void handleEvent(int eventId)
{
if(eventId == 1)
{
System.out.println("Level one selected");
}
else if(eventId == 2)
{
System.out.println("Level two selected");
}
else if(eventId == 3)
{
System.out.println("Level three selected");
}
else if(eventId == 4)
{
... |
903bafab-dba5-4430-a3c0-d1bd7ec61e20 | 6 | public static void load() {
File file = new File(Shortcuts.dataFolder, "bannedPlayers.dat");
if (!file.exists()) {
return;
}
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(file);
ois = new Ob... |
5baccbbe-020c-45ed-a6b9-3b8c06a6b3e6 | 8 | private boolean isEdgeNode(int index)
{
int x = index % width;
int y = index / width;
boolean isValid = false;
if( (x == 0 || x == width - 1) && (y > 0 && y < height - 2) )
{
isValid = true;
}
else if( (y == 0 || y == height - 1) && (x > 0 && x < width - 2) )
{
isValid = true;
}
else
{
i... |
22f13512-42e5-4336-a30f-413ed03a6ea7 | 8 | public void storageAreaCardBackgroundSetter(List<String> backgrounds){
for(int i=0; i<backgrounds.size(); i++){
storageAreaCardsJlabelList.get(i).setIcon(new ImageIcon((URL)this.getClass().getResource(backgrounds.get(i))));
storageAreaCardsJlabelList.get(i).addMouseListener(new MouseListener() {
@Overr... |
349ad43d-f3ec-4040-b679-3c9241613466 | 6 | public void processFrame(ArrayList<Integer> frame) {
// Remove all escape characters in the array.
for (int i = 0; i < frame.size(); i ++) {
//System.out.println("Processing " + String.format("0b%8s", Integer.toBinaryString((int) 0xFF & frame.get(i))).replace(' ', '0') + "");
System.out.print(frame.get(i)... |
c71ce0dd-16ee-4c7f-8d47-6408d74f2111 | 8 | public void addLista(AbstractRolamento r, String s)
{
if(s.equals("Torno") && (r.getEtapa()!=-1))
{
listaTorno.add(r);
checaPrioridades(listaTorno);
checaPrioridades(listaTorno);
}
if(s.equals("Fresa") && (r.getEtapa()!=-1))
{
listaFresa.add(r);
checaPrioridades(listaFresa);
checaPrior... |
432b5ce6-c9fa-4e6f-88b2-d01bace0e2dc | 4 | protected void landingOn(PlayerClass pPlayer)
{
//If you land on it, 100*die*breweries owned
if(this.owned == false) // if not owned
{
if(cout.buyBrewery(this.buyPrice) == true) // prompt the player
{
pPlayer.account.addBalance(-this.buyPrice, pPlayer.getName(), true);
pPlayer.account.addTypeOwn... |
e351b4b2-856c-4954-a827-326f6104c71e | 2 | public EntityComponent getComponent(int id) {
Iterator<EntityComponent> it = components.iterator();
while (it.hasNext()) {
EntityComponent current = it.next();
if (current.getId() == id) {
return current;
}
}
return null;
} |
c2ecd70f-1a4f-4da6-9603-9e246334ea2d | 8 | public void testWeighted(String prefix, int maxIter, int seedSize,
double threshold, int noTrees) throws FileNotFoundException {
if (noTrees == 0) {
noTrees = Integer.MAX_VALUE;
}
double sumacc = 0.0;
// double sumaccw = 0.0;
double acc = 0.0;
// dou... |
1425898e-3c93-43be-8d4e-e781599efd3f | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
08a7f82a-5cfc-4f00-b339-a1ec5bd4d905 | 4 | private boolean newTable(MCDAssociation ass) {
if (ass.sizeLink() > 2 || ass.sizeInformation() > 0)
return true;
boolean porteuse = true;
for (Iterator<MCDLien> e = ass.links(); e.hasNext();)
if (!((MCDLien) e.next()).getCardMax().equals("N"))
porteuse = false;
return porteuse;
} |
25441530-03b1-45e5-8d8e-a48503d9faeb | 5 | @Override
public boolean equals(Object obj) {
if (obj instanceof BulkFood){
BulkFood objFood = (BulkFood)obj;
if (objFood.name.equals(this.name) && objFood.unit.equals(this.unit) &&
objFood.pricePerUnit == this.pricePerUnit
&& objFood.supply == this.supply)
return true;
else
retur... |
38844af1-ff25-411f-904f-4cb912b3c1fd | 1 | @Override
public BufferedImage[] getClonedObject(String name, Map<String, String> data) {
BufferedImage[] oldImages = getObject(name, data);
BufferedImage[] newImages = new BufferedImage[oldImages.length];
for(int i = 0; i < oldImages.length; i++){
newImages[i] = oldImages[i].getSubimage(0, 0, oldImages[i].ge... |
114df5f4-97f2-4c35-8101-efb61646d251 | 5 | public void edit(Room room) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
room = em.merge(room);
em.getTransaction().commit();
} catch (Exception ex) {
... |
6a91ce82-4489-4c93-b9d9-367ab92ea2ec | 5 | @Override
public void executar() throws Exception
{
boolean goBack = false;
while ( !goBack )
{
mostrarOpcions();
int choice = readint("\nOPCIO: ");
switch (choice)
{
case 1:
... |
b61f77d4-8bd6-4dcb-bf8d-b101492c6a08 | 0 | public Medico getMedico() {
return medico;
} |
c77a9cd3-33fe-4cf1-a965-781b3a64e666 | 0 | @Test
public void testTruncate_null()
{
Assert.assertEquals(null, _helper.truncate(null, 35));
} |
80a845f4-cdb6-49b2-8b99-9a82c4fb3766 | 2 | public synchronized void sendBinary(Object message)
throws IOException {
if (trace >= API_TRACE_MESSAGES) {
Log.current.println(df.format(new Date()) + "\n Sending request: " + message + " to connection: " + this);
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("sendBinary: " + ... |
d1a388f1-94ec-49ba-b97d-8f90ce9eb0e9 | 9 | private BufferedImage convertGreyscaleToArgb(byte[] data, BufferedImage bi) {
// we use an optimised greyscale colour conversion, as with scanned
// greyscale/mono documents consisting of nothing but page-size
// images, using the ICC converter is perhaps 15 times slower than this
// method. Using an example sc... |
741d328e-3f82-4dfb-9bec-218c4fd95c48 | 7 | private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
49c7b848-82f8-40a9-b848-6c043f91e5e2 | 4 | public TileMap loadNextMap() {
TileMap map = null;
while (map == null) {
currentMap++;
try {
if(currentMap==4){
currentMap=1;
}
map = loadMap(
"/maps/map" + currentMap + ".txt");
}... |
322956c3-f75f-4713-84d5-1e2168c03f41 | 8 | public void setShuffledState() {
Random random = new Random();
for(int i=0;i<20;i++) {
switch(random.nextInt(5)) {
case 0 : shiftUp(random.nextInt(3)); break;
case 1 : shiftDown(random.nextInt(3)); break;
case 2 : shiftLeft(random.nextInt(3)); break;
case 3 : shiftRight(random.nex... |
50b852b1-f7c0-498d-af8e-9e0938a5414b | 9 | public static void goToUnexplored(){
int x = RobotData.INSTANCE.getLocation().x;
int y = RobotData.INSTANCE.getLocation().y;
Point coor = PatternCheck.getClosestUnexplored(x, y, map,0);
int tarX = coor.x;
int tarY = coor.y;
//path planning, going to unexplored
... |
8ef7aed5-f44c-4d99-81cc-8f754aafc4d7 | 8 | private ForNode For() throws SyntaxException {
try {
BlockNode init = null;
ExpressionNode condition = null;
BlockNode<ExpressionNode> step = new BlockNode<ExpressionNode>();
Position pos = iterator.current().coordinates().starting();
nextToken();
... |
f2655f30-27a6-4dce-9925-f2d62786ec85 | 3 | public Sprite getSprite(String ref) {
if (sprites.containsKey(ref)) return sprites.get(ref);
BufferedImage sourceImage;
try {
URL url = this.getClass().getClassLoader().getResource(ref);
if (url == null) {
System.out.println("Can't find: " + ref);
}
sourceImage = ImageIO.read(url);
Gr... |
282e49c7-3c7a-4257-9fa5-9546091270e1 | 2 | public ArrayList<Tayte> haeTaytelista() throws DAOPoikkeus {
ArrayList<Tayte> taytteet = new ArrayList<Tayte>();
// Avataan yhteys
Connection yhteys = avaaYhteys();
try {
// Haetaan tietokannasta kaikki sinne tallennetut täytteet.
String tayteQuery = "select nimi, tayteID from Tayte ORDER BY ... |
630e958e-74c7-419f-9922-96ab32c5f692 | 9 | public InputStream createIncomingStream(StreamInitiation initiation) throws XMPPException {
PacketCollector collector = connection.createPacketCollector(
getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()));
connection.sendPacket(super.createInitiationAccept(initi... |
3dab0378-fffe-42c0-bad9-c726e2bb5802 | 3 | public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) {
if (!(sender instanceof Player)) {
Language.IN_GAME_ONLY.bad(sender);
return;
}
if (args.length == 0) {
Player player = (Player) sender;
displayInfo(... |
b943b737-19f4-45eb-a70a-028ed08d3f9b | 4 | public String[][] getStringArrayByQuery(String query) throws SQLException {
checkConnection();
if(conn != null) {
Statement stmt;
try {
stmt = conn.createStatement();
ResultSet resSt = stmt.executeQuery(query);
ArrayList<String[]> al = new ArrayList<String[]>();
int rowCount = resSt.getMetaDat... |
82883cf7-d547-4c1d-8ed1-d69e32c5f22a | 5 | static final int method1098(int i) {
if ((double) Class26.aFloat473 == 3D) {
return 37;
}
if ((double) Class26.aFloat473 == 4D) {
return 50;
}
if ((double) Class26.aFloat473 == 6D) {
return 75;
}
if (i != 37) {
retur... |
f4fce0bd-baf7-40d8-8ecf-63e69cd9c60a | 9 | public void magicOnItems(int slot, int itemId, int spellId) {
switch(spellId) {
case 1162: // low alch
if(System.currentTimeMillis() - c.alchDelay > 1000) {
if(!c.getCombat().checkMagicReqs(49)) {
break;
}
if(itemId == 995) {
c.sendMessage("You can't alch coins");
break;
}
... |
0f38a77e-9835-4589-af22-1f1c4a270173 | 8 | public void op(Object x, Object y) {
if (x instanceof double[])
opDouble((double[]) x, (double[]) y);
else if (x instanceof int[])
opInt((int[]) x, (int[]) y);
else if (x instanceof boolean[])
opBoolean((boolean[]) x, (boolean[]) y);
else if (x instanc... |
06954a0e-ad4e-4efe-8096-b33e7dbc1cc7 | 8 | public static ArrayList<String[]> generateStandardPopulation(String popType,
int popSize, String missing) {
ArrayList<String[]> pedList = new ArrayList<String[]>();
int numlength = Integer.toString(popSize).length();
DecimalFormat format = new DecimalFormat("0000000000".substring(0, ... |
c828dbc3-a075-45f8-bf75-54a8d0406d87 | 5 | void func_523_a(int var1, int var2, int var3, float var4, byte var5, int var6) {
int var7 = (int)((double)var4 + 0.618D);
byte var8 = otherCoordPairs[var5];
byte var9 = otherCoordPairs[var5 + 3];
int[] var10 = new int[]{var1, var2, var3};
int[] var11 = new int[]{0, 0, 0};
int var12 =... |
690ec24f-7668-487e-9bce-7f0fa714258f | 1 | public static AppWindow getTopWindow() {
if (!WINDOW_LIST.isEmpty()) {
return WINDOW_LIST.get(0);
}
return null;
} |
c546bc59-990b-4438-b9f4-964aafa7fe51 | 0 | public void setBuyBackMoney(double buyBackMoney){
this.buyBackMoney = buyBackMoney;
} |
b0e10c72-8c20-43fa-97e6-13694770f542 | 2 | public void reconnect()
{
reconnecting = true;
close();
// Attempt reconnects every 5s
while (!isConnected())
{
try
{
connect();
}
catch (IOException e)
{
System.err.println("Error when reconnecting: ");
e.printStackTrace(); // For debug purposes
sleep(5000);
}
}
... |
d1fe24b1-59b1-4a6e-8f72-825cde5e2746 | 4 | public boolean submitResponseBipolar(BipolarQuestion bipolarQuestion) {
Element bipolarQuestionE;
boolean flag = false;
for (Iterator i = root.elementIterator("responseToBipolar"); i.hasNext();) {
bipolarQuestionE = (Element)i.next();
if (bipolarQuestionE.element("id").getText().equals(bipolarQuestion.getId... |
12ef612d-f14b-43e5-b1a6-35b6a7a9b0b4 | 6 | public void printBoard( boolean[][] b, Tuple<Integer,Integer> currentLight ) {
for ( int i = 0; i < 100; i++ ) {
for ( int j = 0; j < 100; j++ ) {
if ( currentLight != null && currentLight.y == i && currentLight.x == j ) {
System.err.print( "*" );
} else {
if (b[j][i]) {
System.err.print( ... |
275787ad-8027-4c8a-bd83-b94507ecb6de | 3 | public InputField() {
super(510);
setMaximumSize( new Dimension(0, 28) );
setFocusTraversalKeysEnabled(false);
addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
handleInputText();
}
... |
08563475-0711-4259-b7d2-ec4e580267c3 | 8 | public void paint(Graphics g) {
Dimension size = getSize();
Color bgColor = getBackground();
if(bgColor != null) {
g.setColor(bgColor);
g.fillRect(0, 0, size.width, size.height);
}
if(useCustomImages) {
Graphics2D g2 = (Graphics2D) g.create();
BufferedImage image = getOrientation() == J... |
62c78675-b943-4af6-a9f7-41e767e63c02 | 8 | public static void addMenu() {
JSScriptInfo.RemoveAllSriptsFromMenu();
unionRoot = new MenuElement(null,
new String[]{CustomMenu.menu_prefix}, resUnion, "Union",
"Union functions", 'U', "union_root");
union_menu.setRootElement(unionRoot);
/*Здесть насрал Керрига... |
7b648b19-065e-4a99-a90c-9fb94edd4048 | 1 | public GameLogic(){
for (int i=0; i<9; i++){
this.gameField[i] = 0;
}
this.isFull = false;
this.turn = 1;
} |
fb58bf3b-460a-4082-87fd-96cd8501adab | 1 | public void ge_print(TextArea area,String var,String prefix){
String instr="";
if(!var.equals("-145876239")){
instr = prefix + "%call" + String.valueOf(call_num) + " = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 " + var + ")\n";
}
... |
7b36549c-65a0-4a9e-a0a3-9bb3a1b42fa2 | 4 | public HUD(Main main, OrthographicCamera cam) {
this.cam = cam;
this.main = main;
this.character = main.character;
//font = TextureRegion.split(Game.res.getTexture("text"), 8, 11)[0];
//font = TextureRegion.split(Game.res.getTexture("text2"), 7, 12)[0];
font = TextureRegion.split(Game.res.getTexture("tex... |
020a56d3-53bb-458a-b7d1-accd8136e31c | 2 | @Override
public String toString() {
String result = "";
for (int y = 0; y < this.image.getHeight() - scale; y += scale) {
for (int x = 0; x < this.image.getWidth() - scale; x += scale) {
result += pixelToChar(getBlockIntensity(x, y));
... |
8243c61a-70d7-45ae-a600-0a3e2648aeb2 | 2 | public static double[][] getArrayCoordinates(Point[] array){
int n = array.length;
int m = array[0].getPointDimensions();
double[][] cc = new double[m][n];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cc[j][i] = (array[i].getPointCoordinates())[j];
... |
c6078777-547a-4735-ab1a-394d0e8b708b | 3 | private static void makeLevel(int level) {
if (level == 1) {
makeLevel1();
}
if (level == 2) {
makeLevel2();
}
if (level == 3) {
makeLevel3();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.