method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b7da832c-dcbd-4c99-b23b-f5f990f720ba | 4 | public Transporte recebeuACKde(Transporte t, InetAddress adress){
Transporte t1=new Transporte(initTransportePSH);
this.Recebidos.lock();
ArrayList<DatagramPacket> lista = (ArrayList<DatagramPacket>) this.Recebidos.lista.clone();
this.Recebidos.unlock();
for(DatagramPa... |
4b04c470-ac05-4993-9ce6-4b44e3f97d93 | 6 | public final void gen_attack_bknight(Board board, int square) {
int mobility_all = 0;
int mobility_safe = 0;
int mobility_total = 0;
int attackedSquare;
for(int i = 0; i < 8; i++)
{
attackedSquare = square + knight_delta[i];
if((attackedSquare & 0x88) ==0)
{
BB[attackedSquare] |= MINOR_BIT;
... |
b3fcd475-1f03-49cc-b50c-833434c14141 | 9 | protected UIComponent createVerbatimComponentFromBodyContent() {
UIOutput verbatim = null;
String bodyContentString;
String trimString;
if (null != bodyContent &&
null != (bodyContentString = bodyContent.getString()) &&
0 < (trimString = bodyContent.getStr... |
27985bce-50a6-4a0b-aee3-8df93e0380dc | 4 | protected boolean needsFill(Point p)
{
if (p.x < 0 || p.y < 0 || p.x >= source.getWidth() || p.y >= source.getHeight())
return false;
return needsFillInBound(p);
} |
7f6ab5c5-006f-4736-915b-d313750e12c8 | 8 | private void makeWormTurn(int i, int j) {
Worm thisWorm = (Worm) Level[i][j];
if (thisWorm.isChecked()) {
return;
}
HexDirection dir = thisWorm.getWormsNewDirection();
int newX = TranslateDirection(i, j, dir, 'x');
int newY = TranslateDirection(i, j, dir, 'y')... |
4356e36b-d9f0-4b25-bb41-5d46b2a0d184 | 3 | void BalWFext( double[][] A)
{
edge f, g;
if ( head.leaf() && tail.leaf() )
distance = A[head.index][head.index];
else if ( head.leaf() )
{
f = tail.parentEdge;
g = siblingEdge();
distance = 0.5*(A[head.index][g.head.index]
+ A[head.index][f.head.index]
- A[g.head.index][f.head.index... |
9afe776c-522a-4520-801a-6691952d33ed | 5 | @Override
public void doAction()
{
if (isRunning)
return;
isRunning = true;
RoundManager roundManager = RoundManager.getInstance();
ScoreManager scoreManager = ScoreManager.getInstance();
MessageDialog messageDialog = MessageDialog.getInstance();
Nam... |
02a02905-16bf-4fea-8ad1-c6637e8c42f4 | 0 | public void decrementAttempts(){ ReconnectAttempts--; } |
9eaa85bf-1ecb-4b39-b383-66662cc49342 | 5 | void menuSave() {
if (image == null) return;
animate = false; // stop any animation in progress
// If the image file type is unknown, we can't 'Save',
// so we have to use 'Save As...'.
if (imageData.type == SWT.IMAGE_UNDEFINED || fileName == null) {
menuSaveAs();
return;
}
Cursor waitCursor = new... |
215feb8f-a5d6-4156-90c4-e8034480e65d | 0 | public static void start() {
GraphDrawer drawer = new GraphDrawer();
drawer.setGraph(GraphInterface.getGraph());
GraphCanvas canvas = new GraphCanvas(drawer);
Window w = new Window(canvas);
SwingUtilities.invokeLater(w);
} |
3c6ee1c2-f2eb-4441-8436-211d5f0f5198 | 3 | public static int getMaxCardsSuite(ArrayList<Card> cards) {
int[] suiteCounts = new int[Card.NUM_SUITES];
for (Card card : cards) {
suiteCounts[card.suite]++;
}
int maxSuiteIndex = 0;
for (int i = 1; i < suiteCounts.length; i++) {
if (suiteCounts[i] > sui... |
791a551d-634d-40e5-8bf8-9c208b45a9e4 | 2 | public int buscarIndex(clsEnArticulo[] arreglo, String nombre)
{
int res=-1;
for(int i=0;i<arreglo.length;i++)
{
if(arreglo[i].getNomprod().equals(nombre))
{
res=i;
break;
}
}
return res;
} |
65a49d9c-5d7e-4d43-8ae4-8d6ba637949c | 9 | public static void init(String _language) {
if (replace == null) {
replace = new SetOfReplacements(SegmentationConstant.FILE_REPLACE);
}
if (_language.equals("???")) {
System.out.println("default=EN");
_language = "ENGLISH";
}
language = _langu... |
53fc7522-53cb-49d2-82c8-9ac1bdb67fbd | 7 | private Class getWrapperClassFromPrimitive(Class t) {
if(t == int.class) { return Integer.class; }
if(t == short.class) { return Short.class; }
if(t == float.class) { return Float.class; }
if(t == boolean.class) { return Boolean.class; }
if(t == double.class) { return Double.class; }
if(t == long.class) { ... |
0b617861-c0ec-40ea-8dda-596c9acc4fa9 | 0 | public KAModel() {
super();
data = new Vector<Osoba>();
} |
b4d5920b-82d6-4b7f-8497-e472e01c8f6a | 5 | public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("How many times do you want to repeat the figure (>1)?: ");
int repeatTimes = keyboard.nextInt();
System.out.print("Indicate the number of stars (>1): ");
int numberOfStars = keyboard.nextInt();
for (int out... |
b86486e8-38dc-416a-a438-9509aa569dd4 | 8 | protected void _putcatalog() {
this._out("/Type /Catalog");
this._out("/Pages 1 0 R");
if ((this.zoomMode == null) && (this.zoomFactor > 0)) {
this._out("/OpenAction [3 0 R /XYZ null null "
+ this.zoomFactor / 100 + "]");
} else if (Zoom.FULLPAGE.equals(this.zoomMode)) {
this._out("/OpenAction [3... |
7c28569f-355f-4a04-965c-c086bd4cf539 | 4 | private static boolean isPangram(String in) {
int []arr = new int[26];
int BASE_A = 'a';
in.trim();
in=in.toLowerCase();
in=in.replace(" ","");
char []chars = in.toCharArray();
for(char ch : chars){
int c = ch;
arr[c-BASE_A] = 1;
}
boolean flg = true;
int i = 0;
while(flg && i<26){
... |
ab27819c-7378-4b11-adca-57dc517687b8 | 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=pro... |
33390a08-ea95-4a03-bd3a-26a943bf49cd | 0 | public void update(Graphics g) {
paint(g);
} |
4159d457-5013-4a8b-af71-c31f60381eaa | 8 | public boolean hit(final int portal){
if(portal == 1){
this.health1--;
for(final Player p : Bukkit.getOnlinePlayers()){
p.playEffect(one, Effect.SMOKE, 0);
p.playEffect(one, Effect.SMOKE, 0);
p.playEffect(one, Effect.SMOKE, 0);
p.playEffect(one, Effect.SMOKE, 0);
p.playEffect(one, Effect.SMO... |
07a4af32-5955-44bf-be00-ad6252183b8d | 8 | @Test
public void test_simple_table() throws ParserConfigurationException, SAXException, IOException{
/*
* Arrange
*/
HtmlView<?> view = new HtmlView();
view.head().title("Dummy Table");
HtmlTable<?> t = view.body()
.heading(1, "Dummy Table")
.hr()
.div()
.table();
HtmlTr<?> headerRow = t.tr(... |
5c34fdad-d9ce-4805-94d4-729c7443ea51 | 6 | private void streamFile(FTPFile fromFile, PipedInputStream pis) throws IOException, FtpWorkflowException, FtpIOException {
setConnectionStatusLock(CSL_INDIRECT_CALL);
setConnectionStatus(RECEIVING_FILE_STARTED, fromFile, null);
setConnectionStatus(RECEIVING_FILE);
RetrieveComma... |
c698c053-f514-459e-86b1-6e64dda81632 | 2 | public void addAload(int n) {
if (n < 4)
addOpcode(42 + n); // aload_<n>
else if (n < 0x100) {
addOpcode(ALOAD); // aload
add(n);
}
else {
addOpcode(WIDE);
addOpcode(ALOAD);
addIndex(n);
}
... |
4186e631-53d3-4ad3-950c-9e54447438b9 | 0 | public static void main(String[] args) {
// 对象名,要在反射的时候输入名称,名称需要在SRC文件下的全路径
AbstractDriver driver = AbstractDriver.getInstance("designPattern.factory.abstraction.BmwDriver");
Car car = driver.driverCar();
Bus bus = driver.driverBus();
car.driver();
bus.driver();
} |
257b5280-d23f-4d99-8038-5f38a0a49e99 | 6 | @SuppressWarnings("unused")
private static void updateOldJobs() {
JobsDatabase oldJob = new JobsDatabase();
int[] refuseSet = {31};
int[] rejectedSet = {12,29,32};
int[] inProcessSet = {49,50,51};
if(refuseSet.length>0){
for(int i=0;i<refuseSet.length;i++){
JobsDatabase.updateJobStatus(jobDBM, "Ref... |
79f70b83-1097-48a4-9765-2e70de7dddef | 1 | @Override
Integer redactEntity(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idOrder = (Integer) criteria.getParam(DAO_ID_TOURIST);
if (idOrder != null) {
return updateTourist(criteria, dao);
} else {
return createTourist(criteria, dao);
}
... |
2f969324-e7d0-40a5-9f88-53138146496b | 7 | public void update(String tabName, String value, String column, ArrayList<String> values,
ArrayList<String> names){
String statement = "UPDATE " + tabName + " SET " + column + "=? WHERE ";
connect();
if(msg.equals("OK")) {
for(int i = 0; i < names.size(); i++) {
... |
6ba14eb0-a237-4548-a7dc-fc07fd59068e | 9 | private CarFeature carFeatureParse(String a) {
if (a.equals(CarFeature.ABS.toString())) {
return CarFeature.ABS;
}else
if (a.equals(CarFeature.ALARM.toString())) {
return CarFeature.ALARM;
}else
if (a.equals(CarFeature.CAR_AUDIO.toString())) {
return CarFeature.CAR_AUDIO;
}else
if (a.equals(Ca... |
9aa30692-293e-4d44-ba9f-57d20f02284e | 7 | public void put(byte[] data, int offset, int len) {
if (len == 0) return;
synchronized (signal) {
// see if we have enough room
while (putAvailable() < len) {
try { signal.wait(1000); } catch (Exception e) { System.out.println("Put.Signal.wait:" + e); }
... |
12aa35f4-3cc0-4a75-8a32-5dbd597ba309 | 9 | private static String findUsingDP(String str){
int maxLen = 0;
int strLen = str.length();
String result = "";
int[][] dpTable = new int[str.length()][str.length()];
for(int i=0;i<strLen;i++){
dpTable[i][i]=1;
}
for(int i=0;i<=strLen-2;i++){
if(str.charAt(i)==str.charAt(i+1)){
dpTable[i][i+1]... |
d3a742fe-5047-4f39-a3b9-389ae7ad497b | 1 | public void AssignPlayersInTeams() {
for (int i = 0; i < players.size(); i++) {
Player p = players.get(i);
int team_num = (int) (Math.random() * (NumOfTeams));
teams.get(team_num).AttachPlayer(p);
}
} |
7560c484-1634-49d3-b5b3-60acf93faa42 | 7 | public int hasLoop(MySinglyLinkedList first) {
if(first == null) // list does not exist..so no loop either.
return 0;
MySinglyLinkedList slow, fast; // create two references.
slow = fast = first; // make both refer to the start of the list.
while(true) {
sl... |
51776984-3f47-4951-9733-1b455250d3d1 | 5 | protected final void advance(char c) {
cursorState = true;
cursorTimer.restart();
switch (c) {
case '\n': cursorX = 0; if (++cursorY >= rows) scrollByOneRow(); break;
case '\r': break;
default:
if (++cursorX >= logicalColumns) {
... |
f90644c2-f34d-4c66-b527-af5bb1860219 | 5 | public static AbstractConfigurator getConfigurator(ConfigurationSection globalConfig, AbstractCommand command) {
AbstractConfigurator result = new NullConfigurator();
switch (command.getCommandType()) {
case BAN:
result = new BanConfigurator(globalConfig);
... |
90ef792e-36ff-4a0f-88ab-1592c4a5532a | 6 | public static byte[] encrypt(byte[] data, byte[] key) {
byte[] bloc = new byte[16];
key = paddingKey(key);
S = generateSubkeys(key);
int lenght = 16 - data.length % 16;
byte[] padding = new byte[lenght];
padding[0] = (byte) 0x80;
for (int i = 1; i < lenght; i++)
padding[i] = 0;
int count... |
6a00340d-ea9d-45a7-906d-c5f3d13c0811 | 2 | public static Image createWhiteImage(int height, int width) {
Image whiteImage = new RgbImage(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
whiteImage.setPixel(x, y, Color.WHITE.getRGB());
}
}
return whiteImage;
} |
0eceab0e-9ad7-4c39-a783-6a7801db5aff | 0 | public static void setBalance(String uid, double bal) {
balance = bal;
} |
30bfc719-de15-4998-ae83-917aa20a2cfa | 0 | public void setTask(Task task) {
this.task = task;
} |
a3238294-a55f-4734-88a9-0318431605e8 | 2 | public Client(String address, int port) throws ConnectException, IOException {
try {
clientSocket = new SocketManager(address, port);
clientSocket.setSoTimeout(5000);
} catch (ConnectException e) {
throw new ConnectException();
}catch (IOException e) {
throw new IOException();
}
} |
d2bb8573-1d62-484c-834c-32316b558300 | 7 | void stepinto()
{
debugMode = 0;
new Memory();
checkpoint.reset();
backend.StepRun.transfer = 0;
backend.step_over.otransfer = 0;
backend.step_out.common = 0;
backend.step_out.call = false;
ScanFile.call_count = 0;
backend.step_out.next = 0;
... |
44aa967d-b070-4704-955b-883a3085f8eb | 7 | @Override
public Item peekFirstItem()
{
if (packageText().length() == 0)
return null;
final List<XMLLibrary.XMLTag> buf = CMLib.xml().parseAllXML(packageText());
if (buf == null)
{
Log.errOut("Packaged", "Error parsing 'PAKITEM'.");
return null;
}
final XMLTag iblk = CMLib.xml().getPieceFromPiece... |
1576ef98-45d6-4c22-a727-48ee07f3bc6d | 3 | @Override
public void mouseClicked(MouseEvent me) {
for(Entity e : Area.entities) {
if(e instanceof Slave) {
if(e.distance(me.getX() + View.x, me.getY() + View.y) < 10) {
select = e;
}
}
}
} |
833ac2ae-c250-46ad-89d0-6ea4a8e36537 | 2 | public final
AbstractPage getChildByURL (URL urlRequested) {
for (AbstractPage child: childPages)
if (child.url.equals(urlRequested)) return child;
return null;
} |
75266e22-41a2-440d-b055-f63a97798f90 | 8 | @Override
public List<Funcionario> Buscar(Funcionario obj) {
// Corpo da consulta
String consulta = "select f from Funcionario f WHERE f.ativo = 1 AND f.id != 0 ";
// A parte where da consulta
String filtro = " ";
// Verifica campo por campo os valores que serão filtrados
... |
40a0b943-40cb-44a4-b1c0-8ffb771c748f | 3 | @Override
public long solve() {
byte[] numbers = new byte[2000001];
long sum = 2;
int breakpoint = (int) Math.sqrt(20000000);
for (int x = 3; x < numbers.length; x += 2) {
if (numbers[x] == IS_PRIME) {
sum += x;
if (x < breakpoint) {
... |
d84a0714-4b84-47b8-950f-6145d5ccacb9 | 6 | public void
mouseClicked(java.awt.event.MouseEvent me) {
// System.out.println("\n mouseClicked");
TWPoint p = drawBoard_.mapClickToRowAndCol(new TWPoint(me.getPoint()));
// System.out.println("mouse click @ " + p.x + "/" + p.y);
if (currentState_ == STATE_PLACE_PEG) {
tryPlacePeg(p);
}... |
ac2f47a3-6e66-44f3-afc3-e79e12db8cc1 | 9 | private void buyHoldSell(Stock[] stocks){
int buyTemp=0;
int sellTemp=0;
int holdTemp=0;
buyArray = new Object [buy][10];
sellArray = new Object [sell][10];
holdArray = new Object [hold][10];
Object [][] smallBuy = new Object [buy][6];
Object [][] smallSell = new Object [sell][6]... |
8411bec3-c9ac-4192-97ef-aeac4b994ebe | 5 | public static void playGame() {
System.out.print("PLAY");
processing();
do {
deck.add(playerOneHand.get(playerOneHand.size() - 1));
playerOneHand.remove(playerOneHand.size() - 1);
if (compareCards()) {
randomPlayer();
}
deck.add(playerTwoHand.get(playerTwoHand.size() - 1));
... |
4de919bc-4757-446a-9736-02b4bbf0c427 | 5 | public boolean add(IAliasedItem<T> item)
{
String key = item.getKey();
if(backingMap.containsKey(key))
{
return false;
}
//IAliasedItem ai = new AliasedItem(item, aliases);
backingMap.put(key, item);
for(String alias : item.getAllAliases())
{
StringList list = aliasesMap.get(alias);
if(list ==... |
85f12829-02fc-4a50-9bd7-d539341cefa8 | 7 | protected static final
synchronized WritableRaster getCachedRaster
(ColorModel cm, int w, int h) {
if (cm == cachedModel) {
if (cached != null) {
WritableRaster ras = (WritableRaster) cached.get();
if (ras != null &&
ras.getWidt... |
2967a033-d30f-4e6b-9ac7-f30a6f3c16aa | 6 | private long collatzSteps(long num) {
long result=0;
cache2.clear();
while(num!=1){
if(cache.get(num)!=null){
result = result+cache.get(num);
break;
}
if(num<0){
print(num, "< 0");
}
if(num%2==0){
num=num/2;
}else{
num=num*3+1;
}
result++;
cache2.put(num, result);
... |
e26cea3d-07ea-4c9d-8f4e-603c0b599b33 | 0 | public static void play(){
GUI g = new GUI();
} |
791319af-8e87-4584-b9c8-7d12f72547de | 5 | public Collection<V> values() {
if (values == null) {
values = new AbstractCollection<V>() {
public Iterator<V> iterator() {
return new ValueIterator();
}
public int size() {
return LinkedTreeMap.this.size();
... |
cb71013c-e6cc-4f85-8822-3a5e2e0689ed | 3 | public boolean checkNijikokunPermissions(Player p, String perm) {
if (nijikokunPermissions == null) {
Plugin plug = parent.getServer().getPluginManager().getPlugin("Permissions");
if (plug != null) {
nijikokunPermissions = (com.nijikokun.bukkit.Permissions.Permissions) plug;
parent.log.debug("Nijikokun ... |
ef4dd2e9-19da-45c3-a9be-b54619e815f3 | 4 | public static double[][] ordenarPorCercania(double[][] dis){//arreglar
double[][] ordenado=new double[11][2];
ordenado[0][0]=dis[0][0]; ordenado[0][1]=dis[0][1];
for(int i=0;i<11;i++){
int min=i;
for(int j=i+1;j<11;j++) {
if(ordenado[j... |
9aae48a2-f0cc-4c1a-8dfd-a7faea32135c | 8 | public void render(){
x = Game.PLAYER.getCameraX();
y = Game.PLAYER.getCameraY();
if(update > 0){
Font.renderColored("LVL UP", Game.PLAYER.getX() - 6*4, Game.PLAYER.getY() + 32, 2, 1f, 0.8f, 0);
update--;
}
if(renderInventory) Inventory.render(x, y);
if(renderQuestLog) QuestLog.render(x, y);
... |
7268fc5c-d3ca-4c77-97fd-f53ade6ad213 | 7 | @Override
public void writeBytesToChannel(final DataBuffers buffers) throws IOException
{
while(buffers.hasNext())
{
final ByteBuffer buffer=buffers.next();
while(buffer.hasRemaining())
{
appSizedBuf.clear();
if(buffer.remaining() <= appSizedBuf.remaining())
appSizedBuf.put(buffer);
else... |
aa50b5b3-f71b-4203-a886-f434621ff2a3 | 6 | public static <T> boolean ifHasLoop(MyListNode<T> head) {
//One pointer advances once at each step,
// and the other advances twice at each step.
// If the faster pointer meets the slower one again,
// there is a loop in the list.
// Otherwise, there is no loop if the faster one reaches the end of list.
... |
dae33579-d595-4bc8-bc1c-92b05f2d319e | 7 | public static String[] getPageNames(Class<? extends BasePage> pageClass) {
int numPages = 0;
for (Class<?> clz : pageTypes) {
if (pageClass.isAssignableFrom(clz)) {
numPages++;
}
}
String[] res = new String[numPages];
int i = 0;
for... |
914a32a3-4447-4f50-8cf9-acca05318720 | 0 | public StringList() {
this.strings=null;
this.numEntries=0;
} |
80680463-3e6c-4082-959d-6b28ea4e43a8 | 3 | private int appendSymbolHistory(StringBuilder b, SymbolTable current)
{
if(current == null)
return 0;
int indent = appendSymbolHistory(b, current.getParent());
for(Symbol s : current.getDeclarationOrder())
{
// Two spaces per indent.
for(int i = 0; i < indent; i++)
b.append(" ");
b.append(Stri... |
096ee6b4-b68a-467c-b546-f1f855b4deae | 2 | private double smooth(int x, int y, BufferedImage image) {
double newValue = 0;
for(int i = x - 1; i <= x + 1; ++i) {
for(int j = y - 1; j <= y + 1; ++j) {
newValue += grayscale(image.getRGB(i, j));
}
}
return newValue/9;
} |
053316ba-ae63-4226-a353-8094eec1527c | 4 | public static int getEnvironmentalTempUnit() throws ClassNotFoundException {
int weightUnit = 0;
try{
//Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar");
Class.forName(driverName);
Class.forName(clientDriverName);
}catch(java.lang.ClassNotFound... |
66570cb9-5500-4d3b-9a53-edcd8f4ba0ba | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String msj_exito = "Se registro ... |
cabf7af9-5928-48ed-bcfe-b06d5cf8666a | 8 | public Image scale(Image img)
{
// Offset the image by one pixel so there's a border around it.
// This lets us avoid having to check that A-I are in range of the image before samping them
sourceGraphics.drawImage(img, 1, 1, null);
int line = width + 2;
for (int y = 0; y < h... |
f40e42a1-29ac-4623-98c7-673a74db454f | 6 | @Override
public void delete() {
Wire start = this.getStartPiece();
Wire end = this.getEndPiece();
if (end.potential != null) {
end.potential.delete();
this.circuit.getSimulation().addEvent(end.potential.getNode1(), 0);
this.circuit.getSimulation().addEvent(end.potential.getNode2(), 0);
}
Board bo... |
4b762f0b-4c19-4542-93a5-347a2dbf41fd | 9 | static String[] mergePropertyNames(String[] localNames,
String[] sourceNames) {
// Set the output names to the other array if one array is null
// or zero-length.
String[] names = null;
if(localNames == null || localNames.length == 0) {
... |
83d98cd9-22bb-4ca3-a63c-5cc57c5ed7d1 | 1 | public static int byteToInt(byte b){
if (b >= 0) return (int) b;
else return b + 256;
} |
59262391-3415-41d5-8deb-d070045c17aa | 6 | public static SequenceMove slow(int num, int withMove) {
EflUtil.assertNoEfl();
List<Move> moves = new ArrayList<Move>();
int move = num > 0 ? Move.DOWN: Move.UP;
if (num < 0)
num = -num;
if(num > 0)
moves.add(new PressButton(move | (num == 1 ? withMove : 0)));
for (int i=1; i<num; i++) {
moves.... |
2205241a-1e26-438e-a66c-4abd0e8913f5 | 2 | @Override
public void run()
{
System.out.println("Subprocess Ouput RUN");
try {
String text ;
int n;
byte[] buffer;
text="";
n=0;
buffer= new byte[9096];
System.out.println("Ok");
... |
3c199809-bbe2-43a4-a898-e393cdee1576 | 7 | public int compare(String a, String b) {
int[][] score = new int[a.length() + 1][b.length() + 1];
for (int i = 0; i <= a.length(); i++) {
score[0][i] = i;
}
for (int j = 0; j <= b.length(); j++) {
score[j][0] = j;
}
for (int i = 1; i <= a.length();... |
233a4129-a6af-4085-a958-b752ddd3c2ee | 6 | static int hex2num(char hex) {
if ((hex >= '0') && (hex <= '9'))
return (hex - '0');
else if ((hex >= 'a') && (hex <= 'f'))
return (hex - 'a' + 10);
else if ((hex >= 'A') && (hex <= 'F'))
return (hex - 'A' + 10);
else
throw (new IllegalArgu... |
152647e1-33f1-4ded-acc4-4d7a506e4118 | 2 | private Command findCommand(String name) {
for (Command command : commands)
if (command.getName().equals(name))
return command;
return null;
} |
9552b549-3c2f-4eb0-aa5a-c8130437ceb1 | 5 | public boolean checkIfMiddleInitial(String checkString)
{
if(checkString.matches(".*\\d.*"))
return false;
if(checkString.length() == 2 || checkString.length() == 1)
{
if(checkString.charAt(0) == '.')
return false;
if(... |
369331ff-9c5e-4772-be83-dc2f7db54778 | 1 | public static TestPanel getTestPanel() {
if (testPanel == null) {
testPanel = new TestPanel();
}
return testPanel;
} |
e6eb06a0-abcb-4c8a-9d66-253a725f0a10 | 7 | public void onUpdate()
{
if (this.isEntityAlive())
{
this.lastActiveTime = this.timeSinceIgnited;
int var1 = this.getCreeperState();
if (var1 > 0 && this.timeSinceIgnited == 0)
{
this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0... |
2d81a818-6144-4b97-a5d3-4f12cc2ed441 | 6 | private float func_1224_a(int i, int j, int k, Material material) {
int l = 0;
float f = 0.0F;
for (int i1 = 0; i1 < 4; ++i1) {
int j1 = i - (i1 & 1);
int l1 = k - (i1 >> 1 & 1);
if (this.blockAccess.getBlockMaterial(j1, j + 1, l1) == material) {
... |
b0aa1b62-ffd7-483b-92c3-e8083acabb9b | 4 | public static void main(String[] args) {
Random randGen = new Random();
Scanner input = new Scanner(System.in);
int n = input.nextInt();
String[] cards = {"2", "3", "4", "5", "6", "7"
,"8", "9", "10", "J","Q", "K", "A"};
char[] suits = { '♣', '♦', '♥', '♠' };
ArrayList<String> Deck = new ArrayList<Strin... |
5c043a39-b9c4-4484-b66a-51cb5ea1aff4 | 3 | private void processGetReplica(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] data = (Object[]) ev.get_data();
if (data == null) {
return;
}
String filename = (String) data[0]; // get name
Integer sender = (Integer) data... |
5cdb7773-d9d2-42fb-9494-bbfdec3f9006 | 1 | public int Area(int[] height,int sta,int end){
if(sta > end){
return 0;
}else{
int minIndex = minHeight(height,sta,end);
int areaT = (end-sta+1)* height[minIndex];
int areaL = Area(height,sta,minIndex-1);
int areaR = Area(height,minIndex+1,end)... |
2efad869-6dc3-4233-97c4-a8a7c12f5468 | 1 | public static synchronized void addConnectionBackToPool(Connection c)
{
if(c != null)
{
usedConnections.removeElement(c);
availableConnections.addElement(c);
}
} |
be4a4cf0-9227-4b26-b71d-4e110b3df45a | 8 | @Override
public void storeArray(Float a[],int column)
{
//store array as column in AL
for(int i=0;i<a.length;i++)
{
switch(column)
{
case 0:
attribute1.remove(i);
attribute1.add(i, a[i]);
... |
be6327f9-097e-46b0-a607-7e97336bb1bc | 1 | public int next() {
int value = -1;
try {
value = m.getElement(next_point[0], next_point[1]);
calculateNext();
} catch(Matrix.MatrixError e) {}
return value;
} |
792b0625-7841-4da5-9676-f7cc0a8f91eb | 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... |
a2d40956-33ae-4c47-b47f-2d17734d96ac | 1 | private static int sum(int... nums)
{
int sum = 0;
for(int element: nums)
{
sum = sum + element;
}
return sum;
} |
a1141026-28cd-4784-9358-df3b514300b8 | 6 | private static void addMetadata( OtuWrapper originalWrapper, File inFile, File outFile, boolean fromR)
throws Exception
{
HashMap<String, MetadataParser> metaMap = MetadataParser.getMap();
BufferedReader reader = new BufferedReader(new FileReader(inFile));
BufferedWriter writer = new BufferedWriter(new F... |
46b774b4-638f-420c-96bd-b90b6867f9d5 | 8 | public boolean rd_play( int i, int j, int val ){
int nval = -val;
int i1 = i+1;
int j1=j+1;
while( i1<values.length && j1<values[0].length && values[i1][j1] == nval ){
i1++;
j1++;
}
if( i1<values.length && j1<values[0].length && i+1 < i1 && values[... |
eedc796c-03dd-475b-a701-25245a60d474 | 9 | public void Puntajes() throws IOException {
try {
String nomArchivo = "Datos.txt"; // Nombre del archivo de texto
BufferedReader fileIn = new BufferedReader(new FileReader(nomArchivo));
int apunta = -1; // Apuntador auxiliar para cambiar el nombre
int[] arreglo; /... |
a38ee6c4-b055-44f6-9f22-e7a993fc81fb | 3 | public void originalVerticesLocal(double paramDistancia,double paramRadio)
{
Iterator elemFuente;
Elemento entrada,salida;
Iterator elemDestino = destino.listaElementos();
double sumaDistancias,sumaValores,distancia,ponderacion;
while(elemDestino.hasNext()) //Recorre... |
d453b896-5180-4126-b51f-6d1b6efdc5fc | 0 | public void setMessage(String message) {
this.message = message;
} |
0b12fd11-82e2-4f0d-aa40-6c45a9683d3f | 3 | private void enterRule(NonTerminal productionRule)
{
if(root == null)
{
root = current = new ParseNode(productionRule, null);
return;
}
ParseNode newNode = new ParseNode(productionRule, null);
newNode.Parent = current;
if(current.FirstChild == null)
current.FirstChild = newNode;
else
{
Pars... |
57543877-205c-4216-9c37-4bde3225f7ac | 4 | private Class getElementTypeFromGenerics (Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)type;
Type rawType = parameterizedType.getRawType();
if (isCollection(rawType) || isMap(rawType)) {
Type[] actualTypeArguments = parameterizedType... |
d2f4c529-ab15-4f65-84a5-848a15c221c5 | 7 | @FXML public void handleAddToCenter(MouseEvent e) throws Exception{
String resourceURL = null ;
ImageView ev = (ImageView)e.getSource() ;
if(ev.getId().equals("departmentImageView")){
resourceURL = "/application/department/addDepartmentDocument.fxml" ;
}else if(ev.getId().equals("teacherImageView")){
r... |
d32defc0-4487-4f4a-b6d5-5d22311e6f52 | 1 | private boolean stringIsNullOrEmpty(String str) {
return (str == null || str.length() == 0);
} |
c4892b43-8fe3-421f-bfd5-fc206bac46fc | 3 | public boolean containsConflictingLoad(MatchableOperator op) {
if (op.matches(this))
return true;
for (int i = 0; i < subExpressions.length; i++) {
if (subExpressions[i].containsConflictingLoad(op))
return true;
}
return false;
} |
7b84efa8-efe9-4cee-962a-fce6e81caed1 | 2 | public void setFactory( ConnectionFactory factory ) {
this.factory = factory;
if( site != null ){
if( factory == null ){
site.listening();
}
else{
trigger();
}
}
} |
9a0d1ebe-5939-4cae-9707-8ee8ccfac43c | 9 | public void spread(World wld){
float newX, newY, newZ;
newX = x;
newY = y;
newZ = z;
Random rndGen = new Random();
int direction = rndGen.nextInt(9) + 1;
switch (direction) {
case 1: newX = x - 1;
newZ = z - 1;
wld.EntityArray.add(new Plant(newX,newY,newZ));
break;
case 2: newX = x... |
9db12adf-b5c2-47ba-b384-250333977f0d | 8 | private static byte[] buildOid(String hex)
{
byte[] oid = new byte[SIZE];
for (int i = 0; i < HEX_SIZE; ++i)
{
char c = hex.charAt(i);
if (c >= '0' && c <= '9')
{
c -= '0';
}
else if (c >= 'a' && c <= 'f')
... |
e1476e60-eefc-4f14-892e-1e5e0efe993c | 0 | @Basic
@Column(name = "address_1")
public String getAddress1() {
return address1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.