method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
22276aea-a126-4aad-ab3e-3ecd293d07ec | 3 | public FlowLoggerImpl() {
try {
Class<?> factoryClass = Class.forName("org.slf4j.LoggerFactory");
Class<?> loggerClass = Class.forName("org.slf4j.Logger");
Method factoryMethod = factoryClass.getDeclaredMethod("getLogger", String.class);
logger = factoryMethod.in... |
5d6e940b-a5ea-486d-85fd-a0ac21c0521c | 3 | public void createMenu() {
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem fileItem = new MenuItem(bar, SWT.CASCADE);
fileItem.setText("&File");
Menu submenu = new Menu(shell, SWT.DROP_DOWN);
fileItem.setMenu(submenu);
//menuItem = new MenuItem(menu, SWT.SEPARATOR);
MenuIt... |
6b471235-f846-4651-b7c3-718d3ddbdf9d | 8 | public boolean canMoveRight(){
int emptyColumsFromRight=0, j, i;
// check for field boundaries on the right side
for(i=(t.getySize()-1);i>0;i--){
if(!t.columnIsEmpty(i)){
break;
}
emptyColumsFromRight++;
}
if((t.getPosX()+t.getxSize()-emptyColumsFromRight)>(p.getxSize()-1)){
return false;
... |
92ec1739-10cd-4524-9d42-2383de881d92 | 5 | private void ForwardCheck(Message message) throws InterruptedException{
System.out.println("HELLO");
CPA fc_cpa = message.cpa();
if(message.SC()>AgentView.SC()){
if(!AgentView_consistent){
if(!fc_cpa.contains(new CPA(AgentView))){
AgentView_consistent=true;
}
}
if(AgentView_consistent){
... |
98207d85-320c-4f72-aa62-87601e06e10a | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ComparePerson)) return false;
ComparePerson person = (ComparePerson) o;
if (age != person.age) return false;
if (name != null ? !name.equals(person.name) : person.name != null) return... |
70ac1c3a-e1df-40b2-a5e1-fca633582824 | 3 | private ResGridlet cancel(int gridletId, int userId)
{
ResGridlet rgl = null;
// Check whether the Gridlet is in execution list or not
int found = gridletInExecList_.indexOf(gridletId, userId);
// if a Gridlet is in execution list
if (found >= 0)
{
// up... |
47de3c5e-79c3-48ce-87b8-49cfb50e3aa5 | 3 | public void infinite() {
while (true) {
try {
synchronized(this) {
while (this.pause == 1)
wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
this.state.update();
}
} |
3c408f73-c57e-4eb0-a8d7-cc700fc8cab7 | 7 | public static void cppOutputSystemMakefile() {
{ String makefile = Stella.makeFileName("Makefile", Stella.KWD_STELLA, true);
String templatefile = Stella.fileNameWithoutExtension(makefile) + ".in";
SystemDefinition system = ((SystemDefinition)(Stella.$CURRENTSYSTEMDEFINITION$.get()));
if (!(Stell... |
1e8640c6-e8e1-43e4-9c47-99b7559a6241 | 3 | public static void main(String[] args) {
char again;
int n;
do{
print("Enter the dimension of the matrix: ");
n = scan.nextInt();
double[][] matrix = new double[n][n];
print("\nEnter the matrix data:\n");
input(matrix);
if(det(matrix)==0){
print("\nThe matrix is singular.\n");
}else{
... |
25aefdc3-c4f3-4b24-9380-3e7a2b590f6a | 9 | public Response serve( String uri, String method, Properties header, Properties parms, Properties files, Socket source ) {
System.out.println("URI: " + uri);
if (uri.length() > 1) {
if (uri.charAt(0) == '/') {
uri = uri.substring(1);
}
} else {
return handleIndex();
}
String[] params = uri.split... |
778a95ab-f276-4fec-8cbf-f18f51385bbf | 3 | @Override
protected Void doInBackground() throws Exception {
final int BUFFER_SIZE = 64000;
Client client = new Client(BUFFER_SIZE, BUFFER_SIZE);
client.getKryo().register(PacketLogin.class);
client.getKryo().register(PacketLoginResponse.class);
client.getKryo().register(Pac... |
5bd6fb09-53a7-413a-a84a-6131d72116ef | 4 | private boolean onCommandListMods(CommandSender sender, Command command, String label, String cmd, String[] args)
{
if (sender.hasPermission(ReplicatedPermissionsPlugin.ADMIN_PERMISSION_NODE))
{
List<String> supportedModList = this.parent.getProvider().getMods();
boolean first = true;
String reply = C... |
bc1c1d9e-3423-459d-ae3f-ca3f47c64d69 | 0 | public static int getInt(String domain, String key, int fallback)
{
return Integer.parseInt(getString(domain, key, String.valueOf(fallback)));
} |
bd099eb2-4580-41e1-bcde-e7d7473807f3 | 1 | public List<CommandType> getCommand() {
if (command == null) {
command = new ArrayList<CommandType>();
}
return this.command;
} |
ab3feb8b-38e5-437e-ba3c-ccc32d6a6004 | 1 | public BufferedImage getImageFromName(String resourceName) throws IOException
{
if (Game.getInstance() != null)
{
return ImageIO.read(Game.getInstance().getClass().getClassLoader().getResourceAsStream(Game.getInstance().getResourceDirectory() + resourceName));
}
return null;
} |
ba71b8a2-ae65-41f8-8db2-bd2b12f7f39d | 4 | public static void main(String[] args){
try{
int i = 4;
if(i==1) throw new C12Q9Exp1();
else if(i==2) throw new C12Q9Exp2();
else if(i==3) throw new C12Q9Exp3();
else
throw new NullPointerException();
}
catch(C12Q09Exception e){
}
finally{
System.out.println("In finally");
}
} |
a384a1bd-7092-4332-bd21-79017844ca8f | 2 | private void bubbleDown(int pos) {
for (int i = pos - 1; i >= 0; i--) {
if(swapIfFirstIsLess(pos, i)) pos = i;
else return;
}
} |
ef544514-7e17-485a-879a-eeb49d032177 | 9 | public boolean isSet(String string) {
Option<?> opt = options.get(string);
if (opt == null)
return false;
if (opt instanceof CollectionOption<?, ?>) {
@SuppressWarnings("unchecked")
CollectionOption<?, Collection<?>> c = (CollectionOption<?, Collection<?>>) opt;
return !c.value.isEmpty();
}
return... |
d3dad894-6348-4fed-87a2-85004da70f30 | 1 | protected void compexch(T[] a, int i, int j) {
if (less(a[j], a[i]))
exch(a, j, i);
} |
80a835c5-cbb2-46f4-9159-42d491074f8b | 9 | @EventHandler(priority = EventPriority.HIGH)
public void useRedstone(PlayerInteractEvent event) {
Material[] blockedInteracts = {Material.WOOD_BUTTON, Material.STONE_BUTTON, Material.LEVER, Material.GOLD_PLATE,
Material.IRON_PLATE, Material.STONE_PLATE, Material.WOOD_PLATE, Material.TRIPWIRE... |
8c6551c7-907b-481d-84f8-a1c79208329b | 7 | @EventHandler
public void SkeletonFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Skeleton... |
9d8134c6-8c73-4033-ae86-0a0ca5db2d77 | 5 | public void generateHTML() {
File file = new File("RAPORT.html");
List<UserDTO> listaUserow;
try {
listaUserow = requests.getAllUsers();
Collections.sort(listaUserow);
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write("<html>");
bw.write("<head>");
bw.write("<style>");
... |
4a7c2a95-ef34-4216-b0bc-342ddac8ed4f | 6 | protected ArrayList<Position> getBgPiecesNrby(Board b, Position tgt) {
ArrayList<Position> posArray = tgt.adjacentP(b, false, false);
int i;
Rank r1 = Rank.Engineer;
Position pos1 = null;
Rank r2 = Rank.Engineer;
Position pos2 = null;
Piece p = null;
for (i = 0; i ... |
2c3c0ff1-2885-42f7-aa28-9c752fc5a23c | 3 | public String intToRoman(int num) {
StringBuffer result = new StringBuffer();
int step = numbers.length - 1;
while (num > 0) {
if (num < numbers[step] - minuses[step]) {
step--;
continue;
}
if(num < numbers[step]){... |
bc65df2a-c4f9-42b4-ade7-44b60c2d4f14 | 5 | */
private boolean initializeMods () {
Logger.logDebug("pack dir...");
Logger.logInfo(ModPack.getSelectedPack().getDir());
ModManager man = new ModManager(new JFrame(), true);
man.setVisible(true);
while (man == null) {
}
while (!man.worker.isDone()) {
... |
bfc84431-f61f-42e4-9c3a-560df0e5feae | 2 | public void run(){
while(running){
println(id + ": " + count);
count++;
this.linha.update();
try{
sleep((long)(wait));
}catch (Exception e){
}
}
println("The thread is dead!");
} |
a19a561f-41b1-4eee-957f-f2eb1c74e771 | 9 | protected Object fillCollection(Object o, TypeToken typeToken, ITestContext iTestContext) {
ITestParamState iTestState = iTestContext.getCurrentParam();
Collection<Object> col = (Collection<Object>) o;
Class collectionClass;
if ( null != iTestContext.getCurrentParam() && null != iTestCon... |
4e1431c8-6405-4650-b4bd-027036603298 | 4 | static void readImages(String xfilename, String yfilename) {
try {
Scanner xscanner = new Scanner(new File(xfilename));
Scanner yscanner = new Scanner(new File(yfilename));
while (xscanner.hasNextLine()) {
Image i = new Image();
String line = x... |
4a2fd191-58ee-48ac-91af-c976d01ba190 | 3 | @RequestMapping(value="/match", method=RequestMethod.PUT)
@ResponseBody
public MatchData startGame(@PathVariable("gameId") String gameId, @RequestParam("accountName") String accountName) {
Assert.notNull(messageRouter, "Message router can't be null, is required.");
Assert.hasText(accountName, "Account name mus... |
64b4ebff-0e33-4a6a-93c0-82787258afdd | 3 | public static PublicEventTypeEnum fromString(String v) {
if (v != null) {
for (PublicEventTypeEnum c : PublicEventTypeEnum.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
fa85d898-1fcc-43aa-94b3-d3b15e199ca8 | 5 | public String encode(String plain)
{
char[] pt=build_keyed_alphabet(h_key,26,0);
int period=v_key.length();
String v_key_u=v_key.toUpperCase();
char[][] ct_table=new char[period][26];
for(int i=0;i<period;i++)
{
char first_c=v_key_u.charAt(i);
char[] ct_line=build_keyed_alphabet(h_key,26,0);
... |
3fff2869-6976-4d4f-b3b6-65e2327c516e | 5 | private void setOutputPrecision(){
int maxPrec = Fmath.checkPrecision(this.responses0[0][0]);
int prech = maxPrec;
for(int i=0; i<this.nGroups; i++){
for(int j=0; j<this.nResponsesPerGroup[i];j++){
prech = Fmath.checkPrecision(this.responses0[i][j]);
i... |
f1598332-caea-491c-871c-54a924b60914 | 4 | public static int removeDuplicates2(int[] A) {
int len = A.length;
int dup = 1;
int des = 0;
for (int i = 1; i < len; i++) {
if (A[i] == A[i - 1]) {
dup = dup + 1;
} else {
if (dup > 2) {
des = des + dup - 1;
}
dup = 1;... |
c2d5d6b9-4d03-4165-b8ab-93d12dc5149d | 1 | public void mouseEntered(MouseEvent e) {
if(getState() == ENABLED) {
textColor = "white";
} else {
textColor = "lightGray";
}
} |
797202cd-4e7d-46fc-91fd-52013a4a6def | 5 | @Override
public float getTaskProgress() {
if (taskList.size() == 0)
return 0;
if (totalWeight == 0)
return 0;
float completedWeight = 0;
for (int i = 0; i < taskProgress; i++) {
IInstallTask task = taskList.get(i);
if (taskWeights.co... |
caae436a-0b09-4ec8-a890-b07fbbf33e5e | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((--regenTick)>0)
return true;
regenTick=maxTickDown;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob.location()==null)
return true;
if(mob.amDead())
return true;
... |
c30386cc-0f44-4082-accc-ca5e279927c5 | 3 | private boolean addCardAtRandom(PlayingCard card)
{
int[] validIndexes=new int[cardsInDeck.length];
int counter=0;
for(int i=0; i<cardsInDeck.length;i++)
{
if(cardsInDeck[i]==null)
{
validIndexes[counter++]=i;
}
}
if(counter==0)
{
return false;
}
int index=random.nextInt(counter);
c... |
05cb6aa8-6267-4115-9870-583a62c74e45 | 6 | static int findFactorByLimit(final long base)
{
final long value = Math.abs(base);
int from = 0;
int to = LIMITS.length - 1;
if (value <= LIMITS[to])
{
return to;
}
if (value > LIMITS[0])
{
return 0;
}
do
{
final int mid = (from + to) >> 1;
if (LIMITS[mid] >= value)
{
if (LIMITS[mid + 1] <... |
8ed6d0e3-c17a-475a-b30b-880392bbc7fa | 6 | public void drawShips(Ship player) {
g2d.setTransform(identity);
Collection<Ship> ships = DataController.getInstance().getShips();
Point playerPoint = player.getCenter();
for(Ship s: ships){
if(s == player){
continue;
}
Point sPoint = s.getCenter()... |
af18d761-5f1c-4b2e-bafb-53161c483173 | 8 | void removeInternal(Node<K, V> node, boolean unlink) {
if (unlink) {
node.prev.next = node.next;
node.next.prev = node.prev;
}
Node<K, V> left = node.left;
Node<K, V> right = node.right;
Node<K, V> originalParent = node.parent;
if (left != null && right != null) {
/*
*... |
f06b6dad-7af5-4722-a965-123e68738203 | 5 | @Override
public boolean onCommand(CommandSender sender, Command command,
String lable, String[] args) {
Player player = null;
Player toPlyer = null;
String toPlayer = "";
String fromPlayer = "";
String fromBoxel = "";
if (!(sender instanceof Player)) {
master.getLogManager().info(
"You can... |
960c1165-48a2-49dc-bc43-1ef0af1fbf1c | 8 | protected final void assertInvariants( LongMap<V> map ) {
LongSet keySet = map.keySet();
Collection<V> valueCollection = map.values();
Set<Entry<V>> entrySet = map.entrySet();
assertEquals( map.size() == 0, map.isEmpty() );
assertEquals( map.size(), keySet.size() );
asse... |
c8adb5e5-3945-43da-a395-61a800de14cb | 4 | public boolean postMortem(PostMortem pm) {
JSONzip that = (JSONzip) pm;
return this.namehuff.postMortem(that.namehuff)
&& this.namekeep.postMortem(that.namekeep)
&& this.stringkeep.postMortem(that.stringkeep)
&& this.stringhuff.postMortem(that.stringhuff)
... |
d2ddc268-08a4-4f10-8733-86687e23a0c0 | 3 | static void preprocess(char[] p) {
int i = 0, j = -1, m = p.length;
b = new int[p.length + 1];
b[0] = -1;
while (i < m) {
while (j >= 0 && p[i] != p[j])
j = b[j];
b[++i] = ++j;
}
} |
8659a8b0-2898-45c8-bf23-5a77864a5161 | 8 | static void lengthLimitedCodeLengths(Cookie cookie, int[] frequencies, int maxBits,
int[] bitLengths) {
cookie.resetPool();
int n = frequencies.length;
int nn = 0;
Node[] leaves = cookie.leaves1;
for (int i = 0; i < n; i++) {
i... |
b25c41a7-c128-4000-8a19-3f1247ed9a33 | 0 | public ReDrawer(int id, int offset, CyclicBarrier cb) {
this.id = id;
this.offset = offset;
this.cb = cb;
} |
63288264-02dc-4648-aec4-2ff22bcd15ef | 0 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final int PENNIES_PER_DOLLAR = 100;
final int PENNIES_PER_QUARTER = 25;
final int PENNIES_PER_DIME = 10;
final int PENNIES_PER_NICKEL = 5;
final int PENNIES_PER_PENNY = 1;
System.out.print("En... |
1f7c748e-4f10-4a0c-8163-b38daf2581d6 | 2 | public void mostrarAdmins(){
if(admins.size() > 0){
for(beansAdministrador admin : admins){
System.out.println("----------------------------------");
System.out.println("Nombre --> "+admin.getNombre());
System.out.println("Nick --> "+admin.getNick());
System.out.println("Edad ... |
63be5fab-32aa-4447-a7e2-ddcd2dd65360 | 2 | private static int setInOrderPosition(Integer[] a, int pos, int startIndex, int endIndex) {
swap(a, pos, endIndex);
int firstSmallerValuePosition = startIndex;
for (int i = startIndex; i <= endIndex; i++) {
if (a[i] >= a[endIndex]) {
swap(a, i, firstSmallerValuePositi... |
0efe84f6-90b4-41c5-a968-b421697a56d3 | 1 | private void ensureCapacity() {
if (elements.length == size)
elements = Arrays.copyOf(elements, 2 * size + 1);
} |
2c7c5e6c-c9e8-4329-b5ed-66f0ee28856c | 0 | public String toString(String input) {
return name + calc(input);
} |
2af72e57-b611-4c3f-b5af-cb70a611a127 | 7 | protected void generateFile(Configuration config, Table table, List<File> templateFiles) {
try {
System.out.println("#############-------------开始生成代码-----------#############");
for (File templateFile : templateFiles) {
String templateRelativePath = templateFile.getName();
if (templateFile.isDirectory() ... |
97fa4e45-58fb-46d9-bb49-d9c5edde1fe8 | 2 | public void setPaused(boolean paused) {
if (this.paused != paused) {
synchronized (pausedLock) {
this.paused = paused;
if (!paused) {
// restart sounds
pausedLock.notifyAll();
}
}
}
} |
ad9e6378-4743-4077-bb91-50e0763a3a63 | 8 | @Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if (arg0.isMetaDown())
{
//popup.show(arg0.getComponent(),arg0.getX(),arg0.getY());
buildPopUp(arg0);
}
else if(arg0.getSource() == popDelete)
{
deleteRows();
}
else if(arg0.getSource() == popOpen)
... |
880f5d24-3d35-40e0-a2f0-bc5455c08f75 | 7 | public static void main(String [] args) {
try {
if (args.length < 1) {
System.err.println("Usage : weka.gui.visualize.Plot2D "
+"<dataset> [<dataset> <dataset>...]");
System.exit(1);
}
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Explorer: Visualize");
jf.setSize(500... |
a6666df0-c379-4c17-9877-4a7e545fd56c | 5 | public String getColumnData(int i) throws Exception {
if (i == 0)
return getFileID();
else if (i == 1)
return getProjectID();
else if (i == 2)
return getFormat();
else if (i == 3)
return getFileName();
else if (i == 4)
return getLocation();
else
throw new Exception... |
96239ca0-d7ca-4712-911f-fce1bfdfff84 | 9 | private Node put(Node h, Key key, Value val){
if(h == null)
return new Node(key, val, 1, RED);
int cmp = key.compareTo(h.key);
if(cmp < 0) h.left = put(h.left, key, val);
else if(cmp > 0) h.right = put(h.right, key, val);
else h.val = val;
if(isRed(h.right) && !isRed(h.left)) h = rotateLeft(h);
if(i... |
41659d7f-4939-47ac-b7b7-8e941a116af5 | 5 | public void checkIP(List<String> ip){
System.out.println("reachable ip:----------------->");
Socket socket = null;
for (String url : ip) {
boolean reachable = false;
try {
socket = new Socket();
// set timeout to 3 seconds
socket.connec... |
f788186e-331f-4677-89ad-d53c46ad9999 | 8 | public Fruit (Room room, int type){
this.room = room;
this.type = type;
switch (type){
case 1: points = 100;
break;
case 2: points = 300;
break;
case 3: points = 500;
break;
case 4: points = 700;
... |
e614fd00-e6bf-4226-8d80-28edca82fe53 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
... |
214e3915-3e1f-488a-bdd1-119a5efa477a | 8 | private String toHtmlTd(Object obj) {
String result = null;
if (obj == null) {
result = "<td x:str></td>";
} else if (obj instanceof StdStyledCell) {
StdStyledCell cell = (StdStyledCell)obj;
StringBuilder sb = new StringBuilder();
StringBuilder style = new StringBuilder();
// スタイルの作成
if (cell.ge... |
d65d58eb-69f3-47e7-8c2d-33e4f19e1b15 | 4 | public static boolean illegalIdentifier(String identifier) {
return identifier.equals("do") || identifier.equals("if")
|| identifier.equals("for") || identifier.equals("try")
|| identifier.equals("int");
} |
ca87f0e8-a58d-43b0-846e-e72041054eb5 | 7 | public void processMouseDragged(int x, int y)
{
// WE MAY HAVE TO USE VALUES IN POSE SPACE
Rectangle2D.Double poseArea = zoomableCanvasState.getPoseArea();
int incX = x - lastMouseDraggedX;
int incY = y - lastMouseDraggedY;
lastMouseDraggedX = x;
lastMouseDraggedY = y... |
0286d609-375c-4b25-a9a9-79e1ddb13b9c | 1 | public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
cp.newUTF8(desc);
if (visible) {
cp.newUTF8("RuntimeVisibleAnnotations");
} else {
cp.newUTF8("RuntimeInvisibleAnnotations");
}
return new AnnotationConstantsCollector(fv.visitAnnotation(desc,
visible), cp);
} |
a49cdf1a-d24e-4006-86a3-81e7a92d041e | 0 | public FileBasedCobweb(String startSite, String dirPath, Cobweb spiderEngine) {
super(startSite, dirPath, spiderEngine);
} |
23551366-e203-47be-b5b5-3c443afa5b31 | 7 | public Purchase makePurchase(int id_user, int cost, String type, int id) throws DataBaseConnectorException {
Purchase purchase = new Purchase();
try {
if(type == null){
throw new DataBaseConnectorException("Shopping error ^_^ (type == null): ");
}else if(type.equa... |
ebd7554f-ecb2-4a9d-aa56-3f4459ed756f | 0 | public BFSPerformanceTest() {
} |
57f6a86f-96b6-4db9-9f96-b8a437230c27 | 8 | public /*@pure@*/ boolean checkInstance(Instance instance) {
if (instance.numAttributes() != numAttributes()) {
return false;
}
for (int i = 0; i < numAttributes(); i++) {
if (instance.isMissing(i)) {
continue;
} else if (attribute(i).isNomina... |
e4de1550-19ee-4228-9059-2510a6461b69 | 6 | public void mainLoop() {
String input;
do {
// show the player where they are to start off
player.getLocation().printInfo();
input = Printer.getInput();
if (move(input))
continue;
switch (input) {
case "look":
// don't know if title should be included
player.getLocation().printDes... |
2b322940-07e9-4894-92e5-af47732b260d | 5 | @Override
public double[] intersect(Ray ray) {
Vector3 rayToTop = ray.getFrom().subtract(top);
double AxR = direction.dotProduct(ray.getDirection());
double AxBR = direction.dotProduct(rayToTop);
double cosSquare = Math.pow(Math.cos(angle), 2);
double paramA... |
d29fc4ea-b416-4814-9e27-d7f9f9060056 | 1 | public String expression(){
if(this.randomXY <= 0.5){
result = "X";
}
else{
result = "Y";
}
return result;
} |
09a668b0-5ced-438f-9c3b-d1d53e79ab60 | 1 | public String toComplexString() {
if(this.b>=0)
return String.format("%.3f +%.3fi", this.a+this.b*Math.cos(ALPHA), this.b*Math.sin(ALPHA));
else
return String.format("%.3f %.3fi", this.a+this.b*Math.cos(ALPHA), this.b*Math.sin(ALPHA));
} |
fd9e6aac-7954-4568-8eba-f3e3b32dc709 | 9 | public void setValueAt( Object aValue, int row, int column )
{
boolean onlyThisRowChanged = true ;
Row r = rows.elementAt( row ) ;
String strValue ;
if ( aValue instanceof String )
strValue = (String)aValue ;
else
strValue = aValue.toString() ;
if (... |
e7467779-8d08-4311-b7ec-3ef436e4a89e | 9 | public DirectedGraph<String, DefaultEdge > parseHPO(BlastProtein Protein) throws Exception {
// Query Hashtable for geneID
String GeneID = ProtGeneMap.get(Protein.getId());
// Graph Data structures
DirectedGraph<String, DefaultEdge > Graph = null;
Graph = new SimpleDirectedGraph<String, DefaultEdge>(De... |
9cb0ee94-549b-4ffc-8e9a-1f584b1866fa | 6 | @Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(Task.PROP_DUE_DATE)
|| evt.getPropertyName().equals(Task.PROP_DUE_DATE_REMINDER)
|| evt.getPropertyName().equals(Task.PROP_START_DATE)
|| evt.getPropertyName().equals(Task.PROP_START_DATE_REMINDER)
|| evt... |
74041322-6fb2-44b4-ad31-a1b203c3afdb | 9 | private ArrayList<Image> getDataFromDataBaseOracle() throws SQLException{
DbHandler db = new DbHandler();
Statement st = db.connect();
ArrayList<Image> files = null;
ArrayList<Rute> rutes = db.getRutes(st);
for (Rute r : rutes) {
ArrayList<Image> images = db.getImage... |
feff027a-e571-4b79-9809-0648c6b3a120 | 2 | @Override
public ServerModel acceptTrade(AcceptTradeRequest request, CookieParams cookie) throws InvalidMovesRequest {
if(request == null) {
throw new InvalidMovesRequest("Error: invalid accept trade request");
}
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
if (request.isWillAc... |
7c712640-854a-4722-971e-7fe7cbc89619 | 8 | private void generateAllOperators(HallInfo h) {
if (h == null) {
h = hallInfo;
if (operationCount > 0)
return;
operations = new SymmetryOperation[4];
operationCount = 0;
if (hallInfo == null || hallInfo.nRotations == 0)
h = hallInfo = new HallInfo(hallSymbol);
setLattice(hallInfo.latticeCode... |
572e8090-2333-452f-8fbf-b90f77250756 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Teacher)) {
return false;
}
Teacher other = (Teacher) object;
if ((this.idTeacher == null && other.idTeacher !=... |
7df5d598-ce77-4aab-8fc4-3e74f47c5597 | 0 | @Basic
@Column(name = "employee_id")
public int getEmployeeId() {
return employeeId;
} |
05bda008-ab16-459e-8308-1b63e6b6954d | 5 | public void actionOcurred(GameAction action){
if (gameOver) return;
// if (gameOver) throw new IllegalStateException("Game is over! No actions accepted");
if (isGameOver(successRule, action) && listener != null) listener.onGameSuccess();
if (isGameOver(failRule, action) && listener != null) listener.onGam... |
90755c21-6902-4f70-88c0-7bfc7e86bb5e | 7 | private String getDowJonesValue ()
{
String dowJonesValue = "0";
try (final Scanner dowJonesWebPage = new Scanner (new URL (FieldGoogleFinance.URL.toString()).openStream()))
{
boolean lastPriceHasFind = false;
boolean changePercentHasFind = false;
while (dowJonesWebPage.hasNext() && ((! lastPrice... |
92d8d1b5-dce1-4a98-85a9-de10e264df24 | 1 | @Override
public void changedBroadcast(boolean enabled){
if(enabled){
broadcastChkbox.setSelected(true);
} else {
broadcastChkbox.setSelected(false);
}
} |
969ed3ca-1c57-4ead-9076-27fbc4ee18c8 | 0 | public String getShareKey() {
return shareKey;
} |
512051af-3b84-4f75-ac86-bbfe927b9c03 | 5 | public static DoubleMatrix createAverages(int w, int h, double... values) {
if (w == 0 || h == 0)
throw new IllegalArgumentException(
"Dimensions must be bigger than 0!");
double sum = 0;
for (double value : values)
sum += value;
double avgs[... |
91373c09-1aa0-4403-8864-e8face04b535 | 3 | public static void main(String[] args) {
int[] src = new int[TOTAL_ELEMENTS];
for (int i = 0; i < TOTAL_ELEMENTS; i++)
src[i] = i + 1;
System.out.print("Source array : ");
for (int i = 0; i < TOTAL_ELEMENTS; i++)
System.out.print(src[i] + " ");
System.out.println();
int destSize = src.length / 2;
... |
0746f078-be8d-487f-95c5-44efc73a0c08 | 7 | LexingState(TokenStream stream) {
this.regExpFlags = stream.regExpFlags;
if (stream.stringBufferTop > 0) {
this.bufferedString = new String(TokenStream.stringBuffer, 0, stream.stringBufferTop);
}
this.xmlOpenTagsCount = stream.xmlOpenTagsCount;
... |
f90929fc-bfb9-4aa8-b493-9cdae03b290b | 7 | @Override
public boolean equals(Object obj) {
if (obj instanceof ScreenCharacter == false) {
return false;
}
final ScreenCharacter other = (ScreenCharacter) obj;
return character == other.character && foregroundColor == other.foregroundColor && backgroundColor == other.backgroundColor && bold == other.bold... |
f6e60b3b-f82e-439f-8ed9-ca967a8c00e7 | 1 | public static void main(String[] args) throws Exception
{
Class<?> classType = Class.forName("java.lang.String");
Object array = Array.newInstance(classType, 10);
Array.set(array, 4, "ArrayTest");
String str = (String)Array.get(array, 4);
System.out.println(str);
} |
29336638-585b-420c-9808-df9f8a038535 | 8 | public int getValue()
{
int faceValue = 0;
if (this.getFace() == "Seven") {
faceValue = 7;
} else if (this.getFace() == "Eight") {
faceValue = 8;
} else if (this.getFace() == "Queen") {
faceValue = 9;
} else if (this.getFace() == "King") {
faceValue = 10;
} else if... |
7ed27e5d-5ffb-4fc0-9e2f-ae9971168c58 | 4 | public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
in.nextLine();
List<Integer> strengths = new ArrayList<Integer>();
for (int i = 0; i < N; i++) {
strengths.add(in.nextInt());
in.nextLine();
}
... |
6143c911-bef1-44fb-b7b0-24de9d53c1a9 | 6 | public void rotate(boolean clockWise)
{
if(!currentCreatedAndMovable)
return;
try
{
lock.acquire();
}
catch (InterruptedException e)
{
return;
}
for(int i = 0; i < currentBlock.length; i+... |
7dcd5c84-dd35-4ae8-af6e-b19ead895c01 | 5 | private static void inputStrToList(String cleanString) {
//deletion of blanks at beginning or end of String
if (cleanString.startsWith(" ")) {
cleanString = cleanString.substring(1);
}
//temporary linked list with userInput
LinkedList finalInputList = new <String>... |
86700c63-76fb-4aa3-8470-bb532fd5c4fa | 6 | public void ParseElements(Node parentElement) {
Node child = parentElement.getFirstChild();
while (child != null) {
String nodeName = child.getNodeName();
if (nodeName == "has") {
ConditionType = ConditionTypeENUM.OWNER;
if (child.getFirstChild().getNodeValue().charAt(0) == 'y') {
has = true;... |
35d87434-736b-4829-85ac-aa59414badb5 | 6 | public static void main(String args[]) {
/* Set the Windows 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://dow... |
9b8bffaa-a38d-4d0e-a259-a23184b3898f | 9 | public static void handleHelloReply(HTSMsg msg, HTSPClient client){
Collection<String> requiredFields = Arrays.asList(new String[]{"htspversion","servername","serverversion","servercapability","challenge"});
if (msg.keySet().containsAll(requiredFields)){
for(String s : msg.keySet()){
if(s.equals(HTSPVERSION)... |
2d2a9053-fe35-4d9d-8471-cdabc9a642d3 | 4 | public void resize(double scaleFactor){
if (Debug.audio) System.out.println("AudioPlayer -> Resize called");
if((null != player) && (realizeComplete)){
scaledXCoord = (int) (scaledXCoord * scaleFactor);
scaledYCoord = (int) (scaledYCoord * scaleFactor);
scaledXDim = (int) (scaledXDim * scaleFactor);
... |
19067bbe-47dc-4461-afba-dea27509969e | 1 | public TweetMap() {
for (int i = 0; i < getSize(); i++) {
Status status = tweets.get(i);
String result = "<html><a href='www.twitter.com'>"
+ status.getUser().getName() + "</a>" + " : "
+ status.getText() + "</html>";
listData.add(result);
}
} |
985b808b-9389-4ccc-a610-321b389b0d5c | 0 | public Tile(Sprite sprite, boolean solid) {
this.sprite = sprite;
this.solid = solid;
} |
c1bb9236-7714-4f47-b083-1009f858e973 | 2 | private Color deserialiseColour(String c) throws NumberFormatException {
String[] parts = c.split(" ");
int r, g, b, a;
Color result;
if (parts.length >= 3) {
r = Integer.parseInt(parts[0]);
g = Integer.parseInt(parts[1]);
b = Integer.parseInt(parts[2]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.