method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e86a1f02-4264-4306-bd7b-f67572711083 | 5 | private MoveDirection getPlayerMove() {
MoveDirection moveDirection = null;
try {
Terminal terminal = Terminal.setupTerminal();
int c = terminal.readVirtualKey(System.in);
if (c == VIRTUAL_LEFT) {
moveDirection = MoveDirection.MOVE_LEFT;
} else if (c == VIRTUAL_RIGHT) {
moveDirection = MoveDirec... |
9fb1f2ee-62a7-47e8-a172-ff94f5612d4f | 2 | private int getY(int[][] value, int x) {
for (int y=0; y<6; y++) {
if (value[x][y] == 0) {
return y;
}
}
return -1; //return -1 if column is full
} |
a2998b01-3353-44e7-b15a-022bf3456a39 | 7 | public String wordWrap(String s, int width, double scale) {
if (!(s.indexOf(' ') > -1) && !(s.indexOf('\r') > -1))
return s;
ArrayList<String> lines = new ArrayList<String>();
String[] currentLines = s.split("\r");
for (String l : currentLines)
lines.add(l);
String result = "";
for (int i = 0; i < li... |
67c62d58-1e10-492c-b393-b700569778e5 | 9 | public HashMap<Integer, Integer> modificationMap() {
HashMap<Integer, Integer> modifs = new HashMap<Integer, Integer>();
for(int i = 0; i < players.length; ++i) {
if(players[i].getReserve().isFired() && players[i].getReserve().getModificator().getType() == 0) {
modifs.put(i, 0);
} ... |
0e5e4f3b-4915-41fd-bbe6-a8d59c8007d4 | 1 | public boolean ApagarTodosQuandoExcluiPessoa(int idPessoa){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("UPDATE emails SET ativo = ? WHERE id = ?");
comando.setInt(1, 0);
comando.setInt(2, idPessoa);
comando.executeUpd... |
844e6f49-caa6-478e-add1-e93955000059 | 8 | private void TimeSet(int prevmode)
{
if (prevmode != MODE_TSET) {
inputval = clocktime;
}
if (bl && cursor < 5) {
cursor++;
} else if (br && cursor > 0) {
cursor--;
} else if (bu) {
inputval = IncTime(inputval, cursor);
} else if (bd) {
if (GetDigit(inputval, cursor) > 0) {
inputval = D... |
0284f98d-97bd-456a-80b3-96d8bed75810 | 3 | private void recursiveGetBoxesInRegion(Box root, Rectangular r, Vector<Box> result)
{
if (r.encloses(root.getVisualBounds()))
{
if (!root.getVisualBounds().isEmpty())
result.add(root);
}
else
{
for (int i = 0; i < root.getChildCount(); ... |
328e7bec-64a6-4c73-9098-e96ee8cf52b0 | 4 | private boolean isExistingLogin(String login){
if (this.file.exists()) {
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(this.file)));
String ligne;
... |
e01a4b7b-5164-4d19-91b0-1d2462b18309 | 4 | public void render(Graphics g){
g.setColor(Color.black);
if(lightx >= 0){
g.fillRect(0, 0, lightx, Game.cam.height);
}
if(lighty >= 0){
g.fillRect(lightx, 0, imageWidth, lighty+5);
}
if(lighty+imageHeight <= Game.cam.height){
g.fillRect(lightx, lighty+imageHeight-5, imageWidth, Game.cam.height-l... |
946cf768-e1a5-422a-8dbf-1ed59165f045 | 5 | public static AutomatonSimulator getSimulator(Automaton automaton) {
if (automaton instanceof automata.fsa.FiniteStateAutomaton)
return new automata.fsa.FSAStepWithClosureSimulator(automaton);
else if (automaton instanceof automata.pda.PushdownAutomaton)
return new automata.pda.PDAStepWithClosureSimulator(aut... |
311bc47c-27d9-49cb-80d6-80705deb4463 | 0 | public void setExpYears(int expYears) {
this.expYears = expYears;
} |
a592e0e0-aa71-4018-ba9b-1856a82a16a8 | 1 | public boolean fromElement(Element ele) {
boolean result = true;
id = X.getAttribute(ele, C.id, null);
type = X.getAttribute(ele, C.type, "mysql");
ip = X.getFirstChildText(ele, C.ip, null);
port = X.getFirstChildText(ele, C.port, null);
user = X.getFirstChildText(ele, C.user, null);
passwor... |
d5ba7584-ae41-4305-a9e3-b30398e3ca10 | 1 | public void mouseReleased(MouseEvent event) {
// Did we even start at a state?
if (first == null)
return;
State state = getDrawer().stateAtPoint(event.getPoint());
controller.gotoGroup(first, event.getPoint(), state);
first = null;
getView().repaint();
} |
4c37b5cd-587e-4d2a-be75-201e8fe474e3 | 9 | public void initialize(NeuralNetwork nn) {
List<ConnectionCandidate> ccs = new BreadthFirstOrderStrategy(nn, nn.getInputLayer()).order();
for (ConnectionCandidate cc : ccs) {
if (cc.connection instanceof FullyConnected) {
FullyConnected fc = (FullyConnected) cc.connection;
if (Util.isBias(fc.getInputLayer())... |
c87a2184-183d-48e4-8f50-c3d4e5281e4e | 6 | public void accMng() throws IOException
{
Scanner in = new Scanner(System.in);
System.out.println("-----------------------");
System.out.println("Account Management Menu");
System.out.println("1.Create New Account");
System.out.println("2.Delete account");
System.out.print... |
b08241df-82cc-4237-8964-fac12ded8e0e | 7 | public Object getValue() throws UtilEvalError {
if (type == VARIABLE)
return nameSpace.getVariable(varName);
if (type == FIELD)
try {
Object o = field.get(object);
return Primitive.wrap(o, field.getType());
} catch (IllegalAccessException e2) {
throw new UtilEvalError("Can't read field: " + fi... |
5612ed93-6649-409b-8f54-61fa5d1ce120 | 9 | void release(boolean destroy) {
Control next = null, previous = null;
if (destroy && parent != null) {
Control[] children = parent._getChildren();
int index = 0;
while (index < children.length) {
if (children[index] == this)
break;
index++;
}
if (index > 0) {
previous = children[inde... |
9204b7d9-d90c-4fc9-8fed-85cda0396edb | 7 | private void quicksort(int low, int high) {
int i = low, j = high;
// Get the pivot element from the middle of the list
int pivot = numbers[low + (high-low)/2];
System.out.println("\nPivot: "+pivot);
// Divide into two lists
while (i <= j) {
// If the current value from the left li... |
22c35328-42b6-4156-aa41-b0c9d38347b4 | 1 | public Process setPriority(long id, int priority) // Change priority.
{
Process process = find(id);
if(process==null)
return null;
else
process.setPriority(priority);
return process;
} |
b7bd3600-42fa-48a5-a425-89d1a2b9017a | 4 | private static void parseBergenCellsAndRequestMeasurements() {
String fileName = "/Users/Johan/Documents/CellTowers/cell_towers_bergen.csv";
try(BufferedReader br = new BufferedReader(new FileReader(fileName));) {
String line = "";
int totalCount = 0;
JSONFile jsonFile = new JSONFile(JSONFile.fileP... |
b650e375-6109-428e-b1bc-afca1c117a74 | 6 | @Override
public void update(float tpf, Node root) {
if (phases.get(currentPhase) instanceof HazardTrafficSignalPhase) {
phases.get(currentPhase).update(tpf, root);
} else {
if (inPhase) {
if (phases.get(currentPhase).getState() == TrafficSignalPhaseState.RED)... |
0d517a4a-4f51-479b-a975-fabd4957e209 | 8 | public /*@non_null pure@*/ String toString() {
if (m_RangeStrings.size() == 0) {
return "Empty";
}
String result ="Strings: ";
Enumeration enu = m_RangeStrings.elements();
while (enu.hasMoreElements()) {
result += (String)enu.nextElement() + " ";
}
result += "\n";
result +=... |
993278cd-6c34-4abc-9027-fd36d0b931e7 | 3 | public boolean isCollisionBoxColliding(CollisionBox box)
{
for(int i = 0; i < collidable.size(); i++)
{
if(box.collisionBox.intersects(collidable.get(i).collisionBox) && collidable.get(i) != null)
{
box.getAttachedEntity().onCollide(collidable.get(i));
collidable.get(i).getAttachedEntity().onColli... |
cce9c4a0-5ae6-418d-ba0a-97d9ce480154 | 4 | public static Type convertType(String name) {
if (name.equals("dir"))
return Type.Dir;
else if (name.equals("nfs"))
return Type.Nfs;
else if (name.equals("lvm"))
return Type.Lvm;
else if (name.equals("iscsi"))
return Type.Iscsi;
else
return Type.Unknown;
} |
2a2a590f-d7fe-4560-b940-9f00ddc3ef38 | 7 | private static <T> List<Expression<?>> getGroups(Root<T> root,
List<String> group) {
List<Expression<?>> groupRet = new ArrayList<Expression<?>>();
if (group != null) {
for (String field : group) {
try {
/**
* separate field and function
*/
String[] splitedfield = field.split(",");
... |
3a627ac4-1b8b-492c-83e9-ea2b9110f907 | 7 | private void paintFocus(Graphics g, int x, int y, int w, int h) {
Color bsColor = getBorderSelectionColor();
if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
g.setColor(bsColor);
g.drawRect(x, y, w - 1, h - 1);
}
if (drawDashedFocusIndicato... |
053d6da2-6a4e-4eb4-ba70-0bb07f802499 | 9 | public LinkTriple [] NodeFilter( Component parent, LinkTriple [] inList ) {
GridBagConstraints c = new GridBagConstraints();
final JDialog frame = new JDialog();
JPanel panel = new JPanel();
panel.setLayout( new GridBagLayout() );
panel.add(new Label("Edge Types"), c);
c.gridx = 1;
panel.add(new Label("... |
0aff2753-f1ed-4b8b-bf8d-33994cd0d8b6 | 2 | public static StaffArrangement decodeArrangement(File f)
throws ParseException, IOException {
BufferedReader bf = new BufferedReader(new FileReader(f));
String line = "";
String str = "";
while (true) {
line = bf.readLine();
if (line == null)
... |
b358ec48-704f-4285-ade5-5b8238c0b1f3 | 2 | public ComplexMatrix subarray_as_Complex_rowMatrix(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Complex[] cc = this.getArray_as_Complex();
Complex[] retArray = new Complex[end-start+1];
... |
2a0ff1c2-a532-4722-9500-b965c3407714 | 4 | @Override
public void run() {
super.run();
try {
while (true) {
currentJob = (JobImpl2) qMananager.pull("Queue2");
if (currentJob!=null) {
currentJob.startWork(this);
System.out.println("2-"+id+" start"+currentJob.name);
Thread.sleep(1000);
currentJob.endWork(this);
System.out... |
9b485995-973b-4971-aef3-fd0aec207e39 | 1 | public static Object[] fetchValues(Method[] getterMethods, Integer[] parameterIndexes, Object[] args,
List<String> parameterNames) {
Object[] values = new Object[getterMethods.length];
for (int i = 0; i < getterMethods.length; i++) {
Method method = getterMethods[i];
Integer index = parameterIndexes[i];
... |
dbbacc5e-0c92-47d7-a2b1-d42abd5f109a | 7 | private java.util.Map<Integer, Integer> findUnmatchedBrackets() {
final Segment text = new Segment();
final java.util.Stack<Integer> lefts = new java.util.Stack<Integer>();
final java.util.Map<Integer, Integer> unmatched = new java.util.HashMap<Integer, Integer>();
final int lineCount = ... |
dab0ce43-c300-410d-908f-807b955ec3b2 | 1 | public Connection getConnection()
throws SQLException {
try {
Connection connection = DriverManager.getConnection("jdbc:derby:.\\db\\music.db;create=true");
createTable(connection);
return connection;
} catch (Exception e) {
log.log(Level.SEVE... |
49c47846-0920-449a-876b-0d9cc48af6fd | 5 | @Override
public void run() {
do {
Collection<Transition> values = this.dataset.values();
for (Transition transition : values) {
Map<String, Object> datagramContent = new HashMap<String, Object>();
datagramContent.put(Statics.CONTENT_TRANSITION, transition);
try {
this.out.writeObject(new Data... |
e8d025fc-3fd9-4e8a-98e0-686063417c6e | 7 | public void exec(){
boolean nextStep = true;
do {
try{
inpFirstArg();
inpOperation();
res = unOp(inpOperation);
if (res != null){
out.println(res);
... |
aef6e968-33d3-4907-8d2f-5355545565a2 | 6 | 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 s... |
323cfc6b-7c9d-4bea-8572-406589fea37a | 2 | public static void enableElements(Container container, boolean shouldBeEnabled) {
Component[] components = container.getComponents();
for (Component c : components) {
c.setEnabled(shouldBeEnabled);
if (c instanceof Container) {
enableElements((Container) c, should... |
59407fb3-d1e7-470c-b5c5-543e2001af1f | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._const_ == child)
{
this._const_ = null;
return;
}
if(this._var_ == child)
{
this._var_ = null;
return;
}
... |
8b6a93b7-6839-476c-92cd-9b99eced1f5f | 3 | private static void checkPrinter() {
String queryString = "${^XSET,ACTIVERESPONSE,1}$";
try {
PrintService printService = findPrintService();
System.out.println(printService.getAttribute(QueuedJobCount.class).getValue());
if (printService == null) {
... |
33feb10f-3f12-4a33-b3cd-42d6a54c3566 | 0 | @Override
public Point getDirection() {
return direction;
} |
e1817135-de8c-4924-ba52-3b68f83be4f4 | 1 | private void tablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMouseClicked
if (evt.isMetaDown()){
JOptionPane.showMessageDialog(null, "Pulsado");
}
}//GEN-LAST:event_tablaMouseClicked |
f4e5c000-6198-42c5-a3d3-33ac2f711d66 | 9 | private void setDisplayMode() throws LWJGLException{
DisplayMode targetDisplayMode = null;
DisplayMode[] modes = Display.getAvailableDisplayModes();
int freq = 0;
for (int i=0;i<modes.length;i++) {
DisplayMode current = modes[i];
if ((current.getW... |
85ea9b15-4f77-4536-9bb3-6ef7f709f545 | 2 | public boolean isLit() {
return this != OFF && (!isBlinkAspect() || isBlinkOn());
} |
fb5485ed-d257-4c4c-a250-d37e5f417260 | 8 | private void printBoard() {
for ( int i = 0; i < getBoard().length; i++ ) {
for ( int j = 0; j < 7 - i; j++ ) {
System.out.print(" ");
//Forward spacing between cards
}
for ( Card card : getBoard()[i] ) {
System.out.print(car... |
4f919ef6-8e28-4e49-8d3d-3997bb4eed3e | 8 | @Override
public void run()
{
try
{
// Create a ServerSocket to listen on that port.
final ServerSocket masterSocket = new ServerSocket(HttpServer.PORT);
// Now enter an infinite loop, waiting for connections and handling
// them.
while (true)
{
Socket client = masterSocket.accept();
if ... |
0281c4bb-8855-40a8-8c52-0c439140a8d5 | 1 | @Override
public void logicUpdate(GameTime gameTime) {
for (Entity entity : entityList) {
processEntity(entity);
}
} |
2a402463-781a-4859-9d36-657f8c603604 | 9 | public void configure(Element pageElement) {
this.setName(this.monome.readConfigValue(pageElement, "pageName"));
this.setSpeed(Integer.parseInt(this.monome.readConfigValue(pageElement, "speed")));
if (this.monome.readConfigValue(pageElement, "syncEnabled") != null) {
if (this.monome.readConfigValue(pageElement... |
43881a49-ed18-4280-9440-d77de73d4a69 | 6 | public void editSelected() {
Actions action = actionsTree.getSelectedItem();
if (action != null) {
if (action.getClass().equals(Delay.class)) {
formUI.getDelayTab().loadAction((Delay) action);
formUI.getformTabs().setSelectedIndex(FormUI.DELAY_TAB);
}
if (action.getClass().eq... |
c97860a9-c92b-41a4-81fe-1ac2772586b0 | 1 | @Override
protected void createReaderWriter() throws JoeException {
// try to create an appropriate reader-writer
ourReaderWriter = new PdbBFReaderWriter() ;
if (ourReaderWriter == null) {
throw new JoeException(UNABLE_TO_CREATE_OBJECT) ;
}
} |
eca779f6-01aa-432c-82a2-e25c4a256fe1 | 4 | public double value()
{
ArrayList<Double> numbers = new ArrayList<Double>(values.size());
for (int i = 0; i < values.size(); i++)
{
numbers.add(values.get(i).value());
}
for (int i = Operator.total_priorities(); i > 0; i--)
{
int skipped = 0;
... |
6ab98079-4275-49e6-9902-909be774c432 | 9 | public static void loadMods() {
File base = new File(Constant.MODS);
if (!base.exists()) {
base.mkdir();
}
File[] files = base.listFiles();
for (int i = 0; i < files.length; i++) {
File[] fles = files[i].listFiles();
for (int a = 0; a < fles.length; a++) {
File z = fles[a];
if (z.getName().eq... |
ece369b2-b2cd-400b-b0a3-c73f605e927e | 1 | private String JsonUsername(String username) {
JsonObject jasonObject1 = Json.createObjectBuilder().add("username", username).build();
StringWriter stringwriter = new StringWriter();
try (JsonWriter jsonwriter = Json.createWriter(stringwriter)) {
jsonwriter.write(jasonObject1);
... |
0029ba0b-97c9-47e9-a048-370b69435c6a | 2 | private boolean memeChecker(String currentText)
{
boolean isAMeme = false;
for(String currentMeme : memeList)
{
if(currentMeme.equalsIgnoreCase(currentText))
{
isAMeme = true;
}
}
return isAMeme;
} |
55e2824e-4bf9-4978-80be-ed78cead91dd | 7 | public void transitionCreate(State from, State to) {
// TODO Auto-generated method stub
if (currentStep != TRANSITIONS_TO_TRAPSTATE) {
outOfOrder();
return;
}
if (!to.equals(myTrapState))
{
JOptionPane.showMessageDialog(frame,
"You have to make transition to the trap state!", "Error",
JOpti... |
4436f13f-c1f4-4bd4-804a-ca37482112db | 6 | public static ArrayList<String> getFeatures(String model) {
HashSet<String> features = new HashSet<String>();
for(Entry<String, LinkedHashMap<String, Double>> entry1 : tfidfTable.entrySet()) {
if(!entry1.getKey().startsWith(model))
continue;
for(Entry<String, Double> entry2 : e... |
a8a621f2-9821-4016-98e5-7610bdad5503 | 9 | @Override
public String toString() {
return "Comment {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (idx != null ? " idx [" + idx + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue +... |
7322c245-166f-407d-912f-55627c754c0f | 4 | public static void main(String args[]) {
try {
//Look and Feel do sistema
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(AppRoot.class.getName()).log(java.util.logging.Level... |
1a599d25-b765-4dbe-bcde-40d494366c1b | 5 | @Override public double nextDouble() throws IOException {
JsonToken token = peek();
if (token != JsonToken.NUMBER && token != JsonToken.STRING) {
throw new IllegalStateException("Expected " + JsonToken.NUMBER + " but was " + token);
}
double result = ((JsonPrimitive) peekStack()).getAsDouble();
... |
8cb04ed7-e735-40de-83cb-a14103d3c03b | 2 | public static <K,V> Map.Entry<K, V> soloEntry(Map<K, V> m) {
if ((m != null) && m.size() == 1) {
return m.entrySet().iterator().next();
}
throw new IllegalArgumentException(String.format("expected a map of one entry, got %s", m));
} |
19586032-df01-490f-9a5e-6e95441c2a7f | 8 | public void run() {
InetAddress group = null;
try {
group = InetAddress.getByName(multicast);
} catch (UnknownHostException e) {
e.printStackTrace();
}
//create Multicast socket to to pretending group
MulticastSock... |
7f15e59b-b07f-4419-bfe2-4511cfb5fb7a | 2 | public void changeHideIcon(boolean hidden) {
hide.setIcon(hidden ? makeImageIcon("/images/fold_right" + color + ".png") : makeImageIcon
("/images/fold_left" + color + ".png"));
hide.setToolTipText(hidden ? "show... |
3b849a7e-56ea-4acd-b884-3a8bbf2bb3fe | 5 | private void addStudentToDB(Student student) throws ServerException {
if (log.isDebugEnabled())
log.debug("Method call. Arguments: " + student);
NodeList groups = document.getElementsByTagName("group");
Element group = null;
Element students = null;
for (int i = 0; i < groups.getLength(); i++) {
if (gro... |
ac797a15-8da3-4d72-9edd-1a170e20ad18 | 7 | public void getTester()
{
networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + userTester + "," + userName);
clientType = userTester;
tester = true;
cleanLabels();
if(observer)
getObserver.setVisible(true);
if(contributor)
getContributor.setVisible(true);
if(repo... |
d6d98c7f-136d-43ed-a281-5a8fa260b40a | 3 | @Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
AbsValueNode temp = (AbsValueNode) getChildAt(this.getChildCount() - 1);
assert(temp!=null);
Value test = (temp.evaluate(context));
if (test.getType() != VariableType.BOOLEAN)
... |
aa6acec7-12d1-4738-b1c0-5f679b229460 | 3 | private void jButtonCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCalcActionPerformed
/**This method calculates Monthly Mortgage Payment**/
/**Get Input**/
//Get the vlaue of the text fiels
sPrinciple = jTextFieldPrincipal.getText();
... |
f2fe09d7-b838-4164-b2b2-1e2a20bc79a1 | 8 | public void think(double dt) {
switch (mode) {
case WALK:
VillagerEntity closest_villager = grid.getClosestVillager(point.x,
point.y, ZOMBIE_FOLLOW_RADIUS);
TowerEntity closest_tower = grid.getClosestTower(point.x, point.y,
ZOMBIE_FOLLOW_RADIUS);
Entity closest_entity = null;
if (closest_towe... |
2f13ae15-4020-410f-8003-db61de425701 | 6 | public void sort(int low, int high) {
int i = low, j = high, tmp;
int pivot = intArr[(low + high) / 2];
// aufteilen und sortieren
while (i <= j) {
/**
* Wandere mit i nach rechts, bis ein Wert größer oder gleich dem
* Pivotelement gefunden wurde. Entsprechend wird mit j nach links
* gew... |
b66c33b1-97c5-41d3-818e-12beb43ab73e | 5 | private Character blockPrint(Block block) {
switch (block.getColor()) {
case BLACK:
return '$';
case BLUE:
return '@';
case GREEN:
return '&';
case RED:
return '#';
case YELLOW:
... |
a6335744-ad3e-4155-8aee-3181017e10bc | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
59f190f3-3869-416b-938f-18bc45b3963c | 8 | public void draw(Graphics surface) {
// Draw the sprite
sprite.draw(surface, x, y);
// Move the object each time we draw it
x += xDirection;
y += yDirection;
// If we have hit the edge and are moving in the wrong direction,
// reverse direction
// We check the direction because if a box is placed near... |
8d6757c4-b0e5-4302-8ba2-4625f8177d30 | 7 | @EventHandler
public void onPluginEnable(PluginEnableEvent event) {
mainLogger.debug("onPluginEnable executing");
PluginManager pm = plugin.getServer().getPluginManager();
Plugin checkVault = pm.getPlugin("Vault");
Plugin checkMobArena = pm.getPlugin("MobArena");
if (checkVault != null && !plugin.isEconomyEn... |
f127a9b9-b8c5-4e22-a44c-3a7472789d15 | 9 | public boolean checkInput (char input) {
if ((input == '1')||(input == '2')||(input == '3')||(input == '4')||(input == '5')||(input == '6')
||(input == '7')||(input == '8')||(input == '9')) {
return true;
} else {
return false;
}
} |
aa7fe6c7-da1d-483e-a88a-4ce6e97fde3f | 1 | private ArrayList<AdvancedLocation> makeAdvanced(ArrayList<Location> list, MapLayer layer) {
ArrayList<AdvancedLocation> out = new ArrayList<AdvancedLocation>();
for (Location i : list) {
out.add(new AdvancedLocation(i, layer));
}
return out;
} |
e88db222-ce90-414f-8a92-2f7895535631 | 8 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
Article article;
try {
article = em.getRef... |
be0d8e58-e2cd-4ba5-97ae-d2296d6b66b3 | 9 | private void button11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button11ActionPerformed
if (order2code5tf.getText().equals("1001"))
{
o2c5destf.setText("Chicken Nugget");
}
if (order2code5tf.getText().equals("1002"))
{
o2c5... |
5746c274-1642-4a5e-8e6c-5e3f629bcc53 | 9 | public void doFrameInGame() {
moveAndCheckCollisons();
incrementTimers();
if (finishedFinalLevel()) {
addGameState("GameWon");
gameOver();
} else {
if (player.timeToWaitAfterKilled == 0) {
lifeLost();
}
if (existsObject("player")) {
if (!onBossLevel()) {
if (gameTimer < STAGE_D... |
53a6b252-cee9-4b68-bcea-6530f79503df | 5 | public static void singleLineComments(File fileName, DetailObject detailObject, String comment) {
detailObject.updateNumberOfFiles();
DetailObject.updateTOTAL_NUMBER_OF_FILES();
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
String line;
while ((line = bufferedReader.... |
0d6c7ee3-bfee-4f86-b29c-c0b53444ee28 | 0 | public List findBySumbitIp(Object sumbitIp) {
return findByProperty(SUMBIT_IP, sumbitIp);
} |
b53999e7-669b-48a4-ba60-8cabf7d059d7 | 5 | public double[] getEnergyRange() {
if (energyRange != null) {
return energyRange;
}
double max = 0;
double max2 = 0;
for (MatterInterval mi : intervals) {
if (max <= mi.getY()) {
max2 = max;
max = mi.getY();
}
... |
3476efb5-17dc-4c9d-908a-d6e0c32483a7 | 5 | public static String checkInteraction(String drugFilling, String drugInList){
String[] interactingDrugs = HelperMethods.splitString(drugInList);
String[] activeDrugList = HelperMethods.splitString(currentActive);
String conflictFound="";
for(int i = 0; i<interactingDrugs.length; i++){
for(int j = 0; j<active... |
6458f07b-c988-4d10-8466-16b749bb73fc | 2 | public void startServer() throws Exception {
ServerSocket serverSocket = null;
boolean listening = true;
try {
serverSocket = new ServerSocket(_portNumber);
} catch (IOException e) {
System.err.println("Could not listen on port: " + _portNumber);
System.exit(-1);
}
while (listening) {
handle... |
a7e63375-83bd-48c2-bcbe-bbdce867fd34 | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length != 3) {
printArgsError(args);
printHelp(sender, label);
return true;
}
String target = findTarget(args[1]);
int chargeId = -1;
try {
chargeId = Integer.valueOf(args[2]);
} catc... |
56661029-546c-434a-bad9-928f782a4d05 | 7 | public void setOptions(String[] options) throws Exception {
String optionString;
optionString = Utils.getOption('X', options);
if (optionString.length() != 0) {
setAttsToEliminatePerIteration(Integer.parseInt(optionString));
}
optionString = Utils.getOption('Y', options);
if (optionStrin... |
c0743a62-7abf-4323-b35d-6e892200269f | 0 | @Override
public void actionPerformed(ActionEvent e) {
Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().undoAll();
} |
25d8d3de-059f-496b-aab3-1b5908fbdec0 | 3 | private void groupMatches()
{
clear();
try
{
System.out.println("Select group id: ");
int id = new Scanner(System.in).nextInt();
Group gm = groupmgr.getById(id);
if (gm != null)
{
ArrayList<MatchScheduling> groupPla... |
bb691753-ccd5-4951-9107-a086b49116bb | 8 | public static boolean isInBoardLimits (int MoveToX, int MoveToY, int MoveFromX, int MoveFromY){
if (MoveToX<8&&MoveToX>-1&&MoveToY<8&&MoveToY>-1&&MoveFromX<8&&MoveFromX>-1&&MoveFromY<8&&MoveFromY>-1)
return true;
else
return false;
} |
492893a1-1e62-49c7-bfcf-76b427be6d67 | 8 | public void parseMap() {
Tile[][] ret = null;
Scanner read = null;
try {
read = new Scanner(this.mapFile);
int mapwidth = read.nextInt();
int mapheight = read.nextInt();
read.nextLine();
ret = new Tile[mapwidth][mapheight];
... |
f20c47e3-7ff3-4c32-83cb-9957a8d91ec0 | 8 | final private boolean jj_3R_133() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_142()) {
jj_scanpos = xsp;
if (jj_3R_143()) {
jj_scanpos = xsp;
if (jj_3R_144()) {
jj_scanpos = xsp;
if (jj_3R_145()) {
jj_scanpos = xsp;
if (jj_3R_146()) {
jj_scanpos = xsp;
if (jj_3R_147()) {... |
f5c82073-54e5-4a86-b3b4-16a5ac34cd78 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPData")
public JAXBElement<PGPDataType> createPGPData(PGPDataType value) {
return new JAXBElement<PGPDataType>(_PGPData_QNAME, PGPDataType.class, null, value);
} |
bc17dc5f-638c-4873-9643-e6a3de262c29 | 8 | public static Object escape(Object original) {
if (original instanceof Character) {
char u = (char) ((Character)original);
int idx = "\b\t\n\f\r\"\'\\".indexOf(u);
if (idx >= 0)
return "\\"+"btnfr\"\'\\".charAt(idx);
if (u < 32)
re... |
8be3d18d-4c14-4fac-8276-a53f09f45cd7 | 7 | public void runHuckedInsertionSortV2(int[] array){
// start timer
long startTime = System.currentTimeMillis();
// start Huck specific timer
long startHuckTime = System.currentTimeMillis();
// length of array
int length = array.length;
// Array's statistical mean.
double mean = StandardDeviation... |
e12bf0f0-1764-452a-b696-13963e6b498e | 2 | public void lconst(final long cst) {
if (cst == 0L || cst == 1L) {
mv.visitInsn(Opcodes.LCONST_0 + (int) cst);
} else {
mv.visitLdcInsn(new Long(cst));
}
} |
e44a83a2-6d1d-4d45-adaa-2e3251ba10e7 | 1 | public void pause_ingress() {
for (ConnectionProcessor pipe : pipes) {
pipe.pause_ingress();
}
} |
56717d6c-8d54-4d5e-9587-c8171a4e7d71 | 7 | @Override
public final void contextRun(final Context context,
final TaskLogger taskLogger,
final Task<?> parent,
final Collection<Task<?>> predecessors)
{
if (transitionRun())
{
final Promise<T> promise;
... |
de4ef8c9-bfe2-4c3e-8b2c-ca58010eb49d | 3 | static void blendingBench(CPLayer l1, CPLayer l2, int iterations, boolean useFullAlpha) {
double lastTime = System.currentTimeMillis(), newTime;
CPRect size = l1.getSize();
if (useFullAlpha) {
for (int i = 0; i < iterations; i++) {
l1.fusionWithFullAlpha(l2, size);
}
} else {
for (int i = 0; i < i... |
1bb8e737-11b6-4990-a039-db6ffeda7f63 | 2 | public List<Group_schedule> getGroup_scheduleList(int group_id)
{
List<Group_schedule> list = new ArrayList<Group_schedule>();
try {
PreparedStatement ps = con.prepareStatement("SELECT * FROM group_schedule WHERE group_id=?");
ps.setInt(1, group_id);
ResultSet rs = ps.executeQuery();
while(rs.next(... |
b4b4091f-dfd7-48cd-af01-f1f7ce37d956 | 9 | public static void main(String args[]) {
QueueBuilder builder = new QueueBuilder();
builder.parseInput("input.txt");
Monitor monitor = new Monitor();
RegisterManager manager = new RegisterManager(builder.getRegisters(), monitor);
// total number of customers
totalCusto... |
cabd91ba-113c-488b-a7a9-4a90a007cfda | 8 | private void initThreads() {
EXECUTORS.execute(new Runnable() {
@Override
public void run() {
try {
int size = 0;
Thread.currentThread().setName(getThreadName());
while (running.get()) {
InputStream in0 = inSocket.getInputStream();
OutputStream out0 = outSocket.getOutputStream();
... |
3121e436-0146-4c93-ad7c-253eab851281 | 6 | @Override
public void execute(Joueur jou){
Joueur proprio = this.getProprietaire();
if(proprio == null){
propositionAchat(jou);
}
else if(proprio == jou && getRanking() < 5 && jou.possede(this.groupePropriete)){
propositionAmeliorat... |
c7fcc26b-d31e-4049-8fea-ba53aed966a9 | 9 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int cc = 0;
while (in.hasNextInt()) {
cc++;
int n = in.nextInt();
if ( n == 0 ) break;
int[][] nn = new int[3*n][3*n];
List<Q> lq = new ArrayList<Q>();
List<Double> lx = new ArrayList<Double>();
List<Double>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.