method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b6091a34-082f-43dc-92f4-d372c6778d09 | 3 | public synchronized int addWalkBatch(int vertex, int numWalks) {
if (sourceSeqIdx >= sources.length)
throw new IllegalStateException("You can have a maximum of " + sources.length + " random walk sources");
if (sourceSeqIdx > 0) {
if (sources[sourceSeqIdx - 1] > vertex) {
... |
0b6cf10c-42dc-4482-8b16-26a8b818f621 | 0 | public static void main(String[] args) throws Exception {
new HelloWorldAWTGL().loop();
} |
9c96f64c-d17d-4a6e-b4fb-cd189fd2258d | 9 | public List<Class<? super T>> inheritance() {
return unfold(
(java.lang.Class<? super T> c2) -> {
if (c == null)
return none();
else {
final P2<java.lang.Class<? super T>, java.lang.Class<? super T>> p =
new P2<java.lang.Cla... |
c7d02b27-271f-4b95-8613-2292d20db24e | 1 | public static void main(String[] args) {
//获取枚举类型中的全部枚举值
Week[] days = Week.values();
for(Week day : days) {
//返回枚举常量的名称
String name = day.name();
//返回枚举常量的序数(常量在枚举声明中的位置,从0开始)
int ordinal = day.ordinal();
String toString = day.toString();
Class declaringClass = day.getDe... |
b0969ce3-e304-44df-9d9d-02fd97f64c8a | 1 | public static String fetchLink(String lineText)
{
if(linkExists(lineText)) return link.get(lineText);
return null;
} |
82e4ef10-3f4e-425b-8cf8-a3bbd80e4436 | 5 | public String getPiece() {
boolean readString = true;
String piece = getString("What type of piece would you like to be? Enter x or o.");
while (readString) {
if (!(piece.equals("x") || piece.equals("X") || piece.equals("o") || piece.equals("O"))) {
System.out.println( "Oops, you must enter x or o, try again... |
b1241fb5-e89f-42a6-9c19-8c2e7a09443f | 8 | public static void addMethods( Class<?> c, MethodDepth depth )
{
switch (depth)
{
case DEFINED:
for (Method m : c.getDeclaredMethods())
{
addMethod( m );
}
break;
case PUBLIC_INHERITED:
for (Method m : c.getM... |
af0075b5-09a5-465a-ac26-4e9f6b91af89 | 5 | public static boolean warpNextMap(final MapleCharacter c, final boolean fromResting) {
final int currentmap = c.getMapId();
final ChannelServer ch = c.getClient().getChannelServer();
if (!fromResting) {
clearMap(ch.getMapFactory().getMap(currentmap), true);
c.gainItem(Items.currencyType.Sight, 1);
... |
8b81dbab-f0ce-4ead-95c7-f75ee3da7e32 | 7 | private static Collection liveMethods(final Collection classes,
final BloatContext context) {
// Determine the roots of the call graph
final Set roots = new HashSet();
Iterator iter = classes.iterator();
while (iter.hasNext()) {
final String className = (String) iter.next();
try {
final ClassEdito... |
f311d8b5-6abc-44dd-96f0-82aabe07d18c | 3 | public static boolean isEmptyString(String str, boolean showError)
{
boolean bool = false;
if (Utils.isNull(str, true))
{
}
if (str.replaceAll(" ", "").isEmpty())
{
bool = true;
if (showError)
{
final IllegalArgumentException as = new IllegalArgumentException("The Parameter Cannot Be Empty... |
ef4dcfbc-8ea4-4d2c-af9b-5f8cc3996444 | 5 | private void idCmbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idCmbxActionPerformed
String id = "";
if (idCmbx.getSelectedItem() != null && idCmbx.getSelectedIndex() != 0) {
id = idCmbx.getSelectedItem().toString();
try {
Student student = ... |
bfd9abe4-0433-404b-8971-e39c92f914a6 | 7 | public void start() throws InstantiationException, IllegalAccessException{
//new intance
for(Class<? extends IModule> clazz:classSet){
IModule module=(IModule)clazz.newInstance();
this.moduleSet.add(module);
}
//init context
for(IModule module:moduleSet){
moduleContext.addMod... |
5d460f2c-86fb-4c6a-a3ea-1ee85861fc63 | 6 | public void overwriteTRNS(byte r, byte g, byte b) {
if(hasAlphaChannel()) {
throw new UnsupportedOperationException("image has an alpha channel");
}
byte[] pal = this.palette;
if(pal == null) {
transPixel = new byte[] { 0, r, 0, g, 0, b };
} else {
... |
9f3eb9bf-8c8f-4e57-b544-adf4f8d37b0a | 7 | @Override
public BodyElement process(BodyElement source) {
JsArray<Node> toProcess = (JsArray<Node>) JsArray.createArray();
extractChild(source, toProcess);
Node node;
while ((node = toProcess.shift()) != null) {
int type;
try {
type = node.getNodeType();
if (type == Node.T... |
e82cb137-8ae0-40fa-b7a5-291182a66f99 | 9 | private void sendSuccessfulResponse(SipRequest sipRequest, Dialog dialog) {
SipHeaders reqHeaders = sipRequest.getSipHeaders();
SipHeaderFieldValue contentType =
reqHeaders.get(new SipHeaderFieldName(RFC3261.HDR_CONTENT_TYPE));
if (RFC3261.CONTENT_TYPE_SDP.equals(co... |
fa01f919-b05a-4387-a82c-20fa9f77c162 | 0 | @Override
public void windowClosed(WindowEvent e)
{
} |
1af744f0-595c-4ce3-9e5e-1a556e437925 | 8 | public int computeAreaPart(int top, int bottom, Box topBox, Box bottomBox, Box current) {
int area = 0;
if (top < MAX_VALUE && bottom < MAX_VALUE) {
if (current.in(topBox) && current.in(bottomBox)) {
area = -current.area();
} else {
int topLength =... |
565191ef-d1bd-4786-9dbc-2ecabb589e32 | 9 | public void drawAsLine(Graphics graphics, double xmin, double xmax, double ymin, double ymax, Dimension componentSize) {
Graphics2D g = (Graphics2D) graphics;
double b1 = a*xmin + b;
double b2 = a*xmax + b;
double y1 = VisualPoint.bToY(b1, ymin, ymax, componentSize);
double y2 = VisualPoint.bToY(b2, ymi... |
bf97dc3f-cd51-4185-ae65-783c0d41e838 | 3 | public int temaLookback( int optInTimePeriod )
{
int retValue;
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
retValue = emaLookback ( optInTimePeriod );
retu... |
74ddbdcd-5d5f-4e93-b6f1-1d5d3d79ec14 | 1 | public void stop() {
System.out.println("Stopping attack. . .");
for (Flooder flooder : flooders) {
flooder.stop();
}
running = false;
} |
d33e25e1-8cf9-45d4-82a4-b4b1008e7881 | 4 | public String genJSONRequest(String method, String field, String id) {
try {
JsonObject req = new JsonObject();
req.addProperty("method", method);
JsonObject arguments = new JsonObject();
//FIELDS
Scanner sc = new Scanner(field).useDelimit... |
cffe4852-3374-4492-88ed-85f77bde47a8 | 3 | @Override
public boolean equals(Object other) {
if (this == other)
return true;
if (!(other instanceof Position))
return false;
Position pos = (Position)other;
return ((this.row == pos.row) && (this.col == pos.col));
} |
feec5f3d-1964-4fe7-bdac-ebb6053f89a8 | 5 | private static int[] getFirstK(double[] sum, int k) {
Map<Integer, Double> m = new TreeMap<Integer, Double>();
for (int i = 0; i < sum.length; i++) {
m.put(i, sum[i]);
}
List<Map.Entry<Integer, Double>> mappingList = null;
mappingList = new ArrayList<Map.Entry<Integer... |
37e643a9-cb1e-4d9a-a764-e9d28be59255 | 2 | public Object open() {
createContents();
UI.centerShell(getParent(), shell);
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
} |
8dec63ee-0544-4abb-8849-9d92aa7fd4b4 | 8 | static private void parseDataVariables(DodsV parent, Enumeration children) throws NoSuchVariableException {
while (children.hasMoreElements()) {
opendap.dap.BaseType bt = (opendap.dap.BaseType) children.nextElement();
DodsV dodsV = new DodsV(parent, bt);
parent.children.add(dodsV);
if (bt i... |
b492da07-addc-47be-89c6-4e3eeb735766 | 9 | @Override
public boolean importData(TransferSupport support) {
if(!canImport(support))
return false;
Transferable transferable = support.getTransferable();
try {
ArrayList<Object> data = (ArrayList<Object>) transferable.getTransferData(
... |
ffa39f77-531d-4f61-a146-cf94e0863f7b | 6 | public void handlePlayerInfo(Packet201PlayerInfo par1Packet201PlayerInfo)
{
GuiPlayerInfo var2 = (GuiPlayerInfo)this.playerInfoMap.get(par1Packet201PlayerInfo.playerName);
if (var2 == null && par1Packet201PlayerInfo.isConnected)
{
var2 = new GuiPlayerInfo(par1Packet201PlayerInfo... |
86c3d1ba-1b18-45ed-8d15-f827a79afcc6 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
8f67b829-2b85-46b9-b695-a338046e11d1 | 4 | public List<Position> getPath2(int x, int y){
try{
Pattern pattern= Pattern.compile("(\\d+)");
List<Position> posList= new ArrayList<>();
int X,Y = 0;
if(posicao(pacmanX(),pacmanY())){
String str=intelFant(x, y, pacmanX(), pacmanY(),"solve2");
... |
9b9ea96d-66a3-44a3-95b5-f810bfab4fd7 | 7 | protected T fetchOverlappingInterval(T queryInterval) {
Node<U, T> node = (Node<U, T>) binarySearchTree.getRoot();
while (node != null) {
if (node.getValue().overlaps(queryInterval)) {
return node.getValue();
}
Node<U, T> leftChild = node.getLeft();
node = node.getRight();
... |
188fed8c-8a1f-48bd-8712-101fab4ee3c3 | 3 | public void setAvalie(PExpLogica node)
{
if(this._avalie_ != null)
{
this._avalie_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this)... |
f07b4ed2-11d7-420a-8257-c8c4e0ab508a | 4 | public static TreeNode initNormalTree(int id){
TreeNode root = new TreeNode(1);
if(id==1) {
/**
* 1
* 2 3
* 4 5 6 7
*/
TreeNode l = new TreeNode(2);
TreeNode r = new TreeNode(3);
root.left = l;
root.right = r;
TreeNode ll = new TreeNode(4);
TreeNode lr = new TreeNode(5);
... |
fd41fb48-a0c5-4a50-8d46-927a48850cae | 6 | public Set<Map.Entry<K,Integer>> entrySet() {
return new AbstractSet<Map.Entry<K,Integer>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TObjectIntMapDecorator.this.isEmpty();
}
public... |
acc367b1-de9b-479d-9286-307acb02c85d | 1 | public void testDES() {
String source = "abcdefghijklmnopqrstuvwxyz";
try {
String key = DESCoder.initKey(source);
byte[] data = DESCoder
.encrypt(source.getBytes(), key, DESCoder.DES);
byte[] result = DESCoder.decrypt(data, key, DESCoder.DES);
assertEquals(source, new String(result));
} catch (E... |
89dbbbb6-8130-4201-b252-8f26528d730b | 1 | public boolean isDelete() {
return !(myAdd || myChange);
} |
98b65241-cae4-4cda-8a9d-2536a06a701f | 2 | public static void main(String[] args) throws Exception {
ServerSocket sersock = new ServerSocket(3000);
System.out.println("Server ready for chatting");
Socket sock = sersock.accept( );
// reading from keyboard (keyRead object)
BufferedReader keyRead = new BufferedReader(new InputStreamReader(S... |
58674004-d3f0-47a7-8fcc-051045109465 | 3 | public String getDefaultName() {
switch (typecode) {
case TC_LONG:
return "l";
case TC_FLOAT:
return "f";
case TC_DOUBLE:
return "d";
default:
return "local";
}
} |
0165ffe8-6c34-4246-addc-08c74761abe6 | 3 | @Override
public GameState doAction(GameState state, Card card, int time) {
if(time == Time.DAY)
{
//Do nothing
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
state = temp.doAction(state, card, time);
}
else if(time == Time.NIGHT)
{
state = waitressNightAction(state,... |
32e72894-717a-4719-aa60-206ac128ebf0 | 5 | public boolean isPressed() {
if (KeyMapping.xboxController.isAttached()) {
if (button != null && button.isPressed()) {
return true;
}
}
if (Keyboard.isKeyDown(keyboardValue)) {
if (!keyHeld) {
keyHeld = true;
re... |
7a6e900a-9527-44d0-b35a-a10845122cf3 | 2 | private void travelTree(TreeNode node, List<Integer> result) {
//record
result.add(node.val);
TreeNode left = node.left;
TreeNode right = node.right;
//travel left
if(null != left) travelTree(left, result);
//travel right
if(null != right) travelTree(righ... |
8fc0f865-f03a-4165-ad7a-a80e4d575b3c | 1 | private boolean VerifySelectedObject() {
if(world.getSelectObject() == null)
return selectObjectName.equals("null");
else
return selectObjectName.equals(world.getSelectObject().getName());
} |
b27070ad-6d07-45e0-8c4c-196013a94d58 | 4 | public void frame254(int i1, int i2, int i3, int i4, int i5)
{
outStream.createFrame(254);
outStream.writeByte(i1);
if(i1 == 1)
{
outStream.writeWord(i2);
}
if(i1 >= 2 && i1 <= 6)
{
outStream.writeWord(i3);
outStream.writeWord(i4);
outStream.writeByte(i5);
}
if(i1 == 10)
{
outStream.writeWord(i2);
}
sendMessage("F... |
c30e0c8f-8a02-4279-9af6-99d2266d697b | 6 | @Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if(e.isControlDown() && uManager.canUndo()) {
// C-z でUndo実行
if(key == KeyEvent.VK_Z && uManager.canUndo()) {
uManager.undo();
e.consume();
}
// C-y でRedo実行
if(key == KeyEvent.VK_Y && uManager.canRedo()) {
uMana... |
c53812e5-a8d0-4ef1-99e6-375702da1225 | 8 | public static void main(String[] args) throws Exception {
if (args.length != 9) {
System.err.print("Syntax error. Correct syntax:\n"
+ " <trainfile_supervised>" + " <trainfile_semisupervised>"
+ " <supervised_weight>" + " <observation_feature>"
+ " <state_feature>" + " <modelfile>" + " <numiteratio... |
f111765d-0970-4ea5-ac2f-56519577d45e | 1 | private void jjCheckNAddStates(int start, int end)
{
do {
jjCheckNAdd(jjnextStates[start]);
} while (start++ != end);
} |
2579b3cd-daa5-481d-8435-077005c0b9ab | 4 | @Override
protected int getCountInternal(Query query) throws IOException {
// TODO: support query filter
Filter filter = query.getFilter();
if (filter != null) {
//LOGGER.severe("Unhandled filter in getCountInternal" + query.getFilter());
LOGGER.warning("Unable handle... |
a2f1964e-779e-416e-8d87-cad12d2cdc9e | 0 | public String getName() {
return name;
} |
eb5c2da5-1382-406a-871b-47cc578d7974 | 3 | public synchronized boolean removalStep()
{
long l1 = this.TopMessageFinishedAt + 6000L;
long l2 = System.currentTimeMillis();
if (l1 > l2)
{
startRemovalDelay((int)(l1 - l2));
}
else if (this.CurrentMessages.size() > 0)
{
remove((Component)this.CurrentMessages.elementAt(0));
... |
a6628a65-a232-4f99-b091-b9a9ef2300af | 2 | public void connect() throws ErrorException {
try {
Class.forName( this.DRIVER );
} catch( ClassNotFoundException e ) {
throw new ErrorException( "Brak sterownika JDBC" );
}
try {
polaczenie = DriverManager.getConnection( DB_URL, username, password )... |
117b7324-1113-407a-b4e4-de1236ab7780 | 9 | public String getDescription(Hand other) {
if (isRoyalFlush()) return "Royal Flush";
if (isStraightFlush()) return "Straight Flush";
if (hasFourOfAKind()) return "Four of a Kind";
if (isFullHouse()) return "Full House";
if (isFlush()) return "Flush";
if (isStraight()) ret... |
81ccc559-6c03-44d6-8fd8-7f29e99060fe | 7 | private Task updateTask(Task currentTask, Task taskToUpdated) {
if (currentTask.getDescription() != null) {
taskToUpdated.setDescription(currentTask.getDescription());
}
if (currentTask.getFromDateTime() != null
&& currentTask.getToDateTime() != null) {
taskToUpdated.setFromDateTime(currentTask.getFromD... |
264053f4-e8cb-4c5b-ab17-d17187571af1 | 0 | public static ArrayList<Excel> rotateZ(int angle, ArrayList<Excel> toScale)
{
return Rotate.rotateZ(angle, toScale);
} |
c8dcdbb0-8e01-476d-abec-ea7d71d138ac | 3 | public static byte[] decode(InputStream in) throws IOException {
byte first = (byte) in.read();
if (first == -1) {
throw new IOException("End of stream");
}
int length;
if (first >= 0) {
length = first + 1;
} else {
length = (first & 0x1F) + 1;
int count = (first & 0x60) >>> 5;
for (int i... |
41f3b2cc-cb85-4758-b967-945442068e8a | 3 | protected void cellsResized(Object[] cells)
{
if (cells != null)
{
mxIGraphModel model = getGraph().getModel();
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
if (!isCellIgnored(cells[i]))
{
cellResized(cells[i]);
break;
}
}
}
finally
... |
1cbc958d-939d-450b-a36f-24b1e9ee9226 | 1 | public static double processFancyHouse(FancyHouse fancyHouse) {
long timeStart = System.currentTimeMillis();
while (!fancyHouse.canBeLifted()) {
//Random balloon with diameter 20..30 cm and fullness 80..100%
Balloon b = Balloon.getRandomBalloon(0.10, 0.15, 0.8, 1.0);
... |
9cb0cd20-2217-439d-8db4-79e4a542b230 | 9 | @Override
public boolean getDados() {
preenchido = true;
String msg =bundle.getString("Os Campos: ");
nome = txtNome.getText();
localizacao = txtLocalizacao.getText();
desc = txtaDesc.getText();
descIng = txtaDescIng.getText();
qtQuartos = (int) spNQuartos.g... |
b89c98b2-5d50-41e6-8ef3-c5576bbd83d6 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
afd29279-e163-4ec2-adad-5255ebfb4cdc | 8 | public Set<Map.Entry<Long,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Long,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TLongByteMapDecorator.this.isEmpty();
}
public ... |
ba760717-f20c-441e-83f6-28ef988e5353 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "CanonicalizationMethod")
public JAXBElement<CanonicalizationMethodType> createCanonicalizationMethod(CanonicalizationMethodType value) {
return new JAXBElement<CanonicalizationMethodType>(_CanonicalizationMethod_QNAME, Canonicalizatio... |
e41dd457-3c25-4792-b522-0c59f5db5bbd | 7 | public final TLParser.equExpr_return equExpr() throws RecognitionException {
TLParser.equExpr_return retval = new TLParser.equExpr_return();
retval.start = input.LT(1);
Object root_0 = null;
Token set115=null;
TLParser.relExpr_return relExpr114 = null;
TLParser.relExpr... |
4d2409ca-f4fd-4650-8f47-6bbba11a7d7d | 9 | public void gererTour()
{
// Temps max pour test
this.J1.setTempsEcoule(10);
this.J2.setTempsEcoule(10);
boolean fini = false;
while(!fini)
{
if(this.getTour()%2 == 1 && this.J2.getTempsEcoule() != 0)
{
while(!defilerTemps(this.J1))
{
defilerTemps(this.J1);
}
}
if(this.g... |
8fe7ee10-591b-4d47-a150-773291a299ae | 6 | public static boolean isPalindrome(String str) {
for (int i = 0, j = str.length() - 1; i < j; i++, j--) {
char a = str.charAt(i);
char b = str.charAt(j);
if (!(Character.isLowerCase(a) || Character.isUpperCase(a))) {
j++;
continue;
}
if (!(Character.isLowerCase(b) || Character.isUpperCase(b))) ... |
db8ec875-ac3c-49ac-b8a2-a31536d40d61 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
3df429f6-c4aa-4ed5-9fe8-8195bb7573f8 | 9 | private int updateCellCount(int cellValue, int count) {
if (count == 0) {
if (cellValue == 1) {
return -1;
}
if (cellValue == 2) {
return 1;
}
} else {
if (count < 0) {
if (cellValue == 1) {
return count - 1;
}
if (cellValue == 2) {
return 1;
}
}
if (count > 0)... |
b91ad5a1-c1e4-4779-a764-df8b71eef537 | 2 | @Override
public void valueChanged(ListSelectionEvent selEvt) {
// TODO Auto-generated method stub
if (selEvt.getValueIsAdjusting())
return;
if (selEvt.getSource().equals(riverList))
refreshEditData ();
} |
3579debf-3915-4812-b838-f9497d426a9a | 4 | private static double getJaccardBtw2User(User u1, User u2){
double same = 0.0;
for (Business business1 : u1.businesses){
for (Business business2 : u2.businesses){
if(business1.id.equals(business2.id)){
double star1 = ubStar.get(u1.u_id + ";" + business1.id);
double star2 = ubStar.get(u2.u_id + ";" ... |
086c7bce-d87e-4c99-8941-f22578015a3b | 4 | private Node sumExpression() {
// term ((PLUS^|MINUS^) term)*
Node termExpression = term();
while (lookAhead(1) == TokenType.PLUS ||
lookAhead(1) == TokenType.MINUS) {
if (lookAhead(1) == TokenType.PLUS) {
termExpression = new AddOpNode(match(TokenType.PLUS).getPosition(),
termExpression, term())... |
54496875-0dd6-44d0-b824-9487971e5076 | 8 | @Override
protected void onJoin(final String channel, final String sender,
final String login, final String hostname) {
if (sender.equals(getNick())) {
if (trustNickServ && (nickPass != null) && !loggedIn) {
attemptIdentify();
}
sendMessage(getIntendedChannel(), "Initialized - " + getVersion());
i... |
834669b6-5a81-4042-831b-294c7bf1ea7d | 7 | protected void fitLogistic(Instances insts, int cl1, int cl2,
int numFolds, Random random)
throws Exception {
// Create header of instances object
FastVector atts = new FastVector(2);
atts.addElement(new Attribute("pred"));
FastVector attVals = new FastVector(2);
attVals.ad... |
133ad62a-164f-44ce-b12f-b7b04166343c | 9 | public int removeDuplicates(int[] A) {
// Start typing your Java solution below
// DO NOT write main() function
if (A == null)
return 0;
if (A.length < 3)
return A.length;
int i = -1, tag = 0, count = 1, cur = 1;
while (cur < A.length) {
if (A[cur] == A[tag])
count++;
else {
A[++i] = A... |
8e215f66-73ba-4c82-bb40-01bc2729ea38 | 6 | public void mDisplayLCS()
{
System.out.println("Length of Longest Common Sequence is "+
length[seq1.length-1][seq2.length-1]);
LinkedList<Integer> list = new LinkedList<Integer>();
int row = seq1.length-1, col = seq2.length - 1, temp = -1, index = -1;
whi... |
75a127db-affe-4174-a9b0-3c50bd14d264 | 6 | private void renderStats(GUIContext container, Graphics g) {
g.setColor(new Color(0, 0, 0, 0.4f));
g.fillRoundRect(430, 20, 280, 160, 15);
g.setColor(Color.black);
g.drawRoundRect(430, 20, 280, 160, 15);
g.setColor(Color.white);
g.setFont(bigFont);
if (wavesHaveBegun) {
g.drawString("Wave " + (waveIn... |
531b27d0-be0e-45eb-9538-10a568d26f49 | 1 | private boolean jj_2_43(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_43(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(42, xla); }
} |
904b188d-05da-4c77-887f-5af2da8fe189 | 3 | public static Client getClientById(long id) {
Client ClientHolder = null;
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
ClientHolder = (Client) session.get(Client.class, id);
} catch (Exception e) {
e.printSta... |
6fc71edf-3431-4850-9ea7-58b26bbd9bb1 | 4 | public void menuItemUpdate() {
save_to_file.setSelected(theApp.getLogging());
CROWD36_item.setSelected(theApp.isCROWD36());
XPA_10_item.setSelected(theApp.isXPA_10());
XPA_20_item.setSelected(theApp.isXPA_20());
XPA2_item.setSelected(theApp.isXPA2());
CIS3650_item.setSelected(theApp.isCIS3650());
CCIR493_... |
0bd831c6-56c4-482c-93cb-47a2bf327087 | 5 | public static List<String> compareAll(Object o1, Object o2) throws Exception {
final List<String> diffs = new ArrayList<String>();
if (o1.getClass() != o2.getClass()) {
fail("Can't compare different classes");
}
final Field[] fields = o1.getClass().getDeclaredFields();
for (Field f : fields) {
f.setAcc... |
94ff9133-2c71-4bb0-a7c9-29711c026b2f | 9 | private Value getValueForType(Body body, LocalGenerator gen,
Type tp, Set<SootClass> constructionStack, Set<SootClass> parentClasses) {
// Depending on the parameter type, we try to find a suitable
// concrete substitution
if (isSimpleType(tp.toString()))
return getSimpleDefaultValue(tp.toString());
else ... |
7753b55c-0074-463a-97a6-0a3bcd265bfa | 8 | public String eval(final String messageTemplate, final Object problem)
{
try
{
final StringBuilder results = new StringBuilder(
messageTemplate.length());
int state = STATE_OUT_OF_EXPRESSION;
int expStartIndex = 0;
/*
* So you may have guessed that writing compilers is not my strong
* su... |
9c9e3d4a-f6c6-4110-8c50-1e369fe3672d | 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://download.oracle.com/j... |
d7a25b81-3df9-4de2-b195-819a8087fbf6 | 3 | private boolean isInBounds(int cy, int cx) {
return cx >= 0 && cy >= 0 && cx < BOARD_SIZE && cy < BOARD_SIZE;
} |
eb0c154c-4d16-4f1f-a6c5-5e927e0c1261 | 3 | public boolean containsBadStates() {
for (Entry<Integer, HashSet<HashSet<Integer>>> entryOfTable : FiniteTreesTable.entrySet()) {
for (HashSet<Integer> tree : entryOfTable.getValue()) {
if (!FiniteTreesTable.keySet().containsAll(tree))
return true;
}
}
return false;
} |
4961a672-d6dc-406f-964d-1e3d8e886d13 | 1 | private void addToList(List<Ball>[] array, int i, Ball b) {
if (array[i] == null) {
LinkedList<Ball> t = new LinkedList<Ball>();
t.add(b);
array[i] = t;
} else {
array[i].add(b);
}
} |
7e56d54d-751a-4b5c-84c7-d814a9f69259 | 7 | private void btonrepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btonrepoActionPerformed
switch (tabla.getSelectedRow()) {
case 0:
setClientView(false);
jDialog1.setSize(220, 184);
jDialog1.setLocationRelativeTo(this);
... |
26a58efa-c791-4cc8-9080-5ac9f3b09eae | 2 | public Deck() {
// generate the 52 cards and shuffle them
for (int i = 0; i < Card.SUITS.length; i++) {
for (int j = 0; j < Card.CARD_TYPES.length; j++) {
Card card = new Card(Card.CARD_TYPES[j], Card.SUITS[i]);
cardDeck.add(card);
}
}
shuffleDeck();
} |
7553a492-12e6-43fa-a599-428ddfa2be80 | 7 | void replaceChild (Node oldChild, Node newChild)
{
if (_occurs_ == oldChild)
{
setOccurs ((TOccurs) newChild);
return;
}
if (_occursTo_ == oldChild)
{
setOccursTo ((POccursTo) newChild);
return;
}
if (_number... |
f4896850-6b2e-42bb-99bf-c25841984aaf | 1 | @Override
public double cumulativeProbability(double x) {
if (x >= this.point) return 1.0;
else return 0.0;
} |
99f565c1-140b-4dac-9f3d-6c6fe7a1e871 | 9 | private String fixBadChars(String s) {
if (s == null || s.length() == 0) return s;
Pattern p = Pattern.compile("[<>\"&]");
Matcher m = p.matcher(s);
StringBuffer b = null;
while (m.find()) {
if (b == null) b = new StringBuffer();
switch (s.charAt(m.start(... |
ebb0dd41-ff96-4aeb-8a5d-1242352e81e3 | 7 | public ChangesStatus withdrawMoney(int account_id, int customer_id_by,
int amount, int pin) throws BelowMinimumBalanceException {
Connection connection = DBConnectionHelper.getConnection();
AccountDAO accountDAO = DAOFactory.getAccountDAO();
try {
Account account = accountDAO.getObject(connection, account... |
7643d69d-f4c9-4212-80d9-aac23b4053cd | 9 | public Agent(InfluenceMatrix inf,
ArrayList<HashSet<Integer>> iterationPlan, int processingPower,
String type, int totalNum, double constraint, boolean isAveraging,
boolean isExhaustive
/*
* , boolean isRefactoringAll
*/) {
// check for valid iteration plan
boolean flagArray[] = new boolean[inf.getN()... |
7c106ce3-01ce-4d79-867b-c2e483fd2549 | 3 | public void setFlowBlock(FlowBlock flowBlock) {
if (this.flowBlock != flowBlock) {
this.flowBlock = flowBlock;
StructuredBlock[] subs = getSubBlocks();
for (int i = 0; i < subs.length; i++) {
if (subs[i] != null)
subs[i].setFlowBlock(flowBlock);
}
}
} |
927d3074-b24b-45d7-a379-bc1099fbf916 | 2 | public static double logNormalThreeParPDF(double alpha, double beta, double gamma, double x) {
if (beta < 0) throw new IllegalArgumentException("The parameter beta, " + beta + ", must be greater than or equal to zero");
if (x <= alpha) {
return 0.0D;
} else {
return Math.exp(-0.5D * Fmath.square(Math.log((x... |
b32dec2d-93e4-4261-a9cc-9814da5a705b | 5 | private Map<String, String> parseVariablesForUri(final URI uri, final String[] routePaths) {
Map<String, String> routeParams = null;
Map<String, String> variables = new HashMap<String, String>();
String[] inputPaths = URIUtils.getPathSegments(uri);
boolean isComponentCountEqual = routeP... |
f83d92b8-aebe-45e2-bb01-4f8a97f21ce0 | 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 HabitatCategory)) {
return false;
}
HabitatCategory other = (HabitatCategory) object;
if ((this.id == null && o... |
73a80871-bf16-459a-bc89-241df8d1bcbc | 6 | public static void save() throws IOException {
// Scanner scan = new Scanner(System.in);
File input = new File("src/" + ACC + ".txt");
try {
Scanner scan = new Scanner(input);
String table = "";
while (scan.hasNextLine()) {
String temp = scan.nextLine();
String[] t = temp.split(",");
if (t[0... |
5a62f872-d576-4eba-ad72-b09892ff6797 | 2 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityTarget(EntityTargetEvent event) {
Entity target = event.getTarget();
if (target instanceof Player) {
xAuthPlayer xp = plyrMngr.getPlayer(((Player) target).getName());
if (plyrMngr.isRestricted(xp, event))
event.set... |
42d848b6-fd0a-4edd-9025-ac650617fcee | 0 | public void setHeight(Double height) {
this.height = height;
} |
d67043db-e9a4-4bcd-8d1b-d1be6bbc07b3 | 3 | @Override
public void updateUser(User user) throws SQLException {
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(user);
session.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}finally{
if(ses... |
b8ccc406-6958-4035-a6c4-f1829296ce6f | 8 | public void desplazar(Vector3f distancia) {
Transform3D nueva = MiLibreria3D.trasladarDinamico(distancia);
Transform3D actual = new Transform3D();
tgPersonaje.getTransform(actual);
actual.mul(nueva);
tgPersonaje.setTransform(actual);
float diagonal = distancia.getY() * ES... |
6279bfab-a94a-4e29-88d5-768c31a8f5d8 | 1 | private void checkFromNode()
{
Edge edgeFrom = addressFinder.searchForEdge(from.getText());
if (edgeFrom != null)
{
fromNode = edgeFrom.getFromNode();
from.setText(edgeFrom.getRoadName());
mapComponent.setFrom(true);
mapComponent.setFromNode(fromNode);
mapComponent.repaint();
reset.setEnabled(t... |
97ada096-1054-4d9c-8127-e932b31eca53 | 5 | final int method1607(int i, int i_0_, byte i_1_) {
anInt2882++;
int i_2_ = ((i ^ 0xffffffff) > (Class321.windowWidth ^ 0xffffffff)
? Class321.windowWidth : i);
if (Class5_Sub1.aClass221_8344 == this)
return 0;
if (i_1_ >= -103)
aBoolean2881 = true;
if (this == Class223.aClass221_2893)
return i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.