method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
85d6117c-cd3d-402c-bef2-692798556532 | 7 | @Override
public void launchContainers() throws Exception {
String noOfContainers = getJobConfiguration().getProperty(SingularConstants.KEY_NO_OF_CONTAINERS);
String containerClassName = getJobConfiguration().getProperty(SingularConstants.KEY_CONTAINER_CLASS);
String containerCores = getJobC... |
4a42834c-e25c-4ad5-8aed-99cc0e628dea | 0 | public boolean isDebugMode() {
return getConfig().getBoolean("angry-debug", false);
} |
606cb27e-7857-486c-8d21-0188c6968979 | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String method = request.getParameter("method");
String data = request.getParameter("data");
request.setAttribute("data", request.getParameter(... |
9c4cdbb4-65f5-4e7a-986b-df750a093a0d | 9 | private static int[] getMinPrefMaxSumSize(int[][] sizes) {
int[] retSizes = new int[3];
for (int i = 0; i < sizes.length;
i++) {
if (sizes[i] != null) {
int[] size = sizes[i];
for (int sType = LayoutUtil.MIN;
sType <= L... |
2e839715-3b57-447f-8f39-d53444393372 | 1 | public byte[] decodeBytes() {
byte[] res = new byte[decodeInt()];
for (int i = 0; i < res.length; i++) {
res[i] = decodeByte();
}
return res;
} |
1b783dac-9a16-4e04-bfe3-4fe42a11ed29 | 8 | public boolean isEqual(LiteralLabel value1, LiteralLabel value2) {
if (value1.getDatatype() instanceof XSDBaseNumericType && value2.getDatatype() instanceof XSDBaseNumericType) {
Long n1, n2;
n1 = null;
n2 = null;
Object v1 = value1.getLexicalForm();
Object v2 = value2.getLexicalForm();... |
a999f4d5-1bcf-426d-bc12-e2d31381400e | 7 | void createXML(String xml, int orders, int robots, int shelves,
int pickers, int maxOrder, int maxStock, boolean randOrder,
boolean randStock) {
Warehouse wh = new Warehouse();
// Creating Orders
if (orders > 0) {
this.orders = orders;
if (maxOrder <= 0) {
maxOrder = 4;
}
Orders x = new Ord... |
7d1037a2-93eb-4d2e-99cc-7ef501147064 | 8 | public static double get(String util) {
double weighting = (util.matches("[+-]?\\d*(\\.\\d+)?"))? Double.parseDouble(util) : new Random().nextDouble();
if (util.equals("random") || util.equals("next")) {
weighting = new Random().nextDouble() + MIN;
}
else if (util.equals("previous")) {
weighting = P... |
7b1dbe8d-0d07-4194-9ff4-559132c953e0 | 4 | static void stepRK(ArrayList<Body> v, double dt) {
for (int i = 0; i < v.size(); i++) {
v.get(i).setF(Body.forces(v.get(i), v, i));
}
ArrayList<Body> supp = new ArrayList<Body>();
for (int i = 0; i < v.size(); i++) {
Body b = v.get(i);
double x = b.p.x;
double y = b.p.y;
double z = b.p.z;
... |
844399f8-97d4-4ae7-9e84-1a6002836f74 | 4 | public static void adjustToSameSize(Component... comps) {
Dimension best = new Dimension();
for (Component comp : comps) {
Dimension size = comp.getPreferredSize();
if (size.width > best.width) {
best.width = size.width;
}
if (size.height > best.height) {
best.height = size.height;
}
}
fo... |
a960a312-00a6-4a65-a701-55d5b616a44d | 1 | public void setSecondElement( E newSecond ) {
if ( newSecond == null ) {
throw new NullPointerException();
}
this.secondElement = newSecond;
} |
b8588b9d-ed54-4de9-8284-b72fb96f0599 | 2 | public void setPendingStage( int pendingStage ) {
if ( pendingStage <= 0 || pendingStage > shipBlueprintIds.length )
throw new IndexOutOfBoundsException( "Attempted to set 1-based flagship stage "+ pendingStage +" of "+ shipBlueprintIds.length +" total" );
this.pendingStage = pendingStage;
} |
a8973e34-4772-4cdb-a729-d130dbb8de6b | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CarType other = (CarType) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return ... |
702fd766-4fa1-44fb-8c8b-57d55dee5995 | 9 | private final void draw1(byte[] is, int[] is_74_, int i, int i_75_,
int i_76_, int i_77_, int i_78_, int i_79_,
int i_80_, int i_81_, int i_82_, int i_83_,
aa var_aa, int i_84_, int i_85_) {
aa_Sub3 var_aa_Sub3 = (aa_Sub3) var_aa;
int[] is_86_ = ((aa_Sub3) var_aa_Sub3).anIntArray5201;
int[] is_87_ ... |
248a7a2c-0e35-410e-b943-acbe45c306d8 | 8 | public Card(String s) {
switch (s.charAt(0)){
case 'J':
this.value=11;
break;
case 'Q':
this.value=12;
break;
case 'K':
this.value=13;
break;
case 'A':
this.value=14;
break;
default:
this.value=(s.charAt(0)-'0');
}
switch (s.charAt(1)){
case 'S':
this.suit=0;
break;
... |
01c42d9d-5ae4-452f-9c81-29ec7f1507cc | 3 | private void initializeTransitionCycle(TabListWidget... listWidgets) {
SelectionTransition previousTransition = null;
for (int i = 0; i < listWidgets.length; i++) {
SelectionTransition transition = new SelectionTransition(listWidgets[i]);
if(previousTransition != null)
transition.setPrevious(previousTrans... |
47974fa0-d0d3-4686-be61-9600bec326aa | 4 | public void findDocumentFrequency(){
for(String uniqueToken : tokenList){
for(Text t : textList){
if(t.getTokens().contains(uniqueToken)){
if(!documentFrequency.containsKey(uniqueToken)){
documentFrequency.put(uniqueToken, 0);
}
documentFrequency.put(uniqueToken, documentFrequency.get(uni... |
3b4ffe07-324a-4463-8501-7e8a057774c5 | 0 | @Override
public void undo() {
} |
798ae1d5-459f-4c84-a513-19da5ce128a1 | 1 | private String setBudgetType(Budget budget) {
return (budget instanceof AnnualBudget) ? ANNUAL : MONTHLY;
} |
efebefb4-673a-4610-9be0-fa2b7c6ac510 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
67237b05-6a24-428f-93c3-a8fef56ed1ad | 3 | public static ArrivalBoardingActivityEnumeration fromString(String v) {
if (v != null) {
for (ArrivalBoardingActivityEnumeration c : ArrivalBoardingActivityEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
0612cbfd-c57e-4e88-96de-8bd4ced61cf8 | 4 | public static double[][] removeRowColumn(double[][] origMatrix, int row, int col){
double[][] destMatrix = new double[origMatrix.length-1][origMatrix.length-1];
int p = 0;
for( int i = 0; i < origMatrix.length; ++i)
{
if ( i == row)
continue;
int q = ... |
cf165aa4-06e3-486c-b200-0b5672af846a | 3 | public boolean init(Sim_port output, AllocPolicy policy, int resourceID)
{
if (output == null || policy == null || resourceID < 0) {
return false;
}
outputPort_ = output;
policy_ = policy;
resourceID_ = resourceID;
resIdObj_ = new Integer(resourceID);
... |
75611fca-af18-4774-8ecd-4d146c346cb3 | 5 | @Override
public Iterator<Cell<V>> iterator() {
return new Iterator<Cell<V>>() {
private MutableCell<V> cell = new MutableCell<V>();
private int count;
private int current = -1;
@Override
public boolean hasNext() {
... |
cc9aa4b1-464c-47cf-9e32-b949ccf9ff1f | 4 | public Matrix getIndentity(){
if(width == height){
float[][] values = new float[width][width];
for(int i = 0; i < width; i++){
for(int j = 0; j < width; j++){
if(i == j){
values[i][j] = 1;
}else{
values[i][j] = 0;
}
}
}
return new Matrix(values, width, width);... |
a91f43f2-c3a6-4d7e-87d2-7ac25ef7f0a6 | 2 | public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
// return immediately when selecting an item
if (selecting) {
return;
}
// insert the string into the document
super.insertString(offs, str, a);
// lookup and select a... |
2f3eece8-f0e6-4c12-bf37-2022e015c287 | 0 | public int getFTG() {
return ftg;
} |
a988777c-2201-4850-986c-bb4a64adbff2 | 7 | void runBinGobbler() {
FileOutputStream redirectWriter = null;
running = true;
try {
// Create buffer
byte buffer[] = new byte[BUFFER_SIZE];
int num = 0;
// Create redirect file (if any)
if (redirectTo != null) redirectWriter = new FileOutputStream(redirectTo);
// Read input
while ((num = i... |
2e4c79e6-5f0c-498f-ab7c-0042f0458ed9 | 5 | public void move()
{
int dx = 0;
int dy = 0;
switch (direction)
{
case Up:
dy = -Block.HEIGTH;
break;
case Down:
dy = Block.HEIGTH;
break;
case Left:
dx = -Block.WID... |
a9260248-ffe5-44af-a603-997a6d9bad2e | 4 | private boolean canBuild(Player player, Block block) {
if (player.hasPermission(STPermission.ADMIN.getPermission())) {
return true;
}
final Town town = plugin.getTown(block.getChunk());
if (town == null) {
if (block.getLocation().getBlockY() <= new TownUtils(plug... |
90e9bbe8-0f95-4377-9c62-767c7422dce0 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TradeOrder other = (TradeOrder) obj;
if (count != other.count)
return false;
if (resourceType == null) {
if (other.resourceType != null)
... |
c946b126-8108-49af-ba49-7b65ab98395a | 2 | public static Matcher matchInFile(File f, Pattern pattern) throws FileNotFoundException {
Scanner sFile = new Scanner(f);
while (sFile.hasNextLine()) {
String line = sFile.nextLine();
Matcher m = pattern.matcher(line);
Boolean found = m.find();
if(found) {
sFile.close();
return m;
}
}
... |
fb2c524f-a30c-4685-8ab3-b790fc9b10c3 | 6 | protected boolean xObstacleAhead(double time) {
for (StaticObject so : AppFrame.getFrameDesign().getStaticObjects()) {
if (checkXObstacle(so, time)) {
if (obstacleReaction(so)) {
if (currentHorizontalSpeed > 0) {
this.currentCoord.setX(so.g... |
16b37304-c0ca-4b8a-ab7e-8791aa885a41 | 5 | public void createPlayersProjectile2(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time, int slope) {
//synchronized(c) {
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
Player p = Server.playerHandler.players[i];
if(p != null) {
C... |
6a114115-6c35-4235-888a-8d57862f7419 | 4 | void rotate(Node n, Side s, boolean first) {
final Side o = (s == Side.L) ? Side.R : Side.L ;
final Side nS = n.side ;
final Node
p = n.parent,
x = kidFor(n, o),
y = n,
a = kidFor(x, o),
b = kidFor(x, s),
c = kidFor(y, s) ;
if (first && heightFor(b) > heightFor(a)) {
... |
7f2cb1f3-27c2-4be7-ba1c-bdbba49968fb | 8 | public static void main(String[] args) {
CodeConfiguration conf = new CodeConfiguration(null);
conf.setAvailableHardwareThreads(2);
conf.setLoggingEnabled(true);
// DON'T SET CONFIGURATION PARAMETERS BEHIND THIS LINE !!!
IEvaluator evaluator = conf.getEvaluator();
Linked... |
f08d2adb-dc64-4eaf-9d03-73d5199f99b5 | 7 | private static void transform(final MethodEditor method) {
if (CounterDecorate.VERBOSE > 1) {
System.out.println("Decorating method " + method);
}
final MemberRef rcfield = new MemberRef(Type
.getType(CounterDecorate.COUNTER_MAIN), new NameAndType(
CounterDecorate.COUNTER_RCNAME, Type
.getType(C... |
d40b194f-9622-49a4-8809-e797c53004c5 | 3 | private static void displayUserAwards(BufferedReader reader, VideoStore videoStore) {
try {
System.out.println("Please enter the max number of user you would like to see in each category");
int amount = readInt(reader, 1, -1);
System.out.println();
System.out.prin... |
31ed70f0-33d6-4dfe-a1a8-3d38609c76a6 | 2 | public boolean isDraw() {
return theHouse.hasBust() && player.hasBust()
|| theHouse.getScore() == player.getScore();
} |
0aa577d8-edce-4a53-b3c2-28970e07d0a2 | 2 | public void printPrevPopulation(){
for(String[] d : this.prevPopulation){
for(String s : d){
System.out.print(s + ", ");
}
System.out.println();
}
} |
b634db7c-b3ff-417f-a4fa-008c2011b53b | 8 | public boolean startDragComponent(Point p) {
// disable DnD for some cases :
// - child of a compound dockable, in hidden state
// - child of a maximized compund dockable
// - maximized dockable
DockableState.Location targetLocation = target.getDockKey().getLocation();
if(targetLocation == DockableState.Lo... |
bb6e6076-b13a-4992-8d5f-e4ea88fd61f7 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
ba1e2fe3-3f97-4012-a7b1-7129f8e9d42c | 5 | protected void acceptSocket() {
try {
Socket socket;
socket = serverSocket.accept();
boolean equal = false;
for (EziPeer p : peers) {
if (p.getSocket().getInetAddress().equals(socket.getInetAddress())) {
equal = true;
... |
db22fdc7-9874-4bfa-bfdc-b2c719f294c0 | 8 | @Override
public MovementAction testAction(Creature c) {
Direction action = this.checkForDirt(c);
if (action != null){
currentDirection = action;
return Direction.convertDirToAct(action);
}
int value = -1;
int dist = -1;
Sensor s = c.getSensor();
if (currentDirection != null){
value = (int) s.ge... |
c1a8a14c-4734-44e6-812b-5a2386da5cfe | 1 | public void visitCastExpr(final CastExpr expr) {
print("((" + expr.castType() + ") ");
if (expr.expr() != null) {
expr.expr().visit(this);
}
print(")");
} |
4c11ae24-2aeb-4065-8a6d-1a218e9f0798 | 0 | public static void main(String[] args) throws Exception {
Thread t = new Thread(new ADaemon());
t.setDaemon(true);
t.start();
TimeUnit.MILLISECONDS.sleep(100);
} |
41b5a431-26f7-442a-a165-7046d0b8b5bc | 5 | private void addToAdjBuffer (double in) {
double lossAverage=25.0;
if (NOISY) lossAverage=60.0;
// If the buffer average percentage difference is more than lossAverage then we have lost the signal
if (absAverage()>lossAverage) {
if (display==true) {
// Tell the user how many bits were received
String... |
97cac4ac-dd1d-438b-b4c8-56da8044955a | 6 | @Override
public void move(GameBoard board, Control control) {
int[][] overall = new int[7][4];
startState = new int[7][6];
for (int n = 0; n < 7; n++) {
for (int m=0; m<6; m++) {
startState[n][m] = board.get_state(n, m);
}
}
for (int i=0; i<4; i++) {
int[] scores = eval(board, control, startSta... |
4f64d321-c87b-48e7-8e5e-53ad5cdfea55 | 2 | * @see InitStmt
*/
public void initLocals(final Collection locals) {
final LocalExpr[] t = new LocalExpr[locals.size()];
if (t.length == 0) {
return;
}
final Iterator iter = locals.iterator();
for (int i = 0; iter.hasNext(); i++) {
t[i] = (LocalExpr) iter.next();
}
addStmt(new InitStmt(t));
... |
a24c0eef-ef33-4bf8-9707-d209c627bb9a | 7 | @Override
protected Class<?> loadClass(final String name, boolean resolve) throws ClassNotFoundException {
Class<?> clazz = null;
synchronized (this) {
clazz = findLoadedClass(name);
}
if (clazz == null) {
clazz = withClassLoaders(new AbstractClassLoaderClos... |
7ba2699e-9c0e-48a8-bf93-c986cf05d2bd | 1 | private boolean jj_2_13(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_13(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(12, xla); }
} |
592866de-4ca1-4759-b931-da39c227d9c7 | 7 | public void moveOnX(int xMoveSize) {
int casePositionX = 0, casePositionYup = 0, casePositionYdown = 0;
int caseSize = GameVue.getCaseSize();
switch(xMoveSize) {
case 10 :
casePositionX = (player.getxPosition() + caseSize + xMoveSize - 1) / caseSize;
... |
8ee5422a-d259-4dfb-8892-11e94409ae21 | 6 | public CancelInvoiceResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "invoiceID") ) {
... |
efbedcb0-0413-4deb-8114-7369a5e93bd0 | 4 | private static void validerReponse(Reponse reponse) throws ChampInvalideException, ChampVideException {
if (reponse.getMessage() == null || reponse.getMessage().isEmpty())
throw new ChampVideException("La réponse ne peut être vide");
if (reponse.getSujet() == null)
throw new Cham... |
486b3a7a-501f-4d85-912e-b6d9b8f9c318 | 2 | private Connection getConnection() {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
Utilities.outputError("Could not find sqlite drivers");
return null;
}
try {
return DriverManager.getConnection("jdbc:sqlite:" + m_databaseFile.getAbsolutePath());
} catch (SQLE... |
9759dc72-cc81-4b1d-b04c-caec1bdd47ed | 1 | public void replaceFood() {
for (int[] i : foodSpawnCells) {
getCell(i).setFood(5);
}
} |
0a7ab20f-7b92-4416-a0aa-04398b69b0ca | 6 | protected Game(String cfgPath) {
try {
introduceParameterName(getClass(), "TIME_LIMIT");
setParameter("TIME_LIMIT", "0"); //infinite turn time
if(cfgPath == null) {
board = loadConfigFile(null);
if(board == null) //if a Board was not created by loadConfigFile when you passed loadConfigFile 'null'
... |
ad02d544-fa35-4d56-917c-cea188056d2b | 0 | public static void setBreedingAge(int newBREEDING_AGE)
{
BREEDING_AGE = newBREEDING_AGE;
} |
d427713f-1e72-4cc4-a53a-6096ff201a27 | 3 | public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integ... |
a5cb26f6-cf95-4585-832c-6dc4ded33bbd | 1 | private void closeButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_closeButtonActionPerformed
{//GEN-HEADEREND:event_closeButtonActionPerformed
try
{
echoClient.close();
} catch (IOException ex)
{
Logger.getLogger(ChatGui.class.getName()).l... |
2d8bff20-2e77-428e-846b-ef8f3b0d0770 | 4 | public static boolean isValidXML(String path) throws IOException {
File f = new File(path);
if (f.exists() && !f.isDirectory()) {
// check if XML
String extension = "";
int i = path.lastIndexOf('.');
if (i > 0) {
extension = path.substring(i + 1);
if (extension.equalsIgnoreCase("XML")) {
... |
995bd22d-ebb0-45df-9d8f-a7d8c17f954a | 8 | private boolean uhattuAlhaalta(int pelaajaNumero, int x, int y) {
int i = 1;
while(x+i < 8 && kentta[x+i][y].onTyhja()) i++;
if(x+i == 8) return false;
if(kentta[x+i][y].getNappula().omistajanPelinumero() != pelaajaNumero) {
if(i == 1 && kentta[x+i][y].getNa... |
a99312c3-621d-4672-8ac5-bfbc6e507668 | 4 | public Node<Integer> mergeSort(Node<Integer> head) {
if (head == null)
return null;
if (head.next == null)
return head;
Node<Integer> slow = head;
Node<Integer> fast = head;
while (fast.next != null && fast.next.next != null) {
slow = slow.next;
fast = fast.next.next;
}
Node<Integer> sec = s... |
a16807d7-9fbf-411a-b587-5b26b5df83e7 | 0 | public void join() {
cleanUp();
super.join();
} |
9549ab2a-7476-42b0-9faa-50ca1f7832fa | 5 | @Override
public String encode(Response response) throws EncoderException {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
return "";
}
if (response.getResponse() == null)
return "";
char... |
abf1dde4-c682-4865-a3ee-a620033c28ce | 0 | public void setObjectShape(Object o){
objectShape = o;
} |
5947b901-8b68-459f-b145-298011d9fa69 | 6 | * @param options
* @return StringWrapper
*/
public static StringWrapper shellCommand(Stella_Object command, Cons options) {
if (((Boolean)(OntosaurusUtil.$BLOCK_SHELL_COMMANDp$.get())).booleanValue()) {
throw ((StellaException)(StellaException.newStellaException("Execution of `shell-command' is blocke... |
1c0bb6b2-8705-4506-a55f-efef43d533c9 | 3 | private void mapFileReAccessRequirements( HypertextAccessFile htaccess,
URI requestedURI,
File requestedFile,
Map<String,BasicType> optionalReturnSettings,
Environment<String,BasicType> session,
String authType ) {
// Finally: store some session data for the ca... |
e4ba2964-c72f-46bb-bd79-4988767f6598 | 2 | public static Header createOAuthHeader(Token token) {
return new BasicHeader(AUTH.WWW_AUTH_RESP, "OAuth " +
(token == null || !token.valid() ? "invalidated" : token.access));
} |
69463d5a-9217-43c1-9211-91ee124a6591 | 4 | public double removeMax() {
if ( _heap.size() == 0 )
return -1.0;
else
_size--;
//store root value for return at end of fxn
double retVal = peekMax();
//store val about to be swapped into root
double foo = _heap.get( _heap.size() - 1);
//swap last (rightmost, deepest) leaf with root
swap( 0, _hea... |
3d8b0ea8-3b8d-42f9-a5da-c66243dfc50a | 1 | public void testToStandardSeconds() {
Period test = new Period(0, 0, 0, 0, 0, 0, 7, 8);
assertEquals(7, test.toStandardSeconds().getSeconds());
test = new Period(0, 0, 0, 0, 0, 1, 3, 0);
assertEquals(63, test.toStandardSeconds().getSeconds());
test = new Period(... |
11d78dd0-4b71-4231-a1d8-3b01a9918a59 | 4 | private int bruteEst(GameState state, Card card) {
int est = 0;
//We see if the brute will actually knock somebody out or not
for(Player p : state.getPlayerList())
{
if(!p.getFaction().equals(card.getFaction()))
{
for(Card c : p.getHand())
{
if(c.getValue() >= card.getValue())
est++;... |
16a7b8e4-8db2-4584-abaf-cfc0c1440a6c | 2 | private void handleInputFile(Object input)
{
Configuration[] configs = null;
AutomatonSimulator simulator = getSimulator(automaton);
/* if (input instanceof InputBox)
{
InputBox tt=(InputBox) input;
if (getObject() instanceof TuringMachine)
tt.addSimulator(automaton, simulator, true);
else
tt.a... |
de74b2ba-268c-4d79-84b1-46b46e466c01 | 2 | public void hit(Player player) {
if (player.getHand().size() < 5 && deck.size() > 0) {
deck.get(deck.size() - 1).flip();
player.getHand().add(deck.get(deck.size() - 1));
deck.remove(deck.size() - 1);
player.refreshImage();
refreshImage();
}
} |
3ef36585-d0ff-4d04-a948-ec28e2865252 | 4 | public static void forceFocusToAccept() {
KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
Component focus = focusManager.getPermanentFocusOwner();
if (focus == null) {
focus = focusManager.getFocusOwner();
}
if (focus != null) {
FocusListener[] listeners = focu... |
cdf4950c-76b7-4915-bb8e-787533a7f54f | 0 | public DefaultTempFile(String tempdir) throws IOException {
file = File.createTempFile("NanoHTTPD-", "", new File(tempdir));
fstream = new FileOutputStream(file);
} |
97a2ae44-9461-4a98-8877-3ae88c5e0ed2 | 4 | public void createTable(byte[] table)
{
boolean isSystemTable = ForemanConstants.TableIdentifier.getIdentifierFromName(table) != null;
boolean tableExists = tableExists(table);
if (!tableExists && !isSystemTable)
{
instance.hset(ForemanConstants.TableIdentifier.TABLE.getId(), table, ForemanConstants.TableId... |
a5adb13b-62bc-4384-8b75-fa5da60feb25 | 5 | public void mergeUnsortedWithSortedList(ArrayList<node> unsorted,ArrayList<node> sorted){
if(unsorted.size()>0){
while(unsorted.size()>0){
for(int i = 0;i<=sorted.size();i++){
if(i==sorted.size()){
sorted.add(unsorted.get(0));
... |
4536be9e-c8b1-4cd6-b20c-ab2df186137c | 9 | public static JulianDate jauCal2jd(int iy, int im, int id) throws JSOFAIllegalParameter
{
int ly, my;
long iypmy;
double djm0, djm;
/* Earliest year allowed (4800BC) */
final int IYMIN = -4799;
/* Month lengths in days */
final int mtab[]
= {31, ... |
cc1dc912-7aae-4562-827b-2e1d66ffbc1a | 9 | public Iterator<ResultSet> getIteratorFromQuery(String query)
{
Iterator<ResultSet> ret = null;
Connection connection = null;
Statement statement = null;
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, passwd);
statement = connection.createStatement();
final ... |
e514cd24-556a-4017-993a-7c37ae0a4d2a | 8 | private void GestionSelection() {
// Initialisation
boolean trouve = false;
ListIterator<Forme> it = model.getCalqueCourant().listIterator();
while (it.hasNext())
it.next(); // On déroule la liste pour commencer par la fin
// Vérification de la touche contrôle
if ( !model.getControlPressed() ) {
m... |
6f8a8579-d5ed-41b5-ad1e-d37ef97fd0d3 | 4 | public WikiPagePath getFullPath(WikiPage suiteSetup) {
if (suiteSetup.getName().equals(SuiteResponder.SUITE_SETUP_NAME)) {
return new WikiPagePath (SuiteResponder.SUITE_SETUP_NAME);
}
if (suiteSetup.getName().equals(SuiteResponder.SUITE_TEARDOWN_NAME)) {
return new WikiPagePath (SuiteResponder.SUITE_TEARDOW... |
3fc45df4-16d3-47ae-a3dc-61a9336f2e2f | 4 | public Dimension preferredLayoutSize(Container parent) {
synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets();
int totalWidth = maxWidth - insets.left - insets.right;
int height = 0;
int width = 0;
int maxHeightOfThisLine = 0;
int componentCount = parent.getComponentCount();... |
4d4505db-f438-45dc-a2f8-1757b3ac2eab | 0 | @Test
public void EnsureLeadingSlashIsRemoved() {
String path = "/x/y";
String newpath = Path.trimSlashes(path);
assertEquals("x/y", newpath);
} |
bcd4435d-5fa8-45cf-ba61-4c5eb4bdd71f | 4 | public final void setBounds(float var1, float var2, float var3, int var4, int var5, int var6, float var7) {
this.vertices = new Vertex[8];
this.quads = new TexturedQuad[6];
float var8 = var1 + (float)var4;
float var9 = var2 + (float)var5;
float var10 = var3 + (float)var6;
var1 -= var... |
8ba42145-47c4-4113-97b6-840ab4962006 | 9 | public synchronized Request getNextBlockRequest(Peer peer, int[] piecesFrequencies){
RequestExtended recoveredRequest = recoverRequest(peer);
if (recoveredRequest != null){
associateRequest(peer,recoveredRequest);
return recoveredRequest;
}
Integer piece... |
2d6c90df-32b9-4848-8b29-416f12401f4f | 6 | private void sequentialTraverse(FineNode<T> curr, Operation<T> operation) {
if (curr != null && curr == root && curr.getLeft() == null && curr.getRight() == null) {
operation.empty(curr);
return;
}
if (curr == null || curr.getValue() == null) {
return;
}
operation.start(curr);
sequentialTraverse(cu... |
39a7bd1b-28d6-427b-94c7-b5031306cfdd | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu3 = new jav... |
a05692b5-8146-4839-865e-ff9f6a42bd13 | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result
+ ((endereco == null) ? 0 : endereco.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + (... |
4273f98e-2eaf-4af6-9dca-e9ad97bd2c7e | 4 | private void countEdges() {
int edges = 0;
if (getState() == States.ARR_ADJ)
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
if (arr_adj[i][j] != 0)
edges++;
this.M = edges;
} |
7a7721ed-39db-4cc3-9396-8aa4fe568346 | 2 | private void readData() {
byte[] timeBuffer = new byte[8];
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb, Locale.US);
ByteArrayInputStream inStream = new ByteArrayInputStream(
outStream.toByteArray());
DataInputStream reader = new DataInputStream(inStream);
try {
for ... |
474acfc8-bff5-4d41-9ac7-99fd144601f7 | 9 | private void handleBidSubmission(TACMessage msg) {
Bid bid = (Bid) msg.getUserData();
int status = NO_ERROR;
while (msg.nextTag()) {
if (msg.isTag("bidID")) {
int id = msg.getValueAsInt(Bid.NO_ID);
bid.setID(id);
} else if (msg.isTag("bidHash")) {
String hash = msg.getValue();
bid.setBidHas... |
9897ab5d-8b3c-4454-ad6c-d5af2a159e25 | 0 | public void driver() {
System.out.println("benz drive");
} |
fff1507d-e7ba-4b6c-a5c5-f8af96713c00 | 1 | @SuppressWarnings("unchecked")
public void saveMessage(HttpServletRequest request, String msg) {
List<String> messages = (List<String>) request.getSession().getAttribute(MESSAGES_KEY);
if (messages == null) {
messages = new ArrayList<String>();
}
messages.add(msg);
... |
66dcd26f-f92b-4a44-bc1f-8b8f72f8f745 | 6 | public int getMaxSubArrayProduct(int[] a) throws IllegalArgumentException {
if (a == null || a.length == 0) { throw new IllegalArgumentException(); }
int _MAX_EndingHere = 1;
int _MIN_EndingHere = 1;
int maxSoFar = Integer.MIN_VALUE;
for (int i = 0; i < a.length; i++) {
/*
* If current ... |
2011cf36-604b-49c6-9fe8-a3e9d7d92b2d | 8 | public void updateAll(){
try{
DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();
DocumentBuilder docB= docFac.newDocumentBuilder();
Document doc = docB.parse("/Users/djdrty/Desktop/KaneClub/players.xml");
Node players = doc.getFirstChild();
... |
b5cd3cf6-14ee-495d-b9e4-bb538e5f8fe8 | 6 | @Override
public String getDescription(Hero hero) {
String base = String.format("Move through a wall of blocks.");
StringBuilder description = new StringBuilder( base );
//Additional descriptive-ness of skill settings
int initCD = SkillConfigManager.getUseSetting(hero, this,... |
79ff5050-3e95-45e1-89c9-842b711b3b17 | 4 | @Override
public void actionPerformed(ActionEvent e)
{
if ("bStartCasual".equals(e.getActionCommand()))
{
Main.frameMM.setVisible(false);
Main.currentGame = new OneFlower(GameMode.CASUAL);
Main.currentGame.start();
}
else if ("bStartHard".equals(e.getActionCommand()))
{
Main.frameMM.setVisible(f... |
46262d5a-5c6b-4440-b6a2-a923eef39b40 | 4 | @Override
public List<Cotacao> filterGrid(String filter) {
List<Cotacao> lista = service.findAll();
if ("".equals(filter) || filter.equals("*")) {
return lista;
}
List<Cotacao> filtro = new ArrayList<Cotacao>();
for (Cotacao cotacao : lista) {
if (... |
7f7b3bba-592e-4970-a888-dbd42b372ba1 | 0 | public Date getDeclareDate() {
return declareDate;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.