method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8f25fcb2-ff0e-435d-962b-5ba86b965e56 | 8 | @Test public void randomTest() {
final Random rng = new Random(1337);
for(int n = 0; n < 1_000; n++) {
Array<Integer> arr = emptyArray();
final ArrayList<Integer> list = new ArrayList<Integer>(n);
for(int i = 0; i < n; i++) {
final int insPos = rng.nextInt(i + 1);
arr = arr.ins... |
602dc0f3-71cf-403d-828d-27d33cbf1b46 | 3 | public void runServer(ConfigurationForServer configuration) {
configuration.setProperties(properties);
if (configuration.isInvalid())
exitStatus = 1;
if (configuration.showHelp()) {
System.out.println(configuration.getHelpText());
} else {
try {
... |
02784ce0-472c-4686-a43a-747a09af7583 | 3 | public void fireMarkerEvent(final MarkerEvent EVENT) {
final EventHandler<MarkerEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (MarkerEvent.MARKER_EXCEEDED == TYPE) {
HANDLER = getOnMarkerExceeded();
} else if (MarkerEvent.MARKER_UNDERRUN == TYPE) {
... |
c37fe9ba-9029-4887-b701-91356da97f7b | 9 | private void generateMethod(Method method,
String className)
{
CodeVisitor mw = _classWriter.visitMethod(method.getModifiers()
^ ACC_ABSTRACT,
method.getName(),
... |
73cf75ab-4183-4451-8def-19743e234468 | 7 | private String shrtTip() {
String tt = shorttip();
if (tt != null) {
tt = RichText.Parser.quote(tt);
if (meter > 0) {
tt = tt + " (" + meter + "%)";
}
if (FEP != null) {
tt += FEP;
}
if (curio_stat != null && qmult > 0) {
if(UI.instance.wnd_char != null)
tt += "\nLP: $col[205,205,... |
e0c3178b-1a74-4460-a349-5260082d05f3 | 2 | private boolean Recargo(float importe) {
if (importe < 0) {
return false;
}
if (importe > saldo) {
return false;
}
saldo -= importe;
return true;
} |
0815494b-6d1a-4a19-b20d-35291042f50a | 5 | @SuppressWarnings("unchecked")
private static <E extends Comparable<E>> void merge(E[] array, int leftStart, int leftEnd, int rightStart, int rightEnd) {
int length = rightEnd - leftStart + 1;
E[] mergedArray = (E[]) Array.newInstance(array[0].getClass(), length);
int index = leftStart;
for (int i = 0; i < ... |
94d03c94-4d67-4fd5-8018-2502d383d62d | 8 | private static OAuthError extractErrorMessage(String jsonText) {
OAuthError oauthError = new OAuthError();
try {
JsonFactory jsonFactory = new JsonFactory();
JsonParser jParser = jsonFactory.createJsonParser(jsonText);
while (jParser.nextToken() != JsonToken.END_OBJECT) {
String fieldname = jParse... |
a1b89665-6660-4027-9e7a-36625cb24ee6 | 5 | public void layout () {
if (sizeInvalid) {
computeSize();
if (lastPrefHeight != prefHeight) {
lastPrefHeight = prefHeight;
invalidateHierarchy();
}
}
SnapshotArray<Actor> children = getChildren();
float groupWidth = getWidth();
float x = 0;
float y = getHeight();
float maxHeight = 0;
fo... |
e18c898c-69a1-4f48-9d37-39661359c3ca | 1 | public static boolean isThis(Expression thisExpr, ClassInfo clazz) {
return ((thisExpr instanceof ThisOperator) && (((ThisOperator) thisExpr)
.getClassInfo() == clazz));
} |
205de220-ebb3-4227-8fa7-01ce78f6c5a8 | 2 | private void applyRegexHighlighting(JTextComponent comp, Pattern pattern) {
Matcher matcher = pattern.matcher(comp.getText());
Highlighter h = comp.getHighlighter();
h.removeAllHighlights();
while(matcher.find()) {
try {
h.addHighlight(matcher.start(), matcher.end(), regexP... |
b96bdc01-5d00-4924-9740-8122f2e83442 | 5 | public void removeFiles(List<String> names) {
if (names == null) {
throw new IllegalArgumentException("names is null");
}
boolean changed = false;
for (String name : names) {
if (name == null) {
throw new IllegalArgumentException("names contains a ... |
b43447e5-3a00-47d2-8ce9-a488cf7fcc3c | 9 | public TupleFour<String[], Integer, String, String[]> [] countNetLogoTurtles(TupleFour<String[], Integer, String, String[]> [] agentDetails) throws Exception {
TupleFour<String[], Integer, String, String[]> [] returnArray = agentDetails;
int typesOfAgent = 0;
int noAgentsFound = 0;
while(true) {
try... |
c5772cf2-6c34-4be5-8975-074d42d5f6db | 4 | public void handleKeyRelease(int value) {
switch (value) {
case MinuetoKeyboard.KEY_UP:
this.keyUp = false;
break;
case MinuetoKeyboard.KEY_LEFT:
this.keyLeft = false;
break;
case MinuetoKeyboard.KEY_RIGHT:
this.keyRight = false;
break;
case MinuetoKeyboard.KEY_DOWN:
this.ke... |
12d316f8-3b78-42b0-be1d-476fefaf799d | 4 | private void teleport(CommandSender sender, String[] args) {
if (!sender.hasPermission("graveyard.command.teleport")) {
noPermission(sender);
return;
} else if (!(sender instanceof Player)) {
noConsole(sender);
return;
}
if (args.length == ... |
23a8de0e-877d-4aa5-a2a7-36d2c639c71d | 3 | public static ArrayList<BufferedImage[]> loadMultiAnimation(int[] frames, int width, int height, String path){
try {
ArrayList<BufferedImage[]> sprites;
final BufferedImage spritesheet = ImageIO.read(Images.class.getClass().getResourceAsStream(path));
sprites = new ArrayList<BufferedImage[]>();
for (int... |
6b772d45-d264-43d0-9976-d20122f76f73 | 5 | static public String removeExtraSlash(String inStr)
{
int slashLoc = inStr.indexOf("://");
int l = inStr.length();
int hold = slashLoc + 3;
slashLoc = inStr.indexOf("//", hold);
while (slashLoc > 0 && slashLoc < l)
{
hold = slashLoc;
while (hold < l && inStr.charAt(hold) == '/')
hold ++;
if (h... |
a359e85b-6d09-4f7a-b620-55a054506a18 | 8 | private void processInheritanceMap() {
for (Iterator<String> it = inheritenceMap.keySet().iterator(); it.hasNext(); ) {
String childType = it.next();
String parentType = inheritenceMap.get(childType);
if (!childType.isEmpty() && !parentType.isEmpty()) {
VariableMap childAttrs = typeAttrMap.get(... |
cac7d41e-ff0b-41d4-8089-2dfd6aabcea5 | 4 | public void resetAllGameActions() {
for (int i=0; i<keyActions.length; i++) {
if (keyActions[i] != null) {
keyActions[i].reset();
}
}
for (int i=0; i<mouseActions.length; i++) {
if (mouseActions[i] != null) {
mouseActions[i].re... |
0c1ab93b-9aca-4e79-9d75-27492cbf9252 | 7 | public String toString() {
String s = (returnType != null) ? returnType.debugName() : "NULL TYPE"; //$NON-NLS-1$
s += " "; //$NON-NLS-1$
s += (selector != null) ? new String(selector) : "UNNAMED METHOD"; //$NON-NLS-1$
s += "("; //$NON-NLS-1$
if (parameters != null) {
if (parameters != Binding.NO_PARAMETERS) {
... |
54ba9ff4-2cc0-4976-94f5-7fef0e7652b7 | 0 | public initiateRemoval()
{
this.requireLogin = true;
this.addParamConstraint("id", ParamCons.INTEGER);
this.addRtnCode(405, "permission denied");
this.addRtnCode(406, "venue not found");
this.addRtnCode(407, "already removing");
} |
2dff48c6-a4dc-464a-9c57-1d5b4bae7793 | 1 | private void acao139() throws SemanticError {
int numeroEsperado = idMetodoChamado.getParametros().size();
if(numeroParametrosAtuais != numeroEsperado)
throw new SemanticError("Número de parâmetros atuais deveria ser "
+ numeroEsperado);
} |
05cc0d1b-e59b-4ac8-93b6-c502201e187c | 5 | public boolean estCleValable(String k) {
int i=0;
boolean trouve=false;
while(i<k.length() && !trouve) {
if(!ALPHABET.contains(""+k.charAt(i))&&!ALPHABET.toUpperCase().contains(""+k.charAt(i))&&(k.charAt(i)!=' ')) {
trouve=true;
JOptionPane.showMessageDialog(null, "Veuillez saisir une cl constitue uniq... |
2333adad-5fff-4460-9821-d11dcec9a0fc | 2 | @Override
public void actionPerformed(ActionEvent e) {
try {
JFileChooser chooser = new JFileChooser();
UIManager.put("FileChooser.fileNameLabelText", "Имя файла:");
UIManager.put("FileChooser.saveInLabelText", "Каталог:");
UIManager.put("FileChooser.filesOfTypeLa... |
362395c7-8380-4e14-9949-352efa802fbd | 7 | @Override
public void move(){
if(side == true){
if(!engine.getPhysics().canMove(this, this.getLocation().getX()+5, this.getLocation().getY()+5))
engine.getPhysics().usePhysics(this, this.getLocation().getX()+5, this.getLocation().getY());
else
{
side = false;
setNext(1);} ... |
4cd781b3-86d2-4367-a44c-cfdf67b10e4b | 9 | public static LevelState getLevel(int level) {
Gilbert gilbs;
ArrayList<Planet> planetsArray;
Collectable collect;
switch (level) {
case 1:
// gilbert
gilbs = new Gilbert(800, 600, -1, 0);
// planets array
planetsArray = new ArrayList<>();
planetsArray.add... |
0904d56f-2afb-451c-9599-59691e4e1a0d | 0 | public MicroRequestHandler(Vector<File> imageQueue) {
this.imageQueue = imageQueue;
} |
cc7495b8-97ca-4f07-8faa-f71dc5a94018 | 6 | private TreeElement handleClass(HashMap classes, ClassInfo clazz) {
if (clazz == null)
return root;
TreeElement elem = (TreeElement) classes.get(clazz);
if (elem != null)
return elem;
elem = new TreeElement(clazz.getName());
classes.put(clazz, elem);
if (!clazz.isInterface()) {
ClassInfo superCla... |
e991b5cf-7426-439d-a067-1ad237c58a6e | 9 | private long parseFileDate(String age, String fileName, String folderPath) {
Pattern p = Pattern.compile(" ");
String [] splitted = p.split(age);
long count = Long.parseLong(splitted[0]);
long date = (new Date()).getTime();
long fileDate = 0;
long step = 0;
if (sp... |
99024dcd-6d80-447d-b9c7-8b0e33f10372 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CanDDeliveryOrderItemDetailPK other = (CanDDeliveryOrderItemDetailPK) obj;
if (!Objects.equals(this.szDoc... |
375a9c44-8033-4201-9577-589004e144b4 | 8 | public void run() {
ar.configure(ClientActionRobot.intToByteArray(id));
//load the initial level (default 1)
ar.loadLevel();
GameState state;
while (true) {
state = solve();
//If the level is solved , go to the next level
if (state == GameState.WON) {
System.out.println(" loading... |
fdc87974-f648-403b-8525-968135f9c544 | 6 | public static int findKth(int[] A, int A_start, int[] B, int B_start, int k) {
if (A_start >= A.length)
return B[B_start + k - 1];
if (B_start >= B.length)
return A[A_start + k - 1];
if (k == 1)
return Math.min(A[A_start], B[B_start]);
int A_key = A_start + k / 2 - 1 < A.length ? A[A_start + k / 2 ... |
66644230-331d-435b-9f3d-f71944dd5f6e | 4 | public Timer getTimer() {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: getTimer() BEGIN");
}
if (test || m_test) {
System.out.println("Game :: getTimer() END");
}
return m_timer;
} |
ad7dbfb9-7811-4592-beea-d2042809794e | 9 | static private void setDB(int skipStage) {
try {
//First we try and see if we have our databasefile in the same working directory
String pa = Paths.get("").toAbsolutePath().toString() + File.separator + "MICEDB.FDB";
DB.setPath(pa);
} catch (InfException e) { // we di... |
9f9c96c4-ae37-47d7-8098-84e31ed184a7 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuilder sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new St... |
b480aade-233f-437b-a526-e33124852e8d | 0 | public ClientInfo(String t_name, String t_ip, int t_portId) {
name = t_name;
ip = t_ip;
portId = t_portId;
} |
166521f5-b42b-45ae-8e20-257f90d8fd1a | 1 | private static String getCommandName(String commandAsStr) {
int whiteSpaceIndex = commandAsStr.indexOf(" ");
if (whiteSpaceIndex == -1) {
return commandAsStr;
}
String commandName = commandAsStr.substring(0, whiteSpaceIndex);
return commandName.trim();
} |
228bb677-1e57-4065-86b8-f4b560e08ef1 | 7 | public void test(){
assert state == State.OK;
// get the internal thread number
int i = getInternalThreadId();
// activate
setState(i, State.GUARD);
try{Thread.sleep(1+i);}catch(Throwable ignore){};
// guard
if( getState(i+1) != State.IDLE ){ setState(i, State.WAIT); }
else{ setS... |
4946502e-8853-4205-8a33-5ea04e4a588f | 7 | public static void startupQuery() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module... |
6defd0a4-d6ba-41ff-a7b2-cb0893305886 | 1 | public static int HeapExtractMax(List<Integer> array){
if(array.size() < 1){
System.out.println("Nothing in heap...");
}
int maximum = array.get(0);
array.set(0, array.get(array.size()-1));
array.remove(array.size()-1);
MaxHeapify(array, 1);
return maximum;
} |
019a19ac-da64-40c1-aea5-3988ca0246f4 | 4 | public static int check(Point point, Rectangle bounds) {
int value = 0;
if (point.x == bounds.left) {
value |= LEFT;
}
if (point.x == bounds.right) {
value |= RIGHT;
}
if (point.y == bounds.top) {
value |= TOP;
}
if (poi... |
b2f05697-1c01-430b-92e1-be729f4bc667 | 9 | private void doType(int keycode) {
boolean shift = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << SHIFT)) != 0));
boolean ctrl = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << CTRL)) != 0));
boolean alt = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << ALT)) != 0)... |
c36813a8-6b3a-41d3-82e1-83b282646d25 | 5 | public boolean type(char key, java.awt.event.KeyEvent ev) {
if ((key >= '0') && (key <= '9')) {
int opt = (key == '0') ? 10 : (key - '1');
if (opt < menuOptions.length)
wdgmsg("cl", opt);
ui.grabkeys(null);
return (true);
} else if (key == ... |
1edcd888-fc4a-49f4-b2d6-1fd03bc92862 | 4 | public static void updateLocale(Language language) {
String l = Settings.getLocaleLanguage().getLanguageString();
String c = Settings.getLocaleLanguage().getCountryString();
Locale currentLocale = new Locale(l, c);
PropertyResourceBundle localeRes = null;
try (FileInputStream fi... |
85c07311-509d-4a65-a543-01c78d988c17 | 4 | @Override
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken) throws AuthenticationException {
String password = (String)usernamePasswordAuthenticationToken.getCredentials();
if (!StringUtils.hasText(password)) {
l... |
4c463f5b-4df6-48a2-8e6f-b036d1f28ee2 | 7 | public void processBill()
{
QueryWarehouse bank = new QueryWarehouse();
Date date = new Date();
String currentDate = df.format(date);
int compid = this.getCompanyIdCombo(comboCompany.getSelectedIndex());
String tempQuery = "insert into joincompany_member_hdr (billdt) values (... |
7664c34d-a683-4959-9d7b-188d97d905ce | 5 | public static void main(String[] args) {
try {
List<Thread> threads = new ArrayList<Thread> (CLIENTS);
JobDispatcher dispatcher = new JobDispatcher();
dispatcher.start();
JobProcessingService service1 = new JobProcessingService("1");
JobProcessingService service2 = new JobProcessingService("2");
J... |
6230ce69-5e59-478f-8035-9ed669f30c95 | 9 | public void insert(Player player) throws NamingException
{
String INSERT_STMT="insert into player(name,address,city,province,postal_code) values(?,?,?,?,?)"; // JDBC variables
DataSource ds = null;
Connection connection = null;
PreparedStatement insert_stmt = ... |
d3bd5d88-ebc0-46a4-aa3e-0d37b9d2665a | 1 | public AttributeInfo copy(ConstPool newCp, Map classnames)
throws RuntimeCopyException
{
try {
return new StackMapTable(newCp,
new Copier(this.constPool, info, newCp).doit());
}
catch (BadBytecode e) {
throw new RuntimeCopyException... |
c45a8533-d990-4286-9823-2cc9436fc589 | 6 | protected <T> boolean checkIColors(T obj1, T obj2) {
/** Convert IColor-s from the colors teachpack to java.awt.Color */
if (obj1.getClass().getName().equals("colors.Red"))
return obj2.getClass().getName().equals("colors.Red");
if (obj1.getClass().getName().equals("colors.White"))
return obj2.getClass().get... |
734b29b5-d8a3-4271-aa65-d0b2eb82dc4c | 4 | public void visitInnerClass(final String name, final String outerName,
final String innerName, final int access) {
if (innerClasses == null) {
innerClasses = new ByteVector();
}
++innerClassesCount;
innerClasses.putShort(name == null ? 0 : newClass(name));
innerClasses.putShort(outerName == null ? 0 : n... |
fdba7027-5647-47f9-a8b6-96852f160d1c | 2 | private void addReference(final int sourcePosition,
final int referencePosition) {
if (srcAndRefPositions == null) {
srcAndRefPositions = new int[6];
}
if (referenceCount >= srcAndRefPositions.length) {
int[] a = new int[srcAndRefPositions.length + 6];
System.arraycopy(srcAndRefPositions, 0, a, 0,
... |
65813939-8f5c-43fb-b640-1fa326b5e22e | 8 | public void generarDOT_DesdeArchivo() {
FileWriter archivoAutomata = null;
PrintWriter pw = null;
nombreAutomata = JOptionPane.showInputDialog("Por favor, indique el nombre del archivo DOT que describe al automata");
this.nombreAutomata += ".dot";
try {
//archivoAutom... |
2890add8-e7d5-4fc6-a44c-c5f357f7dc5f | 2 | public Model(int col, int row) {
this.board = new CellState[col][row];
for (int j = 0; j < row; ++j) {
for (int i = 0; i < col; ++i) {
this.board[i][j] = CellState.EMPTY;
}
}
// nextPlayer();
} |
93b0db74-7b37-4af8-b17d-5d2937e92048 | 7 | public DefaultHandler(boolean consoleLogging, String fileName)
throws FreeColException {
this.consoleLogging = consoleLogging;
File file = new File(fileName);
if (file.exists()) {
if (file.isDirectory()) {
throw new FreeColException("Log file \"" + fileName
... |
dd767bdd-6e95-4b66-bb17-2f2d1e83132f | 1 | public boolean handles(HTTPRequest req)
{
return req.getPath().matches(PATH)&&req.getHost().matches(HOST);
} |
b62d1478-e845-4bd4-bca3-5ddaf8ef4c08 | 2 | protected void powerUpTimer() {
int type = (int) (Math.round(Math.random() * 5));
powerUpList.add(new PowerUp(type));
if (fixedSpeed == false) {
ball.increaseSpeed();
}
//A chance to create a black hole is 1/6
if (type == 0) {
isBlackHole = true;... |
514f3162-e839-48a7-986c-f13234ff34bc | 9 | public void chasePlayer(){
if(abs(this.x - player.getX()) > abs(this.y - player.getY())){
if(player.getX() < this.getX()){
this.dx = -1;
if(this.dy > 0){
dy -= .03;
}
else{
dy += .03;
}
}
if(player.getX() > this.getX()){
this.dx = 1;
if(this.dy > 0){
dy -= .03;
... |
b6e6ef75-d786-4f78-ac3b-03ce48f4f7f6 | 0 | public void setHasVisited(boolean hasVisited) {
this.hasVisited = hasVisited;
} |
52b5926d-8199-48b0-9ccb-7039bbdf5cbd | 0 | public int getEndLineNumber() {
return endLineNumber;
} |
6c5c20ff-6327-40af-bf84-449d60a1394b | 5 | private void formPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_formPropertyChange
if (evt.getPropertyName().equals("LadattuProfiili")) {
if (palkanlaskenta.getProfiili() != null) {
LadattuProfiili.setText(palkanlaskenta.getProfiili().toString());
}... |
61685db1-766b-4d0f-85bb-d39df686c1db | 5 | public void jasmin() {
try{
// jasmine uses a ".j" extension by default
String name = browseClass() + ".j";
String fileName = parseFileDir(name) + parseFileName(name) + "." + parseFileExt(name);
// make sure there is a place to put it
if (!parseFileDir(name).equals(""... |
41c591ca-5f81-42ef-92e3-d3b78ad70b92 | 6 | @Override
public void load() {
if (vertexLocation != null) {
ResourceText txt = ResourceManager.getText(vertexLocation);
txt.load();
vertexSource = txt.getText();
}
if (fragmentLocation != null) {
ResourceText txt = ResourceManager.getText... |
9ad0cb66-53ce-4233-ae71-27494d35d6b9 | 5 | private void loadHashMap() {
// load from a file formatted like this:
// #HEX color
// e.g #FFFFFF white
File colorMap = new File("colormap.txt");
try {
BufferedReader in = new BufferedReader(new FileReader(colorMap));
while (in.ready()) {
String line = in.readLine();
// make sure it matches the... |
241c14e9-bd96-40db-baca-8ff8c7b6d450 | 3 | private void performFileActions() throws Exception {
if(!PERFORM_FILE_ACTIONS)
return;
for(IFile fileAction : fileActions) {
if(fileAction == null)
break;
fileAction.perform();
fileAction.shutdownNow();
}
} |
e9fe701a-6524-4c42-a57c-62901c5f108f | 9 | public boolean isAnagrams(String a, String b) {
if (a == null || b == null) {
return false;
}
if (a.isEmpty() || b.isEmpty()) {
if (a.isEmpty() && b.isEmpty()) {
return true;
} else {
return false;
}
}
if (a.length()!=b.length()){
return false;
}
int l=a.length();
for(int i=0;i<l... |
fe3385af-7828-4732-8fa8-ba0d660b7764 | 3 | @Override
public void update(GameContainer gc, int d) throws SlickException {
for (int x = 0; x < tiles.length; x++){
for (int y = 0; y < tiles[x].length; y++){
if (tiles[x][y] != null)
tiles[x][y].update(d);
}
}
} |
b78b77f8-7cec-4a00-aee4-7681e7b91687 | 4 | public static List<Command> readList(String pathName) {
List<Command> list = new ArrayList<Command>();
ObjectInputStream oin = null;
try {
File f = new File(pathName);
if (f.exists()) {
oin = new ObjectInputStream(new BufferedInputStream(
new FileInputStream(f)));
list = (List<Command>)oin.read... |
93e9dd68-feea-4eaf-adaf-227bf5028e9e | 5 | public static String getDynamicStorageLocation () {
if (CommandLineSettings.getSettings().getDynamicDir() != null && !CommandLineSettings.getSettings().getDynamicDir().isEmpty()) {
return CommandLineSettings.getSettings().getDynamicDir();
}
switch (getCurrentOS()) {
case WIND... |
c2c1e91f-1605-4cfc-aaa6-139b3b1d2a70 | 3 | public BigDecimal median_as_BigDecimal() {
BigDecimal median = BigDecimal.ZERO;
switch (type) {
case 1:
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
median = Stat.median(bd);
bd = null;
break;
case 14:
throw new IllegalArgumentException("Complex median value not supported");
defa... |
35ad2f6d-7f94-4f1a-b001-b1db66ee94b1 | 4 | private Object executeExpression(Value value, EntityMapping entity, ColumnMapping column, ResultSet records){
Object result_value = null;
if(value == null){
return result_value;
}
if(value instanceof SqlValue){
return executeSql(value,entity,column,records);
... |
dd63f51b-a0db-4a67-8f58-f8aad15e70b7 | 1 | public void visitAddressStoreStmt(final AddressStoreStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
genPostponed(stmt);
final Subroutine sub = stmt.sub();
Assert.isTrue(sub.returnAddress() != null);
method.addInstruction(Opcode.opcx_astore, sub.returnAddress());
stac... |
e211adbe-0e87-474f-86d8-9e72117cb0a6 | 6 | private void createToolBar(Composite parent) {
ToolBar toolbar = new ToolBar (parent, SWT.NONE);
String group = null;
for (int i = 0; i < tools.length; i++) {
Tool tool = tools[i];
if (group != null && !tool.group.equals(group)) {
new ToolItem (toolbar, SWT.SEPARATOR);
}
group = tool.group;
Too... |
391196f2-e79f-4555-9bcb-2b00e157ce67 | 4 | @Override
public double getDblVal()
{
String s = getStringVal();
try
{
Double d = new Double( s );
return d;
}
catch( NumberFormatException n )
{
getXfRec();
if( myxf.isDatePattern() )
{ // use it
try
{
String format = myxf.getFormatPattern();
WorkBookHandle.simpledateform... |
3a8900a0-eaf9-40ab-a8f9-7959db79a10d | 9 | static boolean checkUUIDFormat(String uuid)
{
boolean result = true;
int delimCnt = 0;
int delimPos = 0;
if (uuid == null)
{
return false;
}
for (delimPos = 0; delimPos < uuid.length(); delimPos++)
{
if (uuid.charAt(delimPos) == '-')
{
delimCnt++;
result = result &&
(delimP... |
9f825305-3ba8-48bc-8774-c0949164f1b2 | 5 | public static int calcvalue(String token)
{
int result = 0;
if (token.equals("RA"))
{
return backend.Register.r[15].b;
}
else if (token.equals("SP"))
{
return backend.Register.r[14].b;
}
else if (token.startsWith("R"))
... |
fcfa6836-9e45-4fc1-912c-54587d5eb240 | 0 | private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton6ActionPerformed
{//GEN-HEADEREND:event_jButton6ActionPerformed
world.choiceMade("right");
}//GEN-LAST:event_jButton6ActionPerformed |
90a973cc-3e61-4dcf-857b-6939ac45e642 | 1 | public void draw(Graphics g)
{
for (int i = 1; i < body.size(); i++) {
int x = body.get(i).getX();
int y = body.get(i).getY();
g.setColor(Color.GREEN);
g.fillRect(x, y, Block.WIDTH, Block.HEIGTH);
g.setColor(Color.BLACK);
g.drawRect(x, ... |
fa69416c-154c-48c0-a987-271ded28bad4 | 6 | public void onEnable() {
//Fill our hashmap of material aliases with the ones permitted.
PopulateMaterials();
//Load the markets, deliveries and revenue
load();
//If we didn't load the markets, make them
if(markets == null) {
markets = new HashMap<Material, Market>();
for( Material mat : ... |
d4fdccb4-0971-47f9-a4a2-5849574e1c7c | 5 | public static void main(String[] args) throws FileNotFoundException, JSONException, IOException {
CommonParameters commonParams = new CommonParameters();
CommandSubmit submitCommand = new CommandSubmit();
CommandStatus statusCommand = new CommandStatus();
CommandCancel cancelCommand = new CommandCancel();
Com... |
30a7db49-5146-4883-b34b-babdeb7b5555 | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String firstArg, String[] args) {
/*
* /---- [arena, list, join]
* | /---- [arenaName]
* | | /---- [create, delete, set, check, regen, reload]
* | | | ... |
c54eb715-ac37-46bc-99b0-694e32399674 | 7 | public static void writePredictionsToFile(String testFile, String outputFileName, HashMap<Long, HashMap<Long, Double>> ratingPredictions) throws IOException{
FileWriter fileWriter = new FileWriter(outputFileName);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
Scanner scan = new... |
5a6ef359-4b8e-4343-b47f-13293b6b1e44 | 8 | public Method getSetter(String aname, BaseModelMBean bean, Object resource)
throws AttributeNotFoundException, MBeanException, ReflectionException {
// Cache may be needed for getters, but it is a really bad idea for setters, this is far
// less frequent.
Method m=null;//(Method)se... |
f4c7297e-9922-435b-980d-ce00d9b40e18 | 9 | public void setTableSwitchJump(int switchStart, int caseIndex,
int jumpTarget)
{
if (!(0 <= jumpTarget && jumpTarget <= itsCodeBufferTop))
throw new IllegalArgumentException("Bad jump target: "+jumpTarget);
if (!(caseIndex >= -1))
throw new ... |
fed7e410-e1d3-4d06-a2b2-e9a13372acd5 | 0 | public String getBlogLabel() {
return blogLabel;
} |
6009d682-8d12-4263-b349-a85d7aaaab0f | 4 | private LicenseNumber(String nameIdentifier, int yearOfIssue, int serialNumber, String stringRepresentation){
this.nameIdentifier=nameIdentifier;
if(nameIdentifier.isEmpty())
throw new IllegalArgumentException("The name Identifier is null");
Date date = new Date();
Calendar cal = new Grego... |
d5ff212d-4a56-4c2d-8d21-31dcc31e7e11 | 7 | final public String TableRow() throws ParseException {
String s;
final StringBuffer buf = new StringBuffer();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING:
label_3:
while (true) {
s = jj_consume_token(STRING).image;
buf.append(s);
s... |
6ed40129-42a7-4b56-8f9e-511a5add23e1 | 5 | @Test
public void smallBoardWithKingAndQueen() {
Map<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KING.toString(), 1);
figureQuantityMap.put(QUEEN.toString(), 1);
int dimension = 2;
Set<String> boards = prepareBoardsWithKingAndQueen(figureQuant... |
2d7066da-2534-4175-a7ec-5c29f046365b | 1 | private void initializeApp() {
manager = Manager.getInstance();
for (Disc disc : manager.getDiscs().getDiscs()) {
discSelector.addItem(disc.getName());
}
currentProfile = manager.getProfiles().get("andersonmaaron");
currentCourse = manager.getCourses().get("G... |
3fd14881-2eec-414f-ad07-9ba98b5ab3d5 | 8 | @Override
public void unInvoke()
{
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if(canBeUninvoked())
doneTicking=true;
super.unInvoke();
if(canBeUninvoked() && (mob!=null))
{
final Room R=mob.location();
if((R!=null)&&(!mob.amDead()))
{
final CMMsg msg=CMClass.get... |
178827b2-b07e-49ad-8d40-513dd5b173f1 | 9 | public GetKeyDialog(JDialog owner, String title, boolean modal) {
/** call base class constructor */
setTitle(title);
setModal(modal);
/** setup pointer to point to itself */
me = this;
/** add keyboard event handler */
addKeyListener(... |
1edcb278-1dae-45b7-88e8-b7433e6c83c2 | 8 | private void movement(Ship[] ship){
//Hier werden die Bewegungen der einzelnen Schiffe durchgeführt.
Ship s; //Das derzeitige Schiff
Ship t; //Das Ziel von s
double movement; //Die nötige Bewegung um den Befehl zu erfüllen
double distance; //Der Abstand zwischen s und t
for (int i = 0; i < ship.... |
3ad9a9e4-0fde-40a6-a90a-0f17e5ef122b | 1 | public void visit_fadd(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
da6196f9-cfef-402b-8f28-37f8f972f902 | 0 | public int getVersionCode() {
return this.versionCode;
} |
f000d0fb-b28f-4b8c-972e-c619c5ab6c4e | 3 | @EventHandler(priority = EventPriority.NORMAL)
public void onPickupItem(PlayerPickupItemEvent event){
Player player = event.getPlayer();
if(!player.hasPermission("NodeWhitelist.Whitelisted")){
if(!whitelistWaive.isWaived(player)){
if(!Config.GetBoolean("NoneWhitelisted.Restraints.Interact")){
event.setCa... |
fd4add4d-a255-4ae3-920a-8a0a13060f4a | 8 | public void serverReceiveMessages() {
String input;
String inPart1;
String inPart2;
try {
input = inClient.readLine();
if(input != null) {
String pattern = "^([A-Z]+:)([a-zA-Z0-9:\\s]*)$";
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(input);
//the communication from the clie... |
6f50a376-df6e-4c3b-9997-5aa839e7723e | 7 | @Override
public void setKeyState(int key, boolean state)
{
byte index = -1;
if(key == settings.forwardKey.key)
{
index = 0;
}
if(key == settings.backKey.key)
{
index = 1;
}
if(key == settings.leftKey.key)
{
index = 2;
}
if(key == settings.rightKey.key)
{
index = 3;
}
if(k... |
031e62d1-df32-487a-a97f-6acbc32eebed | 3 | @Override
public void paint ( Graphics gr )
{
initDraw(gr); //Clean the Frame.
switch(actualRole)
{
case PreGame:
DrawPreGame(gr);
break;
case Contributor:
DrawNumbersToInstantiate(gr);
DrawGrid(gr);
break;
default:
if (state == GameState.game) {
DrawGrid(gr);
}
break;
... |
d7f7c2fa-505b-4b7a-bd44-394c5a5e626b | 1 | static void tuneAll(Instrument[] e) {
for (Instrument i : e)
tune(i);
} |
5e3423a3-5787-4b89-954e-6a7ab5844160 | 2 | protected void drawTransitions(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Set arrows = arrowToTransitionMap.keySet();
Iterator it = arrows.iterator();
while (it.hasNext()) {
CurvedArrow arrow = (CurvedArrow) it.next();
if (arrow.myTransition.isSelected){
arrow.drawHighlight(g2)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.