method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
03dd76e8-d70d-4f67-bff9-3644a0c6243b | 0 | public void start_logging() {
++start_logging_count;
} |
d9716841-5aef-47a2-8539-ca8e676419a0 | 3 | public void paintShape(Graphics2D g2)
{
if (image != null)
{
Dimension dim = label.getPreferredSize();
if (dim.width > 0 && dim.height > 0)
{
label.setBounds(0, 0, dim.width, dim.height);
g2.translate(getX(), getY());
... |
94a7d77c-6eed-4540-9276-1af2e801bc8b | 0 | @Override
public void doAction()
{
QuestionManager.getInstance().setQuestion(QuestionsCache.getNextQuestion());
StateManager.getInstance().setState(new QuestionLoaded());
} |
8e33628f-716f-4782-a438-e67dfd8e88c8 | 5 | private GenericConverter getRegisteredConverter(Class<?> sourceType, Class<?> targetType,
Class<?> sourceCandidate, Class<?> targetCandidate) {
ConvertersForPair convertersForPair = converters.get(new ConvertiblePair(sourceCandidate, targetCandidate));
return convertersForPair == null ? null : conve... |
e80e8a13-76df-4306-b0ee-d91e4ef69f76 | 1 | public static void handleJoin(String channel) {
if ( !channel.startsWith("#") ) {
appendError("Nesprávná syntaxe příkazu: /join #kanál");
return;
}
getCurrentServerTab().getConnection().joinChannel(channel);
clearInput();
} |
4e7a77bd-51a8-4b59-9008-096edeadacf0 | 9 | public static Map<String, String> simpleCommandLineParser(String[] args) {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i <= args.length; i++) {
String key = (i > 0 ? args[i-1] : null);
String value = (i < args.length ? args[i] : null);
if (key == null || key.starts... |
f8609b45-5f4c-420b-aecc-beb2881cbf21 | 0 | public String getURI() {
return uri;
} |
5d6bff1d-9f04-4b74-aaaf-9d0ea0a28a0b | 4 | public static ArrayList getTotaisOpMes(String data_in, Integer gmp, String arg_prod) throws SQLException, ClassNotFoundException {
ArrayList sts = new ArrayList();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
throw new SQLException("Nume... |
4d6a306a-23de-4bbe-b12d-e9e2528aa7c5 | 4 | public static void main(String[] args){
Class c = null;
try{
c = Class.forName("org.jimmy.grammar.FancyToy");
//Can't work.
//c = Class.forName("org.jimmy.grammar.Chap14Q1.FancyToy");
}catch(ClassNotFoundException e){
System.out.println("Can't find FancyToy.");
System.exit(1);
}
printInfo(c);
... |
1a435e21-3b49-4904-8713-ce00a2e1f98d | 6 | public int isWon() {
if(flaggedLocs().size()==numMines)
for(Location L:flaggedLocs())
if(!L.isMined())
{
won=2;
return won;
}
else
won=1;
if(won==1)
return won;
else
for(Location L:minedLocs())
if(L.isClicked())
won=0;
return won;
} |
7dbaf171-9b10-465b-bc09-0946d37fddbd | 6 | public HashMap<String,ArrayList<String>> combineBodyText(ArrayList<String> bodyPieces){
ArrayList<String> bodyText = new ArrayList<String>();
ArrayList<String> bodyPic = new ArrayList<String>();
int i=0,j,k;
while(i<bodyPieces.size()){
String textStr = "";
String ... |
0c594017-9016-4e1a-b7ab-12771fcb53ab | 9 | public Composite<P> setChildren(View<?>... children) {
for (View<?> child : this.children) {
child.setParent(null);
}
this.children.clear();
for (View<?> child : children) {
this.children.add(child);
child.setParent(this);
}
P ownPrese... |
0e144a3c-7ba6-47b8-a6c7-717c17317bb3 | 7 | public static boolean existeCorreo(String correo) {
Connection conn = null;
PreparedStatement stmt = null;
boolean existe = false;
try {
conn = model.ConexionMySQL.darConexion();
stmt = conn.prepareStatement("Select count(*) as count f... |
4777a44f-e86a-4359-bb2e-775c84d00fdc | 4 | public void tick() {
super.tick();
if (level.game.getKeyboard().left) left = true;
else left = false;
if (level.game.getKeyboard().right) right = true;
else right = false;
if (level.game.getKeyboard().up || level.game.getKeyboard().space) {
jump();
... |
751924bd-f058-4aec-9bd9-5a75441b1e43 | 5 | public CheckResultMessage check13(int day) {
int r1 = get(33, 5);
int c1 = get(34, 5);
int r2 = get(36, 5);
int c2 = get(37, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 +... |
61a3e485-e8b0-4b8f-ac6e-dc3594384323 | 2 | @Override
public void setProbabilities(Double[] probabilities) throws NGramException {
/*
* int count = 0;// count the index of string[] probabilities if
* (probabilities == null) { throw new
* NGramException("ERROR: probabilities null or contains!"); } for
* (Double i : probabilities) { if ((i == null)... |
46c4c2cb-aa3d-46de-a73f-934f0d962b5e | 0 | public void setRadius(double radius) {
this.radius = radius;
} |
c2acda14-b254-4626-9bea-eb66fc0705cd | 0 | @Basic
@Column(name = "discount_percent")
public int getDiscountPercent() {
return discountPercent;
} |
81133b05-fb1e-413f-9647-a3d0bebc6d3b | 7 | public static boolean methodNeedsEvaluatorWrapperP(MethodSlot method) {
{ boolean testValue000 = false;
testValue000 = MethodSlot.methodMustBeEvaluableP(method);
if (testValue000) {
if (((BooleanWrapper)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_METHOD_VARIABLE_ARGUME... |
553f5b24-7e10-43b0-a2c5-c21f6f4812bd | 3 | @Override
public void processBroadcastMsg(Message m) {
if (m instanceof PackHello) {
((PackHello) m).setHops(hops);
((PackHello) m).setMetric(metricPath);
((PackHello) m).setPaths(pathsToSink);
((PackHello) m).setSinkID(sinkID);
broadcast(m);
statistic.countBroadcastTree();
}
if (m instance... |
cbb63fe8-2c58-4208-a08f-83a96a94879d | 8 | private void findOuterGraph(HashMap<String, String> relevantSPARQLBlocks, int varIndex){
int charIndex = varIndex;
int bracketIndex = 0;
int maxBracketIndex = 0;
while (true){
if (charIndex==0){
String currentLine = getCurrentLine(text, charIndex);
if (addNewGraphBlockMapping(relevantSPARQLBlocks, va... |
39be0587-4c8e-47b5-aeee-c995eef08e6f | 8 | public Object invokeImpl(Object proxy, Method method, Object[] args) throws EvalError {
String methodName = method.getName();
CallStack callstack = new CallStack(namespace);
/*
* If equals() is not explicitly defined we must override the
* default implemented by the This object protocol for scripted
... |
d63e2444-ebcc-4989-85c0-f3ce8ee2ad80 | 1 | @Override
public void encode(OutputStream os) throws IOException {
os.write(PREFIX);
for (BencodeType bencodeType : list) {
bencodeType.encode(os);
}
os.write(COMMON_POSTFIX);
} |
9f7360a8-3773-4716-8c01-905a19be6cd8 | 1 | void write(DataOutputStream out) throws IOException {
out.writeShort(accessFlags);
out.writeShort(name);
out.writeShort(descriptor);
if (attribute == null)
out.writeShort(0);
else {
out.writeShort(attribute.size());
AttributeInfo.writeAll(attri... |
b08db307-0a46-46ea-9341-a4211f63bedf | 1 | public static void main(String[] args) {
// TODO Auto-generated method stub
int array[]= new int[args.length];
for(int k = 0; k < array.length; k++){
array[k]=Integer.parseInt(args[k]);
}
int array2 [] = {180,15,70,9,7};
System.out.println(Arrays.toString(array2));
// sort(arr... |
54f7d03f-7163-48b8-85a4-3179360adad3 | 1 | public void setSurrenderPending(boolean pending) {
if (pending) {
surrenderButton.setText(SURRENDER_BUTTON_CONFIRM_TEXT);
surrenderButton.setActionCommand(SURRENDER_BUTTON_CONFIRM_TEXT);
} else {
surrenderButton.setText(SURRENDER_BUTTON_TEXT);
surrenderButton.setActionCommand(SURRENDER_BUTTON_TEXT);
}... |
15ec1bad-62fa-4de7-b8d3-4cf2f83046a5 | 9 | private JPanel createRoleAssignmentPanel(Person person) {
JPanel roleAssignmentPanel = new JPanel();
TitledBorder titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Zugewiesene Rollen");
roleAssignmentPanel.setBorder(titledBorder);
double size[][] = { { 20, TableLayout.FILL },... |
41ee3452-30da-4a3a-9549-aa02c2734e91 | 7 | private LinkGene crossoverLinkGenes(LinkGene a, LinkGene b){
double weightA = a.getWeight();
double weightB = b.getWeight();
long weightALong = Double.doubleToRawLongBits(weightA);
long weightBLong = Double.doubleToRawLongBits(weightB);
long mask = -1L; // all bits set to 1
... |
e5f05066-3c26-4eed-91a5-c42565bf317f | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
73b86c10-5713-41d0-9eb1-bf406b6dda33 | 7 | @Override
public Banker getBank(String chain, String areaNameOrBranch)
{
for (final Banker B : bankList)
{
if((B.bankChain().equalsIgnoreCase(chain))
&&(B.bankChain().equalsIgnoreCase(areaNameOrBranch)))
return B;
}
final Area A=findArea(areaNameOrBranch);
if(A==null)
return null;
for (fina... |
b510d730-28bf-4bbc-b5aa-42067c34088a | 3 | public static void main(String[] args) throws FileNotFoundException {
File f = new File("src/jobs.txt");
Scanner sr = new Scanner(f);
sr.next();
int i = 0;
for (i = 0; i < 10000; i++) {
jobs[i][0] = sr.nextInt();
jobs[i][1] = sr.nextInt();
jobs[i][2] = jobs[i][0] / jobs[i][1];
}
Sortingbydiffere... |
623b2748-f95f-412e-875d-07acbaaae7e5 | 0 | public int getDestinationStop() {
return this._destinationStop;
} |
4c975fd9-883b-4927-8623-75b9363cd63e | 4 | public void setShips() {
for(int i = 0; i < players.size(); i++) {
ShipPanel s = players.get(i).getShip();
// Set border to player color
if(players.get(i).getNumber() == 1)
s.setBorder(BorderFactory.createLineBorder(GameBoard.PLAYER1));
else if(players.get(i).getNumber() == 2)
s.setBorder(Bord... |
345369cd-e043-4845-9869-18ffcbaf8669 | 7 | public void visitFrame(final int type, final int nLocal,
final Object[] local, final int nStack, final Object[] stack) {
buf.setLength(0);
buf.append(ltab);
buf.append("FRAME ");
switch (type) {
case Opcodes.F_NEW:
case Opcodes.F_FULL:
buf.append("FULL [");
appendFrameTypes(nLocal, local);
buf.a... |
18174a2f-6177-468e-a2b4-f2a3015f6bc5 | 4 | public void testStream () throws IOException {
final int largeDataSize = 12345;
final Server server = new Server(16384, 8192);
server.getKryo().setRegistrationRequired(false);
startEndPoint(server);
server.bind(tcpPort, udpPort);
server.addListener(new Listener() {
public void connected (Connection conn... |
e15d586f-0949-46dd-93f4-41547e362d9a | 7 | @Override
public void setProbability(double[] p, Map<String,Integer> stateToIndex) throws IllegalArgumentException {
if( p == null)
throw new IllegalArgumentException("Error: null probability distribution");
double sum = 0.0;
for( int i = 0; i < p.length; ++i) {
sum += p[i];
if( Double.isNaN(p[i]))
... |
c8a90b06-f72c-4fd9-aa94-cf241696ec70 | 5 | public void removeFrame( JInternalFrame jif )
{
// if( jif.getClass().toString().equalsIgnoreCase( "class ImageFrame" ) //remove ImageFrame
// || jif.getClass().toString().equalsIgnoreCase( "class HistogramFrame" ) ) //remove histogramFrame
if( jif instanceof ImageFrame
|| jif ... |
4e9dbcdf-b2ad-4cfa-a0ab-b26d4f227835 | 4 | private Block parseForRun() throws InterpreterException {
int i = 0;
Block first = null;
Block last = null;
while (i < code_.length) {
String copy[] = new String[code_.length - i];
System.arraycopy(code_, i, copy, 0, copy.length);
ReturnStruct rs = Parser.parseLine(this, code_[i], copy, getLine()
... |
166524c0-e02e-43e3-8d31-d4f6e8628f4f | 1 | public byte convertBitsToValue(byte org,int startBit, int endBit, boolean value){
System.out.println("StartBit="+startBit+"/endBit="+endBit);
int mask1 = (255 >> startBit); //for above example, mask 1 = 00000011;
System.out.println("mask1="+String.format("%8s", Integer.toBinaryString(mask1)).replace(' ', '0'))... |
b1dd5a31-0da0-46d0-9402-b119ae7d8f91 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainContainer = new javax.swing.JPanel();
topSubContainer = new javax.swing.JPanel();
jButton3 = new javax.swing.JButton();
jB... |
0db98aed-b6f6-4e9f-9fdb-82fd7f84fa36 | 6 | @Override
public ClienteBean get(ClienteBean oClienteBean) throws Exception {
if (oClienteBean.getId() > 0) {
try {
oMysql.conexion(enumTipoConexion);
if (!oMysql.existsOne("cliente", oClienteBean.getId())) {
oClienteBean.setId(0);
... |
d446955d-3581-4b75-84d8-22c1272c2871 | 6 | @Test
public void testAsteroidStartingVelocityY() {
for (int i = 0; i < 20; i++) {
p.spawnAsteroids();
}
for (Asteroid a : p.getAsteroids()) {
if (a.getVelY() > -0.5 && a.getVelY() < 0.5) {
assertTrue(false);
}
if (a.getVelY()... |
c1218a19-6872-44a3-af0d-3b6bd9b1ce6d | 8 | @EventHandler(priority = EventPriority.NORMAL)
public void onASyncOnPlayerChatEvent(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
PlayerFile playerFile = new PlayerFile(player.getName());
if (playerFile.muteMuted) {
String finalTime = (playerFile.muteLength.equals(0) ? AdminEye.messages
... |
73bab143-25e5-4828-bf79-c608dee297e6 | 5 | public void draw(GOut og) {
GOut g = og.reclip(tlo, wsz);
Coord bgc = new Coord();
for (bgc.y = 3; bgc.y < wsz.y - 6; bgc.y += bg.sz().y) {
for (bgc.x = 3; bgc.x < wsz.x - 6; bgc.x += bg.sz().x)
g.image(bg, bgc, new Coord(3, 3), wsz.add(new Coord(-6, -6)));
}
... |
adf1bae8-f385-4499-8dd3-db03c886ed34 | 3 | public boolean retrieveWords(File language)
{
try
{
Scanner sc = new Scanner(language, "UTF-8");
if (!isValidLanguageFile(sc))
return false;
words.clear();
while (sc.hasNextLine())
mapWord(sc.nextLine());
... |
dc897406-9712-494a-9b57-0f96c6093412 | 0 | public void setGenre(Genre genre) {
this.genre = genre;
} |
ff7993ad-338a-4cd9-9e42-1c7a35286a89 | 8 | protected boolean causesCheck(PossibleTile pt, Board b){
Board bClone = b.clone();
bClone.removePiece(pt.getOriginalPiece());
Piece newPiece = pt.getOriginalPiece().clone();
newPiece.setX(pt.getX());
newPiece.setY(pt.getY());
bClone.addPiece(newPiece);
if (pt.hasPieceToRemove()) {
bClone.removePiece(pt... |
1a7b2d9c-ce54-40ae-9e5e-148625c5f19e | 8 | @Override
public void update(Observable board, Object o) {
if (o instanceof NotifyReveal){
System.out.println("********");
}
else if(o instanceof NotifyFlagged){
System.out.println("********");
}
else if(o instanceof NotifyDoubted){
System.out.println("********");
}
else if(o instanceof NotifyUn... |
553bf36f-4194-4097-a05b-bddcd53512a9 | 1 | public static double squaredMagnitude(List<Double> point) {
double sum = 0;
int size = point.size();
for (int i = 0; i < size; i++) {
double val = point.get(i);
sum += val * val;
}
return sum;
} |
c5269d56-412c-4f77-b861-4c9d06cd3dc6 | 8 | public static double svm_predict_probability(svm_model model, svm_node[] x, double[] prob_estimates)
{
if ((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&
model.probA!=null && model.probB!=null)
{
int i;
int nr_class = model.nr_class;
double[] dec_val... |
4bcb8d8f-c4da-4c21-9966-ca08b26c5f6c | 8 | static void setZeroMatrix( int[][] matrix, int n) {
boolean[][] checker = new boolean[2][n];
for ( int i = 0; i < n; ++i) {
checker[0][i] = false;
checker[1][i] = false;
}
for ( int i = 0; i < n; ++i) {
for ( int j = 0; j < n; ++j) {
if(matrix[i][j] == 0 ) {
checker[0][i] = true;
checker[... |
6144c6cc-bcad-494b-b732-77abd19ef549 | 5 | public void run(){
try {
InputStream inputStream = loginSocket.getInputStream();
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
OutputStream outputStream = loginSocket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
String ord... |
71e6e9d8-338d-4a79-a241-9dbb31688a40 | 4 | void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
try {
// 1. creating a socket to connect to the server
requestSocket = new Socket("localhost", 2004);
System.out.println("Connected to localhost in port 2004");
// 2. get Input and Output s... |
60a089ba-d025-490a-a476-5887773b24b7 | 7 | public void paint(Graphics2D g,boolean draw,boolean fill){
if (calcularVar) {
calcular();
calcularVar = false;
}
if (draw && !fill) {
g.draw(path);
}else if(fill && !draw){
g.fill(path);
}else if(draw && fill){
... |
0b261685-8ead-4e58-8ad9-782d0d6072f2 | 9 | public static Set<Component> getFocusableComponents(Component currentFocusOwner) {
HashSet<Component> set = new HashSet<Component>();
set.add(currentFocusOwner);
Container rootAncestor = currentFocusOwner.getFocusCycleRootAncestor();
Component comp = currentFocusOwner;
while ((r... |
cdc4f242-162e-43db-b194-5c919e0d5e7c | 6 | public void merge(EasyPostResource obj, EasyPostResource update) {
if (!obj.getClass().isAssignableFrom(update.getClass())) {
return;
}
Method[] methods = obj.getClass().getMethods();
for (Method fromMethod: methods) {
if (fromMethod.getDeclaringClass().equals(obj.getClass()) && ... |
69f0cf8c-5e26-40f2-b2ca-d1a603b6cdea | 8 | private Field getField(Object object, String name, Boolean read) throws NullPointerException,
IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
Field field = null;
for(Class<?> c = object.getClass(); c != null; c = c.getSuperclass()) {
for(Field f : c.getDeclaredFields()){
if(f.getN... |
f6666336-9761-49a8-a1da-b6cd7a9a3c2d | 7 | private static void export(File file, ResultSetReference ref, boolean withHeader) throws IOException, SQLException {
Exporter exporter = Exporter.getExporter(file);
try {
ResultSet rs = ref.getResultSet();
ColumnOrder order = ref.getOrder();
boolean needOrderChange = ... |
01803ac1-8059-45e8-ac4e-ef4434a4a3ee | 5 | public int init(BinarySearchTree<String,String> tree) throws IndexOutOfBoundsException, IOException {
Properties prop = new Properties();
InputStream istream = getClass().getClassLoader().getResourceAsStream("com/file/resources/searchtree.properties");
List<BinaryNode<String, String>> li =... |
41f022e4-d0df-4bab-a30d-62a37be77a87 | 6 | public void draw (Graphics g) {
for(int i = 0; i < button.length; i++) {
if(button[i].contains(Screen.mse)) {
g.setColor(new Color(0,0,0));
g.fillRect(
button[i].x,
button[i].y,
button[i].width,
button[i].height
);
}
g.drawImage(
Screen.tileset_res[0],
button[i].x,
... |
7f860fe1-a4f1-4d02-9680-e879e3b9e15c | 1 | @Override
public List<Integer> save(List<TourType> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (TourType bean) -> {
Object[] objects = new Object[1];
objec... |
acf0e1b0-ae5a-4081-9db5-f127812e1661 | 7 | public void LoadSubGate(ObjectInputStream s) throws IOException, ClassNotFoundException {
int numSignals = s.readInt();
mySignals = new Vector<Signal>();
for (int a = 0; a < numSignals; a++) {
Signal newSignal = new Signal();
newSignal.Set(s.readBoolean());
ne... |
f6194902-dc4f-4a43-a697-86c8f49483c9 | 8 | public static boolean checkSumSign(BinaryFloatingPoint A, BinaryFloatingPoint B) {
return (A.isSign() && B.isSign()) ? true :
(!A.isSign() && !B.isSign()) ? false :
(Math.abs(A.floatValue(false)) >= Math.abs(B.floatValue(false)) && !A.isSign()) ||
(Math.abs(A.floatValue(false)) <= Math.abs(B.floatValue(fal... |
b6e16bcf-6f92-4031-9d99-fbfaffdc0e95 | 8 | public MainWindow(final NamiBeitrag namiBeitrag,
final LetterDirectory letterDirectory,
final NamiBeitragConfiguration conf) {
letterGenerator = new LetterGenerator(namiBeitrag.getSessionFactory(),
letterDirectory, conf);
reportViewer = new ReportViewer(namiBeitr... |
88d3bd61-c043-4dd6-96b3-1d45d6367bd2 | 2 | public static ActionType SelectActionComById(int id) throws SQLException {
String query ="";
ActionType Action = new ActionType();
ResultSet resultat;
try {
query = "SELECT * from ACTION_TYPE where ID_ACTION_TYPE=? ";
PreparedStatement pStatement = ConnectionBDD... |
28fd0754-538f-47c7-8b81-00c5ec58ebe1 | 2 | public void upX(){
x += moveX;
if (x+width>level.getLength()){
x = level.getLength()-width;
}
if (x<0) { // begin lock
x = 0;
}
} |
362ecc1f-cbd0-4cdc-a73f-e99d4c5d0fbf | 8 | public void accessSpace(int space,int buttonType){
//LEFT CLICK:
if(buttonType==1){
/*if(Screen.mouseCommand == 6){
//decide wich ones can be built:
if(canBeBuilt(items.get(space).type)){
Screen.menuItemToBuild = space;
Syst... |
11ce3973-068b-47a1-9dc9-5bfd9da73dcd | 9 | final public RGB Colour() throws ParseException {
final Expression e1, e2, e3;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACKET:
jj_consume_token(LBRACKET);
e1 = FloatExpression();
jj_consume_token(COMMA);
e2 = FloatExpression();
jj_consume_token(COMMA);
e3 = Flo... |
6cec8cc1-2d2b-47e0-b2aa-e71137e74e25 | 9 | public void paint(Graphics g2)
{
if (this.applet != null) {
return;
}
int w = getWidth() / 2;
int h = getHeight() / 2;
if ((this.img == null) || (this.img.getWidth() != w) || (this.img.getHeight() != h)) {
this.img = createVolatileImage(w, h);
}
Graphics g = this.img.getGraph... |
13434f3d-221d-4601-889b-e4a7729c8279 | 9 | public ArrayList<Integer> maxset(ArrayList<Integer> a) {
ArrayList<Integer> result = new ArrayList<>();
int currstart = 0, currend = 0, maxstart = 0, maxend = 0;
long currsum = 0, maxsum = Integer.MIN_VALUE, seg = 0, maxseg = 0;
for (int i = 0; i < a.size(); i++) {
... |
3abe2e00-0a70-4dc8-80a3-0c0a1eb3e7de | 4 | @EventHandler
public void onEntityDeath(EntityDeathEvent event){
ItemStack drop = new ItemStack(Material.GOLD_NUGGET, 1);
Entity entity = event.getEntity();
int chance = DeityNether.config.getDropChance();
if(entity instanceof PigZombie && entity.getWorld().getEnvironment() == Environment.NETHER){
event.get... |
146b3b24-143a-4c0d-a6e4-3d3783a1be52 | 0 | public boolean hasPeerId() {
return this.peerId != null;
} |
ba56e8f3-a1ac-43b3-b727-f1a929188a2d | 4 | private void rotateLeft(Node<K, V> root) {
Node<K, V> left = root.left;
Node<K, V> pivot = root.right;
Node<K, V> pivotLeft = pivot.left;
Node<K, V> pivotRight = pivot.right;
// move the pivot's left child to the root's right
root.right = pivotLeft;
if (pivotLeft != null) {
pivotLeft.... |
9e09f99f-29bc-4380-ac66-cda4c5412548 | 1 | public void remove(BacklogBean oBacklogBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oBacklogBean.getId(), "backlog");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("BacklogDao.remove: Error: " + e.g... |
acbd03e2-6bbe-4c49-9f24-626d247e12ef | 3 | public synchronized int getAmount() {
int retVal = amount;
if (retVal != 0) {
if (state == STATE_RELEASED) {
amount = 0;
}
else if (behavior == DETECT_INITAL_PRESS_ONLY) {
state = STATE_WAITING_FOR_RELEASE;
amount = 0;
... |
98b3425b-45f4-4252-9da2-228e72294bdb | 3 | public static BufferedImage compress(BMPcontainer bmPcontainer) {
int newWidth;
int newHeight;
double ar = bmPcontainer.getAspectRatio();
if (ar > 1) {
newWidth = 256;
newHeight = (int) (newWidth / ar);
} else {
newHeight = 256;
ne... |
799fcaf0-daa0-4013-8928-af84398193a9 | 8 | public static String post(String adress,List<String> keys,List<String> values) throws IOException
{
String result = "";
OutputStreamWriter writer = null;
BufferedReader reader = null;
try
{
String data="";
if(keys != null && values != null)
... |
8385e65a-a5e1-482d-b012-d1d1fa46201e | 0 | public static void main(String[] args)
{
MyFlow myFlow = new MyFlow();
myFlow.go();
} |
9d0eda13-c9c1-4ec2-bc16-5ed102478474 | 5 | public void play() {
board.drawBoard();
do {
for (Player player : players) {
player.move();
board.drawBoard();
if (board.isFull()) {
printStream.println("Game is a draw");
break;
}
... |
ca77b490-de9b-4dcf-9277-5b9b19b9eb58 | 3 | public void spawn(){
x=rand.nextInt(Level.SIZE);
y=rand.nextInt(Level.SIZE);
while(l.world[x][y]!=TileType.AIR && l.world[x][y]!=TileType.FIRE && l.world[x][y]!=TileType.TORCH){
x=rand.nextInt(Level.SIZE);
y=rand.nextInt(Level.SIZE);
}
} |
d0ac3626-f15d-47fb-8516-59517a65ddc8 | 2 | private void randomTeleport(String arena, Player p) {
ArrayList<Location> spawns = ffaconfig.getSpawns(arena);
Random num = new Random();
if (spawns != null && spawns.size() > 0) {
p.closeInventory();
p.teleport(spawns.get(num.nextInt(spawns.size()-1)));
} else {
p.sendMessage(prefix + "Unable to find ... |
3b802176-b55a-4592-80b4-8092f4bb4c29 | 9 | @SuppressWarnings({ "rawtypes", "unchecked" })
public CreateEvent() {
final JFrame eventFrame = new JFrame("New Event");
eventFrame.setAlwaysOnTop(true);
eventFrame.setBackground(Color.WHITE);
eventFrame.setResizable(false);
eventFrame.setVisible(true);
eventFrame.setLocationRelativeTo(CalendarPanel.bullse... |
83415ac0-2668-4a40-93cb-59df32e27f00 | 4 | public Solution search(State state, int goalN) {
SearchTreeNode init = createSearchTreeNode(state, null, 0, 0);
queue.add(init);
while (!queue.isEmpty()) {
SearchTreeNode node = dequeue();
if (visualize) {
System.out.println(node.toString());
}
if (node.state.isGoal()) {
return new Solution(no... |
e050a5ba-b139-4fa2-bf1d-8c1777347aee | 9 | private boolean diagonalDecrementingBlock(int[][] grid, LinkedList<Square> squareStore, boolean pickOne) {
//Block - Diagonal dec
if ((grid[0][0] == 1 && grid[1][1] == 1) && grid[2][2] != 2) {
BuildAndAddSquareTwoTwo(squareStore);
pickOne = updateGridTwoTwo(grid);
} else ... |
f72cb90c-f519-4597-8428-87d814a26f2f | 5 | static public void printCoauthorTable() {
Iterator it = Person.iterator();
int coauthors[] = new int[501];
Person pers;
int c;
while (it.hasNext()) {
pers = (Person) it.next();
c = pers.getNumberOfCoauthors();
if (c > 500)
... |
0dee97cd-eee5-41e8-aba5-3bf2c64f32b5 | 9 | @Override
public void acceptButtonActionPerformed() {
//Comprobation that closuredTo is a double value is needed
try{
String selectedNames[] = ds.getSelectedData();
DataFrame dataFrame = mainApplication.getActiveDataFrame();
boolean selection[] = dataFrame.getVa... |
18916272-d41a-456c-bd37-f48b3d91f13f | 5 | private void cargarCampos(int numAsiento){
try {
r_con.Connection();
ResultSet rs=r_con.Consultar("select * from borrador_asientos where ba_nro_asiento="+numAsiento);
Asiento asiento=null;
renglon=0;
BigDecimal debeTotal=new BigDecimal(0);
... |
23194ae6-a9e1-41e8-9d04-afcebe971a6e | 4 | private void showHelp(CommandSender sender) {
sender.sendMessage("Commands:");
sender.sendMessage(" /soundcheck - Plugin administration command");
if (Perms.canUsePlaySound(sender)) {
sender.sendMessage(" /playsound - Play an individual sounds");
}
if (Perms.canUseP... |
23f1ebd4-b352-4aa7-af9c-bbfaccf54136 | 5 | public Frame() {
setBackground(Color.GRAY);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e1) {
} catch (InstantiationException e1) {
} catch (IllegalAccessException e1) {
} catch (UnsupportedLookAndFeelException e1) {
}
setIconImage(To... |
002caba3-b0cf-4790-9376-a9167e7bc59d | 0 | public String getEmail() {
return email;
} |
82c28c30-e4f7-4577-9c35-1743b722c8fd | 8 | public void resolveBackupDirectory()
{
// Load the backup_location file to get the backup folder path. If it doesn't exist, it's
// the first run
File backup_file = new File("backup_location");
if(backup_file.exists())
{
Scanner in = null;
try
{
// Read the path in, and if it's valid, set the ba... |
d1a798bc-040a-43f2-9477-e93bc9d789bd | 0 | public int getBrakes() {
return brakes;
} |
45a32239-e3c9-40e9-8303-31d5e73e9fea | 2 | public double[] standardizedItemRanges(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedItemRanges;
} |
b47cc6d9-572e-4ed1-84da-099d4d946409 | 8 | public void mousePressed(MouseEvent me)
{
// Track the current tree node selected
// so there by the query token.
JTree tree = (JTree) me.getSource();
if (SwingUtilities.isRightMouseButton(me))
{
int row = tree.getRowForLocation(me.getX(), me.getY());
if (row !... |
5216a2c1-6965-4fa6-8235-2395ebf47c58 | 0 | public static void main(String[] args) {
Random rand = new Random(47);
int i = rand.nextInt();
int j = rand.nextInt();
printBinaryInt("-1", -1);
printBinaryInt("+1", +1);
int maxpos = 2147483647;
printBinaryInt("maxpos", maxpos);
int maxneg = -2147483648;
printBinaryInt("maxneg", maxneg);
printBinar... |
f74aae43-24c8-4dfb-a1f6-7a99e0dfce20 | 7 | public static void open(String url){
String os = System.getProperty("os.name").toLowerCase();
Runtime rt = Runtime.getRuntime();
try{
if (os.indexOf( "win" ) >= 0) {
// this doesn't support showing urls in the form of "page.html#nameLink"
rt.exec( "rundll32 u... |
2947d2db-2074-4498-a3af-89bf90dc3332 | 1 | @Override
public float calculateDesire() {
float desire = 0;
//figure out the distance between player and mob
int actorX = ai.getActor().getMapX();
int playerX = registry.getClosestPlayerX(ai.getActor().getCenterPoint(), registry.getScreenWidth());
int distance = Math.abs(pl... |
76970b86-0561-4041-9262-26d23b38ea1b | 9 | public void run() {
boolean hasUpdate = true;
while (hasUpdate) {
hasUpdate = false;
Set<String> keys = new HashSet<String>(this.r.keySet());
for (String rkey : keys) {
double ru = this.r.get(rkey);
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(new FileInput... |
1bcae3c7-662a-40b4-9c01-8969b172db76 | 7 | public Var intern(Symbol sym){
if(sym.ns != null)
{
throw new IllegalArgumentException("Can't intern namespace-qualified symbol");
}
IPersistentMap map = getMappings();
Object o;
Var v = null;
while((o = map.valAt(sym)) == null)
{
if(v == null)
v = new Var(this, sym);
IPersistentMap newMap = map.ass... |
c47e712c-5360-4110-b083-c91e2c355af1 | 6 | public void mouseDragged(Point p) {
//System.out.println("mousedragged");
//insert location mode
if(mode==INSERTLOC){
if(curr!=-1){
mygraph.locations[curr].setPoint(p);
changeNotify();
}
}
//insert path mode
if(mode==INSERTPATH){
lineEndIndex=mygraph.findIndex(p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.