method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
db3a585c-af4f-4c4b-a8ba-4b8adc68848e | 2 | public void setBuffer (byte buf [])
{
if (buf == null || buf.length >= 0xffff)
throw new IllegalArgumentException ();
this.buf = buf;
this.len = (short) buf.length;
} |
f4b689b6-d86a-44c7-b9b9-78140fc067a2 | 3 | public static void setDirs(boolean allowStay){
if (allowStay)
DIRS = new String[] { "R", "S", "L" }; //made this non-static to allow for switching option
else{
// EDebug.print("Reduction");
DIRS = new String[] { "R", "L" }; //made this non-static to allow for switching... |
12b83046-87b9-4f4d-a869-e7c9d4250c11 | 8 | public void getResourceInfo(gamelogic.PublicGameBoard pub, boolean exp) {
List<catanui.BoardObject.type> data = pub.resData();
for (int i = 0; i < data.size(); i++) {
Tile active = (exp)? getTileByIntExp(i):getTileByInt(i);
if (active == null) return;
switch (data.get(i)) {
case WHEAT:
active.setTyp... |
cc2d34f0-9bd0-44e4-ab29-7f69ab4aa7f9 | 6 | private static boolean modifyPrescription(Prescription bean, PreparedStatement stmt, String field) throws SQLException{
System.out.println("just inside the method");
String sql = "UPDATE prescriptions SET "+field+"= ? WHERE presc_id = ?";
stmt = conn.prepareStatement(sql);
if(field.toLowerCase().equals("dose... |
3b2c3220-5e3d-42f4-a5fb-ce2eda5808c2 | 1 | private void parse() {
try {
rootElement = $( new File(FILENAME) );
} catch (SAXException | IOException e) {
ClientLogger.log("Soubor se seznamem oblíbených serverů neexistuje.",
ClientLogger.ERROR);
rootElem... |
f1869ba8-abd9-4d45-872c-c2b6f352bc21 | 9 | MolecularObjectPropertiesPanel(final MolecularObject molo) {
super(new BorderLayout(5, 5));
if (molo.getHostModel() == null)
throw new NullPointerException("Error: This molecular object does not contain a model reference");
final Point com = molo.getCenterOfMass();
final float rg = molo.getRadiusOfGyratio... |
8f89adb9-d67e-45eb-be77-1e394afb9797 | 4 | public void CreateEntities()
{
//initialize random start Bus-Stop
rndStart = new Random(seed);
//initialize random stop Bus-Stop
rndStop = new Random(seed);
//initialize random used for the Exponential distribution
tmpExp = new Random(seed);
//create ... |
cd401e42-5c8b-419f-9deb-444cc08fafd7 | 1 | public void playDiscard(Card s){
//If we're discarding the drawn card, skip the swap animation
if (!s.equals(animate)){
//Swap animation
animate(s.x, s.y, 450);
int temp = s.card;
s.card = animate.card;
animate.card = temp;
}
animate.visible = true;
animate(pile_discard.x, pile_discar... |
f5d5e38a-64fa-412d-9d08-d029a368a308 | 4 | public ParallelVisualizer() {
// Populates the list of resources
Collection<Sim_entity> entities = Sim_system.getEntityList();
for(Sim_entity entity : entities) {
if(entity instanceof ParallelResource) {
resources.add((ParallelResource)entity);
}
}
initResourceWindows();
... |
f52daf91-acbb-4d26-b300-5d158e3347b8 | 9 | private int consumeEscape() {
if (isEof()) {
return REPLACEMENT_CHAR;
}
if (isHexDigit(peek())) {
int uc = 0;
int len = 6;
while (len > 0 && isHexDigit(peek())) {
uc = (uc << 4) + hexValue(next());
--len;
... |
049b7f56-3e7e-450d-a8ce-9c2afed44429 | 9 | public boolean LoadProxyList(String fileName) {
System.out.println(System.getProperty("user.dir"));
try {
String line;
BufferedReader reader = new BufferedReader(new FileReader(fileName));
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.startsWith("#"))
continue;
... |
aae48ed0-82b7-4c10-b860-d4edcfa8c1ca | 7 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Type)) {
return false;
}
Type t = (Type) o;
if (sort != t.sort) {
return false;
}
if (sort >= ARRAY) {
... |
255beb73-d043-4248-8a9d-e42e82d63be9 | 6 | @EventHandler
public void SnowmanHeal(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Snowman.Heal.... |
2666d7e4-54fc-40af-bb3c-a1a6629733c6 | 9 | public static void buildDictionary(final File inputFile, final File resourcesFolder) throws IOException, ParserConfigurationException, SAXException {
if (!inputFile.isFile() || !inputFile.exists()) {
throw new IllegalArgumentException("Could not find input file " + inputFile);
}
fina... |
3b7d9e0a-f124-4e35-95c2-cb8abb2da69a | 0 | private LLParseTableGenerator() {
} |
9bb6a4fd-f879-4ea5-ab30-b5e1648ff56a | 2 | public static String GetJsonToString(Statement statement,String UID)
{
List<CarNumber> carNumberList = new ArrayList();
String resultString = null;
String sql;
String result = null;
sql = "select * from carnumber where UID = '" + UID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (r... |
23bd9a7a-0d5f-412a-a464-ba780d676d87 | 1 | @Override
public boolean isConstructing() {
return process > 0 && !isComplete;
} |
e0e2124f-004e-4f95-93cd-8df9b4e7b67f | 3 | public StageFlipper runTicTac() {
if(saveMsg != null) {
@SuppressWarnings("unused")
StageFlipper startup = saveMsg;
//Use the message when starting gameroom
saveMsg = null;
}
while(loop) {
try {
String mess = receiveMessage();
int id = retrieveId(mess);
decodeAndRender(id, mess);
}... |
62a5d7dc-a171-4274-9c10-379f82cc051f | 2 | @Override
public void calculate(double[][] heightmap, boolean[][] watermap) {
calc = new double[heightmap.length][heightmap.length];
for (int x = 0; x < heightmap.length; x++)
for (int y = 0; y < heightmap[x].length; y++)
temp(heightmap, watermap, x, y);
} |
7e7700f7-5430-4989-a38b-f7fc350c0e29 | 0 | public static Tags fromString(String string) {
return TO_ENUM.get(string.toUpperCase());
} |
a38834e4-d3fa-4125-9632-5f5289575d73 | 3 | public void checkDeclaration(Set declareSet) {
if (instr instanceof StoreInstruction
&& (((StoreInstruction) instr).getLValue() instanceof LocalStoreOperator)) {
StoreInstruction storeOp = (StoreInstruction) instr;
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo();
if (dec... |
560b8b5c-9417-4101-82cc-8d45416046cb | 1 | public DatagramPacket getResponse() {
while (true) {
}
} |
1158d9e7-6a93-472f-ba3f-ad52cc128980 | 5 | public static String[] getParamsName(final Method method, final String seperator) throws Throwable {
String paramsName = "";
Annotation[] annotations = method.getAnnotations();
if (annotations == null || annotations.length == 0) return null;
Annotation annotation = annotations[0];
String annotationSimpleNam... |
48e32ed3-7944-4e31-ace5-d17d9548cfb0 | 9 | public static void analyzeSorts(){
TreeMap<Long, Class<?>> map = new TreeMap<Long, Class<?>>();
List<Class<?>> sorts = getSorts();
for(Class<?> clazz : sorts){
sampleTest(clazz, false);
System.out.println("--------");
}
for(Class<?> clazz : sorts){
long time = sampleTest(clazz, false);
System.out.... |
198de6a6-e8de-44c2-9fec-d25630695c0a | 3 | private void calcStatistics()
{
double max = Double.MIN_VALUE;
double min = Double.MAX_VALUE;
double ave = 0.0;
for(int i = 0; i < this.generation.length; i++)
{
max = (max < this.generation[i].getFitness()) ? this.generation[i].getFitness() : max;
min = (min > this.generation[i].getFitness()) ? this... |
a5458fbd-9687-4d98-9438-3c11c37325ad | 5 | public void interact() {
Block[][] blocks = Run.window.screen.getMap().blocks;
boolean noOneActive = true;
for (int i = 0; i < blocks.length; i++) {
for(int j = 0; j < blocks[i].length; j++){
if (blocks[i][j].isActive()) {
noOneActive = false;
if (isInteracting) {
blocks[i][j].reverseActi... |
00dd615e-2d73-456b-9f5a-e1dbf0953b8a | 6 | public int winsAgainst(Distribution other) {
// TODO: this could be a bit faster with binary search instead of
// scanning. Would require random-access lists instead of iterators,
// which is currently not supported since we use multisets.
int wins = 0;
int eirIndex = 0;
... |
9b4b2cfe-246b-492b-b73b-38cb7da36141 | 2 | public void testPropertyCompareToMilli() {
LocalDateTime test1 = new LocalDateTime(TEST_TIME1);
LocalDateTime test2 = new LocalDateTime(TEST_TIME2);
assertEquals(true, test1.millisOfSecond().compareTo(test2) < 0);
assertEquals(true, test2.millisOfSecond().compareTo(test1) > 0);
a... |
f2a2014f-dc78-4996-9b4d-bc72f6e82b5c | 7 | private static void initPropertyMap(ServletContext sc) {
String fileName = System.getenv("APP_PROPS");
if (fileName == null) {
fileName = System.getProperty("app.props");
if (fileName == null) {
fileName = "application.properties";
}
}
PropertyMap map = new PropertyMap();... |
529964b3-0254-4d77-8537-27ce4151e1f0 | 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... |
c0cbaca1-d7b1-41ea-8ce9-0be582e9231c | 2 | @Test
public void testQueuePopMultipleJobs() throws LuaScriptException {
String jid1 = addJob();
String jid2 = addJob();
List<BaseJob> jobs = _queue.pop(2);
assertEquals(2, jobs.size());
for (BaseJob baseJob : jobs) {
assertTrue(baseJob.getAttributes().getJID().equals(jid1)
|| baseJob.getAttribute... |
ceb96a59-66cc-4c32-836f-2096006fd84f | 7 | public String StrExpression() {
String string = "";
while(!(current.getId().equals("STMTTERMINATOR")) && !(current.getId().equals("RPAREN"))) {
if(current.getId().equals("EOF")) {
Error("Unexpected end of file.");
break;
}
else if(current.getId().equals("INVALID")) {
Error("Invalid token \'" + ... |
a0dffa93-055e-4337-bbf4-2790168868ee | 9 | public int findNextNode(Node node, Node targetNode)
{
//targetNode not found
if(node==null)
return 0;
if(node.equals(targetNode))
{
//its the root
if(node.parent==null)
{
if(node.left==null)
return node.id-=1;
if(node.right==null)
return node.id+=1;
}
else
{
if(nod... |
14ecef57-e730-49a8-ab07-7bc7f71f487f | 9 | public static ObjectDefinitions getObjectDefinitions(int id) {
ObjectDefinitions def = objectDefinitions.get(id);
if (def == null) {
def = new ObjectDefinitions();
def.id = id;
byte[] data = Cache.STORE.getIndexes()[16].getFile(
getArchiveId(id), id & 0xff);
if (data == null)
System.out.println... |
12509f86-0811-482a-9b04-62750414097f | 2 | public void drawRectangle(int xStartCoord, int yStartCoord, int xEndCoord, int yEndCoord, boolean drawRectangle)
{
this.drawRectangle = drawRectangle;
if (xStartCoord < xEndCoord)
{
this.xStartCoord = xStartCoord;
this.xEndCoord = xEndCoord;
} else
{
this.xStartCoord = xEndCoord;
this.xEndCoord =... |
31166075-96ba-44fd-bc37-ff1932c77706 | 6 | private static void packNormAt(int x, int y, byte heightMap[][], int i) {
//
// We have to allow for 'edge cases' against the sides of the map, which
// complicates matters slightly.
final float slopeX ;
if (x > 0 && x < heightMap.length - 1) slopeX = (
(heightMap[x][y] - heightMap[x - 1][y]... |
2e665f6a-5ea1-4971-8641-f3e65e49a81a | 2 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Matcher matcher;
//clean the inputs using regular expressions
// Compile regular expression
Pattern pattern = Pattern.compile("[;:,#... |
6f56dd51-f572-42ba-b647-b48100c90f43 | 9 | @Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (!active) {
return false;
}
if(e.getExtendedKeyCode() == KeyEvent.VK_TAB) {
if(e.getID() == KeyEvent.KEY_RELEASED) {
gui.hideAndShowToolbars(e.isShiftDown());
}
return true;
}
if(e.getExtendedKeyCode() == KeyEvent.VK_A && e.i... |
69b06431-39e9-473f-826e-916164ffc564 | 6 | @Override
public void init()
{
super.init();
byte[] data = getData();
rgbFore = new java.awt.Color( ((data[0] < 0) ? (255 + data[0]) : data[0]),
((data[1] < 0) ? (255 + data[1]) : data[1]),
((data[2] < 0) ? (255 + data[2]) : data[2]) );
rgbBack =... |
7b6a360b-d2a6-4cdf-96f5-3f36dd54401c | 4 | private Node getNodeFromSource(Object source) {
if (source instanceof OutlinerCellRendererImpl) {
return ((OutlinerCellRendererImpl) source).node;
} else if (source instanceof OutlineButton) {
return ((OutlineButton) source).renderer.node;
} else if (source instanceof OutlineLineNumber) {
return ((Outlin... |
abf6a6ee-2b4d-43ab-9dae-b084af110235 | 3 | public void delete(){
checkEnabledMenuAction();
if(!deleteItem.isEnabled()){ return; }
TreeItem item = getCurrentItem();
TreeItem parentItem = (TreeItem) item.getParent();
int index = parentItem.getIndex(item);
parentItem.removeChild(item);
/... |
8392a4d1-6c67-47f1-afaa-1259177c3721 | 8 | public static int[] sortIntegers(int[] integers, String sens) {
int temp;
if(sens == "asc" || sens == "desc") {
for(int i1 = 0; i1 < integers.length; i1++) {
for(int i2 = 0; i2 < integers.length; i2++) {
switch(sens) {
... |
936e2f69-6f86-44dd-bcc0-8919e7000f5a | 3 | @Test
public void test_combination() throws Exception {
HLLCounter h1 = new HLLCounter();
h1.put("a");
h1.put("b");
h1.put("c");
assertTrue(h1.size() == 3L);
HLLCounter h2 = new HLLCounter();
h2.put("d");
h2.put("e");
h2.put("f");
assertTrue(h2.size() == 3L);
HLLCounter h... |
caae7732-dcf0-48d1-8a7f-b61351e620a5 | 2 | @Override
public void start(Stage primaryStage) {
Group root = new Group();
Scene scene = new Scene(root, 800, 600, Color.BLACK);
primaryStage.setScene(scene);
// Creates a group named circles
Group circles = new Group();
for (int i = 0; i < 30; i++) {
... |
01650ef8-6e88-4cfc-a4b1-98e6ef3da58f | 1 | public void setClient(Client client)
{
// Don't allow someone to replace a client.
if(this.client != null)
return;
this.client = client;
} |
d8068026-4935-438f-b022-6df1f41dea0f | 4 | @SuppressWarnings("unused")
@Init
public void init() {
try {
this.comm = new NetworkCommunication(SYSTEM_TYPE, IP_ADDRESS, PORT, 0, PRIVATE_KEY, PROTOCOL_TYPE);
if (PROTOCOL_TYPE == ProtocolTypeEnum.HAI_OMNI_LINK_II) {
// Register a listener to receive notifications from the controller
((NetworkCom... |
c31a5fe2-4a0a-424e-96c9-d630747f226c | 3 | public static boolean is_legal_label(String label) {
if(label == null)
throw new IllegalArgumentException("Label can't be null");
int len = label.length();
for(int i=0; i<len; i++) {
if(label_bad_chars.indexOf(label.charAt(i)) != -1)
return false;
... |
e66f3dad-4211-4d3b-8fde-2e7b8ae3c9b6 | 6 | @Override
public final void keyPressed(KeyEvent event)
{
int code = event.getKeyCode();
if (code > 0 && code < keys.length)
keys[code] = true;
/*
* This allows developer to quickly check the keycode for any
* key to use, simply hold the ALT key and press another
*/
if (hub.DEBU... |
9b09a6bd-87a1-45fd-82c7-910a91f19c78 | 4 | String[] sort(String a, String b, String c){
String []ledger = new String[3];
String swap, greatest ="";
if(a.compareTo(b) < 0){
greatest = b;
ledger[0] = a;
}
else {
greatest = a;
ledger[0] = b;
}
if(greatest.compa... |
ccf90836-ddd9-4f40-9f2c-c5f76780f1b6 | 8 | public void enqueue(T item)
{
boolean put = false;
while (!put)
{
try
{
queue.put(item);
put = true;
}
catch (InterruptedException exception)
{
}
}
synchronized (queue)
{
if (task == null || task.isDone())
{
task = pool.... |
04771664-fea8-48cf-8a37-5a9d92cbd1ae | 3 | public static StreamIterator create(URL url, Filter filter) throws IOException
{
String urlString = url.toString();
if (urlString.endsWith("!/"))
{
urlString = urlString.substring(4);
urlString = urlString.substring(0, urlString.length() - 2);
url = new URL(urlString);
... |
ad91a5f8-5b81-4d2e-b388-8f925a17ab02 | 7 | public void startMenu(){
EMenuChoices userChoice = EMenuChoices.NONE;
do{
System.out.println("Number of cards : " + this.deck.numberOfCards());
System.out.println("What do you want to do ?");
System.out.println("1 - Watch my cards");
System.out.println("2 - Search a card");
System.out.println("... |
2024b7fc-019e-45ab-8404-3e3750ce3c72 | 0 | public void setAgility(double agility) {
this.agility = agility;
} |
19d9eca7-9e54-449b-80ff-caee2cc646de | 6 | public boolean pickAndExecuteAnAction() {
if(mTimeToCheckRent && mRenterList.size() > 0){
mTimeToCheckRent = false;
CollectRent();
return true;
}
synchronized (mRenterList) {
for (MyRenter r : mRenterList) {
if (r.mState == EnumRenterState.ApplyingForHousing) {
ReviewApplicant(r);
... |
dd03cce9-af1f-42ce-bb91-ea161a5acefa | 7 | public static boolean methodNeedsLispMacroP(MethodSlot method) {
if (Stella.translateToCommonLispP() &&
method.methodParameterNames().nonEmptyP()) {
{ BooleanWrapper lispmacroP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_METHOD_LISP_MACROp, null)));
... |
d4d36247-b3b1-457b-9a6e-92b05f7234b5 | 8 | private JPanel buildTop() {
JPanel panel = new JPanel();
panel.setLayout(gl);
JLabel musicLabel = new JLabel("Music Folder:");
gc.gridx = 0;
gc.gridy = 0;
gl.setConstraints(musicLabel, gc);
panel.add(musicLabel);
musicFolder = new JTextField("",60);
gc.gridx = 1;
gc.gridy = 0;
gl.se... |
fa95ecc7-960b-4756-bc60-c37fb3f848db | 2 | public void displayGUI() {
blackIcon = new ImageIcon(getClass().getResource("black_circle.png"));
blueIcon = new ImageIcon(getClass().getResource("blue_circle.png"));
windowContent = new JPanel();
buttons = new JButton[64];
// Set the layout manager for this panel
Bor... |
89b3bff2-a29f-489a-b02f-623f2940f10f | 1 | String join(String[] strings, String separator){
StringBuilder sb = new StringBuilder();
for(String string : strings){
sb.append(string).append(separator);
}
return sb.delete(sb.length() - separator.length(), sb.length()).toString();
} |
97fd02a7-beb9-41b7-b1f9-8492b3741728 | 5 | protected void processKeyChange(KeyEvent e, boolean pressed){
byte KeyEventType;
if(pressed){
KeyEventType = CKeyEvent.KEYEVENT_PRESSED;
}else{
KeyEventType = CKeyEvent.KEYEVENT_RELEASED;
}
//making sure we are not posting multiple PRESSED events
if(KeyEventType == CKeyEvent.KEYEVENT_RELEASED ||... |
03472583-8b3e-4460-9731-cabb1395c3dc | 7 | public String look() {
String ret;
ret = "You are in the "+getName();
if (getDescription() != null && getDescription().length() > 0) {
ret += " " + getDescription();
}
ret += "\nYou see ";
if (this.countAll() > 0) {
boolean first = true;
for (Item i : this.getAll()) {
if (i.getName() != null) ... |
b0eb00f7-2175-4473-a1b8-8e7376447395 | 9 | public void buyUnit(String unitName, Planet orderPlanet, Factory factory) {
// TODO remake
if (!getBase().isAvailableUnit(unitName)) {
throw new IllegalArgumentException("This unit is not available.");
}
Price price = UnitCreator.getPrice(unitName);
int mineralWorkersNeeded = price.getMinerals();
int ga... |
03a5e386-b522-435f-9f43-17e3dd9ce63c | 2 | public double[] standardizedItemMinima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedItemMinima;
} |
93eceb71-47bd-4c01-ac09-b8747fc789ad | 9 | @Override
public void registerWorldObjectDestroyed(Area area, Room room, CMObject o)
{
if(o instanceof Deity)
delDeity((Deity)o);
if(o instanceof BoardableShip)
delShip((BoardableShip)o);
if(o instanceof PostOffice)
delPostOffice((PostOffice)o);
if(o instanceof Banker)
delBank((Banker)o);
if... |
b5ffe0f0-cb36-4153-b5fd-5ae28ac9d765 | 4 | private boolean _jspx_meth_c_otherwise_0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_choose_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:otherwise
org.apache.taglibs.standard.tag.common.cor... |
67b14ee0-558f-402b-abb3-df98a2881faf | 6 | public Vec2 getMaximumPossibleMovement(MovingObject mo){
maximumMovement = mo.getCurrentDirection();
Vec2 tempMaximumMovement = new Vec2(maximumMovement);
Vec2 currentPosition = mo.getCurrentCenterPosition();
Vec2 predictedPosition = mo.getPredictedCenterPosition();
Vec2 min = cu... |
a1a31abf-85a8-4ed5-831c-10586114e89d | 7 | private void floodFillRecursion(int x, int y, Color oldColor, Color newColor, BufferedImage image) // stackoverflows - BAD
{
if (x >= 0 && x < image.getWidth() && y >= 0 && y < image.getHeight()) // point is in bounds
{
Color currentColor = new Color(image.getRGB(x, y));
if (!oldColor.equals(currentColor) ||... |
8d80fe80-005c-4bd2-955b-ae734a0089ec | 3 | public void newMap(boolean pastedData){
checkEnabledMenuAction();
if(!newMapItem.isEnabled()){ return; }
DatabaseTreeItem parentItem = (DatabaseTreeItem) getCurrentItem();
int id = generateId();
DataMap gameData = null;
DataEditorMap editorData ... |
495451a9-8d97-40cc-b331-9966ff2193a6 | 7 | public void reloadChoiceAttack()
{
int i,
i2;
Entity entStore;
blnMenuRefresh = true;
try
{
frame.chcAttack.removeAll();
}catch (Exception e){};
frame.chcAttack.addItem("Attack");
Iterator iter = vctEntities.iterator();
while (iter.hasNext())
{
entStore = (Entity)iter.next();
if ((entSt... |
1cbed693-ec76-4397-af91-9bd9eadd5516 | 9 | private static SocketChannel connectToNode0(boolean isCurrentJvmNode0, NodeInfo node0) throws RuntimeException {
if (isCurrentJvmNode0 == true) {
return LoopbackSocketChannel.getInstance();
} else {
try {
LOGGER.fine("Waiting 300-500ms before attempting to connect... |
00aba19f-8da2-4b71-93e0-194fb0f6df92 | 1 | public acebotsthree() {
try
{
UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
}
catch(Exception e){
}
initComponents();
} |
1bf0fbea-c586-42b2-9efd-ee5571fe9ad5 | 5 | private int getMx() {
int mx = 0;
if (pFrom.x >= pTo.x) {
if (pMid.x < eFrom.getX() - gap
&& pMid.x > eTo.getX() + eTo.getOWidth() + gap)
mx = pMid.x;
else
mx = Math.max(pFrom.x + eFrom.getOWidth() / 2 + gap, pTo.x
+ eTo.getOWidth() / 2 + gap);
} else {
if (pMid.x > eFrom.getX() + eFro... |
312c1bc3-36d9-459f-9fc8-338d454a7b93 | 8 | public Message getFile(int cache, int id) {
if (cache == 255 && id == 255) {
return crcPacket;
}
try {
JagFS fs = cache == 255 ? jagCRC : jagFS[cache];
MessageBuilder gen = new MessageBuilder();
gen.writeByte((byte) cache).writeShort((short) id);
byte[] file = null;
file = fs.get(id);
if (fil... |
b3c9e8a0-7fbe-48e2-90c0-af08155cd5c1 | 0 | public void remove() { throw new UnsupportedOperationException(); } |
362da623-8e4c-430b-935b-812d7071cb53 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean... |
c85fbb8d-4a15-4bf3-9313-9591c4b0460d | 5 | private boolean doPathExists(Object source, Object destination, Set marked) {
boolean pathFound = false;
marked.add(source);
Set edgeSet = (Set)graph.get(source);
if (edgeSet != null) {
Iterator edgeIter = edgeSet.iterator();
while (edgeIter.hasNext() && !pathFoun... |
8916e4db-9f98-4626-b282-1c4ca4040861 | 7 | private String readUserInput(PromptOptions options) {
PrintWriter writer = new PrintWriter(System.out);
writer.print(options.inputMessage);
if (options.defaultValue != null)
writer.println(" Default is " + options.defaultValue);
else
writer.println();
if ... |
a82e1fdc-acdb-4597-a705-4957cdd931fe | 9 | public SSAP_sparql_response get_SPARQL_indication_obsolete_results(String xml)
{
if(xml==null)
{
System.out.println("ERROR:SSAP_XMLTools:getQueryTriple:XML message is null");
return null;
}
Document doc=null;
try {
doc = builder.build(new ByteArrayInputStream(xml.getBytes()));
} catch (Exception ... |
04c4542d-a986-4ea8-91be-560e8c093767 | 9 | public void printParameter(String parentParameterFile,
String childParameterFile, ArrayList<_Doc> docList) {
System.out.println("printing parameter");
try {
System.out.println(parentParameterFile);
System.out.println(childParameterFile);
PrintWriter parentParaOut = new PrintWriter(new File(
parent... |
891bbcbe-1a7f-4b3e-8876-b03370833a08 | 9 | public void write(Kml kml) throws KmlException {
kml.println("<ExtendedData" + getIdAndTargetIdFormatted(kml) + (nameSpace != null ? " mlns:prefix=\"" + nameSpace + "\"" : "") + ">", 1);
if (dataElements != null) {
for (Data data : dataElements) {
data.write(kml);
}
}
if (schemaUrl != null || simpleDa... |
cc32c132-e5c4-43ab-b05b-fe9a80700c38 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=pro... |
e278b01a-f1c3-4e62-90d5-0f491f115500 | 1 | public void render() {
if (request != null)
request.setAttribute("view", action.getView());
} |
927c52dc-09e1-4ff1-b287-5aecaa3293a5 | 1 | public static Body getInstance() {
if (body == null) {
body = new Body();
}
return body;
} |
6d49fdb2-5590-46b8-9ae4-ac7048ab88fe | 2 | private void getTurn(){
view.beforeTurn();
lastX = getCellX();
lastY = getCellY();
view.onTurn();
int x = lastX-1;
int y = lastY-1;
if(model.getField().isCellSet(x, y)){
view.onError("Ячейка уже занята, попроубей еще раз");
getTurn();
... |
b3ec22b4-8f82-4e02-8125-0baab2bcdb2b | 7 | public String metalCheck(MOB mob, Item I, Item container, StringBuffer msg)
{
if(I==null)
return "";
if(I.container()==container)
{
if((I.material()==RawMaterial.RESOURCE_GOLD)
&&(CMLib.flags().canBeSeenBy(I,mob)))
msg.append(L("@x1 glows golden.\n\r",I.name(mob)));
}
else
if((I.container()!=n... |
b550b6dd-c19f-4738-836e-b66b7debffcf | 1 | public void show(){
for(T key: histogram.keySet())
System.out.println(key +": "+ histogram.get(key));
} |
fdb393b0-262d-4658-81f6-fe2b83b258b2 | 3 | public static void skipElementAndChildren(String tagName, XMLEventReader reader) throws XMLStreamException {
// Ignore all the elements that are inside this element
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isEndElement()) {
if (eve... |
d9b6c6b6-962a-4663-b85c-28db5ff474c6 | 7 | void MaxHeapify(int i){
int l = Left(i);
int r = Right(i);
int largest;
if (l > 0 && l <= this.HeapSize && this.Heap.get(l) > this.Heap.get(i) ) {
largest = l;
}
else {
largest = i;
}
if (r > 0 && r <= this.HeapSize && this.Heap.get... |
8e62d7c5-f1f3-4cb6-84e3-4528f7d9a54e | 0 | @Basic
@Column(name = "amount")
public double getAmount() {
return amount;
} |
4e650fce-0ce0-49ca-8ae8-5aaac848aeba | 2 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("serverOpen"))
response.setServerOpen(getBoolean());
else if (qName.equals("onlinePlayers"))
response.setOnlinePlayers(getInt());
super.endElement(uri, localName, qName);
} |
fbed98dc-4966-4e1f-b1de-d4c7e296d2fa | 8 | private void continueHandShake(HandshakeStatus status) {
switch (status) {
case FINISHED:
fireConnected();
break;
case NEED_TASK:
createRunnable();
//break;
case NEED_UNWRAP:
if(log.isLoggable(Level.FINE))
log.fine(id+"need unwrap so wait");
break;
case NEED_WRAP:
if(log.isLogg... |
f7871aba-97fc-4b9d-b3e8-0246595086ea | 1 | public int getFirstChar() {
if (sb.length() == 0)
return MiniXMLTokenParser.tError;
return (int) sb.charAt(0);
} |
7173208a-4f31-4095-878d-37b0737c1ca4 | 4 | public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double ... |
0c41aaa4-dc16-4644-9739-3df0f3733f20 | 3 | public void operatorControl() {
chassis.setSafetyEnabled(true);
while(isOperatorControl() && isEnabled() && null != chassis){
chassis.arcadeDrive(joystick.getY(), joystick.getZ());
Timer.delay(0.01);
}
} |
c9ca5a7a-b77f-4271-b0f9-3c22380c4d76 | 1 | @Override
public double getVariance() throws VarianceException {
if (nu > 4) {
return 2 / (Math.pow(nu - 2, 2) * (nu - 4));
} else {
throw new VarianceException("InverseChiSquared variance nu > 4.");
}
} |
af6c37d2-15e5-43e2-8133-b8f1de43a2ee | 2 | protected void bindLocalPeerContext() throws UnknownHostException {
Host localhost = new PGridHost(address_, port_);
RoutingTable rt = new RoutingTable();
rt.setLocalhost(localhost);
CorbaFactory corbaFactory = new CorbaFactory();
ORB orb = corbaFactory.getInstance(address_, por... |
c7657b64-c948-4f29-a316-c58050350c44 | 7 | public void loadConfig(String path){
propList.clear();
InputStream in = null;
try {
final File file = new File(path);
if (!file.exists()) {
throw new GameServerStartupException("File " + path + " is not exists");
}
in = new FileInpu... |
693b8c32-528c-4b31-a68a-618bb4b743f8 | 3 | public void visitCallMethodExpr(final CallMethodExpr expr) {
// Method invocations are to be thought of, in terms of
// binary expression trees, as
// (CallMethodExpr)
// / \
// receiver .
// / \
// arg1 .
// / \
// arg2 .
// / \
// arg3 ...
// This might be the opposite of what one would think ... |
b14a9124-8f1c-4484-bb5f-5bf9a5b95e31 | 1 | public int getIndex(char ch){
int i=0;
if(Character.isLowerCase(ch)) i=ch-'a'+26;
else i=ch-'A';
return i;
} |
efa42d4f-9282-4d30-95cd-a313a4a5b3ef | 6 | private boolean inputValid(final int width, final int height, String code) {
if (width < minWidth || height < minHeight
|| width > maxWidth || height > maxHeight
|| code.length() < minWidth * minHeight || code.length() > maxWidth * maxHeight) {
return false;
}... |
261ed4c5-f7e3-498c-920b-a6df3080d3a6 | 1 | public void setAddress(long a) {
if (addressSize == 4)
$.putInt(this, offset, (int) a);
else
$.putLong(this, offset, a);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.