method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5990d0e0-bb7a-4880-8491-adbf52d72e3a | 0 | public void setHouseNumber(String houseNumber) {
Address.setHouseNumber(houseNumber);
} |
69dbf096-6d73-40a5-ba25-245120f383c1 | 8 | private static void handleUpdate() {
final ClientUpdater.Update update = ClientUpdater.getUpdate();
if (update != null && update.getVersionNum() > Client.VERSION_ID) {
if (curFile.toString().endsWith(".jar")) {
final int option = JOptionPane.showConfirmDialog(client, "A new u... |
52af3703-ce22-4087-919a-8b0203591d17 | 5 | @Override
public boolean execute(String input) {
String date;
date = input.substring(input.indexOf(" ")+1,input.length());
java.sql.Date sqlDate = getSqlDate(date);
Date val = null;
String date1 = date;
DateFormat formatter;
formatter = new SimpleDateFormat... |
dcedb2bf-5fef-4cec-8974-e9734fc9119f | 1 | private void initComponents()
{
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(3);
this.setResizable(false);
this.setUndecorated(true);
this.start = new JButton("Start");
this.start.setSize(50, 50);
start.setFocusable(false);
... |
f69bc342-2c47-41d8-82bc-472bbaf718ce | 8 | public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
boolean cdata = false;
@Override
public void startNode(String name, @SuppressWarnings("rawtypes") Class clazz) {
if (!name.equals("xml")) {
char[] arr = name.toCharArray();
if (arr[0] >= 'a' && arr[0... |
6d6d5ca1-49ae-4c5e-a3e0-1a2c790ed318 | 4 | public static ItemStack getCraftItemStack(ItemStack stack) {
// Any need to convert?
if (stack == null || get().CRAFT_STACK.isAssignableFrom(stack.getClass()))
return stack;
try {
// Call the private constructor
Constructor<?> caller = INSTANCE.CRAFT_STACK.get... |
2e3ed2e4-97dd-4af6-b526-824fc326b382 | 9 | public static void Filegen(String srcFilePath, String destFilePath,int rtpStreamPort)
{
int bytesRecieved = 0;
int fileIndex=0;
FileOutputStream fo=null;
DataOutputStream dOut=null;
long videoDuration = 0;
File sourceVideo=new File(srcFilePath);
VideoDetails ... |
f2dcd1c1-97f3-4021-977d-af41fa590d14 | 0 | @Override
public void draw(Graphics g) {
super.draw(g);
Rectangle masse = getAbsoluteRect();
//draw eyes
g.setColor(Color.WHITE);
g.fillOval((int)(masse.getX() + masse.getWidth() * 0.2), (int)(masse.getY() + masse.getHeight() * 0.4), (int)(masse.getWidth() / 6), (int)(masse.getHeight() / 6));
g.fillO... |
9559e186-769f-4881-a3ea-2c48dc68626c | 9 | public static boolean compareSubstring(List<String> pieces, String s)
{
// Walk the pieces to match the string
// There are implicit stars between each piece,
// and the first and last pieces might be "" to anchor the match.
// assert (pieces.length > 1)
// minimal case is <s... |
1442cac6-db1b-468f-a716-dc183632fa80 | 3 | public void setSelected(ArrayList<Boolean> sel) {
int count = 0;
for(int i = 0; i < sel.size(); ++i) {
if(sel.get(i)) {
++count;
}
}
if(count > 1) {
throw new IllegalArgumentException("Must select only one option");
}
el... |
8ca45e5d-2ddc-4a20-9b2f-76b07f253844 | 8 | protected void stepFWDBackTrack(boolean showSteps) {
// Global alignment: start from D(m,n)
// TODO: Not very elegant. To be changed!
CellElement theOneBefore = null;
if (!m_backTrackList.isEmpty()) {
theOneBefore = (CellElement) m_backTrackList.getLast();
}
if (m_backtrackLastS... |
b2209455-299f-4491-80e4-7d8d2d83bb50 | 8 | private void loadBasic() {
FileEntry curr = null;
if(wallpaper!=null) {
jTextField1.setText(wallpaper.getPath());
}
if((curr=getFile("/usr/palm/sysmgr/images/palm-logo.png"))!=null) {
jTextField4.setText(curr.file.getPath());
}
if((curr=getFile("/u... |
3e4f8184-dbd9-478d-a102-a07ebdeda0e8 | 7 | @Override
public Node beforeDecode(mxCodec dec, Node node, Object into)
{
if (node instanceof Element)
{
Element elt = (Element) node;
mxGraphModel model = null;
if (into instanceof mxGraphModel)
{
model = (mxGraphModel) into;
}
else
{
model = new mxGraphModel();
}
// Reads th... |
58809627-694d-4f88-824a-4889be780130 | 5 | private boolean regexpHelper(String xpr, String str) {
// the regular expression syntax required by XACML differs
// from the syntax supported by java.util.regex.Pattern
// in several ways; the next several code blocks transform
// the XACML syntax into a semantically equivalent Pattern ... |
5d53db74-32c5-4b15-b11e-e75fad71c45b | 9 | @Override
public synchronized void move() {
float curX, curY;
curX = getX();
curY = getY();
if(getState().equals("eaten")){
move2();
return;
}
else{
if (getDirection().equals("left") && !isAsleep()){
curX -= GameBoard.tileLength/4;
setX(curX);
}
else if (getDirection().equals("right"... |
e6806314-228e-4e44-a8e1-89169058d93f | 5 | public static String getPageTitle(String url) throws IOException {
URL u = new URL(url);
URLConnection conn = u.openConnection();
ContentType contentType = getContentTypeHeader(conn);
if (!contentType.contentType.equals("text/html"))
return null;
else {
... |
e7e46123-084b-485a-8dd7-c7ebbc79648a | 9 | @Test
public void testNeuronWeightedSynapse() {
AbstractNeuron<Integer, ISynapse<?, Integer>> neuron = new AbstractNeuron<Integer, ISynapse<?, Integer>>(
5) {
@Override
protected Integer computeValueFromInputs(
Set<ISynapse<?, Integer>> inputs) {
return getValue();
}
};
InputReader<INeuron<... |
b00a6e8b-64af-4b11-9e88-c605fec17969 | 3 | public static int getArgumentSize(String methodTypeSig) {
int nargs = 0;
int i = 1;
for (;;) {
char c = methodTypeSig.charAt(i);
if (c == ')')
return nargs;
i = skipType(methodTypeSig, i);
if (usingTwoSlots(c))
nargs += 2;
else
nargs++;
}
} |
9384fa4c-b0e0-4a09-925e-4d70e2cda094 | 3 | public String getTooltipExtraText(final Province current) {
final int id = current.getId();
if (!editor.Main.map.isLand(id))
return "";
String value = mapPanel.getModel().getHistString(id, prop);
if (value == null || value.length() == 0)
value = "0";
... |
bc89d540-fab7-4457-b16d-16c00c4d3d69 | 6 | @Override
public void mouseReleased(MouseEvent me) {
int r = table.rowAtPoint(me.getPoint());
if (r >= 0 && r < table.getRowCount()) {
table.setRowSelectionInterval(r, r);
} else {
table.clearSelection();
}
int rowindex = table.getSelectedRow();
... |
f119053f-3eec-47ab-aeb8-337e6c50fa0b | 9 | public void modBash() {
try {
//Crea la posible ruta del archivo, en el directorio actual en la carpeta 'Redes'
Path IpListas = Paths.get(System.getProperty("user.dir"), "Redes", "IpsBloqueadas.txt");
//checa si existe la ruta y archivo
boolean existe = (new Fil... |
d4683110-a8c7-4d39-aac9-d0aac8ebe988 | 0 | RoomState(String roomValue){
this.roomValue = roomValue;
} |
f5a2a0f1-1106-404e-9fdd-dc875971f0fe | 0 | private void initialize() {
CLOSE = GUITreeLoader.reg.getText("close");
buttonCLOSE = new JButton(CLOSE);
// Define the Bottom Panel
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new FlowLayout());
bottomPanel.add(buttonCLOSE);
getContentPane().add(bottomPanel,BorderLayout.SOUTH);
... |
37ee03d3-800c-4818-b7b8-4edb423747ee | 0 | public final File getCurrentFile() {
return currentFile;
} |
4aafe80d-5e39-4f5b-834d-fec91bde2362 | 6 | public static void hasPathSumHelper(TreeNode node, int sum , int tempSum, ArrayList<Integer> list){
if(node == null) return ;
tempSum += node.val;
if(node.left == null && node.right == null){
if(tempSum == sum){
return ;
}else{
return ;
}
}
if(node.right != null)... |
7f95830c-4225-4a4f-8a52-83c30f95a58a | 0 | @Override
public void addServerStartListener(ServerStartListener listener) {
serverStartListenerList.add(ServerStartListener.class, listener);
} |
7eaaecea-c4e0-4135-9cf0-e93d5199b83f | 0 | public static Person personWithNameAndAge(String name, int age) {
return new PersonImpl(name, age);
} |
72523009-d027-4945-95dd-b382cd8a76df | 5 | public ArrayList<T> levelOrdertoArray(LinkedBinaryTree<T> t) {
ArrayList<T> list;
list = new ArrayList<>();
int height=t.height();
for(int i=0;i<Math.pow(2, height)-2;i++){
list.add(null);
}
int i = 0;
ArrayQueue<BinaryTreeNode<T>> q = new ArrayQueue<>... |
36a5838a-da67-4801-9459-d9ddcd3d627c | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
088de463-635f-4ec0-80ad-fcbaca84a682 | 6 | public int hitBalls(){
double randy = r.nextDouble();
int balls = 0;
while (randy > BALLS_HIT[balls]){
balls++;
}
for (int i = 0; i < balls; i ++){
// place a ball in a random plot
double distance = r.nextDouble();
int row = 1;
while (row < DISTANCE_HIT.length && distance >= DISTANCE_HIT[row... |
eaf68385-0c05-4481-822b-3b80bdabd704 | 2 | public static ArrayList<Book> SearchbyAuthor(String author, FakeDateBase fakeDateBase){
ArrayList<Book> result = new ArrayList<Book>();
for (Book book : fakeDateBase.getBooks()) {
if(book.getAuthor().equals(author))
result.add(book);
}
return result;
} |
70c27a4c-327a-4a03-b1d0-259526b24f41 | 1 | public static int duration(Date start, Date end) {
if (start.after(end))
return -1;
double diff = (double) (end.getTime() - start.getTime()) / MilleSecond;
return (int) Math.ceil(diff);
} |
cd5975c5-0ddf-4d0d-a766-0ab5396aa683 | 6 | private void recolorCaps(Piece piece, Level next)
{
if (next != null)
{
if (!piece.type.monocap)
{
for (int i = 0; i < piece.type.width*2; i += 2)
for (int j = 0; j < piece.type.height*2; j += 2)
{
Piece cap = next.pieceAt(piece.x+i... |
fb62a5b7-983e-47c0-9c04-68489b021b1e | 5 | public void acceptResult(CompilationResult result) {
boolean errors = false;
if (result.hasProblems()) {
IProblem[] problems = result.getProblems();
for (int i = 0; i < problems.length; i++) {
if (problems[i].isError())
errors = true;
this.problems.add(problems[i]);
}
}
if... |
d87bede0-6221-4230-b8b0-06888ba6e05d | 8 | public TextMessageModel buildFromXml(String xml) throws DocumentException {
if (xml.trim().isEmpty() || null == xml) return null;
List<Element> list = WechatUtils.getXmlRootElements(xml);
TextMessageModel textMessageModel = new TextMessageModel();
for (Element element : list) {
... |
41426737-c4be-46c6-9d0e-8128810f1258 | 4 | private ArrayList<TreeNode> searchReturnPath(TreeNode now, TreeNode dest,
ArrayList<TreeNode> path) {
if (now == null) {
return null;
}
path.add(now);
if(now==dest){
return path;
}
ArrayList<TreeNode> tmp = new ArrayList<TreeNode>();
tmp=searchReturnPath(now.left,dest,path);
if(tmp!=null){
r... |
80b00c45-dcf7-4828-9f7e-a94d9e951589 | 1 | @Override
public String getParameter(String key) {
String[] value = parameters.get(key);
if (value instanceof String[]) {
return ((String[]) value)[0];
} else {
return null;
}
} |
f5f74524-8f7c-4490-bfda-69300bc928cc | 8 | @Override
public void expand(int grabber, Point endMove, int canvasWidth, int canvasHeight)
{
Point middle = new Point((int) (x + (width / 2)), (int) (y + (height / 2)));
int distanceToEndPoint = (int) Math.sqrt(Math.pow((middle.getY()-endMove.getY()), 2)+Math.pow((middle.getX()-endMove.getX()), 2));
int dista... |
cce099c3-6c29-48e4-a054-23e75cbcb8fd | 2 | public int write(byte[] data, int dataPtr, int length) throws IOException {
int n = 0;
//while (myAppData.hasRemaining()) {
// Generate SSL/TLS encoded data (handshake or application data)
// FIXME:
// Need to make sure myAppData has space for data!
myAppData.put(data, dataPtr, length);
myAppDat... |
91e6edca-5cd9-421d-aebc-b5329e2b6aa7 | 5 | @PUT
@Produces( { "application/json", "application/xml" })
@Path("/mood/id/{id}/{username}/{valence}/{arousal}")
public void putMoodByID(@PathParam("id") String id,
@PathParam("username") String username,
@PathParam("valence") double valence, @PathParam("arousal") double arousal) {
if(valence>=0 && valence <... |
e3207dd3-8bb4-4db4-b5d0-2749a16f2e3a | 9 | public void showMapControls(boolean value) {
if (value && freeColClient.isInGame()) {
if (mapControls == null) {
try {
String className = freeColClient.getClientOptions()
.getString(ClientOptions.MAP_CONTROLS);
Class<?> ... |
22a1b35c-f8e5-43fa-8240-b24ea35bfde5 | 7 | public void writeRawULong(long val, int bits) throws IOException {
if (bits == 0) return;
if (!ensureSize(bits)) throw new IOException("Memory Allocate Error");
val &= MASK32[bits];
totalBits += bits;
while (bits > 0) {
if (outBits == 0) {
if (bits < B... |
6322b83d-1635-4131-9cf2-97071aba0b3c | 1 | @Override
public boolean activate() {
return Game.isLoggedIn() && !Combat.isInitialized();
} |
cf6acfad-35a9-48ab-a4a8-176df4bdd84f | 7 | private static String message(final String message, final Throwable throwable) {
if (throwable != null && throwable instanceof ParseException) {
final ParseException exception = (ParseException)throwable;
if (exception.getLine() != null && exception.getCol() != null... |
18802170-5fee-427c-9a62-69494499b7ca | 8 | public ImageIcon getImage(Object key) {
if(key instanceof ItalianDeckCard)
{
ItalianDeckCard card = ((ItalianDeckCard) key);
String iconName = "";
iconName = card.getSuit().toString();
iconName += "_" +(
card.getRank().getCardNumber()>=2 &&card.getRank().getCardNumber()<=7 ?card.getRank().getCardNumb... |
5fdb9224-c3ba-41f0-81a9-24d913d0ce71 | 8 | public void mouseReleased(MouseEvent e) {
int ex = e.getModifiersEx();
if ((ex & (MouseEvent.SHIFT_DOWN_MASK | MouseEvent.CTRL_DOWN_MASK
| MouseEvent.META_DOWN_MASK)) == 0 && e.isPopupTrigger()) {
doPopupMenu(e);
return;
}
sim.tempMouseMode = sim.m... |
6a3447f9-9bd3-4093-a191-b73d3c95fbdd | 4 | public static float[] GeneratePerlinNoise(float[] baseNoise, int octaveCount)
{
int width = baseNoise.length;
float[][] smoothNoise = new float[octaveCount][]; //an array of arrays containing
float persistance = 0.5f;
//generate smooth noise
for (int i = 0; i < octaveCount; i++)
{
... |
393f2079-3649-4912-a88b-0802a61aeff3 | 5 | @Override
public void run() {
try(DatagramSocket workerSocket = new DatagramSocket()) {
Sender sender = new Sender(workerSocket, remotePort, remoteAddress);
Logger.log("Starting worker file transfer from port: " + sender.getLocalPort() + " to " + remotePort);
Logger.log("Transfering file: " + request.fi... |
4d927770-4582-4811-8186-bf56bc194a56 | 1 | @Override
public final void run () {
try {
try ( AFUNIXSocket sock = this.serverSocket.accept() ) {
handleConnection(sock);
}
finally {
this.serverSocket.close();
}
}
catch... |
fc5f4d55-c3c7-42b8-a743-3a3f3b517f85 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Tag)) {
return false;
}
Tag o = (Tag) obj;
if (getId() != o.getId()) {
return false;
}
if (name == null && o.name != null || name != null && o.name == null) {
... |
8c253d6c-c443-41b1-9c6a-d447206209c4 | 8 | public static void findAndAddClassesInPackageByFile(String packageName,
String packagePath, final boolean recursive, Set<Class<?>> classes) {
// 获取此包的目录 建立一个File
File dir = new File(packagePath);
// 如果不存在或者 也不是目录就直接返回
if (!dir.exists() || !dir.isDirectory()) {
... |
fdba65c2-f279-45df-af63-b88089ebfb72 | 2 | public void close() throws IOException {
// Okay, everythings is done. Set some values for the entry,
// cross your fingers, and run away.
if (!compress && (size != null)) {
currEntry.setSize(size.value);
currEntry.setCrc(FunkyJar.crc32.getValue());
}
currEntry = null;
size = null;
this.closeEntry(... |
1754c7ba-1c98-4a20-b220-173913dfca5d | 5 | private double arbitrary (double n) {
if ( n <= 10 && n < d ) { return 0; }
else if ( n <= 10 ) { return 1; }
// We don't want the actual log, we want the log of the highest power of 10 lower
// than this number; casting to an int drops the decimal part which accomplishes
// this.
int log = (int) Math.log... |
4992152d-9062-4be4-a4dc-122cef865961 | 4 | public void arrangeGroups(Object[] groups, int border)
{
graph.getModel().beginUpdate();
try
{
for (int i = groups.length - 1; i >= 0; i--)
{
Object group = groups[i];
Object[] children = graph.getChildVertices(group);
mxRectangle bounds = graph.getBoundingBoxFromGeometry(children);
mxGeom... |
9bc938a5-74ec-4444-b731-bf0ff2583aaf | 0 | protected int getBreedingAge()
{
return BREEDING_AGE;
} |
0148ac45-ffe0-4f9e-a30d-06a894731196 | 1 | public JSONObject optJSONObject(int index) {
Object o = opt(index);
return o instanceof JSONObject ? (JSONObject)o : null;
} |
547538df-5dde-4f6e-b0dd-496f30f7333e | 0 | public long getDelay() {
return delay;
} |
dd2e949f-b846-4994-9a4a-8514251ca5c1 | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
int n, d, q;
n = 10;
d = 2;
if (d != 0 && (n % d) == 0)
System.out.println(d + " is a factor of 1 " + n);
d = 0; //now set the value to 0.
// Since d is zero, the second is zero this is not evaluated.
if(d != 0 && (n %... |
47630210-8dff-4445-93b4-2eb28f8540a3 | 6 | public static void main(String args[]) {
/* Set the Nimbus 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://down... |
ac774d41-38f4-4034-b5e3-08532601cbbb | 3 | void initD(){
tableMessage.setDefaultRenderer(Object.class, new DefaultTableCellRenderer()
{
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
final Compone... |
a0d0f645-696d-4df5-9c98-03776d3edfde | 0 | @Transactional(readOnly=false,propagation=Propagation.REQUIRED)
@TriggersRemove(cacheName="findAllBlogCache",when=When.AFTER_METHOD_INVOCATION,removeAll=true)
public void deleteByKey(long pBlogId) {
this.blogModelDao.deleteByKey(pBlogId);
} |
729e53de-23d9-4feb-a217-065413b73208 | 7 | public static void main(String[] args) {
try{
Hashtable<String, String> txMap = new Hashtable<String, String>();
MongoClient mongoClient = new MongoClient("localhost", 27017);
// MongoClient mongoClient = new MongoClient(Arrays.asList(new ServerAddress("localhost", 27017), new ServerAddress("localhost", ... |
82dc502f-3945-468f-8a1a-3b08c534678b | 1 | @Override
public void actionPerformed(ActionEvent e) {
final JButton deconnecter = (JButton) e.getSource();
deconnecter.setText("Déconnexion");
deconnecter.setEnabled(false);
new Thread(new Runnable(){
public void run() {
try {
Main.service.deconnecterServeur(new CallbackListener... |
43129a48-3d88-4d32-8784-776e0dfa3234 | 9 | public Element openStyle(Element parentElement, ComputedStyle newStyle, boolean hasBlockContent, boolean hasEmptyContent) {
Element builderElement = parentElement; /* Default if we can't do any sensible styling */
if (isBuildingMathMLIsland()) {
/* We're doing MathML. We create an <mstyle/> ... |
2cd75b04-7de1-445f-b1c6-25b48d0f256a | 9 | public static void free(int buffer) {
int bufferPos = poses[buffer];
int bufferLength = lengths[buffer];
int index = bufferPos + bufferLength;
int bytesLength = bytes.length;
int move = 0;
if (lengths.length > 0 && lengths.length < buffer + 1) {
move = length... |
0cff7ae4-5844-4f92-9581-9bf4de3a2d28 | 1 | public static void spawnWraith (Location loc, int amount) {
int i = 0;
while (i < amount) {
LeatherArmorMeta meta;
ItemStack stack = new ItemStack(299, 1, (short) - 98789);
meta = (LeatherArmorMeta) stack.getItemMeta();
meta.setColor(Color.fromRGB(52, 52, ... |
a742330c-ba7d-44c0-9ea1-80ae72b95ce1 | 0 | public static ClientFinder getInstance()
{
return instance;
} |
934462fb-bb8b-4132-9c22-9a17e24d7fbc | 5 | @SubCommandHandler(name = "delete", parent = "channel", permission = "multichat.channel.delete")
public void deleteChannelCommand(Player player, String[] commandArgs)
{
if (commandArgs.length > 1 && !commandArgs[1].isEmpty())
{
String channelName = "";
//Parse for channel name
for(int I = 1; I < command... |
31b81e7c-db19-4a7e-b11c-420096cc3aee | 6 | public mxCellHandler createHandler(mxCellState state)
{
if (graph.getModel().isVertex(state.getCell()))
{
return new mxVertexHandler(this, state);
}
else if (graph.getModel().isEdge(state.getCell()))
{
mxEdgeStyleFunction style = graph.getView().getEdgeStyle(state,
null, null, null);
if (graph... |
91cc07a1-eb7f-4abf-82b5-9c9b910fe929 | 8 | private void paintStore(Graphics g) {
g.drawImage(statusBar,0,0,null);
for(Link link : level.getLink()){
int centaineRubis=(link.getNumberCoin()-link.getNumberCoin()%100)/100;
int dizaineRubis=((link.getNumberCoin()-centaineRubis*100)-(link.getNumberCoin()-centaineRubis*100)%10)/10;
int dizaineArrow = (lin... |
445af7a6-1591-461e-bbd8-5e4ba1870d11 | 6 | private void findCollectableSprites(GameDescription game){
ArrayList<String> avatars = getAvatarSprites();
ArrayList<SpriteData> allSprites = game.getAllSpriteData();
for(String a:avatars){
for(SpriteData s:allSprites){
ArrayList<InteractionData> interactions = game.getInteraction(s.name, a);
for(In... |
ecaec469-93e1-4fc7-af26-03df7636099c | 1 | public void addText(String key, String value) {
value = Replace.replace(value,"\\n", "\n");
value = Replace.replace(value,"\\\\", "\\");
if (textResources.get(key) != null) {
System.out.println("WARNING: Writing over existing text repository key: " + key);
}
textResources.put(key, value);
} |
dd08d44f-c5dc-453e-bc71-46b82ce3b48f | 2 | public boolean isAlly(Color c1, Color c2)
{
return allies != null && allies.contains(c1) && allies.contains(c2);
} |
814e46cf-3a8a-4eb1-8b60-1e8f5fa2104b | 2 | public static void main(String[] argsv) {
try {
// Runnable has method void run()
Runnable theRunner = () -> System.out.println("Hello");
theRunner.run();
// Flushable has as method void flush () throws IOException
Flushable theFlusher = () -> Syste... |
0fee0a10-e2e3-42f4-9478-e9432b8c9060 | 3 | public
void updateProcessorInterest( long someProcessorId ) {
//local vars
DataCore db;
List<Class<? extends Data>> interestList;
//get the current DataCore
db = _dataCenter.getDataCore();
//get the list of data this processor is interested in
interestList =... |
c322266b-39af-4888-a5f1-d0c9d6132ced | 7 | public static Question getQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) {
String type = root.attributeMap.get("type");
if (type.equals("question-response")) {
return ResponseQuestion.getResponseQuestionByXMLElem(root, quiz, pos);
} else if (type.equals("fill-in-blank")) {
return FillInBlankQuesti... |
1598c643-a040-45a9-b75b-31e498f059f5 | 9 | Production parseProduction (Model model) throws Exception
{
//if (!t.getToken().equals("(")) { model.error(t); throw new Exception(); };
//t.advance();
if (!t.getToken().equals("p") && !t.getToken().equals("p*")) model.recordError (t);
t.advance();
Symbol name = Symbol.get (t.getToken());
t.advance();
i... |
2e8da881-a6da-4f16-8101-cdfc40cac9a0 | 5 | public static int[] numberOf(String s) {
int[] a= new int[4];
for (int k= 0; k < s.length(); k= k+1) {
switch (s.charAt(k)) {
case 'C': a[0]= a[0] + 1; break;
case 'A': a[1]= a[1] + 1; break;
case 'T': a[2]= a[2] + 1; break;
cas... |
02dbed8c-d41f-49bc-9d90-ebe103e570ad | 2 | protected void verticalShift (int amount) {
setLocation(getX(), getY() + amount);
button.setLocation(button.getX(), button.getY() + amount);
if (pShowLineNumbers) {
lineNumber.setLocation(lineNumber.getX(), lineNumber.getY() + amount); // Might want to take this out of the if.
}
if (pShowIndicators) {
i... |
35fbea4e-a49b-468e-b01b-650137481f58 | 7 | private static void getAllItems() {
MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("net.sf.odinms.wzpath") + "/String.wz"));
List<Pair<Integer, String>> itemPairs = new ArrayList<Pair<Integer, String>>();
MapleData itemsData;
itemsData = data.getData("Cash.img");
fo... |
1126ee07-57f7-4955-ab73-674f614018f4 | 3 | * @return float fraction of version that is unique
*/
private float getPercentUnique( short version )
{
float unique=0.0f,shared=0.0f;
for ( int i=0;i<pairs.size();i++ )
{
Pair p = pairs.get( i );
if ( p.versions.nextSetBit(version)==version )
{
if ( p.versions.size()==1 )
unique += p.length... |
568c4136-fd56-4df8-8677-3f43e3f20eac | 9 | public boolean lessThan (Card c)
{
if (c==null || c.rank==null || rank == null)
return false;
if (rank.lessThan (c.rank))
return true;
if (rank.greaterThan (c.rank))
return false;
if (c.suit == null || suit == null)
return false;
if (suit.lessThan (c.suit))
return tru... |
6effd72e-8a13-4d35-b218-ac8268ae0a58 | 7 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Autor a = new Autor();
if (!(txCodigo.getText().equals("")) || (txCodigo.getText().equals(null))){
a.setId_autor(Integer.parseInt(txCodigo.getText()));
}
i... |
e4a662a5-61df-4e10-a75f-ecd3cd4a8aef | 1 | public void update(long time){
walk.update(time);
level.getBackground().setX(x);
if(time - previousTime >= timeFrame) {
// movement over y and x
upY();
upX();
// Calculation Stubi position :
int i = y/Obstacle.getHeight(); // Stubi's head position in grid
int j = x/Obstacle.getWidth(); // Stubi'... |
b333387b-b4c1-4d76-bb60-10706fac872b | 3 | public boolean equals(Object var1) {
if(this == var1) {
return true;
} else if(var1 != null && this.getClass() == var1.getClass()) {
J_JsonArray var2 = (J_JsonArray)var1;
return this.elements.equals(var2.elements);
} else {
return false;
}
} |
5fe0afbf-8ee2-40d9-8998-17545dde32af | 0 | public List<CreativeMaterial> findCreativeMaterialsByRoomEventIdAndTypeName(
final Long roomEventId, final String creativeMaterialTypeName
) throws WrongTypeNameException {
return new ArrayList<CreativeMaterial>();
} |
ce354ca8-e151-4fc2-8f41-d0772d234c15 | 8 | public static String removePar(String expr){
//check to see if it starts and ends with parentheses
if((expr.length() >= 1) && expr.charAt(0) == '(' && expr.charAt(expr.length()-1) == ')'){
int parDepth = 1; //how deep we are into parentheses nesting
boolean parDepthReached0 = false;//if parDepth ever reaches... |
1820b621-d799-42d5-b22f-506e06e9b79e | 5 | private void disableBackgroundErase() {
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
disableBackgroundEraseMethod =
getToolkit().getClass().getDeclaredMethod("disableBackgroundErase",
new ... |
b58266b0-745a-44f7-b5f8-5505e1cecf9f | 4 | void Angle_Body(float dt) {
// IK test - moving body
if(Input.GetSingleton().GetButtonState("camera","active")==Input.ButtonState.OFF) {
float a = buttons[BUTTONS_X_ROT_NEG] - buttons[BUTTONS_X_ROT_POS];
float b = buttons[BUTTONS_Y_ROT_NEG] - buttons[BUTTONS_Y_ROT_POS];
float c = buttons[BUTTONS_... |
30bf869e-e46d-48c2-b997-02d58202230a | 1 | public void analyzeInnerClasses() throws ClassFormatError {
int serialnr = 0;
Enumeration elts = anonConstructors.elements();
while (elts.hasMoreElements()) {
InvokeOperator cop = (InvokeOperator) elts.nextElement();
analyzeInvokeOperator(cop);
}
} |
18f06cb1-d476-43e5-9c28-12caead8375d | 4 | private Token matchBlockComment() {
SourcePosition pos = new SourcePosition(lineNo, columnNo);
match("/*");
StringBuilder sb = new StringBuilder();
int character = lookAhead(1);
while (true) {
if (character == END_OF_FILE) {
throw new LexerException("E... |
4b785e73-4940-4810-842d-c5ce0189706e | 2 | @Test
public void testGetAvailableCaptures() {
System.out.println("getAvailableCaptures");
Position pos = new Position(3, 2);
Board board = new Board(8, 12);
RuleManager instance = new RuleManager();
Set<Position> expResult = new HashSet<>(4);
Set<Position> result = i... |
da743d50-33c5-428d-99e9-493312f5d5df | 4 | public static String[] seperateWords(String text) {
// Make sure there is something to process:
if (text == null)
return null;
// Remove all leading spaces:
while (text.length() > 0 && text.substring(0, 1).matches("\\s")) {
text = text.substring(1);
}
// Make sure there is still something left to pr... |
8049ba3d-016d-45ce-a726-64534dc55be4 | 5 | public Ch16Lab1(){
JPanel panel = new JPanel(); // use the panel to group buttons
panel.add(jbtEnlarge);
panel.add(jbtShrink);
JPanel panel2 = new JPanel(); // secondary panel to display total number of sides
panel2.add(jlblNumberOfSides);
panel2.add(jlblSidesTotal);
add(canvas, BorderLayout.N... |
dafd15d1-cb97-4677-96f5-40cf959879d0 | 1 | public void makeInitializer(Type type) {
if (type.getHint().isOfType(getType()))
isInitializer = true;
} |
04daa82a-a534-45d6-b505-380a3bf68b2a | 5 | public boolean containsRegionRef(Id regionId) {
if (members != null) {
for (Iterator<GroupMember> it = members.iterator(); it.hasNext(); ) {
GroupMember member = it.next();
if (member instanceof RegionRef) {
if (((RegionRef)member).getRegionId().equals(regionId))
return true;
} else { //if (... |
46c877ea-2161-42cf-b90c-ce9ac642abde | 7 | public static void main(String[] args) {
String str1 = "str";
String str2 = "str";
if(str1.equals(str2)){
System.out.println("true");
}
else{
System.out.println("false");
}
if (str1 == str2) {
System.out.println("true");
} else {
System.out.println("false");
}
String str3 = new ... |
e56d5ab5-fb49-4d21-96f1-f3677153d2f8 | 0 | @Override
public String getPhone() {
return super.getPhone();
} |
b2093a59-cd73-42e5-88ac-eb99a4b92459 | 8 | final public ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) throws ParseException {
Token t;
ParsedNameClass[] nameClasses;
int nNameClasses;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 20:
nameClasses = new ParsedNameClass[2];
nameClasses[0] = nc;
... |
762c7b4c-8a91-4a41-aea8-7280f29467c9 | 5 | @Override
public void start(Stage stage) {
//V razredu Function kliči funkcijo, ki nastavi spremenljivko path na glavno mapo aplikacije,
//glede na operacijski sistem, ki ga uporabnik uporablja
Functions.setPath();
//Preveri če ima aplikacija internetno povezavo.
//Če aplika... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.