method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6d708c34-7191-474c-866b-201857a2875c | 4 | public void render(Vector<SOMVector> inputs) {
float fl = (float)Math.sqrt(inputs.size());
int qb = Math.round(fl);
if (fl > qb) qb += 1;
float cellWidth = img.getWidth() / qb;
float cellHeight = img.getHeight() / qb;
int imgW = img.getWidth();
int imgH = img.getHeight();
Graphics2D g2 = img... |
c52106a0-cb6a-40ec-b6a6-b2a1167819d0 | 8 | public void processKeyInput(Monkey monkey, int keyCode) {
switch(monkey.getState()) {
case FirstRun:
case SecondRun:
if (keyCode == KeyEvent.VK_SPACE) {
model.getMonkey().setVerticalVelocity(Constants.JUMP_STRENGTH);
model.getMonkey().setState(MonkeyState.FirstJump);
}
break;
case First... |
0fa61684-748a-4bc1-87ba-b17ca865fc1b | 3 | private ArtifactType(ArtifactTypeEnum artifactType, String mimeType) {
setArtifactType(artifactType);
// Might need something more interesting than this in the future.
if (mimeType == null) {
if (artifactType == ArtifactTypeEnum.Document || artifactType == ArtifactTypeEnum.ExtendedDo... |
f7b77e91-f30c-4231-8c77-02d5296aa82d | 9 | public static void mergeQuestion() {
int arrlen = 3;
int [] arra = new int[arrlen * 2];
int [] arrb = new int[arrlen];
int [] arrc = new int[arrlen * 2];
arra = ArrayUtil.getRandomIntArray(arrlen * 2, 100);
arrb = ArrayUtil.getRandomIntArray(arrlen, 100);
Arrays.sort(arra);
Arrays.sort(arrb);
... |
761ab648-8d58-4824-bddd-8419cb76c225 | 6 | public static double capture(String sentence, int pos) {
double ans = 0;
String current = "";
char sufijo = ' ';
for (int i = pos+2; i < sentence.length(); i++)
if(sentence.charAt(i)=='.' || Character.isDigit(sentence.charAt(i)))
current += (sentence.charAt(i)+"");
else{
sufijo = sentence.charAt(... |
f66cdd55-e4c8-45de-a20d-bb0bcd158881 | 5 | private void pullFile_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pullFile_fileManagerButtonActionPerformed
String location = directoryLabel_fileManagerLabel.getText();
String name = (String) jList1.getSelectedValue();
boolean pullDir = false;
File... |
0d30e814-f36f-459c-83be-1e8b371be82f | 9 | protected int diff_commonOverlap(String text1, String text2) {
// Cache the text lengths to prevent multiple calls.
int text1_length = text1.length();
int text2_length = text2.length();
// Eliminate the null case.
if (text1_length == 0 || text2_length == 0) {
return 0;
}
// Truncate the longer string.
... |
d3dc424b-de03-416b-b6b5-25da5df05cff | 1 | public void hideDialog() {
if(frame == null) buildGUI();
frame.setVisible(false);
} |
64460bd3-fedd-4e92-8a04-441007d07304 | 0 | public String getErrorMsg() {
return errorMsg;
} |
0d806b0b-1d50-4b94-a057-67268cd21cfe | 1 | public void main() {
System.out.println("Starting ...");
long start = System.currentTimeMillis();
Thread t1 = new Thread(new Runnable() {
public void run() {
process();
}
});
Thread t2 = new Thread(new Runnable() {
public void ... |
88e3ce9a-1803-4d09-a220-827b3be9139f | 2 | @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(name + ", Position,");
// Position
int pos[] = posArray();
for (int i = 0; i < count.length; i++)
sb.append(pos[i] + ",");
sb.deleteCharAt(sb.length() - 1);
sb.append("\n");
// Counts
sb.append(name + ",Count,")... |
9753f5a9-ce72-4d9d-8ae7-40f8c1c4677a | 1 | public boolean isInSection(long time) {
return start <= time && time <= end;
} |
9c9f818d-1f8d-4c56-8f6e-e62a0beee1c6 | 0 | @Override
public void destroy() {
node = null;
newText = null;
oldText = null;
} |
6bc0353a-441f-4402-ba67-4dc8d854e4f2 | 3 | private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) {
double[][] inputValues = this.learning.getInputValues();
double[][] outputValues =this.learning.getOutputValues();
currentScenario--;
if (currentScenario<0){
currentScenario = inputValues.length-1;
}
//updat... |
b64c4179-1df3-47d6-8379-e1bc1db7f74a | 5 | public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
while(true)
{
String s = sc.next();
StringTokenizer token = new StringTokenizer(s,":");
int hours=Integer.parseInt(token.nextToken());
int minutes=Integer.pa... |
6d89e48b-19cd-490f-8254-b780f93b7285 | 3 | public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw... |
ca5a1c30-3ed5-4b82-96e4-56fd79a31dc9 | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
9271a538-d735-4b91-9447-801f7b015c14 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler()
.runTaskTimerAsynch... |
7bafa89b-4c6d-4624-8d70-d0e07ef16d28 | 1 | public List<DocumentDTO> fetchAll() {
List<DocumentEntity> documents = documentDao.fetchAll();
List<DocumentDTO> documentDtos = new ArrayList<DocumentDTO>();
for (DocumentEntity documentEntity : documents) {
DocumentDTO documentDTO = dtoCreatorUtil
.createDocumentDto(documentEntity);
documentDtos.add(d... |
238ce998-3282-4689-bec1-dfcef6bec46e | 0 | public String getBmonth() {
return bmonth;
} |
6f51c4f1-7115-4a25-bfbd-3f58aaee632e | 7 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
Context context;
Connection connection = null;
try {
context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup("jav... |
a504340d-795d-4baf-8e23-3d4fb8a9607c | 5 | private static final void set_default_settings() {
for (Setting s : Setting.values()) {
if (s.getDefaultValue() != null) {
System.setProperty(s.getKey(), s.getDefaultValue() != null ? s.getDefaultValue().toString() : null);
} else {
System.clearProperty(s.getKey());
}
}
for (StartupSetting s : S... |
46ef76b2-5c51-4cd5-8ba9-b6192c0d14d2 | 5 | private static void performCleanupStep1(BotState state, Moves movesSoFar) {
List<Region> regionsToConsider = new ArrayList<>();
for (Region region : state.getVisibleMap().getOpponentBorderingRegions(state)) {
if (region.getIncomingArmies() > 0 && region.getOutgoingMoves().size() == 0
// && region.getDefenceRe... |
1f0c1343-eaa4-499f-87b7-8e2754c86ce1 | 0 | public Colleague(String name) {
this.name = name;
} |
8a303f16-1b39-41b8-ae42-b3fde188592a | 7 | @Override
public void encode(BitBuffer buffer) {
int flag = 0;
if (use_direct_blit)
flag |= 1 << 6;
if (use_gpu)
flag |= 1 << 5;
if (has_metadata)
flag |= 1 << 4;
if (actionscript_3)
flag |= 1 << 3;
if (suppress_cross_domain_caching)
flag |= 1 << 2;
if (swf_relative_urls)
flag |= 1 << 1... |
1a46e06d-2436-4938-9e40-d4e1e50f2e99 | 2 | public double[][] getGridDydx1(){
double[][] ret = new double[this.nPoints][this.mPoints];
for(int i=0; i<this.nPoints; i++){
for(int j=0; j<this.mPoints; j++){
ret[this.x1indices[i]][this.x2indices[j]] = this.dydx1[i][j];
}
}
... |
2aa2b4b4-f863-4a00-b2e3-c85b1b523989 | 7 | @Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.allowLists ? 1 : 0);
hash = 53 * hash + (this.allowSingleTokens ? 1 : 0);
hash = 53 * hash + (this.ignoreComments ? 1 : 0);
hash = 53 * hash + (this.printTimingInfo ? 1 : 0);
hash = 53 * hash + (... |
6ceaabfd-4bda-41e5-9be1-ddaf8ae150cd | 4 | private void checkState() {
if(game.isWin(human)) {
gameOver("Congratulations, You've Won!");
}
if(game.isWin(computer)) {
gameOver("Sorry, You Lose!");
}
if(game.nextMove(human)==null && game.nextMove(computer)==null) {
gameOver("Draw, Click 'Play' For Rematch!");
}
} |
140369d1-6b1e-424a-b71d-5bfc5b2419ac | 4 | private void createConfig() {
getDataFolder().mkdirs();
File file = new File(getDataFolder(), "config.yml");
try {
config.load(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
e.printStac... |
eca6813b-62e8-48bf-ab72-bc5d3ee5f5b9 | 1 | public void visitCallStaticExpr(final CallStaticExpr expr) {
expr.visitChildren(this);
genPostponed(expr);
method.addInstruction(Opcode.opcx_invokestatic, expr.method());
// Pop each parameter off stack
final Expr[] params = expr.params();
for (int i = 0; i < params.length; i++) {
stackHeight -= param... |
1d761e47-5604-4014-b916-0381e9f97e9c | 7 | static private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
... |
a27fea0b-e60d-477d-9f83-d3442d264495 | 1 | @Override
public void goToCrystal(ManaCrystal manaCrystal, ManaAltar closestManaAltar) {
setPath(manaCrystal.getPoint());
addAction(new GatherMana(this, manaCrystal, getRemainingTime()));
if(closestManaAltar != null) {
// TODO we need to check again at each step if that the a mana altar exists
addAction(ne... |
6d9aeef2-98ea-4b14-8996-853c0ad8e5e4 | 0 | public void setSno(String sno) {
this.sno = sno;
} |
3b1bd2f3-ec3c-4413-bd79-4bd359046c38 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... |
a14fc5a2-151f-4183-80e2-31470c317199 | 0 | public Date getCreatedDate() {
return this.createdDate;
} |
e4df61bd-82fe-4b9c-97b0-c78619ceeae3 | 3 | protected final synchronized char nextCharInString(){
this.testFullLine=true;
char ch=' ';
boolean test = true;
ch=this.fullLine.charAt(0);
this.fullLine=this.fullLine.substring(1);
if(this.fullLine.length()==0)this.testFu... |
68b728e2-6725-4e74-998f-cbc74333311b | 5 | private void initialisationTextPaneKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_initialisationTextPaneKeyReleased
if (evt != null && isArrowKeyCode(evt.getKeyCode())) {
return;
}
try {
initialisationParser.parse(initialisationTextPane.getText());
}... |
3464aa5c-e7b6-42c5-9880-b96ddb32cf32 | 5 | public boolean desvirarCartas(PosicaoCarta pc1, PosicaoCarta pc2)
throws JogoNaoIniciadoException, DesvirarMesmaCartaException,
PosicaoDeCartaInvalidaException, JogoNaoFoiFinalizadoException {
if (!jogoIniciado())
throw new JogoNaoIniciadoException("Jogo não foi iniciado!");
if (pc1.getPx() == pc2.getPx()... |
76beb739-a1e3-4194-b224-fb953ea3f14c | 2 | public ProfesorBean loadId(ProfesorBean oAlumno) throws NumberFormatException {
try {
if (request.getParameter("id") != null) {
oAlumno.setId(Integer.parseInt(request.getParameter("id")));
} else {
oAlumno.setId(0);
}
} catch (NumberFor... |
4024874a-e4d2-4a1f-90fb-5f93a22b1ff8 | 7 | private static Map<String, String> retornaRecomendacoesDbpedia(
String mensagem, Map<String, String> mapa, String textoAnterior,
String entidadesAnteriores) {
URIBuilder builder = new URIBuilder();
builder.setScheme("http").setHost("spotlight.sztaki.hu:2228/rest")
.setPath("/annotate").setParameter("text... |
49858d04-7b90-4579-8c60-dc40ecfd05c0 | 7 | public final boolean setMidi(@SuppressWarnings("hiding") final Path midi) {
if (midi == null) {
throw new IllegalArgumentException();
}
synchronized (this) {
++this.lock;
while (this.lockRead > 0) {
try {
wait();
} catch (final InterruptedException e) {
--this.lock;
notifyAll();
... |
b53cadb4-ef56-4f61-b80c-bc1789ec7689 | 0 | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeObject(data);
} |
f693c7bd-5454-43b4-9922-08a71e83e57c | 0 | public FileProtocol getProtocol() {
return this.protocol;
} |
217430f7-79e2-4f30-9b93-39ec76bd5b4c | 5 | public static LinkedBlockingQueue<SeleniumNode> parseJob(BasicJob job) throws Exception {
LinkedBlockingQueue<SeleniumNode> queue = new LinkedBlockingQueue<SeleniumNode>();
Field[] fields = job.getClass().getDeclaredFields();
for (Field f : fields) {
if (!f.isAnnotationPresent(ElementAction.class)) {
throw... |
c8e2c03e-3826-4fb1-8474-b13f496b46f6 | 9 | private boolean isStandardProperty(Class clazz) {
return clazz.isPrimitive() ||
clazz.isAssignableFrom(Byte.class) ||
clazz.isAssignableFrom(Short.class) ||
clazz.isAssignableFrom(Integer.class) ||
clazz.isAssignableFrom(Long.class) ||
clazz.isAssignab... |
7b5c68bd-36b9-46d6-884d-5b858ff21c14 | 8 | public PrimitiveOperator combineLeftNRightOnRight(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
// the other gate is on the left side - on the LSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 1 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[2]) ? 1 : ... |
a6e546c1-5928-4c64-9b46-6aa3083e81fa | 2 | @Override
/**
* Is called when user updates the value in the table -> update Mortgages table
*/
public void setValueAt(Object value, int row, int col) {
BigDecimal amount = (BigDecimal) value;
MortgageTransaction mortgageTransaction = data.getBusinessObjects().get(row);
if (col == 2) {
mortgageTransactio... |
2407e9d1-c423-42be-835b-5955afdcd4bd | 7 | public void mouseClicked(MouseEvent e) {
for(int i =0; i < ppc.getProductClassesSize();i++)
{
for(int j =0; j < ppc.getProductsSize(i);j++)
{
if(e.getButton() == MouseEvent.BUTTON3){
if( e.getComponent() == productButtons[i][j] || e.getComponent() == orderedButtons[i][j])
{
if(orders[i][j]... |
db773ac7-cd88-43f5-a643-e2ef1c9500fc | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
int a, b, c;
a = 2;
b = 3;
if(a < b) System.out.println("a is less than b");
if (a == b) System.out.println(" you won't see this");
System.out.println();
c = a - b;
System.out.println("c contains -1 ");
if(c >... |
868f1f3a-a46c-4760-94cf-394a92adc50d | 3 | public void setData(int a, int m, int d) {
// ano = a; // sem validar ano
ano = a>0 ? a : 1;
if ( m > 0 && m <= 12 ) mes = m; // valida o mês
else {
mes = 1;
System.out.println( "Mes " + m + " invalido. Colocado o mes 1.");
}
dia = valid... |
e0c2c08b-35cf-4964-9de7-9018b990d71e | 0 | public String getByear() {
return byear;
} |
26eb9114-9836-48fa-962a-a32275bdd7b6 | 9 | public Type intersection(Type type) {
if (type == tError)
return type;
if (type == tUnknown)
return this;
int mergeTypes;
int mergeHints = 0;
if (type.typecode != TC_INTEGER)
mergeTypes = 0;
else {
IntegerType other = (IntegerType) type;
mergeTypes = possTypes & other.possTypes;
mergeHint... |
5ec4a944-dee6-421f-9b60-ebe5416a3d60 | 1 | public boolean _setMapCanvas(GenericCanvas mapcanvas)
{
if(mapcanvas != null)
{
this.mapcanvas = mapcanvas;
return true;
}
else
{
return false;
}
} |
702c9ba5-19ef-46e8-899a-19c135677c1f | 3 | public static boolean isFailureResult(Option[] options){
for(int i=0,count=options.length ; i<count ; ++i){
if((options[i].getName().equals(ActionResult.RESULT)) &&
options[i].getValue().equals(ActionResult.FAILURE))
return true;
}
return false;
} |
61b7e335-9edc-42ce-9d40-864af2fa7301 | 4 | public void changeHealth(int adjustment, boolean defendable) {
if (hasStatus(UnitStatus.Type.DEFENDED) && defendable && adjustment < 0) {
//Only defend health *reduction* that isn't self-inflicted.
adjustment += Ability.DEFEND.getProperty(Ability.Property.DAMAGE_REDUCTION);
}
currentHealth += adjustment;... |
98cdfd7e-50a9-4338-a140-3d2968c4b43d | 7 | public static void testGetProperty2() {
String input="foo, bar, foobar: 1000";
String result=Util.getProperty(input);
assert result != null && result.equals("1000");
input="foo, bar, foobar";
result=Util.getProperty(input);
assert result == null;
System.setPro... |
27a72e2d-aed0-4b58-90c1-256a327331fe | 6 | @Override
public byte[] getBinaryValue(byte[] result) {
ensureOpen();
if (isBinary) {
if (fieldsData == null) {
// Allocate new buffer if result is null or too small
final byte[] b;
if (result == null || result.length < toRead)
b = new byte[toRead];
... |
af110943-10a6-40a2-99d8-54f85cfb0e20 | 0 | public int getX() {
return x;
} |
a6d6d981-84d2-455c-97ed-b8c9b4104958 | 1 | public void fromStackToStack(int beginN, int endN, int srcStackNo,
int dstStackNo) {
int midStackNo = getThirdStackNo(srcStackNo, dstStackNo);
//get all stacks for pop/push operations later
Stack<Integer> srcStack = getStack(srcStackNo);
Stack<Integer> dstStack = getStack(dstStackNo);
if(beginN == en... |
1ae802f7-4d42-458d-9fd5-0822bb562eee | 0 | @Override
public String toJsonString(Map data) throws IOException {
return objectMapper.writeValueAsString(data);
} |
70b00b97-4907-4eaa-9adb-4873453e7542 | 9 | private T unmarshallPrimitive(VElement elem) throws ClassNotFoundException,
InstantiationException, IllegalAccessException,
NoSuchMethodException, IllegalArgumentException,
InvocationTargetException {
String wr = elem.getAttribute(
VMarshallerConstants.PRIMITIVE_WRAPPER_ATT... |
067f9945-cb74-4d5e-b75c-785cac9a29ce | 3 | public void handleRequest(Client client, byte[] request) {
StreamEventListener[] listeners = getStreamEventListeners();
for (int i = 0; i < listeners.length; i++) {
listeners[i].handleEvent(new StreamEvent("ClientRequest", request, client));
}
synchronized (this) {
hasRequested = true;
notifyAll();
... |
e8c585be-0cf6-44e4-b16f-c95c212df3f3 | 0 | public BSplaynForm (ArrayList<Excel> allEx)
{
allex = allEx;
setColoredExes();
} |
efee8f76-76d1-41a1-9e76-1ca5e376c80e | 8 | public Installation[] selectInstalledByActivity ( int activityId ) {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Installation> installations = new ArrayList<Installation>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT... |
eb91b1fd-07ae-49ae-80b4-5b2869a9611b | 3 | private void doStep(Vertex<Text, Text, NullWritable> vertex, Iterable<Text> messages) {
Text currentComponent = vertex.getValue();
boolean changed = false;
// did we get a smaller id ?
for (Text message : messages) {
Text candidateComponent = message;
if (candidat... |
60588aec-8e8c-4e16-8275-5ee01a20e5bf | 1 | public static void main(String[] args) {
BinaryTree<Integer> firstTree = new BinaryTree<Integer>();
Integer a = 5;
firstTree.add(a);
for (int i = 1; i < 8; i ++) {
a = i;
firstTree.add(i);
}
System.out.println(firstTree.exists(10));
firstTree.printByDepth();
firstTree.remove(5);
firstTree.pr... |
a253b279-300b-4382-8767-ed88e3749f39 | 5 | public boolean validMove(Coordinate newLocation){
boolean valid = true;
// remove the path if it is a wall or it is occupied or it is part of the outerwall
if(mazeMap.getNode(newLocation).isWall() ||
//mazeMap.getNode(newLocation).isOccupied() ||
newLocation.getX() < 1 || newLocation.getY() < 1 ||
new... |
7dc68de5-0227-4b2f-a0f7-b8d47e3a80ec | 5 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == buttonPane.getPlayButton()) {
errorPane.clearErrors();
buttonPane.setPlayButtonStates();
if (scriptEditor.isScriptEmpty() == false) {
try {
... |
d92a812e-5906-4324-8a51-8531418193ef | 1 | private int segmentAt( double position ) {
int result = Arrays.binarySearch( segmentLengthsSum, position * totalLength );
if( result >= 0 ) {
return result;
} else {
return -2 - result;
}
} |
6ed9f7b7-83b7-4ea9-9d91-4bc044dabee9 | 4 | public void indexFCTH(String IndexFile){
System.out.println("Indexing FCTH descriptor");
System.out.println("Indexing images in " + FileLocation);
//Get all files from sub directory
ArrayList<String> imagePaths = getFilesFromDirectory();
//create standard config file for the inde... |
a70da674-5781-405c-8c56-67a33091f8e8 | 1 | public boolean isArrowKey(int keyCode)
{
return keyCode >= KeyEvent.VK_LEFT && keyCode <= KeyEvent.VK_DOWN;
} |
e1302f2d-50cb-4103-9654-83370af0ac73 | 5 | private MainFrame()
{
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
setTitle("FBMS: File Backup and Management System");
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosed(WindowEvent arg0)
{
instance = null;
if(timer != null)
{
timer... |
7c636b02-810f-44bd-963b-2bea15213ec3 | 8 | static final void method424(int i, int i_0_, AbstractToolkit var_ha, int i_1_, int i_2_,
int i_3_, int i_4_, byte[][][] is, int i_5_,
int i_6_, int i_7_, int i_8_, int i_9_) {
try {
anInt768++;
if (i_7_ != i_1_ && i_3_ != 0) {
if ((i_7_ ^ 0xffffffff) == -10) {
i_7_ = 1;
i_4_ = i_4_ - -1... |
cbad79b9-d868-4938-af74-dde0a8029212 | 1 | public static AutomatonGraph getAutomatonGraph(int algorithm, Automaton automaton) {
if (algorithm == TREE_HIERARCHY)
return new AutomatonDirectedGraph(automaton);
else
return new AutomatonGraph(automaton);
} |
cc708082-ec03-4663-845e-496f08a88983 | 4 | public static PackedImage segment(PackedImage img, int level) {
img = threshold(img, level);
int index = 0;
for (int r = 0; r < img.rows(); r++) {
for (int c = 0; c < img.cols(); c++) {
if (img.at(r, c) == 0xffffff) { // If the pixel is white, change that region's color
segmentRecursion(im... |
d4b8cdad-f5da-4158-8bee-d96d5f081f60 | 9 | public static float shortJobFirst(int[] tasks, int[] dur) {
if (tasks == null || dur == null || tasks.length != dur.length) return 0;
PriorityQueue<Process> queue = new PriorityQueue<Process>(new Comparator<Process>() {
@Override
public int compare(Process p1, Process p2) {
if (p1.executeTime == p2.exe... |
261054de-222b-4bfa-978b-b355dd1ee32d | 7 | public Value create(Object val, Object args) {
Value[] v = (Value[]) val;
if(args instanceof Boolean)
return(new RCvalue(v, ((Boolean)(args)).booleanValue()));
String key = (String)(args);
if((key.compareTo("row") == 0) || (key.compareTo("col") == 0)) {
Value vv[];
if(v.length < 2) vv = v;
e... |
5e031a34-ccbe-46c6-a12a-00326de7da80 | 3 | @Override
public void caseAFormalrest(AFormalrest node)
{
inAFormalrest(node);
if(node.getIdentifier() != null)
{
node.getIdentifier().apply(this);
}
if(node.getType() != null)
{
node.getType().apply(this);
}
if(node.getComm... |
cf1def8a-b033-4a18-b627-525b021eb366 | 4 | public void basicSetUser(User myUser) {
if (this.user != myUser) {
if (myUser != null) {
if (this.user != myUser) {
User olduser = this.user;
this.user = myUser;
if (olduser != null)
olduser.removeAmis(this);
}
}
}
} |
0681f9af-0224-423e-92ee-5ad7bba88f4f | 7 | private boolean checkForKey() throws Exception {
String query = m_query;
query = query.replaceAll(" +"," ");
//query has to use all columns
if(!query.startsWith("SELECT *"))
return false;
m_orderBy.removeAllElements();
if(!m_DataBaseConnection.isConnected())
... |
38f8d9a1-2ef5-4fef-917d-cde055cb517c | 1 | private void selectionDown() {
pointer++;
if (pointer >= buttons.size())
pointer = 0;
} |
a5d61507-e12c-4a8d-95fe-03e5f68c77f7 | 1 | public boolean buscar(BeanProducto bean) {
String buscar = "SELECT id FROM producto WHERE nombre = \""
+ bean.getNombre() + "\"";
boolean estado = false;
try {
PreparedStatement ps = MySQL_Connection.getConection()
.prepareStatement(buscar);
... |
10f516eb-f5ad-4073-8c51-961803ba6ea3 | 8 | public RecNginxStatus(String NginxPath, String NginxStatusPath, String NginxUsername, String NginxPasswd)
{
if(NginxPath!=null && NginxPath.length()!=0)
{
this.NginxPath = NginxPath;
}
else
{
this.NginxPath = "/usr/local/nginx";
}
if(NginxStatusPath!=null && NginxStatusPath.length()!=0)
{
this... |
be5128db-416b-45a9-81b3-448aa4e52b11 | 8 | public List<Point> getPossibleMoves(Point position) {
List<Point> possibleMoves = new ArrayList<Point>();
//lower
if (position.x + 1 < _height) {
possibleMoves.add(new Point(position.x + 1, position.y));
if (position.y + 1 < _width) possibleMoves.add(new Point(position.x+1, position.y+1));
if (positio... |
80d530f1-d92d-4111-a537-ebea2e014192 | 2 | public String getSelectedPerson_stats(String selected){
String result = "Empty";
for (Person tempPerson : enginePersonList) {
if(tempPerson.getName().equals(selected)){
result = tempPerson.getNiceGuiString();
}
}
return ... |
6f4098c1-0880-4f1f-9f43-210e2cd16f25 | 4 | public static int triangleAmin(int x[][]) {
int min = x[0][0];
System.out.print("Triangle Is:\n");
for (int i = 0; i < x.length; i++) {
System.out.print("\n");
for (int j = 0; j < x[i].length; j++) {
if (i <= j) {
System.out.print(x[i][j] + " ");
if (min > x[i][j]) {
min = x[i][j];
... |
9e058a49-1c74-4ab6-ad05-2cf94c27e6a6 | 9 | public void direction() {
if (untouchable > 0) {
Dolphin dolphin = (Dolphin) getWorld().getObjects(Dolphin.class).get(0);
if (dolphin.direction == 0) {
setRotation(0);
}
else if (dolphin.direction == 1) {
setRotation(-45);
... |
766d98a9-0e5e-4b77-9661-bdbe50036ef7 | 0 | public void adiciona(Empresa empresa) {
geraIdEAdiciona(empresa);
} |
f634f124-5edb-473e-96f5-9f257be703b9 | 9 | private void processMemBlt(RdpPacket_Localised data, MemBltOrder memblt,
int present, boolean delta) {
if ((present & 0x01) != 0) {
memblt.setCacheID(data.get8());
memblt.setColorTable(data.get8());
}
if ((present & 0x02) != 0)
memblt.setX(setCoordinate(data, memblt.getX(), delta));
if ((present & 0... |
d18e3c2f-a172-4e68-bfe4-ef60926b756b | 1 | public void selectEdit() {
if (isAction()) {
div.findElement(By.className("dropdown-toggle")).click();
}
} |
187fe1c4-2de7-467f-bf19-643010e95f93 | 7 | private void select() throws IOException {
selector.selectNow();
Set<SelectionKey> readyKeys = selector.selectedKeys();
Iterator<SelectionKey> i = readyKeys.iterator();
while(i.hasNext()) {
SelectionKey sk = i.next();
i.remove();
if (sk.isAcceptable()) {
accept();
... |
db9af000-e4b9-41d0-b160-bdf514fdb9fb | 9 | protected static int getValue(char c) {
if (c >= 'A' && c <= 'Z')
return c - 'A';
if (c >= 'a' && c <= 'z')
return c - 'a' + 26;
if (c >= '0' && c <= '9')
return c - '0' + 52;
if (c == '+')
return 62;
if (c == '/')
retur... |
5dd65e17-43e7-4730-9e0d-f955d0de73ad | 4 | public static void main(String[] args) throws IOException {
BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
String line;
int n = Integer.parseInt(bi.readLine());
int[] a = new int[n];
int[] aSorted = new int[n];
long[] sums = new long[n];
long[] sumsSorted = new long[n];
line... |
e4aac624-5079-451e-a834-4d76a149b016 | 7 | public void startPlaying(final String filename)
{
try {
setupPlayer(filename);
Thread playerThread = new Thread() {
public void run()
{
try {
if(filename.contains("music/") &&... |
a2e71b9f-7753-4fd0-ab72-7886395ab7cb | 2 | private void createStructure() {
Random random = new Random((int)Math.random()*100);
data = new DataArrays<Integer[]>();
for(int i=0; i<kitSize; i++){
array = new Integer[length];
for (int j=0; j<array.length; j++){
array[j] = random.nextInt(chars);
... |
395acb0e-8763-46fa-b5b2-4911e77ceee5 | 5 | Object[] parameterForType(String typeName, String value, Widget widget) {
if (typeName.equals("org.eclipse.swt.widgets.TreeItem")) {
TreeItem item = findItem(value, ((Tree) widget).getItems());
if (item != null) return new Object[] {item};
}
if (typeName.equals("[Lorg.eclipse.swt.widgets.TreeItem;")) {
S... |
5002eb2e-877c-42bb-8483-430e2eca9b21 | 3 | public static void main(String[] args) {
// a variable declared with final can only be initialized once
// and its value can't be modified throughout the program
final int NUMBER_OF_STUDENTS = 3;
int[] marks = new int[NUMBER_OF_STUDENTS];
try {
BufferedReader reader = new BufferedReader(new InputStreamReade... |
5ea0a2e0-91c6-47f6-9688-a1e48c0145c3 | 5 | public static void main(String[] args) {
try(
ServerSocket server = new ServerSocket(10_000);
Socket clientsocket = server.accept();
PrintWriter out = new PrintWriter(clientsocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clientsocket.getInputStream())... |
f5c6a1f6-6941-4868-97d1-3927b6a9b0da | 8 | private boolean fixNameTable (TrueTypeFont ttf, NameTable name) {
// if we didn't find the table, or there was an exception,
// just create a new one
if (name == null) {
name = (NameTable) TrueTypeTable.createTable (ttf, "name");
ttf.addTable ("name", name);
}
... |
3feb4464-ae1e-4b7f-89e4-cd0cabf0511d | 0 | public MessageValidationException(Message m) {
super("Message " + m + " is not valid!", 0);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.