method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
20434b80-27eb-4c50-806f-1755a20dda5b | 2 | @Override
public void salvar(Funcionario funcionario, Acesso acesso) {
try {
conn = ConnectionFactory.getConnection();
String sql = "INSERT INTO funcionario (id, nome, login, senha, idacesso, cpf) " +
"VALUES ((SELECT NVL(MAX(id),0)+1 FROM FUNCIONARIO), ?, ?,... |
eb7fabc3-7910-4f02-a702-cb998c921045 | 7 | public boolean requirementsMet(boolean delayed, World world, Location sLoc, int time, int lightLevel, Biome biome, Material materialBelow, Environment environment)
{
if (!delayed && delayRequirementsCheck)
return true;
// If the mobs alive limit is reached we can't spawn any more of this mob
if (!withinAli... |
6a981d19-7772-4bc1-a6a7-6045f077bd44 | 5 | public double getSternLayerPotential(){
if(!this.sternOption){
System.out.println("Class: GouyChapmanStern\nMethod: getSternLayerPotential\nThe Stern modification has not been included");
System.out.println("The value of zero has been returned");
return 0.0D;
}
... |
cded5853-5b65-4ddb-9f4a-0918eceec3e8 | 2 | public Matrix4f mul( Matrix4f r )
{
Matrix4f res = new Matrix4f();
for ( int i = 0; i < 4; i++ )
{
for ( int j = 0; j < 4; j++ )
{
res.set( i, j, m[i][0] * r.get( 0, j ) +
m[i][1] * r.get( 1, j ) +
m[i][2] * r.get( 2, j ) +
m[i][3] * r.get( 3, j ) );
}
}
return res;
} |
7871f0d3-5b5a-4c5b-b9d8-ba78229bd978 | 9 | private static String getXmlProlog( BufferedInputStream is, String guessedEnc ) throws IOException
{
String encoding = null;
if ( guessedEnc != null )
{
byte[] bytes = new byte[BUFFER_SIZE];
is.mark( BUFFER_SIZE );
int offset = 0;
int max = BUF... |
490894ac-7d5a-4422-82e0-52ec59cd5da5 | 1 | public int totalNQueens(int n) {
String []board= new String[n];
char[] init = new char[n];
Arrays.fill(init, '.');
for (int i =0; i < n ;i++ ) {
board[i]= new String(init,0,n);
}
nextQueens(board,0,n);
return list.size();
} |
0184d6d7-9862-4b6f-975d-9566642f204c | 0 | public Newspaper getNewspaper() {
return newspaper;
} |
33d30500-cdac-4c92-bcec-38fa26f9f925 | 4 | public static void main(String[] args) {
int start = 0, end = 100;
/*if (args.length > 0) {
start = Integer.parseInt(args[0]);
end = Integer.parseInt(args[1]);
}*/
Solver solver = new Solver();
try {
solver.readDictionary("files/dicio.txt");
... |
ea8a257e-ec82-44a3-b637-07d1afca791a | 5 | public void update(TetrisBoard board, TetrisEngine.MovementSequence sequence){
refreshBoardView(board);
if(sequence != null) {
//Mise à jour du tetromino
for (int i = 0; i < sequence.getWorkingTetromino().getWidth(); i++) {
for (int j = 0; j < sequence.getWorkin... |
4f3a445e-21d7-4396-8187-b24b2cd20bb5 | 1 | public void endMethod() {
if ((access & Opcodes.ACC_ABSTRACT) == 0) {
mv.visitMaxs(0, 0);
}
mv.visitEnd();
} |
639c5488-4752-475a-8c20-3432cbcc70d0 | 8 | public void findPatternNaive(String string, String pattern) {
if (string == null || pattern == null) {
System.out.println("String or pattern null ");
return;
}
int stringlen = string.length();
int patternlen = pattern.length();
for (int i = 0; i < stringlen - patternlen; i++) {
if (string.charAt(... |
a4a15466-9e93-44a2-8c93-bd2bf8ba19b1 | 7 | private void expressionStart() {
while (pos < numRead) {
if (!(buf[pos] == '{' || buf[pos] == '}')) {
break;
}
pos++;
}
if (pos < numRead) {
Operator operand = OperatorFactory.getOperator(buf,
startTokenPos, pos ... |
0d5d46bc-49f7-4eed-a26a-cfe2fa589f3f | 3 | public static void buttonVerify(ActionEvent e)
{
try
{
boolean verified = API.verify(new File(Main.panelVerify.fieldFile.getText()), Main.panelVerify.fieldPublicKey.getText(), Main.panelVerify.fieldSignature.getText());
if (verified)
{
String pubkey = Main.panelVerify.fieldPublicKey.getText();
Str... |
3e08b46f-4cd5-4fb1-a316-454a43a89117 | 6 | public void renderParticles(Entity var1, float var2) {
float var3 = MathHelper.cos(var1.rotationYaw * 3.1415927F / 180.0F);
float var4 = MathHelper.sin(var1.rotationYaw * 3.1415927F / 180.0F);
float var5 = -var4 * MathHelper.sin(var1.rotationPitch * 3.1415927F / 180.0F);
float var6 = var3 * Math... |
b73fc268-a4ac-42e5-9733-fc1128be7fc8 | 5 | private List<Task> createTaskSnapshot() {
List<Task> taskSnapshot = new ArrayList<Task>();
List<Task> finishedTasks = new ArrayList<Task>();
for(Task task : runningTaskStats.values()) {
if(task instanceof MapTask) {
taskSnapshot.add(new MapTask((MapTask)task));
} else if(task instanceof ReduceTask) {... |
108d49e6-b33d-496b-8755-ce0f208db941 | 4 | @Override
public void run() {
try {
while (true) {
synchronized (this) {
this.isDone = true;
this.action = null;
while (this.action == null) {
this.println("waiting for an action");
this.wait();
}
this.isDone = false;
this.send(this.action, cloudChannel);
// outp... |
63f9254f-ecbb-482e-a7e6-e46174e6a8ef | 1 | public boolean Step(int direction)
{
// Get the offset
int offset_x = Directions.getOffsetX(direction);
int offset_y = Directions.getOffsetY(direction);
// Get the new tile by adding the offset to the current location
int other_x = this.getX() + offset_x;
int other_y = this.getY() + offset_y;
// TO... |
350ef6b6-4b5e-4be2-93ac-425fdcd5573f | 3 | public int GetDateFrom(Date DateTime, DateFormat Format)
{
switch(Format)
{
case Seconds:
{
return (int) ((new Date().getTime() - DateTime.getTime()) / 1000);
}
case Minutes:
{
return 0;
}
case Hours:
{
return 0;
}
}
return 0;
} |
19e9d8e2-4385-4343-9c7a-3f60ac797df5 | 8 | void calcNormals() {
debugOutputLn(TRACE, "calcNormals()");
debugOutputLn(LINE_TRACE, "coordsLength, facetsizes.len = " +
coordsArray.length + ", " + facetSizes.length);
if (facetSizes[0] > 2) {
// points and lines don't need normals, polys do
if (facetIndices != null) {
normalIndices =... |
83135475-7c75-4c91-8a42-1357dc028699 | 8 | protected void checkForDuplicateControlIDs() throws FIXatdlFormatException
{
// -- Note getAtdl4jWidgetMap() constructs a new Map --
Collection<Atdl4jWidget<?>> tempAtdl4jWidgetMapValues = (Collection<Atdl4jWidget<?>>) getAtdl4jWidgetMap().values();
for ( Atdl4jWidget<?> widget : tempAtdl4jWidgetMapValues )
... |
dda6e968-21dc-4f5d-8802-3029faf5197b | 9 | public int longestValidParentheses_naive(String s) {
if (s == null || s.length() == 0)
return 0;
char[] arr = s.toCharArray();
int len = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] == ')')
continue;
else {
int count = 1;
for (in... |
82f8a661-d17d-45fe-903f-654dc19b7d6e | 9 | @Override
public int compareTo(TimeStampedMessage secondMsg) {
//this message is < secondMsg if every value in this Set is < every value in secondMsg Set
HashMap<String, TimeStamp> secondMsgTS = secondMsg.getTimeStamp();
Boolean testing = true;
for(String name : msg_timestamp.keySet()){
if(!msg_timestamp.ge... |
e5b1290c-587c-416b-b871-0dfb9b26432a | 8 | public static void init(String resource) throws FileNotFoundException, IOException, MyException {
ClientGlobal.config = new Config(resource);
String[] szTrackerServers;
String[] parts;
g_connect_timeout = config.getIntValue("connect_timeout", DEFAULT_CONNECT_TIMEOUT);
if (g_con... |
3b750cdd-7a3f-4bf3-9ee8-a62b4cf85c1b | 7 | private static int[][] FileToGraphArray(String dat) {
int[][] A = null;
FileInputStream fis = null;
try {
fis = new FileInputStream(dat);
} catch (Exception e) {
System.out.println(dat + " konnte nicht geoeffnet werden");
System.out.println(e.getMessage());
}
try {
InputS... |
9120d805-b85a-41db-9f3e-d6ea8f5fd5e1 | 7 | public void majNumObjetSelec(Tuple mouse) {
for (int i = 0; i<5; i++) {
for (int j = 0; j<5; j++) {
if (inventaire[i*5+j] != null) {
Tuple pos = new Tuple(tailleEcran.x/2*32 -62 + j*36, tailleEcran.y/2*32 -104 +i*36);
if(mouse.x >= pos.x && mouse.y >= pos.y && mouse.x <= pos.x+32 && mouse.y <= pos.y+... |
6240e456-0cbc-4f11-8d43-042ed0825ee4 | 2 | public String getWinnerString() {
int winner = getWinner();
if (winner == 1)
return "Player 1 Wins!";
else if (winner == 2)
return "Player 2 Wins!";
else return "Tie";
} |
1256901a-d355-4f70-a0c4-0a66bd0244fb | 3 | private void labelUriMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelUriMouseClicked
URI uri;
try {
uri = new URI(wikiUri);
if (java.awt.Desktop.isDesktopSupported()) {
try {
java.awt.Desktop.getDesktop().browse(uri);
... |
031420ee-8ce4-48c6-a0ae-b7f0d1a04d88 | 9 | public void trimToSize(long maxSize) {
while (true) {
Object key = null;
ICacheable value = null;
synchronized (this) {
if (mCurrSize < 0 || (mCacheMap.isEmpty() && mCurrSize != 0)) {
throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsi... |
8d4e72db-4199-4322-8649-2bfaee520952 | 3 | public BBZoomLevels(SeekableStream fis, long fileOffset, int zoomLevels,
boolean isLowToHigh, int uncompressBufSize){
int zoomLevel;
int zoomHeadersRead;
long zoomDataOffset;
long zoomIndexOffset;
// save the seekable file handle and zoom zoomLevel header... |
9345a164-2b51-4498-943d-4e58fa16a0de | 2 | public static void main(String[] args) {
GUI2048 game = new GUI2048();
Board board = new Board(game);
if (args.length != 0 && args[0].matches("[0-9]*")) {
Board.GOAL = Value.of(Integer.parseInt(args[0]));
}
KeySetting kb = KeySetting.getkeySetting(board);
boa... |
3b13b16c-c555-4a89-8357-5ff01f42a279 | 0 | public int getWest(){
return this.west;
} |
b65d7556-f78d-4f9a-b116-5a7d97c7e13b | 6 | @Override
public void caseAAccessIdxExp(AAccessIdxExp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(AccessAtIndex");
inAAccessIdxExp(node);
if(node.getObj() != null)
{
node.getObj().apply(this);
}
... |
1e5a1ae9-7629-47df-bf74-3616e0e60391 | 1 | public String makeDir(String name) {
String dir = FilenameUtils.concat(currentDirectory, name);
File file = new File(dir);
if (file.exists()) {
return "File exists already!";
}
file.mkdirs();
log.warn("directory {} created", name);
return null;
} |
9d3e938f-9ef9-4cb3-8735-49d6e26afe1c | 0 | public MyMemberRule( IToken token ) {
super(new MyMemberDetector(), "@", "", token );
} |
d5a866fc-6cf4-4d2b-b3d2-22a5d785dce4 | 9 | void hookCustomListener (final String eventName) {
if (browser == null) return;
if (eventName == "AuthenticationListener") {
browser.addAuthenticationListener(new AuthenticationListener () {
public void authenticate(AuthenticationEvent event) {
log (eventName, event);
}
});
}
if (eventName ==... |
ffa68335-e5ed-4f6b-9955-ec0ba1201208 | 5 | @Override
public int read(int[] chunk, int start, int length) {
int[] samples = new int[length];
int amountRead = 0;
if (!backupReady && (mThread == null || !mThread.isAlive())) {
mThread = new WorkerThread();
mThread.start();
}
if (samplesInBuffer < length) {
System.arraycopy(primaryBuffer,BU... |
22403447-bf6d-423b-84cf-07cc1c513c1e | 9 | public static int setChildrenFromDigit(int pId) {
int numberOfChildren;
switch(pId) {
case 1: case 2: case 3: case 4:
numberOfChildren = 2;
break;
case 5: case 6: case 7: case 8: case 9:
numberOfChildren = 3;
break;
default:
numberOfChildren = 1;
}
return numberOfChildren;
} |
4f0aa840-009a-459b-b88b-c19f6efbf459 | 5 | public void playChess() {
Piece chosenPiece;
Player activatedPlayer = blackPlayer;
while (!isCheckmate) {
// YG: 상대편 플레이어의 정보를 가져다 써야 한다면
// YG: 상대편 플레이어를 저장해두고,
// YG: 여기서 서로 교체하는 방식도 고려해볼만.
activatedPlayer = (activatedPlayer.color== Color.WHITE) ? blackPlayer : whitePlayer;
System.out.println(act... |
4461020a-bcdd-4fe1-98e5-c0bdc0c45747 | 4 | public TSLWriter endObject() throws IOException
{
if(level == 0 || closed)
{
throw new IllegalStateException(ERROR_ROOTCLOSED);
}
if(first_element)
{
throw new IllegalStateException("Cannot close an empty TSL Object.");
}
level--;
writeSeparator(false);
osw.write... |
84ce6d2c-5771-4e4d-8ae5-5eea6605c6e4 | 6 | public void afficher(int index, int pas) {
this.vue += pas;
precedent.setVisible(true);
suivant.setVisible(true);
if (this.vue <= 0)
precedent.setVisible(false);
if (this.vue >= (this.liste_vue.size() - 1))
suivant.setVisible(false);
if (this.vue >= 0 && this.vue < this.liste_vue.size()) {
String... |
57f33933-7321-4b3d-84a1-7b289c150493 | 9 | public void unpackNatives(CompleteVersion version, File targetDir) throws IOException {
OperatingSystem os = OperatingSystem.getCurrentPlatform();
Collection<Library> libraries = version.getRelevantLibraries();
for (Library library : libraries) {
Map nativesPerOs = library.getNative... |
83284caf-9a5e-4811-a0bf-83b696aed2e9 | 0 | public void setUpVariables(){
xShip = (window.getWidth()/2) - (ship.getWidth()/6);
yShip = 600-ship.getHeight()/3;
attackSpeed = 24; //lower is faster;
moveSpeed = 3;
difficulty = 3;
health = 3;
invulnerabiltyTime = 750; //1 sec in ms
currentBackground = 0... |
30e9f34a-bab3-4f6e-b53b-ff15d5e843d9 | 4 | @Override
public void run() {
try {
if (lines == null)
return;
if (lines.size() > 1500) {
System.out.println("Ignoring Url " + " with size "
+ lines.size());
return;
}
HashSet<Long> completedUsers = new HashSet<Long>();
TreeMap<Long, Integer> local = new TreeMap<Long, Inte... |
3371f86f-807f-4d61-99d5-25bae91a34e9 | 6 | private void jTable2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked
/*Metodo que muestra las imagenes respectivas a cada producto al hacer clic
* sobre ellos en la jtable2
*/
int b = jTable2.getSelectedRow();
String c = (String) jTable2.... |
01030c6f-5733-4194-9324-81452d687e99 | 4 | @Override
public boolean containsKey(Object keyObject)
{
String key = (String) keyObject;
boolean res = false;
for (Map.Entry<String, String> e : entries)
{
if (key == null)
{
if (e.getKey() == null)
{
res = true;
break;
}
}
else if (key.equalsIgnoreCase(e.getKey()))
{
... |
cc885962-0a86-46cb-942e-053479afa226 | 7 | @Override
public final List<Successor> getSuccessors (final Object state) {
final Point curPos = (Point) state;
final ArrayList<Successor> result = new ArrayList<Successor>();
for (char direct : DIRECT_MAP.keySet()) {
// Get the new position by current position and direct
... |
5389f2db-0c68-432a-9fca-4b98908b6a3b | 8 | private boolean renderBlockRepeater(Block block, int i, int j, int k) {
int l = this.blockAccess.getBlockMetadata(i, j, k);
int i1 = l & 3;
int j1 = (l & 12) >> 2;
this.renderStandardBlock(block, i, j, k);
Tessellator tessellator = Tessellator.instance;
float f = block.g... |
e7d64e67-ed0b-42d8-886a-333dbb722531 | 0 | public PrimitiveUndoableAttributeChange(Node node, String oldKey, Object oldValue, boolean oldReadOnly, String newKey, Object newValue, boolean newReadOnly) {
this.node = node;
this.oldKey = oldKey;
this.oldValue = oldValue;
this.oldReadOnly = oldReadOnly;
this.newKey = newKey;
this.newValue = newValue;
t... |
4870cb54-7657-400c-a623-fed86e23e64f | 0 | public void addListener(String address, OSCListener listener) {
addressToListener.put(address, listener);
} |
492a7e73-2060-4cc1-9f61-ef0ab8604f7b | 5 | private static List<String> getArgs(String commandAsStr) {
int whiteSpaceIndex = commandAsStr.indexOf(" ");
if (whiteSpaceIndex == -1) {
return Collections.emptyList();
}
String argsStr = commandAsStr.substring(whiteSpaceIndex);
argsStr = argsStr.trim();
if ... |
28eb0d77-ae93-48a1-b81d-052ac68c9ff7 | 9 | public void run() {
try {
String input = channel.setUp();
if (input != null) {
System.out.println("Exec Mode");
execute(input);
} else {
System.out.println("Shell Mode");
channel.write("Welcome to the SIRS SSH server!");
String line;
while ((line = channel.readLine()) != null) {
St... |
bd7456cc-ea7e-408f-8552-ca5e6e167b1e | 5 | @Override
public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException {
if (args[0].toLowerCase().equals("p")) {
game.getPlayer().removeFollower();
} else if (args[0].toLowerCase().equals("t")) {
try {
((Walkable) target).removeFollower();
} catch (ClassCastEx... |
92079a25-a534-4701-8394-8d1bbc742ddf | 0 | @Test
public void test() throws Exception {
//Test service can be initialized without throwing any exception
TestRailwayRepository repo = new TestRailwayRepository();
repo.initializeService();
} |
34f4fcdb-d186-4fcb-999c-c5a5af394ed4 | 6 | private String trim( String word ) {
word = word.trim();
if( word.length() >= 6 && word.startsWith( "'''" ) && word.endsWith( "'''" ) ) {
word = word.substring( 3, word.length() - 3 );
}
word = word.trim();
if( word.length() >= 4 && word.startsWith( "[[" ) && word.end... |
43f83975-c780-4e2d-bc59-1892b9c4f350 | 2 | public void setCanHaveChildren(boolean canHaveChildren) {
if (canHaveChildren != canHaveChildren()) {
if (canHaveChildren) {
mChildren = new ArrayList<>();
} else {
setOpen(false);
mChildren = null;
}
}
} |
1de28cfe-d93b-4ead-b0d1-7cf3d1277d10 | 8 | public static void main(String[] args) throws IOException {
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(ir);
String[] input;
while (true) {
input = in.readLine().split(" ");
if(input[0].equals("0") && input[1].equals("0"))
break;
String res... |
bb1c6ff6-cd8d-4ee7-8e91-0532fbb0ef7b | 1 | private int jjMoveStringLiteralDfa0_2()
{
switch(curChar)
{
case 42:
return jjMoveStringLiteralDfa1_2(0x100L);
default :
return 1;
}
} |
28b4697f-2c74-41dd-b23f-ff75d8483f0f | 8 | public int compare(List<String> ssc1, List<String> ssc2) {
for (int idx:indicesOfKeys) {
String str1 = ssc1.get(idx);
String str2 = ssc2.get(idx);
if (str1 == null && str2 == null) {
continue;
} else if (str1 != null && str2 == null) {
return -1;
} else if (str1 == null && str2 != null) {
r... |
2be83bf2-9d0f-424a-8529-a12a629078c7 | 7 | private TreeNode balance(TreeNode node) {
if (node == null) {
return null;
}
if (height(node.node1) - height(node.node2) >= 2) {
if (height(node.node1.node1) > height(node.node1.node2)) {
node = rotateLToR(node);
}
else if (height(... |
ad0f56a6-728b-417e-b7b7-4e3ef16ff7a3 | 3 | public static Object
clone(
Object obj )
{
if ( obj instanceof List ){
return( cloneList((List)obj));
}else if ( obj instanceof Map ){
return( cloneMap((Map)obj));
}else if ( obj instanceof byte[]){
return(((byte[])obj).clone());
... |
9669112f-10b8-4ca0-9cbc-ba589d68349d | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
e5889eaf-26f4-43bb-9d7b-8b1f0916a8c4 | 9 | @Override
public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Comp... |
3b45b1ac-0c06-430b-9494-95a6a15f612f | 3 | public static DragAndDropController open(DiagramPanel diagramPanel){
JFileChooser fileSelect = new JFileChooser();
fileSelect.setFileSelectionMode(JFileChooser.FILES_ONLY);
int returnVal = fileSelect.showOpenDialog(diagramPanel);
//If it worked then pass the directory location to the generate
//code ... |
8e230e94-815e-442c-a3fd-980ba417fbda | 9 | public Tag findNextTagByName(String name, Tag found) {
if (type != Type.TAG_List && type != Type.TAG_Compound)
return null;
Tag[] subtags = (Tag[]) value;
for (Tag subtag : subtags) {
if ((subtag.name == null && name == null) || (subtag.name != null && subtag.name.equals(name))) {
return subtag;
} el... |
66fdaa99-4ba1-4708-a8e9-c4bb818423fa | 1 | private int d(int num) {
Set<Integer> facts = Utils.evenDivisors(num);
int b = 0;
for (Integer fact : facts) {
b += fact;
}
return b;
} |
025ce89f-3c30-4a70-b980-444c59eefa7c | 6 | public Vec3D getSkyColor(Entity var1, float var2) {
float var3 = this.getCelestialAngle(var2);
float var4 = MathHelper.cos(var3 * 3.1415927F * 2.0F) * 2.0F + 0.5F;
if (var4 < 0.0F) {
var4 = 0.0F;
}
if (var4 > 1.0F) {
var4 = 1.0F;
}
int va... |
cfe28987-1bb4-4ad2-abcf-8479dad593f1 | 0 | public void debug(final String msg) {
} |
896ded04-5931-4c14-a34d-4238c0b8248b | 2 | public void filter(List<String> allowedFrameElements) {
Iterator<Sentence> iter = sentences.iterator();
while (iter.hasNext()) {
if (!iter.next().filter(allowedFrameElements)) {
iter.remove();
}
}
} |
bd820c17-38cd-4f59-b386-8bb9c078a7c6 | 3 | private static double crigfGaussQuad(double a, double x) {
double sum = 0.0;
// set increment details
double upper = 100.0 * a;
double range = upper - x;
double incr = 0;
if (upper > x && range > 100) {
incr = range / 1000;
} else {
upper = x + 100.0;
range = 100.0;
incr = 0.1;
}
int nInc... |
2aa91ddc-f2a6-4955-855a-a81a512364b5 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
647af5cc-c7a5-43f1-bf4a-2163f6b7af38 | 7 | public static String getHtml(String urlString) {
try {
StringBuffer html = new StringBuffer();
java.net.URL url = new java.net.URL(urlString); //根据 String 表示形式创建 URL 对象。
java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection();// 返回一个 URLConnection 对象,它表示到 URL 所引用的远程... |
cfd55464-3da6-4a6b-9134-21b7369b5c52 | 2 | public void setDccPorts(int[] ports) {
if (ports == null || ports.length == 0) {
_dccPorts = null;
}
else {
// Clone the array to prevent external modification.
_dccPorts = (int[]) ports.clone();
}
} |
815dcf53-54bb-4537-b190-b10b550c5262 | 9 | public JSONObject getJSON( ChartSeriesHandle[] series, WorkBookHandle wbh, Double[] minMax ) throws JSONException
{
JSONObject chartObjectJSON = new JSONObject();
// Type JSON
chartObjectJSON.put( "type", getTypeJSON() );
// Deal with Series
double yMax = 0.0;
double yMin = 0.0;
int nSeries = 0;
JSON... |
cb384ae5-1813-4012-b8dd-c8d117bd8925 | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String op = request.getParameter("op");
String userid = request.getParameter("id");
String actionUrl = "";
boolean ret;
try {
if (op == null || op.equals("member")) {
int page = ... |
2845a12b-00dc-497e-80c9-5d6853b1e703 | 2 | protected void saveAreas() {
synchronized (planAreas) {
for (PlanArea area : planAreas) {
try {
area.trySave();
// If one area breaks, we don't want the rest to not save..
} catch (Throwable e) {
e.printStackTrace();
}
}
}
} |
ad039fe9-fdbe-4a31-900a-7a0ca5b5b15a | 2 | public Set<String> terminateTransaction(String transaction) {
Set<String> result = new HashSet<String>();
if (writeLog.containsKey(transaction)) {
result.addAll(writeLog.get(transaction).keySet());
writeLog.remove(transaction);
}
if (readLog.containsKey(transactio... |
44e45215-2408-4215-9423-069f9450fbaa | 1 | public WinWait(String mess, final int time) {
super(Game.getInstance(), true);
//setModal(true);
setBounds(Game.getInstance().getBounds());
setResizable(false);
setUndecorated(true);
// Fond d'écran
JLabel background = new JLabel();
background.setIcon(Game.BACKGROUND);
FlowLayout layBack = new Flo... |
33680e59-0e45-42ce-8beb-83b51ea6aec1 | 3 | private void addLayer(String paramString)
{
if (!this.Layers.containsKey(paramString))
{
if (paramString.compareTo("Robot") == 0)
addLayer("Robot Effects");
SimpleContainer localSimpleContainer = new SimpleContainer();
localSimpleContainer.setSize(this.MapSize.width * 50, this.MapSiz... |
e682ce8e-e26c-4cce-ab27-db824af4b39f | 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('... |
2d877c48-4abc-42e1-a070-61f1af1e765f | 5 | public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
if (computeSVUID) {
if ("<clinit>".equals(name)) {
hasStaticInitializer = true;
}
/*
* Remembers non private constructors and methods for SVUID
* comput... |
fae5e28b-0c84-439d-bab6-b8a6f747cde1 | 0 | public static void main(String[] args) {
Context context;
// Three contexts following different strategies
context = new Context(new FirstStrategy());
context.execute();
context = new Context(new SecondStrategy());
context.execute();
context = new Context(new ThirdStrategy());
context.execute();
} |
9bc2dbae-56a6-4203-923d-a54ff6e41f09 | 2 | public List<T>[] getLevels()
{
List<T>[] levels = new ArrayList[maximumDepth + 1];
for (int i = 0; i <= maximumDepth; i++)
{
levels[i] = new ArrayList<T>();
}
for (int i = 0; i < orderedSize; i++)
{
levels[orderedNodes[i].getDepth()].add( ordered[i] );
}
return levels;
} |
e91e7c5c-6b2c-43f2-a5a3-0c14375eea65 | 4 | public void update() throws IOException {
// update player
player.update();
tileMap.setPosition(GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety());
// set background
bg.setPosition(tileMap.getx(), tileMap.gety());
// attack enemies
player.checkAttack(enemies);
// update al... |
f2bcf293-d1c1-4f75-9a84-176bb61eb609 | 8 | static final public void Stat() throws ParseException {
if (jj_2_2(2)) {
AssignStat();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENT:
CallStat();
break;
case IF:
IfStat();
break;
case WHILE:
WhileStat();
break;
cas... |
f924559e-9b3e-45a6-858f-87e97ae0b0b1 | 4 | @Override
public void callAction(String args) {
String perceptronName;
String patternName;
System.out.print("Name of perceptron to propagate: ");
perceptronName = ui.inputToString();
Perceptron perceptron = ds.getPerceptron(perceptronName);
if(perceptron == null) {
ui.printToConsole("Aborting... Ther... |
a842eeef-6092-4ce1-8c63-35e139a423ca | 7 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
int min, max, step, repeat, selected;
try {
min = Integer.parseInt(jTextField1.getText());
max = Integer.parseInt(jTextField2.getText());
step = Integer.par... |
1047c520-4d10-45a7-9868-138042f44df7 | 5 | public void deepTree(TreeNode node,int deep){
if(node.left == null && node.right == null){
minDeep = Math.min(minDeep,deep);
}
if(deep >= minDeep)
return;
if(node.left != null)
deepTree(node.left,deep+1);
if(node.right != null)
deep... |
b84ce43c-f351-45f7-8812-0f1f99dc56c8 | 0 | public int getRowCount() {
// TODO Auto-generated method stub
return 0;
} |
131e7556-b01d-483a-a88d-697458cdbc20 | 4 | int search(int arr[],int key,int start,int end) {
if(start<end ) {
int mid=start+(end-start)/2;
if(key<arr[mid]) {
return(search(arr,key,start,mid));
}
else if(key>arr[mid]) {
return(search(arr,key,mid+1,end));
}
else if(key==arr[mid]) {
return key;
}
}
else {
return -1;
}
return 1;
} |
00310dd6-c57f-4941-a603-9d32b23d59fe | 5 | public static void PlayerToPlatformObject()
{
List<PlatformObjects> pl = CoreClass.getCurrentPlat();
if(CoreClass.mainCharacter.isFalling == true)
{
for(int x = 0; x < pl.size(); x++)
{
int charYPos = CoreClass.mainCharacter.getyPos();
int jumpTopRange = (( pl.get(x)).getyPos() - 25);
i... |
fcd66a20-fe85-47d8-8e51-860ea5d38e5e | 6 | public void tmat_read(String path) throws IOException {
FileInputStream is = null;
DataInputStream dis = null;
try{
is = new FileInputStream(path);
dis = new DataInputStream(new BufferedInputStream(is));
ci_states = (int)dis.readFloat();
int states_per_triphone = (int)dis.readFloat();
tmat = new fl... |
9851fbb6-0513-432d-a5c3-5ba38d5070dc | 5 | public void setSampleFont()
{
// Get font name
String facename
= (String) facenameCombo.getSelectedItem();
// Get font style
int style = 0;
if (italicCheckBox.isSelected())
{
style = style + Font.ITALIC;
}
if (boldCheckBox.is... |
e0c4bb8b-4bf2-40b5-a243-a7119f05a45f | 7 | public void calculateScaleRange() {
if( !automaticScale && userScaleRange != 0.0 ) {
scaleRange = userScaleRange;
} else {
RootedTree tree = treePane.getTree();
if (tree != null) {
final double treeHeight = tree.getHeight(tree.getRootNode());
... |
e501360b-a19d-4d0c-b065-79a8d310e3c8 | 0 | @Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", loginno='" + loginno + '\'' +
", loginpwd='" + loginpwd + '\'' +
", email='" + email + '\'' +
", status=" +... |
983d02a4-4cc8-4850-9cdb-021ceef368d2 | 1 | @Override
public void keyTyped( KeyEvent e ) {
for( KeyListener listener : listeners( KeyListener.class )){
listener.keyTyped( e );
}
} |
ad54d0b5-713f-48e8-afce-369464108a6d | 7 | public void luoPalikat(){
// palikkamuodostelman keskikohta luodaan ruudun ylälaidan keskelle, ts. kohtaan (0, 5)
// x-koordinaatti kasvaa alaspäin, y-koordinaatti kasvaa oikealle
switch (muoto){
case I:
palikat.add(new Palikka(3, 0));
palikat.add(new ... |
8fc8e1de-d59a-4081-9e07-f0d95c398032 | 5 | @Override
public boolean equals(Object mc){
if ((mc == null)|| !(mc instanceof MessageContent)){
return false;
}
if (this.size() != ((MessageContent)mc).size()){
return false;
}
for (int i = 0; i < this.size(); i++) {
//if (this.getValue(i)... |
a756811b-f6d8-48d3-b523-2f724931244a | 0 | public String getTicketType() {
return ticketType;
} |
01c3e4bc-8191-4b85-8b13-dd49cff248d4 | 0 | public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
myTable.setFont(new Font("Default", Font.PLAIN, source.getValue()/10));
myTable.setRowHeight(source.getValue()/10+10);
} |
342df909-1c34-4e28-9974-6895ddd8f874 | 4 | Argument(final String arg) {
final String trimmed = arg.trim();
if (trimmed.startsWith("--")) {
type = Type.LONG;
int equalsPosition = trimmed.indexOf("=");
if (-1 == equalsPosition) {
name = trimmed.substring(2);
value = null;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.