method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7db8e612-919d-444e-ae43-8c81e613c389 | 5 | public boolean contains(DockLayoutNode node) {
if (node == this) {
return true;
}
for (DockLayoutNode child : mChildren) {
if (child == node) {
return true;
}
if (child instanceof DockLayout) {
if (((DockLayout) child).contains(node)) {
return true;
}
}
}
return false;
} |
53dad04d-c408-40b1-9397-113e7856993f | 1 | public void setPos1(int val){ if (val == 1){p1 = true;} else { p1 = false; }} |
c6fc66a1-d272-43db-a9e1-cb53a31fa742 | 4 | public static void main(String[] args) {
/* Use an appropriate Look and Feel */
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
//UIManager.setLookAndFeel("... |
5f280dce-b1d6-4ee5-8922-57f807678d64 | 1 | private void setGrid(Grid grid) {
if (grid == null)
throw new IllegalArgumentException("Grid can't be null!");
this.grid = grid;
} |
2ee68d40-247e-4f73-916b-59f473052e71 | 2 | public static long unsignedInt (byte[] byteArray, int selector, int byteOrdering)
{
// byteOrdering tells how bytes are stored
// selector should always point to lowest byte position of range
// local vars
int a = 0 ;
// case out on the storage scheme
switch (byteOrdering) {
case HI_TO_LO: //... |
bc73ab40-e164-4353-b1a4-097e50f50abd | 9 | final public Identifier ValueIdentifier() throws ParseException {
ModuleIdentifier module;
Token dot_t;
NodeToken value;
Identifier identifier;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TYPE_IDENTIFIER_T:
module = ModuleIdentifier();
dot_t = jj_consume_token(DOT_T);
value = ... |
ef27a461-5f64-44aa-ba6b-14bcec05c4ce | 5 | private void addSearchPanel() {
Dimension inputDimension = Constants.getInputDimension();
Dimension dateDimension = Constants.getDateDimension();
searchPanel = new JPanel();
searchPanel.setBorder(new TitledBorder("查询条件"));
searchPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
... |
d51842f5-b131-4ebe-9bb7-2dda0b939b22 | 3 | public static boolean isWhitespace(String str)
{
if (str == null)
{
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++)
{
if ((Character.isWhitespace(str.charAt(i)) == false))
{
return false;
... |
db9dba6a-b975-40bf-af6d-27f2280c8bc5 | 9 | @Override
public synchronized void run() {
try{
while (true){
while (ch1.isEmpty()||!ch2.isEmpty()){
wait();
} // Wait for something to do
val=int_receive();
while (numberOfRepetitionAndLost < maxError){
Random random = new Random();
int randomInt = random.nextInt(3); // randomIn... |
483b471a-1a88-4265-89e8-ca43d4470ba3 | 5 | public boolean initialize(ArrayList<String> in) {
assert (in != null) : "Cannot initialize with a null list";
assert (tokens == null) : "Cannot reinitialize EnglishNumber";
assert (in.size() != 0) : "Cannot accept an empty arraylist";
if (in == null)
{
em.error(... |
4fe17f51-8472-47fb-94ec-81eca9c6df7d | 2 | @Override
public String getConnectionsString() {
String result = "";
for (Iterator<ISocketServerConnection> it = getConnections().iterator(); it.hasNext();) {
ISocketServerConnection ssc = it.next();
if (result.isEmpty()) {
result = new Long(ssc.getIdConnection()).toString();
}
... |
00f1cb57-1486-4d00-81ef-9db4621a078c | 5 | public void setName( String name )
{
if( cxnSp != null )
{
cxnSp.setName( name );
}
else if( sp != null )
{
sp.setName( name );
}
else if( pic != null )
{
pic.setName( name );
}
else if( graphicFrame != null )
{
graphicFrame.setName( name );
}
else if( grpSp != null )
{
grpSp... |
5cb1e46e-5339-41ea-9b8a-c6acd022f3a3 | 2 | private void createAndAddApplicationToSystemTray() throws IOException {
// Check the SystemTray support
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
Image image = new ImageIcon("").getImage();
final TrayIcon trayIcon = new TrayIcon(image, TOOL_TIP);
thi... |
c5726956-1bbb-48ac-a4be-26ebdfa54712 | 5 | private void drawBeastRadius(GOut g) {
String name;
g.chcolor(255, 0, 0, 96);
synchronized (glob.oc) {
for (Gob tg : glob.oc) {
name = tg.resname();
if ((tg.sc != null)
&& (!name.contains("/cdv"))
&& ((na... |
3dab062e-8163-43f2-9539-b0df3e61e9ee | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
List<Usuario> us = new Conectar().ConexionUs();
Usuario u = new Usuario();
String s = null;
try {
s = new UseUser().Ge... |
281388ed-f663-4a38-97f7-896b0c387a34 | 4 | public void addRoom(String showName, String dei, Room room){
Days day = Days.valueOf(dei);
int d = day.ordinal();
for (Show show : days[d].getShows()) { //iter the shows of that day
if (!show.getName().equals(showName)){ //see if there is a show with tha correct name
... |
f9fe167e-6164-4b2f-8fd1-1696ac0f1127 | 0 | @Override
public int fight() {
return super.fight();
} |
773e49c6-4c5f-4713-b412-caaf066e8d09 | 1 | boolean isImportTaxApplicable(String sItem)
{
if(sItem.contains("import"))
return true;
return false;
} |
11074e8a-22b9-43c8-9e2f-158699abfde1 | 2 | public void startup(Window window) {
this.window = window;
csvLoadCard.init(this);
serializationLoadCard.init(this);
manualSetupCard.init(this);
scrapeInfoCard.init(this);
setupBatteriesCard.init(this);
if (StartupSequence.checkForSerializedData()) {
... |
af3f4358-f90e-4b9f-ba2c-6cd4376ca4b8 | 5 | @EventHandler(priority = EventPriority.HIGH)
public void playerPickUpItem(PlayerPickupItemEvent e) {
if(e.getItem().getItemStack().equals(new ItemStack(Material.SKULL_ITEM, 1))) {
for(TTEnTGame game: TTEnTMain.activeGames) {
for(IngamePlayer p: game.players) {
e.getItem().getLocation().equals(p.getSpawnH... |
6cd1b02c-3b26-4f25-ab55-65345f9c8919 | 1 | public double nota()
{
double acum =0;
for(RespuestaAlumno respuesta: respuestas)
{
acum = acum + this.puntaje(respuesta);
}
double laNota = acum*10/this.puntajeTotal();
return(laNota);
} |
1af08bab-e9b6-4b65-9962-4b833203e1ce | 0 | public String getName() {
return name;
} |
6bf093b3-aac4-4a9a-844b-267134fd67d3 | 6 | public void reorderList(ListNode head){
if(head != null && head.next != null){
ListNode slow = head;
ListNode fast = head;
while(fast!=null && fast.next!=null&&fast.next.next!=null){
slow = slow.next;
fast=fast.next.next;
}
ListNode second = slow.... |
54ef9ae1-996c-4c83-8b81-18754a9492a6 | 5 | * @return The column, or <code>null</code> if none is found.
*/
public Column overColumnDivider(int x) {
int pos = getInsets().left;
int count = mModel.getColumnCount();
for (int i = 0; i < count; i++) {
Column col = mModel.getColumnAtIndex(i);
if (col.isVisible()) {
pos += col.getWidth() + (mDrawCol... |
44aadd8c-0629-475b-9569-55e7f12cf949 | 7 | public void damage(Vector2f lineStart, Vector2f lineEnd, Vector2f nearestIntersection)
{
Vector2f nearestBotIntersect = null;
Enemies nearestBot = null;
for (Enemies enemies : enemises)
{
Vector2f colVector = Game.getLevel().lineInterSectRect(lineStart, lineEnd, new Vecto... |
f451dc42-605e-4a70-a1fa-593a53fab739 | 0 | public Speaker findSpeakerById(final Long id) {
return new Speaker();
} |
ba6acf83-5924-4e67-8793-0c66dc04dd8b | 7 | private static void addMetadata( OtuWrapper wrapper, File inFile, File outFile,
boolean fromR) throws Exception
{
HashMap<String, Integer> caseControlMap = getCaseControlMap();
BufferedReader reader = new BufferedReader(new FileReader(inFile));
BufferedWriter writer = new BufferedWriter(new FileWriter(out... |
d8686a6c-80ed-4d86-ae0c-8666daa06803 | 5 | private DataModel loadFromFile(File pathToFile) {
DataModel dm = null;
if (pathToFile != null) {
ObjectInputStream ois = null;
if (pathToFile.exists()) {
try {
ois = new ObjectInputStream(new FileInputStream(pathToFile));
... |
163c8035-0ade-439b-aafa-f56d7975c206 | 8 | public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
JSONArray ja = new JSONArray();
for (;;) {
String value = getValue(x);
if (value == null) {
return null;
}
ja.put(value);
for (;;) {
ch... |
e95c7e3f-6a24-4ccb-85e2-e3b8b133f265 | 7 | protected final void setTComponentContainer(TComponentContainer componentContainer)
{
if (tComponentContainer != componentContainer)
{
if (tComponentContainer != null)
{
tComponentContainer.getParent().removeMouseListener(this);
tComponentContainer.getParent().removeMouseMotionL... |
56fae1d9-6c0f-4637-9058-6b6fa29c2196 | 7 | public boolean bishopMove(int startRow, int startCol, int endRow, int endCol)
{
Piece piece = checker[startRow][startCol];
Piece endTile = checker[endRow][endCol];
if(endTile == null || endTile.alligence != piece.alligence) //only move or move and attack
{
if(Math.abs(endCol-startCol) == Math.abs(end... |
897b1ff1-9537-4b6c-b265-c21c4d11a863 | 3 | public void dump(String prefix) {
System.out.println(toString(prefix));
if (children != null) {
for (int i = 0; i < children.length; ++i) {
SimpleNode n = (SimpleNode)children[i];
if (n != null) {
n.dump(prefix + " ");
}
}
}
} |
8708233b-e2f3-4fff-b019-71b6def72084 | 2 | protected void openXmlPng(BasicGraphEditor editor, File file)
throws IOException
{
Map<String, String> text = mxPngTextDecoder
.decodeCompressedText(new FileInputStream(file));
if (text != null)
{
String value = text.get("mxGraphModel");
if (value != null)
{
Document document = mx... |
b1928600-b755-4f6e-8c00-a0c6ed210467 | 3 | public static RoutingMessage getRoutingMessage(ByteBuffer buffer) {
int headerSize = buffer.getInt();
// header
Map<String, String> header = null;
if (headerSize > 0) {
header = new HashMap<>();
for (int i = 0; i < headerSize; i++) {
String key = ... |
10eea4a3-c04d-4291-b1c1-63eda7a7b7d5 | 9 | private void establishConnection(String url, boolean willRetryOnFailure) throws SQLException
{
if (!isEncryptionEnabled())
jdbc = DriverManager.getConnection(url);
else if (0 == encryptionPassword.length)
throw new IllegalStateException(
"The password is no longer available. Please set the password agai... |
8212a254-48ec-44a7-ae02-f32d64fc8fbe | 3 | public byte[] getData() {
if(tmpData != null) {
if(data == null || tmpData.size() != data.length) {
data = tmpData.toByteArray();
}
}
return data;
} |
73daad5b-726f-49c3-b2e4-246286ffc03b | 8 | private void AddNodeToQueue( CommandNode node )
throws CreateCMDTreeErrorException
{
if ( SwitchStack.empty() )
{
if ( IfStack.empty() && WhileStack.empty() )
{
__AddNodeToQueue__( CMDTree, node );
}
else
{
RTTestLog.logToConsole( "Stack Error.", LogCollector.ERROR );
Crea... |
5c2c1f56-7ce5-49e3-a72e-3c7bec7b3820 | 1 | @Override
public void endTransaction() {
if(commit()){
this.transaction = false;
}
} |
7c11d5d3-1c88-4086-9604-f776172c6325 | 6 | public int countPlayerPoints(int player)
{
int points = 0;
for (int[] row : board)
{
for (int value : row)
{
if(value == W && player == W)
{
points++;
}
else if(value == B && player ==... |
cce796b7-cb01-49aa-94dd-47403f73fa5d | 4 | public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
dx = 0;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 0;
}
if (key == KeyEvent.VK_UP) {
dy = 0;
}
if (key == KeyEvent.VK_DOWN) {... |
d64f234a-08fe-4f8d-9c70-e994125419db | 3 | @GET
@Path("/{repoName}")
@Produces(MediaType.APPLICATION_JSON)
public String getRepositoryFiles(
@PathParam("repoName") String repoName,
@Context HttpServletRequest request) {
RepositoryVm repositoryVm;
Gson gson = new Gson();
if (StringUtil... |
5c36d523-d225-4945-b4e8-1f1971d75059 | 7 | private void printAddUser() throws IOException {
String s, username = null, password = null;
printMenu(PrintMenuName.ADD_USER);
while (true) {
s = br.readLine();
System.out.println(s);
if (s.equals("b")) break;
else if (s != null) {
if (username == null) username = s;
else {
password = s;... |
259ec728-9506-4d6f-9be6-27ac1eac6b59 | 2 | public static AbstractModel getRandomGrid(int min, int max, int distance,AbstractModel result) {
// AbstractModel result = new ModelParallel();
Random r = new Random(1);
for (int i = min; i < max; i += distance) {
for (int j = min; j < max; j += distance) {
result.p.add(new Particle(0.5, 0, 0, i + 0.5 - r.n... |
8dde7466-5c30-4ea0-9dba-5a1540a0d1fd | 4 | public static ArrayList<Integer> primeNumbers(int n) {
if (n < 2)
return new ArrayList<Integer>();
isPrime = new boolean[n];
char[] is_composite = new char[(n - 2 >> 5) + 1];
final int limit_i = n - 2 >> 1, limit_j = 2 * limit_i + 3;
ArrayList<Integer> results = new ArrayList<Integer>(
(int) Math.ceil(... |
94e95f50-f8fd-4afb-bf52-e7ca696e7def | 0 | @Test
public void minimalTest()
throws Exception
{
Thread.sleep( 5000 );
assertTrue( this.timedTask.getInvocationsTimedTaskA() > 0 );
} |
e131bde3-ca02-42cb-9ea2-c7e3bd9665c8 | 2 | public static void main(String[] args) {
ServerSocket server;
final int DAYTIME_PORT = 1300;
Socket socket;
try {
server = new ServerSocket(DAYTIME_PORT);
do {
socket = server.accept();
PrintWriter output = new PrintWriter(socket.getOutputStream(),
true);
Date date = new Date();
out... |
562ad53f-e99e-4518-8273-a35f23f10220 | 9 | private static void readFromFile() {
filepath = JOptionPane
.showInputDialog("Enter the file path of the file you wish to read from:");
try {
File f = new File(filepath);
Scanner sc = new Scanner(f);
while (sc.hasNextLine()) {
String name = sc.nextLine();
String title = sc.nextLine();
Array... |
26a7f170-1164-4478-a5a5-3387ecf1de7f | 8 | public static int[] findPrimes(int max) {
int[] prime = new int[max+1];
ArrayList list = new ArrayList();
//假设所有数都是质数
for(int i = 2; i <= max; i++){
prime[i] = 1;
}
//检查所有数
for(int i = 2; i*i <= max; i++) { // 這邊可以改進
//如果当前数是质数
... |
4f504250-8600-4550-a8a8-b1d8d3cfdafb | 8 | public void sublogic(int index) {
Graphics2D g2 = (Graphics2D) bi.getGraphics();
// We talked about this above...
if (foci[index] == null) {
if (DALLATONCE)
return;
else
generateCircle(index);
}
Circle subject = fo... |
f6c43647-515d-4c24-b3a8-fea737b4e02c | 4 | private double expectedValue(int[] bowl, int bowlId, int round){
int bowlSize = 0;
for(int i=0; i<bowl.length; i++)
bowlSize += bowl[i];
double avgFruitScore = 0;
int totFruitsInDistribution = 0;
for(int i=0; i<NUM_FRUITS; i++){
if(currentDistribution[i] > 0){
totFruitsInDis... |
c2e1594f-1a80-4386-bb46-89afdb11fae7 | 1 | public static int[] rightHalf(int[] array) {
int size1 = array.length / 2;
int size2 = array.length - size1;
int[] right = new int[size2];
for (int i = 0; i < size2; i++) {
right[i] = array[i + size1];
}
... |
aa056244-1645-43cd-9074-6463e67e26e5 | 8 | public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
... |
e471eb5c-edb9-49ff-9351-803eb11e64ab | 6 | public void playerHoldings() {
if (!register || !Methods.hasMethod()) {
return;
}
Format sdf = new SimpleDateFormat(larvikGaming.getConfig().getString("TimeFormat", "yyyy-MM-dd HH:mm:ss"));
Date date = new Date();
String timeStamp = sdf.format(date);
File outFile = new File(fileDir + "Player-Holdings... |
472db1e8-b2e3-493c-906e-c45549c6bab3 | 2 | private String formatProperty(String fieldKey, String fieldValue) {
if (!safe) {
// Remove whitespace from name and quotes the value.
// This typically still returns bash-unsafe key-value pairs.
return fieldKey + "=" + fieldValue;
} else {
// This returns ... |
d30da274-1cd0-42f9-83d6-a4f17fbbc1d9 | 8 | public boolean avaiable(Dish dish) {
LinkedList<Material> materials = dish.getMaterials();
for (Material tmp : materials) {
for (StorageAdapter storage : storageList) {
if (tmp.getName().equals(storage.getName()) && tmp.getAmount() > storage.getAmount()) {
return false;
}
}
}
LinkedList<Ing... |
96107492-a5c4-49e5-adf5-f9cb92bb2b25 | 5 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
Graphics2D g = (Graphics2D)G;
Composite c = g.getComposite();
// g.setComposite(new Additive());
g.setColor(new Color(255,r.nextInt(255),... |
54a73071-32f2-4b4d-afe0-6764c3dea3c9 | 8 | static int process(String line) {
int[] arr = giveArray(line.trim().split(" "));
if(arr.length == 1 && arr[0] == 0)
return 0;
int n = arr[0], c = arr[1];
String[] chosen = readLine().trim().split(" ");
boolean[] mp = new boolean[10002];
for(String s : chosen) {
mp[Integer.parseInt(s)] = true;
}
... |
6a5b330b-5bf3-416b-a07e-1bb3feaf66bc | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
977e5120-5e29-4a72-9759-deb8a3a86faf | 0 | private static int getLineNumber(){
return Thread.currentThread().getStackTrace()[3].getLineNumber();
} |
69dbfc15-cbda-4a81-af37-03028dc3e3be | 1 | @Test
public void testTimeStep_PERIOD() throws Exception {
printDebug("----------------------------");
printDebug("PERIOD: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.assertNotNull(t);
... |
916fde7d-3fc0-435e-8e77-e15acdfc6cda | 5 | public void init() {
if (inited) {
return;
}
// try and find the form's resources dictionary.
Resources leafResources = library.getResources(entries, "Resources");
// apply resource for tiling if any, otherwise we use the default dictionary.
if (leafResource... |
8d4feab0-ea02-475e-9a2d-98ca39b14dcb | 8 | void prefetch_all_headers(Info first_i, Comment first_c, int dataoffset)
throws SoundException {
Page og = new Page();
int ret;
vi = new Info[links];
vc = new Comment[links];
dataoffsets = new long[links];
pcmlengths = new long[links];
serialnos = new... |
f02eec3f-d878-4772-8323-eb7dbd1feafe | 3 | public PixImage toPixImage() {
PixImage image = new PixImage(width,height);
RunIterator iterate = iterator();
int row = 0;
int column = 0;
do {
int[] runArray = iterate.next();
int count = runArray[0];
while (count > 0) {
image.setPixel(column,row,(short)runArray[1],(short)... |
17b8dd26-37e7-40c9-a9b2-2f541b30176b | 7 | public ResourceClump(int cx, int cy, int radius, int type) {
this.cx = cx;
this.cy = cy;
this.radius = radius;
this.num_voxels = 0;
this.type = type;
int ci = getI(cx);
int cj = getJ(cy);
int iradius = getI(radius);
for (int i = ci - iradius; i < ci + iradius; i++) {
for (int j = cj - i... |
b2a4fb4a-ee7e-4f3d-b429-db5d796a565d | 5 | @EventHandler
public void login(PlayerLoginEvent ple) {
MemberManager memberManager = Citadel.getMemberManager();
memberManager.addOnlinePlayer(ple.getPlayer());
String playerName = ple.getPlayer().getDisplayName();
Member member = memberManager.getMember(playerName);
if(member == null){
... |
2780db00-0db1-4312-9c1d-3bd024df1fb1 | 4 | public static Matrice multiply(Matrice a, Matrice b) throws MatrixException
{
//Condition sur les dimensions
if(a.columns != b.lines)
{
throw new MatrixException("Problème de dimension !");
}
Matrice res = new Matrice(a.lines, b.columns);
... |
7bf7f121-1771-465a-bcb2-937481161675 | 8 | @Override
public void execute() {
Vars.status = "SummoningNode";
Vars.needToSummon = true;
Timer t = new Timer(2500);
if (Summoning.getPoints() < 1 && !Summoning.isFamiliarSummoned()) {
Vars.status = "Pot";
Inventory.getItem(Const.SUM_POT).getWidgetChild().interact("Drink");
t.reset();
while (t.isR... |
8ebbb077-8963-4350-bf3d-e2a6fcb4ae8f | 9 | public final static String htmlEscape(String line)
{
StringBuilder sb = new StringBuilder();
char[] chars = line.toCharArray();
for (int i=0; i<chars.length; i++) {
char cur = chars[i];
if ((cur == '\n') || (cur == '\r') || (cur == '\t')) {
sb.append(c... |
c6d3de89-405d-4496-957b-ae7e3a86455c | 9 | public static int storeVersion(byte[] target, int targetOffset, int targetLength, int targetLimit,
long versionHandle, byte[] source, int sourceOffset, int sourceLength) {
int existedMask = 0;
int to = targetOffset;
if (targetLimit > target.length) {
throw new IllegalArgu... |
5664fd65-f7ff-43c5-b2af-6bdd13b26ab6 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((dataNascimento == null) ? 0 : dataNascimento.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime ... |
e14d0aab-e711-44dd-8832-0aabc0c960a6 | 7 | protected Direction decide() {
if (followingWall && rotation == 0) {
// "When the solver is facing the original direction again,
// and the angular sum of the turns made is 0,
// the solver leaves the obstacle and continues
// moving in its original direction." (Wikipedia)
followingWall = false;
}
... |
95825552-f352-47ad-b452-3ffbe7a7b50e | 6 | public static String formatRange(long... range) {
switch (range.length) {
case 0: return "bytes=0-";
case 1:
if (range[0] < 0) throw new IllegalArgumentException("negative range");
return "bytes="+range[0]+"-";
case 2:
if (range... |
0cf088ac-7a9c-4d21-a5aa-373fe9f539e3 | 1 | Font(BufferedImage sheet, int charWidth, int charHeight) {
this.charWidth = charWidth;
this.charHeight = charHeight;
sprites = new Sprite[L.length()];
int sheetWidth = sheet.getWidth();
for (int i = 0; i < sprites.length; i++) {
sprites[i] = new Sprite(sheet.getSubimage(i * this.charWidth % sheetWidth, (i ... |
614e7154-5308-43fd-bcbf-2d2b553c9d26 | 7 | public String getPath(String path) {
String split[] = path.split("\\.");
if (split.length <= 0)
return path;
String newPath = "";
boolean set = true;
ConfigurationSection section = config.getRoot();
for (int i = 0; i < split.length; i++) {
if (!set) {
newPath += "." + split[i];
continue;
... |
8e55e361-4ed7-4d8a-893a-c617d46ef08c | 5 | public void getMap(){
int x = xStart;
int y = yStart;
mapWidth = 0;
mapHeight = 0;
int doorCount = 0;
int interactiveCount = 0;
//Gets map from globalMap
LocalMap blockTypes = globalMap.enterLocalMap(globalPosX , globalPosY);
columns = blockTypes.x;
rows = blockTypes.y;
blocks = new Block[... |
5accda04-8559-4a0c-b282-76a2229dbffc | 3 | boolean isAttackPlaceDiagonallyAboveRightNotHarming(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) {
int positionRightAbove = 1;
while (attackPlacesOnTheRight > 0) {
if (isPossibleToPlaceDiagRightAbove(position, dimension, positionRightAbove)
... |
fd4c8a8e-4cfb-4ce3-9700-8c18618f953d | 0 | String getAuthors()
{
return authors;
} |
1bd56570-78dd-4c3f-ba98-b9b2781dd731 | 7 | public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException {
if (syntaxGraph == null || dataFormatInstance == null) {
return;
}
if (syntaxGraph.hasTokens()) {
sentenceCount++;
final PhraseStructure phraseStructure = (PhraseStructure)syntaxGraph;
try {
sentenceID.setLength(0)... |
b80ce1e4-c39c-473c-b81f-e3b55d801b08 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
4cf34345-2e0d-4642-b2ba-85b44106a884 | 0 | public static void main(String[] args)
{
TuringTrimmingTester t=new TuringTrimmingTester("productions.txt");
} |
e42b43ef-e74d-4585-ac4a-1b34dde4671f | 1 | public void visit_lrem(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
72b611d4-783e-4195-a780-e06ff084b8dc | 9 | void balance(Entry<V> x) {
Entry<V> y;
x.color = true;
while (x != root && x.parent.color) {
if (x.parent == x.parent.parent.left) {
y = x.parent.parent.right;
if (y != null && y.color) {
x.parent.color = false;
... |
b87c9210-813a-4469-b038-9d2ab8a38ad1 | 4 | public static String getContentFromSeekableInput(SeekableInput in, boolean convertToHex) {
String content = null;
try {
in.beginThreadAccess();
long position = in.getAbsolutePosition();
ByteArrayOutputStream out = new ByteArrayOutputStream();
/*
... |
db05cecd-7b63-428b-99d9-9a44df7bb25d | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int times = Integer.parseInt(in.readLine().trim());
for (int t = 0; t < times; t++) {
in.readLine();
String firstLine = in.readLine... |
acbcb635-7e7a-4e3a-9dcc-ed5f42d334e8 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FavoritesTag other = (FavoritesTag) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
retur... |
1c48322f-2a10-497e-96e0-1b107337d0e3 | 2 | private int readStringTable
(byte[] remainingData,
int offset,
int blockStart,
ResStringPool_Header stringPoolHeader,
Map<Integer, String> stringList) throws IOException {
// Read the strings
for (int i = 0; i < stringPoolHeader.stringCount; i++) {
int stringIdx = readUInt32(remainingData, offset)... |
1022bdcd-7112-4364-ace3-9f42d4014fde | 6 | @Override
public void insertAt(T object, int index) throws DAIllegalArgumentException, DAIndexOutOfBoundsException
{
if(object == null)
{
throw new IllegalArgumentException();
}
else if((index >= 0) && (index <= size))
{
if(size >= array.length)
{
growArray();
}
//starts at the end an... |
d0e80c20-420a-444c-a5bc-3271421769e9 | 0 | public ArrayList<String> getEspTitles() {
return espTitles;
} |
67291d35-8e9c-4796-a863-903862561f89 | 0 | public boolean getScrollableTracksViewportWidth() {
return getPreferredSize().width < getParent().getSize().width;
} |
75621c14-0c54-4262-ad32-eb0b66325c5b | 6 | public List<Claim> getClaimAndSubclaimList(String teamType) {
List<Claim> claimList = new ArrayList<Claim>();
Element claimE;
Claim claim;
for (Iterator i = root.elementIterator("claim"); i.hasNext();) {
claimE = (Element)i.next();
if (claimE.attributeValue("teamType").equals(teamType)) {
if (cla... |
59c32897-18f6-47c8-a127-60a0faf2d96c | 5 | public static boolean canAccess(String position, String subsystem){
if(position.equals("manager"))
return true;
if(position.equals("pharmacist")&&!subsystem.equals("employee"))
return true;
if(position.equals("tech")&&subsystem.equals("patient"))
return true;
return false;
} |
bdf8f390-012b-4faf-87ec-a8370fef8266 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServicePK_Simple other = (ServicePK_Simple) obj;
if (client == null) {
if (other.client != null)
return false;
} else if (!client.equals... |
962f7dfa-b6ee-4d1a-884c-48b75388d271 | 6 | public static Point2D lookUpNextStep(Point2D start, Point2D end, Class<?>... ignoredObstacles) {
if (Field.arePointsNear(start, end)) { return end; }
int[][] map = getMap(ignoredObstacles);
map[start.x+1][start.y+1] = 0;
map[end.x+1][end.y+1] = 0;
Queue<Integer... |
66686e66-a394-40e7-901a-c90443e00795 | 8 | @Override
public void run() {
for(Player p : DeityNether.plugin.getServer().getOnlinePlayers()){
if(p.getWorld() == DeityNether.plugin.getServer().getWorld(DeityNether.config.getNetherWorldName())){
if(!p.hasPermission(DeityNether.OVERRIDE_PERMISSION) && p.hasPermission(DeityNether.GENERAL_PERMISSION)){
... |
39c04ad5-4178-4a7f-96fe-44693c449d18 | 8 | public boolean setWumpusPos(Position newPos){
boolean success = false;
if(getWumpusPos().getX() != -1 && getWumpusPos().getY() != -1) { // Wumpus already exists
removeWumpus();
}
if(this.isInsideBoard(newPos)) {
if(this.isEmpty(newPos)) {
// Set Wumpus
if(writeOnBoard(newPos,WUMPUS)){
getW... |
536cd30d-aac1-4fed-9fdd-dfbbc91d8927 | 3 | public static List<RecParametr> StringToParams(String str)
{
List<RecParametr> list = new ArrayList<RecParametr>();
String[] strs = str.split(";");
for(String s1 : strs)
{
RecParametr r = new RecParametr(s1.trim() + ";");
if(!r.GetName().equals("") &&... |
2e8a62b3-ac34-4f6e-9d63-4ce1dae967c4 | 1 | @Override
public int rowsX() {
return isNotPlayerInventory() ? 4 : 5;
} |
d13e6176-3c71-45fa-9239-93d11a88ca7c | 2 | public static void loadData(ArrayList<ResourceLoader> loaders){
for(ResourceLoader loader : loaders){
loader.addResources();
}
OutputUtility.outputLine("-Loading Resources-");
OutputUtility.increment();
OutputUtility.outputLine("-Loading Images-");
Outp... |
441e064e-c77d-4fac-a979-c8301074c9f4 | 2 | public double[][] standardizedCovariances(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.standardizedCovariances;
} |
85dc4962-ec9c-4d47-91b8-f508fda7f511 | 9 | public boolean execute() {
final int cycle=CDState.getCycle();
if( shuffle ) rperm.reset( Network.size() );
for(int j=0; j<Network.size(); ++j)
{
Node node = null;
if( getpair_rand )
node = Network.get(CDState.r.nextInt(Network.size()));
else if( shuffle )
node = Network.get(rperm.next());
else
no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.