method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6ccc6633-585d-4791-9ecf-b69fab911687 | 5 | public IRegion getDamageRegion(
ITypedRegion partition,
DocumentEvent event,
boolean documentPartitioningChanged) {
if (!documentPartitioningChanged) {
try {
IRegion info =
fDocument.getLineInformationOfOffset(event.getOffs... |
db9ef0be-a349-47e5-9b43-6900b94f7f50 | 9 | protected @Override Token getNewToken() throws ScannerException {
charScanner.resetContext();
final StringBuilder repr = new StringBuilder();
try {
appendToContext(' ');
Char c;
Char.Class cc;
// consume whitespace
try {
do {
c = charScanner.getToken();
cc = c.getCharClass();
} wh... |
85888312-6cc5-4e23-bc91-c7de000bf739 | 5 | private void initializeCircleCollisionPoints(int radius, int edgeprecision,
int layers)
{
// Calculates the number of collisionpoints
int size = edgeprecision;
// From layer 2 onwards, center is added
if (layers >= 2)
size ++;
// Larger amount of layers means more collisionpoints
for (int i = 3; i <... |
3a71ffce-2e64-4561-9c1e-47e7d44fd986 | 5 | private void attemptUse(Command command) {
if (!command.hasSecondWord()) {
System.out.println("Use what?\n");
return;
}
String name = command.getSecondWord();
// look for item in player's inventory and use it if found (only takeable items)
Item item = pla... |
02535a09-4e06-4f32-84af-4b2381cd7acc | 4 | @Override
public boolean createTable(String query) {
try {
if(query == null)
{
this.writeError("SQL Create Table query null", true);
return false;
}
if (query.equals("") || query == null) {
this.writeError("SQL Create Table query empty.", true);
return false;
}
Connection connection... |
e8267cea-215b-42cb-ae99-5184ca5e2aad | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
d0f48d12-41cd-4f79-8c34-33d9b3a6180a | 5 | @Override
public void run() {
try {
while (true) {
String message = this.inQueue.take();
if (message.equals(User.KILL_MSG)) {
break;
} else if (message.equals(User.DO_NOTHING)) {
continue;
}
... |
236aa0be-be1a-4557-94f7-640f74c76e24 | 8 | @SuppressWarnings("rawtypes")
public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
( this.sec... |
1861522a-457b-4255-8f4e-1649ab49b172 | 8 | static int[][][] floydWarshall(int[][] mAdy){
int N; int[][][] res = new int[N=mAdy.length][N][2];
for(int i=0;i<N;i++)for(int j=0;j<N;j++)res[i][j]=new int[]{mAdy[i][j], j};
for(int k=0;k<N;k++)
for(int i=0;i<N;i++)for(int j=0;j<N;j++)
if(res[i][k][0]<MAX_VALUE&&res[k][j][0]<MAX_VALUE)
if(res[i][j][0... |
33d75d6a-b7f4-4043-b257-673a578b782c | 7 | private Board randomMove(Board board, boolean myTurn, boolean needChained) {
Checker curChecker;
Board pieces;
//Copy the board and get the first piece.
if (!needChained) {
pieces = board.copy();
curChecker = pieces.pop();
//If the move requires a chain we do not copy the board and continue o... |
662c48fb-435e-422b-b29e-3f6fd7d8cf28 | 9 | public Material toolPicker() {
int next = gen.nextInt(10);
switch (next) {
case 1:
return getHelmet();
case 2:
return getChestPlate();
case 3:
return getLeggings();
case 4:
return getBoots();
case 5:
return getHoe();
case 6:
return getPickaxe();
case 7:
return getAxe();
case 8:
... |
25cbf6e0-1075-49af-812c-29989e439b6a | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... |
5fcc7272-f713-4d99-9c54-e1073afb8866 | 5 | public void handleInput(InputManager input)
{
// Check if the left mouse button is down.
if (input.isMouseButtonDown(1))
{
// Transform the mouse coordinates into world space.
// Check if the Body has been clicked on.
if ((input.mouseEventPosition().x <= (_Body.getLayeredPosition().x + (_Body.getShape(... |
e1c5506a-dd1f-417c-8893-84e868c274a5 | 7 | public static String rearrangeString(String input, int distance) {
Map<Character, Integer> frequencyCounter = new HashMap<>();
PriorityQueue<Pair> heap = new PriorityQueue<Pair>(input.length(), new Comparator<Pair>(){
@Override
public int compare(Pair o1, Pair o2) {
... |
554e61c5-3d80-44f3-81a4-588d3116d8df | 9 | @Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MethodCall that = (MethodCall)o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (params != null ?... |
8c4de3e8-1da4-4039-8e68-ee6638daba65 | 0 | @Before
public void setUp() throws Exception {
Character pc = 'A';
product = new Product(pc);
product.writePriceForQuantity(1, BigDecimal.valueOf(10.00));
product.writePriceForQuantity(5, BigDecimal.valueOf(25.00));
product.writePriceForQuantity(7, BigDecimal.valueOf(50.00));
} |
b5643f17-8b6f-472d-9adb-8f0959b4d854 | 6 | @SuppressWarnings("resource")
public void readLine(char type){
try {
if(lines.size() == 0){
File quotes = new File("quotes.txt");
Reader reader;
reader = new FileReader(quotes);
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != nu... |
45ec0361-cf27-4f06-827c-126fc0315bab | 4 | @Override
public void setBoolean(long i, boolean value)
{
if (ptr != 0) {
Utilities.UNSAFE.putByte(ptr + i, value == true ? (byte) 1 : (byte) 0);
} else {
if (isConstant()) {
throw new IllegalAccessError("Constant arrays cannot be modified.");
... |
1f6f8a19-417b-4d19-b857-62dad194e2d0 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int n = to.length();
char[] circle = new char[n];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we... |
af9764fd-6500-49ae-bae6-f5e4d42b1abb | 2 | @Override
public void leave(String n) {
try {
m_server.pushMessage(new Leave(n));
} catch (RemoteException e ) {
e.printStackTrace();
} catch (InterruptedException e){
e.printStackTrace();
}
} |
92f6c175-23a5-4233-94ff-61d0a0375f02 | 0 | public void setFecha(Date fecha) {
this.fecha = fecha;
} |
32f64950-cbb0-487c-9d31-707d2429bf9d | 6 | public static int isHerbloreSkill(Item first, Item other) {
Item swap = first;
Ingredients ingredient = Ingredients.forId(first.getId());
if (ingredient == null) {
ingredient = Ingredients.forId(other.getId());
first = other;
other = swap;
}
if (ingredient != null) {
int slot = ingredient.getSlot(... |
546f78e4-f62e-4163-b023-4d59dec0228b | 0 | public void setName(String name) {
this.name = name;
} |
ed1f1a29-ae9d-4967-bd13-820a678d39b2 | 9 | void handlePacket(byte[] hidReport, int packetLen) throws
IOException,
AWTException {
// decode keys, only process up to NUM_KEYS
int modifier = hidReport[2];
int nrKeys = packetLen - 4;
if (nrKeys > NUM_KEYS){
nrKeys = NUM_KEYS;
}
... |
5f11742d-9aa0-4d44-a032-01901c1ba1a5 | 2 | @Override
public void fail(LeakCheckEntry entry) {
StringBuilder message = new StringBuilder();
message.append("A memory leak has been detected!").append("\r\n");
message.append("\t").append("offending object: ").append(entry.description).append("\r\n");
if (entry.o != null && entry.o.get() != null) {
messa... |
7d06b847-30a5-46ce-8f00-6feaa4e9933a | 4 | * 初始数据内容
* @return
*/
public boolean registerProvider(ServiceMetadata metadata) {
try {
if (!exits("/"+metadata.getInterfaceName()))
zookeeper.create("/"+metadata.getInterfaceName(),
"provider".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
String path = zookeeper.creat... |
29977f40-15a7-4057-9429-5b10e50dc9b3 | 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://download.oracle.com/j... |
5ea1ab81-ab68-49c2-b62b-472884c5b1ad | 1 | @Override
public int top() {
if (amount > 0) {
return head.getValue();
} else {
return error;
}
} |
c288b8e8-04f7-46c8-b7ab-ce9466946870 | 8 | public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
if (var4 == null)
{
return par1ItemStack;
}
else
... |
6edea312-43f6-451f-90b1-46ec73c3559a | 0 | public void setOtherSource(SaltAlgorithmIdentifierType value) {
this.otherSource = value;
} |
84b31d7c-ef5b-40fb-9c51-27e842200bea | 4 | protected void printFileContents(PrintWriter writer) {
int nrOfConcentrations = times.size();
int nrOfClusters = clusters.size();
for (int i = 0; i < nrOfConcentrations; i++) {
writeToFile(times.get(i), false);
for (int j = 0; j < nrOfClusters; j++) {
List<Integer> timeSerieIndexes = clusters.get... |
d8a5ab3c-759a-48d3-b3dd-3906788549d3 | 9 | public void testIntegerMap(Map<Integer,Object> map){
Integer[] keys=new Integer[itemCount];
Object[] values=new Object[itemCount];
for(int i=0;i<itemCount;i++){
keys[i]=i;
values[i]=Double.valueOf(random.nextDouble());
}
map.clear();
assertTrue(map.isEmpty());
for(int i=0;i<itemCount;i++){
... |
2e4b9e45-d656-4acd-98df-0af584d8f4aa | 3 | private int leftGenerateX(Object obj)
{
if (obj.getClass().equals(DynamicImagePanel.class))
{
int finalX = ((DynamicImagePanel)obj).getX() + ((DynamicImagePanel)obj).getWidth();
finalX = finalX + ((DynamicImagePanel)obj).getParent().getX();
return finalX;
}
else if (obj.getClas... |
b02b311e-dfd6-4dc1-8583-fc548edcbc2c | 0 | public void setMargaritas(int margaritas) {
this.margaritas = margaritas;
} |
d70bafdd-af12-4d7d-a7e4-dd194212393e | 6 | private void stopEditing(boolean cancel) {
if (editingTable == null)
return; // Nothing to do.
try {
editingTable.getCellEditor().stopCellEditing();
} catch (NullPointerException e) {
} catch (IllegalArgumentException e) {
System.err.println("Odd 'focusCycleRoot' exception thrown "
+ "from the de... |
b4747414-13fd-456e-bb76-21fc7c9847af | 6 | protected void processAction() {
log.info("Process Clicked");
saveFields();
StringBuffer errors = new StringBuffer();
if (reportFolder.getText().isEmpty()) {
errors.append("You must specify a report folder\r\n");
}
if (errors.length() > 0) {
log.info("Errors: " + errors.toString());
Run.s... |
0dff5213-b77c-44bd-92e7-a15a135bc586 | 5 | @Test
public void getIncome() {
AmateurAthlete test = null;
AmateurAthlete test1 = null;
try {
test = new AmateurAthlete("Franz", 3);
test1 = new AmateurAthlete("Karl", 5);
} catch (Exception e) {
// expected
}
try {
AmateurAthlete test3 = new AmateurAthlete("Sepp", 12);
} catch (ValueExcepti... |
b580575d-0584-4e3c-adb7-1e5b59ba2d65 | 1 | public HWindow(Widget parent, String title, boolean closable) {
super(new Coord(234, 29), new Coord(430, 100), parent);
canhastrash = false;
this.title = title;
shp = (IHWindowParent)parent;
shp.addwnd(this);
if(closable)
cbtn = new IButton(new Coord(sz.x - cbtni[0].getWidth(), 0), this, cbtni[0], cbtni[1], ... |
df15aa40-0e20-42bb-8501-1f21ce1d0dc0 | 9 | public void writeReducedOtuSpreadsheetsWithTaxaAsColumns(
File newFilePath, int numTaxaToInclude) throws Exception
{
HashSet<String> toInclude = new LinkedHashSet<String>();
HashMap<String, Double> taxaSorted =
getTaxaListSortedByNumberOfCounts();
numTaxaToInclude = Math.min(numTaxaToInclude, taxaSort... |
fae4518c-d2c6-4ae0-b205-24b50e2832c6 | 2 | private static int showMainPrompt(){
String displayStr = "1) Add a new T/F question\n"
+"2) Add a new multiple choice question\n"
+"3) Add a new short answer question\n"
+"4) Add a new essay question\n"
+"5) Add a new ranking question\n"
+"6) Add a new matching question\n"
+"7) Finish";
int choice... |
47e07e40-a737-4eea-a8b8-23d85b0a18fe | 4 | public void startElement(String uri, String localName, String qName,
Attributes attrs) throws SAXException {
// determine mode and call appropriate method
if (mode == "getschema")
// find the schema location
startGetSchemaElement(qName, attrs);
if (mode == "schemadefs")
// get schema defaults
start... |
47643abc-e33b-4379-a016-cc1ccc095c99 | 6 | public static void main(String[] args) {
String Style = "Nimbus";
//String Style = "Metal";
//String Style = "Windows";
//<editor-fold defaultstate="collapsed" desc=" Carga estilo de Interfaz ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIMan... |
a8763c6d-2ba1-4d67-91c0-dcd850aca244 | 4 | private String timeToString(int hour, int minute, int second, int millisecond)
{
String result = "";
if (classicTime)
{
result += twoDigitString(hour);
result += timeDelimiter;
result += twoDigitString(minute);
result += timeDelimiter;... |
75baa944-c35c-4a86-9b1f-3460e208d10e | 9 | public void enforceTrackerLimit() {
if ((this.inactiveLeafNodeCount > 0)
|| ((this.activeLeafNodeCount * this.activeLeafByteSizeEstimate + this.inactiveLeafNodeCount
* this.inactiveLeafByteSizeEstimate)
* this.byteSizeEstimateOverheadFraction > this.maxByteSizeOpt... |
9ee22928-e5af-4588-93a0-8140d0c630e6 | 0 | public Characters(String name, int hp, int mana, int attack, int manaRegen, SkillSet skillSet)
{
this.name = name;
this.hp = hp;
this.mana = mana;
this.attack = attack;
this.manaRegen = manaRegen;
this.skillSet = skillSet;
this.alive = true;
} |
45ba68e3-d41f-4c20-95bc-07dd2f6746c2 | 6 | public static float doFrictionY(float xv, float yv, float FRICTION) {
float angle = (float) Math.atan(yv / xv);
if (xv == 0) {
if (yv == 0) {
angle = 0;
}
angle = (float) Math.PI / 2;
}
// apply friction
float fy = Math.abs(FRI... |
bb939286-c072-42bf-9545-189135351fbb | 5 | @Override
public void parseArgs(String[] args) {
if (args.length > 1) usage(null);
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (isOpt(arg)) {
usage("Unknow option '" + arg + "'");
} else {
// Command line
if (arg.equals("galaxy")) {
galaxy = true;
html = false;... |
bada9075-bbd1-4702-bd55-29b052281ade | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S-... |
c1b07838-b35e-4c9a-beec-d6117aa9d16a | 9 | @SuppressWarnings("ConstantConditions")
@Test
public void testOTUConsensusConversion() {
File otuDir = new File("/home/alext/Documents/tuit/OTU Seq90/Seqs");
File tmpDir = new File("/home/alext/Downloads/tmp");
File executable = new File("/usr/local/bin/clustalw2");
File[] otuFil... |
0952e8cd-f7ae-44cb-b4fb-8c8360b3119e | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
83f64f14-0a7b-46ef-be5d-6ba9852f4f70 | 4 | public void start() throws Exception {
File base = new File("./data/cache/");
for (int i = 0; i < THREADS_PER_REQUEST_TYPE; i++) {
workers.add(new JagGrabRequestWorker(new IndexedFileSystem(base, true)));
workers.add(new OnDemandRequestWorker(new IndexedFileSystem(base, true)));
}
for (RequestWorker<?,... |
a3e13056-00a2-4825-a224-395fce94d498 | 7 | public static Rule_VCHAR parse(ParserContext context)
{
context.push("VCHAR");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
int ... |
e8fa8af6-7ae3-4d12-b4e7-974b3daa7b86 | 5 | @Override
public int getNumUnclaimedHeads(String issuer) throws DataStorageException {
int count = 0;
Set<String> keys = this.config.getConfigurationSection("bounties").getKeys(false);
for (String key : keys) {
try {
Integer.valueOf(key);
Configur... |
4324d5f5-9a12-45fd-aca6-46423810ff9d | 2 | private boolean isFontSmallEnough(Font font, String text) {
FontMetrics metrics = new FontMetrics(font) {};
Rectangle2D textBounds = metrics.getStringBounds(text, null);
Dimension panelBounds = contentLabel.getSize();
return textBounds.getWidth() <= panelBounds.getWidth() * (1.0f - TEXT_MARGIN_RATIO)
&& text... |
70605d83-88c2-4cd9-9886-c0f461909799 | 7 | public Formula(StringBuffer formulaString) {
LinkedList<Integer> originalFormula = new LinkedList<Integer>();
variablesAffected = new Stack<LinkedList<Integer>>();
unitVariables = new TreeSet<Integer>();
// Temporary string that is used for reading each line of the file
String ... |
474f129e-3dcf-4e74-a504-49fe8f633ebb | 8 | private void searchDown(boolean doReplace, boolean showWarnings) {
if (findNext(doReplace, false, page) == StringFinder.STRING_FOUND)
return;
page.getHighlighter().removeAllHighlights();
Object[] entry = embeddedTextComponents.values().toArray();
int n = entry.length - 1;
for (int i = 0; i < n; i++) {
i... |
c9a077d1-126e-4817-bffc-5539e98c6878 | 2 | public Integer getInt(String key)
{
Object val = get(key);
if (val == null)
return null;
else if (val instanceof Integer)
return (Integer)val;
else
return ((Double)val).intValue();
} |
0d7f8a7b-ba8f-4cf5-a8a3-92c47b216579 | 7 | protected void beforeCallForProposals() {
List<YellowPageCapsule> pagesToCallFor = new ArrayList<>();
for (Task t : leftOvers) {
boolean taskToQueryFor = true;
for (YellowPageCapsule yCap : yellowPagedCapsules) {
if (t.getRequiredCapability() == yCap.getTask().getRequiredCapability()) {
taskToQuer... |
0dcf8fa4-9104-482f-95c4-10947119faa9 | 8 | private boolean readUntilMatch(byte[] match, boolean withinBlock) throws IOException {
int i = 0;
while (true) {
int b = fsin.read();
// end of file:
if (b == -1) return false;
// save to buffer:
if (withinBlock) buffer.write(b);
// check if ... |
1bb9d27d-02b3-481b-b128-cecc29a3d862 | 0 | public static Gson getGson()
{
return new GsonBuilder()
.registerTypeAdapter(GeoJsonObject.class, new GeoJsonObjectAdapter())
.registerTypeAdapter(LngLatAlt.class, new LngLatAltAdapter())
.create();
} |
a5bab832-adb9-4cf6-be56-42f198417ee4 | 3 | public boolean hasNonPrimitiveProperty()
{
for(int x = 0;x<getPropertyCount();x++)
{
Class<?>prop = getReturnType(x);
if(!ObjectTools.isDatabasePrimitive(prop))
{
return true;
}
}
return false;
} |
03e98959-7fed-4459-b3ee-265196569b67 | 7 | final int[][] method3047(int i, int i_28_) {
if (i_28_ != -1564599039)
return null;
anInt9462++;
int[][] is = ((Class348_Sub40) this).aClass322_7033
.method2557(i_28_ ^ 0x5d41e2a6, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) {
int i_29_ = 1 + (anInt9463 + anInt9463);
... |
d7220ffd-81ac-4bdf-b8a0-5f55fe48daff | 0 | public void mouseDragged(MouseEvent e)
{
String str = "x: " + e.getX() + ",y: " + e.getY();
System.out.println(str);
} |
95775031-137d-4b7c-95b5-8a40e9f29ce5 | 4 | public static void addFact(Node newFact){
//make a new clause for the new fact
String newClause;
if(newFact != null){
newClause = makeFact(newFact);
//System.out.println("Added New Fact " + newClause);
facts.add(newClause);
//add new clauses when our fact is unified with the given rules for a win
... |
4d9b2d2e-45f5-4a8c-b22b-175eefe7d26d | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
5bb984a6-f6bb-400a-a165-2919062fa88f | 9 | public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
if(var3.getBlockId(var4, var5, var6) != Block.snow.blockID) {
if(var7 == 0) {
--var5;
}
if(var7 == 1) {
++var5;
}
if(var7 == 2) {... |
584fb86d-001f-46de-9fa9-c707237ce41a | 4 | public JLabel getPlayer2Score() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer2Score() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer2Score() - END");
return m_player2Score;
} |
4ae48a92-ef01-4fdc-96cb-0b28fe91692b | 0 | @Basic
@Column(name = "POP_FECMOD")
public Date getPopFecmod() {
return popFecmod;
} |
5437dca6-735f-48b7-ad9a-09489c1f6d93 | 4 | private static void countMax() {
int counter = 0;
for (int i = 0; i < girlsNum; i++) {
if (isMagical[i] == 1 && isProtected[i] == 0) {
counter++;
}
}
if (counter > max) {
max = counter;
}
} |
154045b5-fdf3-4067-90cd-ba2f1eb7e198 | 3 | public static String genericSyncAPICall(String region, String service, String operation, Object[] args)
{
//Retrieve a PvP.net client from the region.
LoLRTMPSClient client;
try
{
client = LoadBalancer.returnClient(region);
}
catch (NullClientForRegionException e1)
{
return "Connection to " + e1.... |
e234ba11-e025-459c-b50f-7ef3ebf0f13a | 9 | public int reverseBits(int n) {
if (n == 0) {
return 0;
}
if( n == Integer.MIN_VALUE){
return 1;
}
char[] arr = Integer.toBinaryString(n).toCharArray();
char[] narr = null;
if(arr.length<32){
narr = new char[32];
for(int i=narr.length-1,j=arr.length-1;i>=0;i--){
if(i>=narr.length-arr.len... |
e6834a0b-5025-4a60-a5e7-8e6147638931 | 1 | public void incRegister() {
this.wert++;
if(this.wert == 256) {
this.wert = 0; // Überlauf
}
} |
b4b66274-bc2b-4b14-ac00-556da2a8c0da | 1 | public void insert(Connection conn) throws SQLException {
if (isValid())
{
PreparedStatement stmt = conn.prepareStatement("INSERT INTO crminterests VALUES (?, ?)");
stmt.setInt(1, id);
stmt.setString(2, favouriteSport);
stmt.execute();
}
} |
29aa4847-6769-4838-b458-d49ef962fb2f | 7 | public static void run(String[] args) throws IOException, InterruptedException
{
Runtime rt = Runtime.getRuntime();
Process ps;
boolean vMode = false;
if(args[0].equalsIgnoreCase("-v"))
{
System.out.println("Verbose mode");
vMode = true;
}
String cmd0[] = {"yum","-y","install","g... |
d08f5aa4-ac5f-43bf-888b-d5467c2c6f22 | 7 | public static void main(String[] args) {
ArrayList<Integer> bArr = new ArrayList<>();
for (int i = 2; i < 1000; i++) {
if (p7primefinder.isPrime(i)) {
bArr.add(i);
bArr.add(i * -1);
}
}
int maxA = 0, maxB = 0, maxPrime = 0;
... |
afd91a2b-8e29-429b-8fa6-aa7e2f5c5792 | 4 | public static BloomSpecification computeBucketsAndK(double maxFalsePosProb){
// Handle the trivial cases
if(maxFalsePosProb >= probs[minBuckets][minK]) {
return new BloomSpecification(2, optKPerBuckets[2]);
}
if(maxFalsePosProb < probs[maxBuckets][maxK]) {
return ... |
60fae059-0744-45a0-b254-c329a1733470 | 8 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
Map<String, Object> rpta... |
6320db75-4de5-450a-a067-5b4ace3479eb | 4 | public int read(byte[] samples, int offset, int length)
throws IOException
{
// read and filter the sound samples in the stream
int bytesRead = super.read(samples, offset, length);
if (bytesRead > 0) {
soundFilter.filter(samples, offset, bytesRead);
return byt... |
d4b457a2-7afa-41d6-a80b-a270ad6df660 | 3 | public void reportDead(Bee deadBee) {
if (_currentPopulation <= 0 || !_simulation.environment().removeBee(deadBee)) {
// Exception is caught by Tortuga framework
// throw new RuntimeException("A bee of an empty hive wanted to die. This is impossible.");
System.err.println("A bee of an empty hive wanted to di... |
8e981480-f0ea-4497-8d96-aa033e7ca15e | 5 | @Override
/**
* performs the SimulationEvent
* @return EventDone - the event that was performed with flag set to true if the event was actually performed
*/
public EventDone performEvent(SimulationEvent reaction) {
// specify the fromAgent in the case of infection or exposure
... |
67618a16-179f-4df5-8441-5a6960f4129a | 5 | private void spawn() {
for (int i = 0; i < nr; i++) {
if (type == Type.PARTICLE) {
Game.level.addEntity(new Pieces(x, y));
} else if (type == Type.STEP) {
Game.level.addEntity(new Step(x, y));
} else if (type == Type.BLOOD) {
Game.level.addEntity(new Blood(x, y));
} else if (type == Type.SPAR... |
394ef1e5-8ee5-4b11-8d93-74a5024bac7e | 9 | public void doAllTheThings() {
//clear
currentChord = 0;
for (int i = currentChord; i < bass.length; ++i) //clear chords later since this change
{
tenor[i] = null;
alto[i] = null;
soprano[i] = null;
}
ArrayList<ArrayList<Object[]>> mas... |
d2945c02-cbe5-4e56-85e0-b8bd6d0eaca0 | 3 | private static J_JsonNodeSelector func_27352_a(Object[] var0, J_JsonNodeSelector var1) {
J_JsonNodeSelector var2 = var1;
for(int var3 = var0.length - 1; var3 >= 0; --var3) {
if(var0[var3] instanceof Integer) {
var2 = func_27345_a(func_27354_b(((Integer)var0[var3]).intValue()), var2);
... |
3a8424e9-d7a3-423e-8f72-238336568a92 | 7 | public void run() {
try {
while (true) {
File file = new File("online_players.json");
file.delete();
BufferedWriter w = new BufferedWriter(new FileWriter(file, true));
String json = "{";
for (ServerThread t : Server.threads) {
String name = t.name;
ArrayList<ChatPlayer> players = Pla... |
5a0037ac-ac92-42a6-9574-035ba541acca | 9 | private boolean openPage() {
File lastFile = fileChooser.getSelectedFile();
boolean success = false;
Frame frame = JOptionPane.getFrameForComponent(this);
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.addChoosableFileFilters(new String[] { "png", "gif", "jpg", "txt", "mws", "pdb", "xyz", "cml" })... |
2accc227-94fb-45fa-a016-49fffa393b2c | 4 | public static int mult(int x, int y){
if (x == 0 || y == 0) {
return 0;
} else if (x < 0 || y < 0) {
return -1;
} else {
return x*y;
}
} |
e83a19ec-ce1a-4a38-9d19-7fd6fecb47bf | 1 | public String getStatusPercent() {
Map<String, Double> map = analytic.getStatusPercent();
StringBuilder sb = new StringBuilder();
List<Entry<String, Double>> entries = new ArrayList<Entry<String, Double>>(map.entrySet());
Collections.sort(entries, new Comparator<Entry<String, Double>>() {
public int co... |
75532dbb-7c25-4a4b-a831-10d84bf199ac | 5 | private void rechercherPostesVisibles(){
for(Poste poste : postes){
poste.initialiserPostesVisibles() ;
for(int orientation = Orientation.NORD ; orientation <= Orientation.NORDOUEST ; orientation += 1){
Position positionCible = Position.voisin(poste.getPosition(),orientation) ;
if(Position.estPositionVa... |
38df1f79-5e32-4154-a9b2-1fb60ef6109c | 5 | private void readXML() throws IOException {
try {
doreadXML();
} catch (Exception e) {
e.printStackTrace();
}
//bulding the construction view straight from vc
if (!con.init) {
setConst();
con.setInit(true);
}
con.setC... |
0b0b9e5f-365b-4ead-8395-338279cecacd | 9 | public boolean input(Instance instance) throws Exception {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_NewBatch) {
resetQueue();
m_NewBatch = false;
}
Method m = (Class.forName(m_Class)).getMethod(m_Method, new Clas... |
292dce73-d4e6-4fdf-a377-b0b28f24a088 | 0 | @Basic
@Column(name = "PRP_CC_RESPONSABLE")
public Integer getPrpCcResponsable() {
return prpCcResponsable;
} |
e320c080-803b-4f03-a6ac-ce613b4b7b6d | 8 | public void visit_dstore(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_dstore);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
bcfef193-6482-4ce6-bd4a-5ef079b28b24 | 7 | private String decodeMessage(ContactItem to, String Message) {
StringBuffer msg = new StringBuffer(Message);
int previndex = 0;
for(int i = 0; i < Message.length(); i++) {
int v = Message.indexOf('%', previndex);
if(v == -1) {
break;
... |
d945f62b-2b1d-4650-9c6e-633dcd7e7da3 | 5 | private NoeudArbre rechercheClefArbre(E clef, NoeudArbre<E> noeudCourant) {
NoeudArbre<E> result = NIL;
if (noeudCourant.clef.compareTo(clef) == 0) {
result = noeudCourant;
} else if (noeudCourant.clef.compareTo(clef) < 0) {
if (noeudCourant.filsDroit != NIL) {
... |
e34b94fc-1aee-4e7b-ac6f-8c998bbf7b5f | 0 | public void setAbsolutePath(boolean is_absolute_path) {
this.is_absolute_path = is_absolute_path;
this.path = assemblePath(this.path_list);
} |
9747aa0e-dd68-404d-85d6-df30573c6be8 | 3 | public double get (int i)
{
switch (i)
{ case 0:
{ return x;
}
case 1:
{ return y;
}
case 2:
{ return z;
}
default:
{ throw new ArrayIndexOutOfBoundsException (i);
}
}
} |
7d4e05a4-4625-4246-9a27-3a479ffbe933 | 5 | public double checkAccuracy(int method, DataSet trainSet, DataSet testSet)
{
int correctCount = 0;
int wrongCount = 0;
String predictedCorrect = "";
for(int i=0; i < testSet.correctWords.size(); i++)
{
String actualCorrect = testSet.correctWords.get(i);
String wrong = testSet.wrongWords.get(i);
... |
5ef7ed2f-0397-4c80-a74c-b9c2f5d61775 | 5 | protected void precess() {
double ra1 = pa.getRA() * Math.PI / 12.0;
double dec1 = pa.getDec() * Math.PI / 180.0;
Vector v = new Vector(Math.cos(dec1)*Math.cos(ra1),
Math.cos(dec1)*Math.sin(ra1), Math.sin(dec1));
double epoch1 = pa.getEpoch();
char etype1 = pa.getEpochType();
switch (etype... |
dc82b969-2db4-4de3-9a88-6459f4662061 | 4 | public void checkInvariants(){
if (super.getCompteARebours() > 10 || super.getCompteARebours() <0){
throw new InvariantError("Compte a rebours de la bombe non permis");
}
if(super.vaExploser()){
if (super.getCompteARebours() != 0){
throw new InvariantError("Vaexploser vrai mais compte a rebours != 0");
... |
b33234d8-9f97-4c79-98cd-fb385033ede1 | 8 | public static void loadAllFiles() {
File texDir = new File("res/tex/");
ArrayList<File> texFiles = new ArrayList<>();
texFiles.addAll(Arrays.asList(texDir.listFiles()));
for (File f : texFiles) {
if (!f.isDirectory() && f.getName().endsWith(".png")) {
try {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.