method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2ecb5ee2-6c5d-4b02-8fe3-51b135d54cbc | 4 | public void handleTerminalInput() {
while (true) {
try {
String write = readString(name + ": ");
if (write.equals(EXIT)) {
shutDown();
} else {
if (!write.equals(null)) {
out.write(write + "\n\r");
out.flush();
}
}
} catch (IOException e) {
e.printStackTrace();
... |
59a476b9-aea4-4ff0-b86b-1be09a37d02a | 1 | Match getPrevMatch(Team t, Match match) {
if (match.homeTeam.equals(t))
return match.prevHTM;
return match.prevATM;
} |
f3785c64-dd7d-4cc0-aaeb-4cc4b7ce0033 | 1 | @Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
return connection.getTypeMap();
} |
fcb61f6f-ed98-4488-98dc-7e98f75d743b | 2 | @Override
public void addNgram(Ngram ngram) throws Exception {
Connection conn = JDBC.createConnection();
String wordAfterHandle = ngram.getWordGroup();
if (ngram.getWordGroup().contains("'")) {
// System.out.println(ngram.getWordGroup());
String spiltArray[] = ngram.getWordGroup().split("\'");
wordA... |
489942f2-8714-4228-8e5f-0c402217d9cb | 2 | public void render()
{
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
screen.clear();
int xScroll = player.x - screen.width / 2;
int yScroll = player.y - screen.height / 2;
level.render(xScroll, yScroll, screen);
... |
09a0e3f7-d5c1-4adb-b776-034ea94087ee | 4 | public int modifyReservation(String bookingID, ARObject obj)
{
// id[0] = resID, [1] = reservID, [2] = trans ID
int[] id = parseBookingID(bookingID);
if (id == null) {
return GridSimTags.AR_MODIFY_FAIL_INVALID_BOOKING_ID;
}
// then search for the existing reserva... |
099045e6-d919-43a5-b002-639b348ff0d3 | 1 | public void draw (boolean tinting)
{
if(tinting)
master.tint(val1, val2, val3, opacity);
else
master.noTint();
} |
774aa9f7-80fd-4fd7-915c-c3cf3cbd9dc9 | 4 | private void readConfig() // liest die Konfigurationsdatei
{
factory = DocumentBuilderFactory.newInstance() ;
try
{
builder = factory.newDocumentBuilder() ;
if ( TGlobal.DEVEL )
{
File f = new File( "src/resource/info/new.xml" ) ;
config = builder.parse( f ) ;
}
... |
a557b3c9-c9d1-411c-b033-e22bf15a3cd4 | 1 | public double get(int index) {
if (data.containsKey(index)) {
return data.get(index);
}
else {
throw new NullPointerException();
}
} |
7af57b93-7118-4d16-86a0-fae84d2ac899 | 0 | public String getDateModified() {return this.dateModified;} |
91080908-c106-4ea8-b1e9-071b6c3b4651 | 1 | private void initMenuBar() {
bookMenuBar = new JMenuBar();
ActionListener myActionListener = new BookGUIActionListener(this,
loginUser);
changeMenu = new JMenu("Wechseln");
changeMenuItem = new JMenuItem("Zur Userverwaltung wechseln");
changeMenu.add(changeMenuItem);
changeMenuItem.addActionListener(... |
783f610f-8578-43f0-963f-e87599aa8073 | 5 | private boolean isNeedsEscape(String character) {
if (character.matches("\\(")) {
return true;
} else if (character.matches("\\)")) {
return true;
} else if (character.matches("\\$")) {
return true;
} else if (character.matches("\\^")) {
return true;
} else if (character.matches("\\!")) {
retur... |
11035a75-6190-411a-a0bb-4559be41b3b3 | 3 | public int lookUp(String toPlayer) {
try {
//Bukkit.broadcastMessage("Test2: " + dataFolder.getPath());
BufferedReader br = new BufferedReader(new FileReader(warnLog));
String line;
String[] line2;
int q = 0;
while ((line = br.readLine()) != null) {
line2 = line.split("\\|");
if (toPlaye... |
22feeb1d-2fba-4b2e-9ee8-f28fbb836e26 | 9 | final public IndexPart IndexPart(Recovery next) throws ParseException {
Token sort;
Identifier identifier;
IndexPart index_part = new IndexList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INDEX_T:
case AUGMENTS_T:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INDEX_T:
sort... |
50ef7739-4638-4e37-89ab-5077b7c93339 | 9 | private static void addTests(File baseDir, TestSuite suite) {
final File[] files = baseDir.listFiles();
if (files != null) {
for (final File file : files) {
final String name = file.getName();
if (file.isFile() && name.endsWith(".bsh") && ! "TestHarness.bsh".equals(name) && ! "RunAllTests.bsh".equals(nam... |
83637bfc-0b93-4ab3-b746-6146a0b58660 | 7 | private void path_to_stockpile(GeneralAIUnit unit, GeneralAI ai, int now_at, int now_start) {
// after harvest, need to return to a stockpile
ArrayList<Integer> stockpiles = new ArrayList<Integer>();
for (int i = 0; i < ai.units.size(); i++) {
Unit u = ai.units.get(i).stats;
if (u.isStockpile()) {
stock... |
58d642f8-e6f0-4dc4-b453-c1e71b7035bd | 8 | public void parseInput(String fileName) {
file = fileName;
nuc.clear();
bass.clear();
// Setup the file reader
try {
reader = new BufferedReader(new FileReader(file));
} catch (IOException e) {
System.err.println("Caught IOExcepti... |
32c7254d-07f0-4858-8593-ad1e3135b2d3 | 5 | public void restoreStatus(){
// EDebug.print("I am mucking with that data structure.");
if (myDeck.size() == 0) return;
Automaton p = null;
while (myDeck.size() > 0 && (p = myDeck.pop()).hashCode() == myMaster.hashCode());
// EDebug.print("Master's hash i... |
3e335967-a9ad-4f90-adbb-c1c7f84ede16 | 5 | public static void openSettingsPanel(final JFrame parentFrame) {
JPanel message = new JPanel(new GridBagLayout());
GridBagConstraints f = new GridBagConstraints();
GridBagConstraints s = new GridBagConstraints();
f.gridx = 0;
s.gridx = 1;
f.insets = s.insets = new Insets(... |
b02cf338-6458-411b-9106-25b14c281640 | 8 | private boolean filterClassName(String className) {
if (!className.endsWith(".class")) {
return false;
}
if (null == this.classNameFilters || this.classNameFilters.isEmpty()) {
return true;
}
String tmpName = className.substring(0, className.length() - 6);
boolean flag = false;
for (String str : cla... |
94bce976-f313-49a1-9b3a-2775fcfc645d | 5 | public void run() {
while (this.run) {
try {
try {
if (getThreadCount() > 0) {
Socket client = this.server.accept();
System.out.println("Server: connection from client: " + client);
WorkerThre... |
2ddfd75a-93ff-4fd4-98dd-b7640067a70f | 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... |
d10b6e15-5abc-457b-a630-89f6219d2d29 | 8 | public void method558(int cache, int file) {
if (cache < 0 || cache > files.length || file < 0 || file > files[cache].length) {
return;
}
if (files[cache][file] == 0) {
return;
}
synchronized (queue) {
for (OnDemandRequest onDemandRequest = (On... |
cb608637-3cf3-4048-9a8c-731f63d4b500 | 3 | public static Object invokeZeroArgMethod(Object bean, String methodName)
{
Method method = getZeroArgMethod(bean.getClass(), methodName);
// Ensure we can invoke even if method or class is not public
method.setAccessible(true);
Throwable cause = null;
try
{
... |
fd05ac57-8101-40f8-b8e0-c6349b661b65 | 9 | public ArrayList<ArrayList<String>> subjectsOf(ArrayList<String> clause, ArrayList<String> charIdentifier) {
boolean hasPrep = false, hasVerb = false;
ArrayList<String> subjects = new ArrayList<>(), identifiers = new ArrayList<>();
for (int index = 0; index < clause.size(); index++) {
... |
7fee2b54-113d-411d-823c-8f7e2eb4b799 | 2 | public static JSONArray getData(int fromIndex){
StringBuilder sb = new StringBuilder(serverUrl).append("json").append("/Leads/").append("getRecords");
JSONArray data = new JSONArray();
try{
URIBuilder uri = new URIBuilder(sb.toString());
uri.setQuery("authtoken");
... |
0b870b14-52df-479f-9415-265a72596a94 | 8 | private boolean isSumTreeHelper(Node<T> node) {
if (node == null || isLeafNode(node)) {
return true;
}
if (isSumTreeHelper(node.getLeft()) && isSumTreeHelper(node.getRight())) {
Integer ls = 0, rs = 0;
if (node.getLeft() == null) {
ls = 0;
} else if (isLeafNode(node.getLeft())) {
ls = (Integer... |
a7d8a750-2a83-4503-b93d-5b74b4b52f22 | 0 | public LayoutFileParser(String packageName, ARSCFileParser resParser) {
this.packageName = packageName;
this.resParser = resParser;
} |
481e9429-8edb-47b5-a2b7-70a519403ff4 | 7 | public void updateText(){
// Set up hot stocks label
String color;
String expensiveText = "<html> <h1 align='center'>Expensive Stocks</h1>";
LinkedList<Stock> hotties = market.getExpensiveStocks(5);
Stock st;
for (int i = 0; i < 5; i++){
st = hotties.get(i);
if (st.getPercentChange() > 0)
c... |
ddf1fdf6-978d-4d8c-af59-d923a7789ce6 | 6 | static final public void bloc() throws ParseException {
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CONST:
;
break;
default:
jj_la1[1] = jj_gen;
break label_2;
}
declConst();
}
label_3:
while (true) {
switch... |
7f83dec4-21ea-459d-a123-22f8f305addf | 4 | private void readAlgorithmNumber(String arg){
switch(readInt(arg)){
case 1: setUpAlgOne();
break;
case 2: setUpAlgTwo();
break;
case 3: setUpAlgThree();
break;
case 4: setUpInverOver();
break;
default: System.out.println("Not a valid algorithm number");
inputError();
}
} |
8900c8d9-1a25-4b69-b5bd-09992f57cb01 | 5 | public Object invoke(Object... parameters) throws CallbackException {
Class<?>[] classes = new Class<?>[parameters.length];
for (int i = 0; i < parameters.length; i++) {
classes[i] = parameters[i].getClass();
}
try {
Method method = this.o.getClass().getMethod(this.method, classes);
return method... |
46b93263-4402-4376-8a49-3032508eafe4 | 1 | public OptionsRenderer()
{
try
{
}
catch (Exception e1)
{
}
} |
105b7c0e-c697-4791-adfe-27cc2c5f16fe | 1 | public int getNumber()
{
int value=-1;
if (q.size() > 0)
{
value = (Integer)q.remove();
}
return value;
} |
0f1a99dc-fa17-4a7d-b25c-8c6a1d341b0b | 1 | public JPanel getPWFieldBtnChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.pwfieldPanel;
} |
1b8f969d-c994-439c-a3be-a91ee89cc312 | 9 | public static String[] cat(String expression) {
ArrayList se = new ArrayList(); // Subexpressions.
int start = 0;
int level = 0;
for (int i = 0; i < expression.length(); i++) {
char c = expression.charAt(i);
if (c == ')') {
level--;
continue;
}
if (c == '(')
level++;
if (!(c == '(' &&... |
494a92eb-fbfe-4a07-936f-2a2acc6c8c08 | 1 | public void testConstructor_invalidObject_Chronology() throws Throwable {
try {
new DateTime(new Object(), GregorianChronology.getInstance());
fail();
} catch (IllegalArgumentException ex) {}
} |
b7c33693-0829-4615-80c8-a9dadf250ed6 | 6 | public void edit(Equipos equipos) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
equipos = em.merge(equipos);
utx.commit();
} catch (Exception ex) {
... |
b57b59ca-71ac-45a3-b667-4a2cb9b8fa09 | 0 | @Override
public String getName() {
return "special";
} |
cc2b3404-ea8e-4cab-8955-781f5823c3d1 | 5 | public int Close()
{
int retcode = DDC_SUCCESS;
switch ( fmode )
{
case RFM_WRITE:
try
{
file.seek(0);
try
{
byte[] br = new byte[8];
br[0] = (byte) ((riff_header.ckID >>> 24) & 0x000000FF);
br[1] = (byte) ((riff_header.ckID >>> 16) & 0x000000FF);
b... |
8398f171-ac9b-4388-8f2b-2272fcc0cff4 | 3 | public int getTab(int index)
{
if (m_tabs == null)
return m_defaultTab*index;
int len = m_tabs.length;
if (index >= 0 && index < len)
return m_tabs[index];
return m_tabs[len-1] + m_defaultTab*(index-len+1);
} |
aea5caaa-d89b-4d05-8945-ed9245b7d849 | 8 | public void highlightCode()
{
currentCode = (String) ASCView.getMemoryTable().getValueAt(programCounter, 0);
ASCView.getMnemonicPane().clearSelection();
ASCView.getMnemonicPane().setSelectedIndex(tracker);
ASCView.getHexPane().clearSelection();
ASCView.getHexPane()... |
981bffbd-2d24-47e8-8aa2-9ebaf6e1952c | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Edge other = (Edge) obj;
if (from == null) {
if (other.from != null)
return false;
} else if (!from.equals(other.from))
return false;
if... |
d7d4c473-1435-4e8d-9d59-789908d9e405 | 3 | private void repairVy(Paddle paddle) {
int centerOfPaddleY = (int) (paddle.getY() + (paddle.getLength() / 2));
if (y < centerOfPaddleY) {
if (vy > 0) {
vy = -vy;
}
} else {
if (vy < 0) {
vy = -vy;
}
}
} |
b29a304b-e1cf-4ad7-a55a-33e66ca1cf98 | 5 | @SuppressWarnings("unchecked")
private static void merge(Comparable[] a, int lo, int mid, int hi)
{
// i and j is used to point to the currently processing element in the
// first and 2nd half respectively
int i = lo, j = mid + 1;
// Copy a[lo..hi] to aux[lo..hi].
for (int k = lo; k <= hi; k++)
aux[k] =... |
1bf4f10c-5872-4666-a71c-fead129063c2 | 4 | protected static LuaValue weaken(LuaValue value) {
switch (value.type()) {
case LuaValue.TFUNCTION:
case LuaValue.TTHREAD:
case LuaValue.TTABLE:
return new WeakValue(value);
case LuaValue.TUSERDATA:
return new WeakUserdata(value);
default:
return value;
}
} |
63da8848-6dbc-4bdd-bd07-bf4259a8e402 | 8 | private boolean check() {
if (N == 0) {
if (first != null) return false;
}
else if (N == 1) {
if (first == null) return false;
if (first.next != null) return false;
}
else {
if (first.next == null) return false;
}
... |
14a53256-7ba1-4c9a-9fd7-330da87b8eee | 3 | public void displayLeaderboard(MessageLib msgLib)
{
//Variable Declarations
int positionCount = 1;
List<String> names = getNames();
List<Integer> counts = getCounts();
//Display that information to the player.
msgLib.standardHeader("Top " + header);
for (int j = names.size() - 1; j > names.size(... |
9f0bd4c6-5d1e-4f64-960c-3383dc588297 | 4 | @Override
public Color getDominantClusterInNeighbourhood(Node node) {
Set<Node> neighbors = IteratorUtils.toSet(this.LPAClusteringEngine.getGraph().getNeighbors(node).iterator());
if (neighbors.isEmpty())
return this.LPAClusteringEngine.getNodeClusterMapping().get(node); // no clusters i... |
8ab75949-433c-4678-bff2-f206bc29731a | 0 | public static <T> T getService(Class<T> serviceType) {
return (T) services.get(serviceType);
} |
721de83c-cbdc-4d9e-9a12-0d430eadf5fd | 6 | public ArrayList getPostTime(String ID) {
ArrayList<Timestamp> time = new ArrayList<Timestamp>();
PreparedStatement ps = null;
ResultSet rs = null;
Connection con = null;
try {
con = dbConnect.getDBConnection();
String queryTime = "select created from tbl_pos... |
6443cb08-84ea-4c66-8f9f-383cebad672f | 0 | public int GetWaitTime()
{
//get the wait time
return waitTime;
} |
8a1a94ae-204a-44e4-9479-41a30b4f2318 | 9 | public void testCloseWithThreads() throws Exception {
int NUM_THREADS = 3;
for(int iter=0;iter<20;iter++) {
MockRAMDirectory dir = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
ConcurrentMergeScheduler cms = ne... |
0e0f6d5d-b6b9-411e-a5c6-df01aff2286e | 8 | public ArrayList<Passenger> getPassengersForMethod(DefaultSeatingMethod method) {
switch (method) {
case BACK_TO_FRONT:
return this.btfBoardingHandler.getPassengers();
case BLOCK_BOARDING:
return this.bBoardingHandler.getPassengers();
case BY_S... |
0420b96d-4628-4b4c-938b-765a1637b442 | 4 | @Override
protected Result unhandledKeyboardEvent(Key key) {
if(getSelectedIndex() == -1)
return Result.EVENT_NOT_HANDLED;
if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') {
if(itemStatus.get(getSelectedIndex()) == true)
itemStatus.set... |
3fe4ff09-29eb-4e04-9aa3-a7a20ecfedc4 | 2 | public Vector toVector() {
Vector<E> vec = new Vector<E>(currentSize);
for (int i = 0; i < currentSize; ++i) {
if (array.getElement(i) != null) {
vec.addElement(array.getElement(i));
}
}
return vec;
} |
88c1bb69-874b-441c-92f0-d957a3eb8011 | 0 | public static Filter isFinal()
{
return new IsFinal();
} |
f80521be-d7d7-4e62-b63a-614d72e5d640 | 9 | public static IList read(InputStream input) throws ThinklabException {
String s = "";
int c;
try {
c = input.read();
} catch (IOException e) {
throw new ThinklabIOException(e);
}
int pcount = 0;
boolean inString = false;
while (c != -1) {
s = s + (char)c;
if (c == '"') {
... |
3f296bf8-f6bf-4964-9c80-1c23f1365e72 | 7 | private XmlNode pullXmlNode() {
// read from queue
if(! nodeQueue.isEmpty()) {
return nodeQueue.poll();
}
// read from stream
try {
while(reader.hasNext()) {
int event = reader.next();
switch(event) {
ca... |
c3b57bd5-f2f7-4829-b535-8b64ee3979be | 9 | @Override
public List<Achievement> fakeBumpAchievement(final MOB mob, final Event E, int bumpNum, Object... parms)
{
List<Achievement> achievements=new ArrayList<Achievement>(1);
if((mob != null)&&(E!=null)&&(!mob.isMonster())&&(CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)))
{
ensureAchievementsLoaded();
f... |
d4c91672-2a43-4e28-843a-9cabfd23f3e3 | 2 | public boolean isQuizComplete(){
System.out.println(checklist.size() + " == 0||("+ max + " != -1 &&" + answeredQuestions +"==" + max);
return (checklist.size() == 0||(max != -1 && answeredQuestions == max));
} |
04fe2174-2bbd-4808-bfb3-85dbfc5a1bfb | 4 | public static Element createElement(Node parent, String prefix, String name, Map<String, String> namespaces) {
if(parent == null) {
throw new IllegalArgumentException("Parent node can not be null.");
}
String uri = null;
if(!isNullOrWhitespace(prefix) && namespaces != null) {
uri = namespaces.get(prefix)... |
7c53ab70-df63-4c72-b21a-9b4639158b89 | 9 | public int getStringWidth(String par1Str)
{
if (par1Str == null)
{
return 0;
}
else
{
int var2 = 0;
boolean var3 = false;
for (int var4 = 0; var4 < par1Str.length(); ++var4)
{
char var5 = par1Str.cha... |
05d2ff50-6055-4c64-a020-a42c56896ac0 | 5 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
currentElement = "";
level--;
if (localName.compareTo("service")==0){
if (device.getServiceTypeCIF() != null &&
device.getServiceTypeCIF().compareTo("urn:schemas... |
98e56e4b-3f4d-4dfc-b82e-4277d0f53b93 | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
ec2b9162-e0af-4b08-b5e7-e5a57ef53d1e | 7 | public static void unwrap(Message message,
RoomMessageListener roomMessageListener) {
if (!(message instanceof ObjectMessage))
return;
Object messagePayload = null;
try {
messagePayload = ((ObjectMessage) message).getObject();
} catch (JMSException e) {
e.printStackTrace();
}
if (!(messagePayl... |
1b508852-dd8a-465f-a7ee-4c33f3b4c6e0 | 3 | public void accept(Visitor visitor) {
if (visitor.visit(this)) {
if (corp != null) {
corp.accept(visitor);
}
if (data != null) {
data.accept(visitor);
}
super.visitContainedObjects(visitor);
visitor.endVisit(this);
}
} |
61e2ef59-1638-48ec-b98f-7c7f1d7a7f55 | 0 | static void staticMethod() {
int local;
} |
5ae9e3c3-02e0-4a28-b325-6c977c544a57 | 4 | public Respawn05(String data){
if(!data.trim().equalsIgnoreCase("")){
data = data.trim();
if(data.equals(Main.playername)){
Main.player.respawn();
}else{
for(Enemy e: Main.enemies){
if(data.equals(e.getName())){
... |
c29e201a-3456-4adf-955a-4a12a001e4ce | 0 | private void button_countActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_countActionPerformed
//Globals.global_connection.get_count_sallary( Globals.idCurrentActivePerson );
label_sallary.setText( String.valueOf( Globals.global_connection.get_count_sallary(Globals.idCurrentActivePerson... |
415daa7a-7582-4b8b-b261-96d4980d4a76 | 1 | public static void main(String... args) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
md5.update("babyduncan".getBytes());
byte[] result = md5.di... |
4211d028-28e9-4832-a346-528caf6c5e1c | 4 | @Override
public void run() {
int posicion1 = generarPosicionAleatoria();
int posicion2 = generarPosicionAleatoria();
int x1 = Juego.jTubo_arriba1.getLocation().x;
int x2 = Juego.jTubo_arriba2.getLocation().x;
while (true) {
try {
Thread.sleep(getV... |
e246943f-3fb1-4862-bda8-335e67f5b94f | 6 | private void breadthLook(Graph<VLabel, ELabel> G,
Graph<VLabel, ELabel>.Vertex v,
LinkedList<Graph<VLabel, ELabel>.Vertex> fringe,
Stack<Graph<VLabel, ELabel>.Vertex> postList) {
Iteration<Graph<VLabel, ELabel>.Edge> myEdges = G.outEdges(v)... |
b7d75ddb-f911-4a69-bc1d-c843be6855da | 2 | public void uncaughtException(Thread t, Throwable e) {
if(e.getClass().equals(java.lang.OutOfMemoryError.class)){
Runtime.nodes = null;
Tools.disposeRecycledObjects(Logging.getLogger().getOutputStream());
System.gc();
java.lang.Runtime r = java.lang.Runtime.getRuntime();
long maxMem = r.maxMemory() ... |
a0dba4bc-c91b-4e7d-bb01-764351392f49 | 7 | @Override
public MapLayer createDiff(MapLayer ml) {
if (ml == null) { return null; }
if (ml instanceof TileLayer) {
Rectangle r = null;
for (int y = bounds.y; y < bounds.height + bounds.y; y++) {
for (int x = bounds.x; x < bounds.width + bounds.x; x++) {
... |
b8d3b02c-3b1c-443a-b1ca-fe2e39f45930 | 0 | public void setPepPosId(BigInteger pepPosId) {
this.pepPosId = pepPosId;
} |
4a9950ed-ed80-4ae7-b0f8-9319c9203104 | 1 | protected double mass(int x) {
if (x < 0) {
return 0;
} else {
return Math.pow(1 - p, x) * p;
}
} |
fcf8f9a5-5f38-4727-a783-4557dfde1434 | 7 | @POST
@Timed
@Path("changePassword")
@Consumes("application/x-www-form-urlencoded")
@Produces(MediaType.TEXT_HTML)
public Response changePassword(@CookieParam("authUser") String token, @FormParam("passwordVerify") @NotNull String passwordVerify, @FormParam("password") @NotNull String password, @Form... |
de13b11a-a4a8-40fe-b77b-888403252ba1 | 6 | public void ReadBlock() throws IOException
{
if (_streamEndWasReached)
{
return;
}
while (true)
{
final int size = 0 - _bufferOffset + _blockSize - _streamPos;
if (size == 0)
{
return;
}
f... |
dfb98a9a-00bb-468d-a7f4-f8e2f4041723 | 3 | @Test
public void testOutput() throws Exception {
List<String> list = new List<>();
list.addToEnd("test1", 1);
list.addToEnd("test2", 3);
list.addToEnd("test3", 5);
int elementCount = 0;
for (String current : list) {
if (list.exist(current)) {
... |
2523c6f7-c80f-446e-9c82-6a1ed282283a | 4 | public String toString() {
String s1 = "";
String s2 = "";
for (int i = 0; i < theLane.length; i++) {
if (theLane[i].getLight() != null)
s1 += theLane[i].getLight().isGreen() ? "G" : "R";
else
s1 += "";
s2 +... |
41e35ede-7b0d-409f-9f32-fd13ba69a50e | 2 | boolean containsWhitespace(String s) {
for (int i = 0; i < s.length(); ++i) {
if (Character.isWhitespace(s.charAt(i))) {
return true;
}
}
return false;
} |
71bd1632-15ce-4f51-b9cb-6119d9da5903 | 5 | public void save(){
if(this.getId() != null){
String q = "SELECT id, name " +
"FROM call_reasons " +
"WHERE id = ?";
try {
PreparedStatement statement = Reason.getConnection().prepareStatement(q,
ResultSet.TY... |
680cdbd6-b068-4f87-91e4-02cd1f9c3ffd | 4 | public void processInput() {
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
schlange.setDirection(SchlangenKopf.DIRECTION_UP);
} else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
schlange.setDirection(SchlangenKopf.DIRECTION_DOWN);
} else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
schlange.setDirection(Sc... |
538e72a2-70ac-4e5a-aa7c-57bcb92626be | 7 | private void paintActor(Actor chosenActor)
{
Rectangle rect = chosenActor.getRect();
char actorName = chosenActor.getClass().getName().charAt(0);
for(int y = rect.y; y < rect.y + rect.height; y++)
{
for(int x = rect.x; x < rect.x + rect.width; x++)
{
if(!chosenActor.getImage().isTransparen... |
26410b28-df76-430c-ad69-2c4880160483 | 7 | public void moveRight(Tetromino current, int x, int y, int orientation) {
boolean[][] tiles = current.getTiles();
int count = 0;
// clear the current piece out
int width = current.getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece
width = current.getTiles()[0].length == 4 ? 2 : width;
boolea... |
3dcb5b26-95c5-433b-b678-f6b90743ca28 | 0 | public static Long getTimeStampL() {
return (new java.util.Date()).getTime();
} |
c13cc15f-6763-49de-ace3-0046e5718582 | 6 | @Override
public List<RecipeSection> retrieveSections(Recipe recipe) throws DataStoreException {
String recipeName = recipe.getName();
List<RecipeSection> resultList = null;
try ( Connection conn1 = getConnection();
Connection conn2 = getConnection();
ResultSet s... |
4c6c9ec4-e6db-4de7-b0be-60008bda1e9a | 5 | public void insert(Node n){
Node current = head;
boolean flag = false;
if (n.getData()<current.getData()) { // case 1: new node becomes head
n.setNext(head);
head = n;
}/*if*/ else{
while(current.getNext()!=null && !flag){
if(n.getData()<= current.getNext().getData()){ // case2: insert mode in the ... |
33a19c06-5a02-4ae8-b03a-6e3067f4a71d | 5 | public Point move( String move ) {
Point moveCoords = new Point();
switch( move ) {
case "NORTH":
moveCoords.x = 0;
moveCoords.y = -1;
break;
case "EAST":
moveCoords.x = 1;
moveCoords.y = 0;
break;
case "SOUTH":
moveCoords.x = 0;
moveCoords.y = 1;
break;
case "WEST":
moveCoords... |
d4d95d0c-4f4b-4658-971f-583c20456f84 | 4 | public static ShipType getSelection() {
switch (selection) {
case 0:
return ShipType.FIGHTER;
case 1:
return ShipType.SCOUT;
case 2:
return ShipType.BOMBER;
case 3:
return ShipType.SHOTGUNNER;
... |
23970722-c417-440b-99d9-92f7ba87115a | 1 | private void drawTile(Graphics g, Tile tile, int x, int y) {
Value val = tile.value();
int xOffset = offsetCoors(x);
int yOffset = offsetCoors(y);
g.setColor(val.color());
g.fillRect(xOffset, yOffset, SIDE, SIDE);
g.setColor(val.fontColor());
if (val.score() != 0)... |
4a75c5b4-3e04-4f0e-a4a7-6fb8b320ef19 | 8 | private Dimension layoutSize(Container target, boolean preferred)
{
synchronized (target.getTreeLock())
{
// Each row must fit with the width allocated to the containter.
// When the container width = 0, the preferred width of the container
// has not yet been calculated so lets ask for the maximum.
int ... |
afa8001e-8580-4c52-9143-afbe87faca8e | 0 | public JobSchedulerBuilder withPriority( int priority )
{
this.priority = priority;
return this;
} |
a5910ffa-95a3-4bea-8cdd-5f5816bbf650 | 7 | protected void addMissing(Instances data, int level,
boolean attributeMissing, boolean classMissing,
int attrIndex) {
int classIndex = data.classIndex();
Random random = new Random(1);
for (int i = 0; i < data.numInstances(); i++) {
Instance current = data.instance(i);
for (i... |
4f877fc3-7ea5-4e30-af82-08e1a89e688d | 0 | public int getAge() {
return age;
} |
24e82fcc-c237-4b63-bd8c-62779dfb0af5 | 0 | public TST() {
} |
a3dd04f0-272f-4fbe-93a5-230328514eb8 | 2 | public List<Player> getTightEndList() throws IOException, ParseException {
List<String> csvPlayers = retriveData(TE_PROJECTION_LINK);
List<Player> players = new ArrayList<Player>();
for (String playerString : csvPlayers) {
String[] split = playerString.split("\t");
if (... |
e4116f5c-d639-4d16-a151-f9979ba9ec11 | 1 | public static LinkedList<Token> buildTokens(Object... objects) throws MalformedParenthesisException, MalformedDecimalException {
LinkedList<Token> l = new LinkedList<Token>();
for(Object o : objects) {
l.add(new Token(o));
}
return l;
} |
a6948233-92d8-48fe-9186-b0bde036a330 | 3 | public static void main(String[] args) throws Exception {
Reader reader = null;
File input = new File(args[0]);
if (args.length == 1) {
if (!input.canRead())
error("could not read " + input);
} else
error("Improper number of arguments");
Preprocessor p = new Preprocessor();
String newInput = p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.